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

[PATCH] cat-file: Move assignment to the buffer declaration

From
Alexander Kuleshov <kuleshovmail@gmail.com>
Date
Jan 8, 2015, 18:20 UTC
Message-ID
<1420741203-21107-1-git-send-email-kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 builtin/cat-file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index f8d8129..840ace2 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -17,14 +17,13 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
 {
 	unsigned char sha1[20];
 	enum object_type type;
-	char *buf;
+	char *buf = NULL;
 	unsigned long size;
 	struct object_context obj_context;
 
 	if (get_sha1_with_context(obj_name, 0, sha1, &obj_context))
 		die("Not a valid object name %s", obj_name);
 
-	buf = NULL;
 	switch (opt) {
 	case 't':
 		type = sha1_object_info(sha1, NULL);
-- 
2.2.1.268.g1e6f5b2.dirty
Next: Junio C Hamano
Message 1 of 2 in “cat-file: Move assignment to the buffer declaration”
  1. cat-file: Move assignment to the buffer declarationAlexander Kuleshov, Jan 8, 2015
  2. Junio C HamanoJan 8, 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.