shared,sysext,analyze: remove unneeded if() for vars already guarded
There are some unnecessary() if() checks for variables that are already guarded by assert()s. Drop those. Thanks to keszybz for clarifying the direction of this commit.
This commit is contained in:
@@ -577,8 +577,7 @@ static bool syscall_names_in_filter(Set *s, bool allow_list, const SyscallFilter
|
||||
|
||||
if (set_contains(s, syscall) == allow_list) {
|
||||
log_debug("Offending syscall filter item: %s", syscall);
|
||||
if (ret_offending_syscall)
|
||||
*ret_offending_syscall = syscall;
|
||||
*ret_offending_syscall = syscall;
|
||||
return true; /* bad! */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,9 @@ Condition* condition_new(ConditionType type, const char *parameter, bool trigger
|
||||
.negate = negate,
|
||||
};
|
||||
|
||||
if (parameter) {
|
||||
c->parameter = strdup(parameter);
|
||||
if (!c->parameter)
|
||||
return mfree(c);
|
||||
}
|
||||
c->parameter = strdup(parameter);
|
||||
if (!c->parameter)
|
||||
return mfree(c);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1339,8 +1339,7 @@ static int openssl_load_private_key_from_file(const char *path, EVP_PKEY **ret)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "Failed to parse PEM private key: %s",
|
||||
ERR_error_string(ERR_get_error(), NULL));
|
||||
|
||||
if (ret)
|
||||
*ret = TAKE_PTR(pk);
|
||||
*ret = TAKE_PTR(pk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1404,8 +1403,7 @@ static int load_x509_certificate_from_file(const char *path, X509 **ret) {
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG), "Failed to parse X.509 certificate: %s",
|
||||
ERR_error_string(ERR_get_error(), NULL));
|
||||
|
||||
if (ret)
|
||||
*ret = TAKE_PTR(cert);
|
||||
*ret = TAKE_PTR(cert);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-2
@@ -2437,8 +2437,7 @@ static int image_discover_and_read_metadata(ImageClass image_class, Hashmap **re
|
||||
return log_error_errno(r, "Failed to read metadata for image %s: %m", img->name);
|
||||
}
|
||||
|
||||
if (ret_images)
|
||||
*ret_images = TAKE_PTR(images);
|
||||
*ret_images = TAKE_PTR(images);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user