ExecCommand *c;
size_t size = 0;
- if (n == 0) {
- exec_command_free_list(s->exec_command[SERVICE_EXEC_START]);
- s->exec_command[SERVICE_EXEC_START] = NULL;
- }
+ if (n == 0)
+ s->exec_command[SERVICE_EXEC_START] = exec_command_free_list(s->exec_command[SERVICE_EXEC_START]);
f = open_memstream(&buf, &size);
if (!f)
exec_command_done(c+i);
}
-void exec_command_free_list(ExecCommand *c) {
+ExecCommand* exec_command_free_list(ExecCommand *c) {
ExecCommand *i;
while ((i = c)) {
exec_command_done(i);
free(i);
}
+
+ return NULL;
}
void exec_command_free_array(ExecCommand **c, unsigned n) {
unsigned i;
- for (i = 0; i < n; i++) {
- exec_command_free_list(c[i]);
- c[i] = NULL;
- }
+ for (i = 0; i < n; i++)
+ c[i] = exec_command_free_list(c[i]);
}
int exec_context_load_environment(const ExecContext *c, const char *unit_id, char ***l) {
void exec_command_done(ExecCommand *c);
void exec_command_done_array(ExecCommand *c, unsigned n);
-void exec_command_free_list(ExecCommand *c);
+ExecCommand* exec_command_free_list(ExecCommand *c);
void exec_command_free_array(ExecCommand **c, unsigned n);
char *exec_command_line(char **argv);
if (isempty(rvalue)) {
/* An empty assignment resets the list */
- exec_command_free_list(*e);
- *e = NULL;
+ *e = exec_command_free_list(*e);
return 0;
}