1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 07:51:21 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-07-09 14:31:04 +02:00
parent 12d729b2ec
commit 2744c7bb01

View File

@ -416,8 +416,8 @@ int xdg_autostart_format_exec_start(
if (!escaped) if (!escaped)
return log_oom(); return log_oom();
free(exec_split[n]); free_and_replace(exec_split[n], escaped);
exec_split[n++] = TAKE_PTR(escaped); n++;
continue; continue;
} }
@ -457,8 +457,8 @@ int xdg_autostart_format_exec_start(
if (!quoted) if (!quoted)
return log_oom(); return log_oom();
free(exec_split[n]); free_and_replace(exec_split[n], quoted);
exec_split[n++] = TAKE_PTR(quoted); n++;
} }
for (; exec_split[n]; n++) for (; exec_split[n]; n++)
exec_split[n] = mfree(exec_split[n]); exec_split[n] = mfree(exec_split[n]);