git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/3] run-command: name the cleanup function child_process_clear()

From
René Scharfe <l.s.r@web.de>
Date
Oct 31, 2015, 09:19 UTC
Message-ID
<56348793.5040909@web.de>
In-Reply-To
<56348709.9080207@web.de>

Rename child_process_deinit() to child_process_clear() in order to stay consistent with similar cleanup functions like argv_array_clear(), string_list_clear() etc.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 run-command.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/run-command.c b/run-command.c
index 82cc238..b10ec75 100644
--- a/run-command.c
+++ b/run-command.c
@@ -13,7 +13,7 @@ void child_process_init(struct child_process *child)
 	argv_array_init(&child->env_array);
 }
 
-static void child_process_deinit(struct child_process *child)
+static void child_process_clear(struct child_process *child)
 {
 	argv_array_clear(&child->args);
 	argv_array_clear(&child->env_array);
@@ -335,7 +335,7 @@ int start_command(struct child_process *cmd)
 fail_pipe:
 			error("cannot create %s pipe for %s: %s",
 				str, cmd->argv[0], strerror(failed_errno));
-			child_process_deinit(cmd);
+			child_process_clear(cmd);
 			errno = failed_errno;
 			return -1;
 		}
@@ -520,7 +520,7 @@ fail_pipe:
 			close_pair(fderr);
 		else if (cmd->err)
 			close(cmd->err);
-		child_process_deinit(cmd);
+		child_process_clear(cmd);
 		errno = failed_errno;
 		return -1;
 	}
@@ -546,7 +546,7 @@ fail_pipe:
 int finish_command(struct child_process *cmd)
 {
 	int ret = wait_or_whine(cmd->pid, cmd->argv[0], 0);
-	child_process_deinit(cmd);
+	child_process_clear(cmd);
 	return ret;
 }
 
@@ -990,7 +990,7 @@ static void pp_cleanup(struct parallel_processes *pp)
 
 	for (i = 0; i < pp->max_processes; i++) {
 		strbuf_release(&pp->children[i].err);
-		child_process_deinit(&pp->children[i].process);
+		child_process_clear(&pp->children[i].process);
 	}
 
 	free(pp->children);
@@ -1157,7 +1157,7 @@ static int pp_collect_finished(struct parallel_processes *pp)
 		pp->nr_processes--;
 		pp->children[i].in_use = 0;
 		pp->pfd[i].fd = -1;
-		child_process_deinit(&pp->children[i].process);
+		child_process_clear(&pp->children[i].process);
 		child_process_init(&pp->children[i].process);
 
 		if (i != pp->output_owner) {
-- 
2.6.2
Previous: René ScharfeNext: René Scharfe
Message 2 of 6 in “daemon: plug memory leak”
  1. 0/3 daemon: plug memory leakRené Scharfe, Oct 31, 2015
  2. 1/3 run-command: name the cleanup function child_process_clear()René Scharfe, Oct 31, 2015
  3. 2/3 run-command: export child_process_clear()René Scharfe, Oct 31, 2015
  4. 3/3 daemon: plug memory leakRené Scharfe, Oct 31, 2015
  5. Jeff KingOct 31, 2015
  6. Stefan BellerOct 31, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.