diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-09 14:31:04 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-09 15:07:40 +0200 |
commit | 2744c7bb0176dc6b86a69acd4c449ea9e269e097 (patch) | |
tree | 4cd47d73322d7f0ab26ea8c5ee8045fe076b8b5c /src/xdg-autostart-generator/xdg-autostart-service.c | |
parent | nspawn: inline one iterator variable declaration (diff) | |
download | systemd-2744c7bb0176dc6b86a69acd4c449ea9e269e097.tar.xz systemd-2744c7bb0176dc6b86a69acd4c449ea9e269e097.zip |
xdg-autostart: minor refactoring
We can't say free_and_replace(exec_split[n++], quoted), because the the
argument is evaluated multiple times. But I think that this form is
still easier to read.
Diffstat (limited to 'src/xdg-autostart-generator/xdg-autostart-service.c')
-rw-r--r-- | src/xdg-autostart-generator/xdg-autostart-service.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/xdg-autostart-generator/xdg-autostart-service.c b/src/xdg-autostart-generator/xdg-autostart-service.c index d6e90302fdc..f21d3f54b13 100644 --- a/src/xdg-autostart-generator/xdg-autostart-service.c +++ b/src/xdg-autostart-generator/xdg-autostart-service.c @@ -416,8 +416,8 @@ int xdg_autostart_format_exec_start( if (!escaped) return log_oom(); - free(exec_split[n]); - exec_split[n++] = TAKE_PTR(escaped); + free_and_replace(exec_split[n], escaped); + n++; continue; } @@ -457,8 +457,8 @@ int xdg_autostart_format_exec_start( if (!quoted) return log_oom(); - free(exec_split[n]); - exec_split[n++] = TAKE_PTR(quoted); + free_and_replace(exec_split[n], quoted); + n++; } for (; exec_split[n]; n++) exec_split[n] = mfree(exec_split[n]); |