tree-wide: use ASSERT_PTR more

This commit is contained in:
David Tardon
2022-09-13 08:13:27 +02:00
parent 6d64cb0625
commit 995340074e
220 changed files with 1071 additions and 2323 deletions
+3 -9
View File
@@ -253,7 +253,7 @@ int execute_directories(
}
static int gather_environment_generate(int fd, void *arg) {
char ***env = arg;
char ***env = ASSERT_PTR(arg);
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **new = NULL;
int r;
@@ -264,8 +264,6 @@ static int gather_environment_generate(int fd, void *arg) {
* fd is always consumed, even on error.
*/
assert(env);
f = fdopen(fd, "r");
if (!f) {
safe_close(fd);
@@ -295,13 +293,11 @@ static int gather_environment_generate(int fd, void *arg) {
static int gather_environment_collect(int fd, void *arg) {
_cleanup_fclose_ FILE *f = NULL;
char ***env = arg;
char ***env = ASSERT_PTR(arg);
int r;
/* Write out a series of env=cescape(VAR=value) assignments to fd. */
assert(env);
f = fdopen(fd, "w");
if (!f) {
safe_close(fd);
@@ -321,13 +317,11 @@ static int gather_environment_collect(int fd, void *arg) {
static int gather_environment_consume(int fd, void *arg) {
_cleanup_fclose_ FILE *f = NULL;
char ***env = arg;
char ***env = ASSERT_PTR(arg);
int r = 0;
/* Read a series of env=cescape(VAR=value) assignments from fd into env. */
assert(env);
f = fdopen(fd, "r");
if (!f) {
safe_close(fd);