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

[PATCH 2/3] http-push.c, add_send_request: Do not initialize transfer_request.

From
Stefan Beller <stefanbeller@googlemail.com>
Date
Jul 18, 2013, 21:35 UTC
Message-ID
<1374183327-14939-2-git-send-email-stefanbeller@googlemail.com>
In-Reply-To
<1374183327-14939-1-git-send-email-stefanbeller@googlemail.com>

That pointer will be assigned to new memory via request = xmalloc(sizeof(*request)); 20 lines later unconditionally anyway, so it's safe to not assign it to an arbitrary variable.

As this patch is a micro-optimization (for readability?) it would be nice to have as little work with this patch, so maybe I need a feature to send a patch without a symmetric number of lines around change-diff. For this patch I'd be only interested in showing the next 20 lines, but nothing really before the function declaration.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 http-push.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/http-push.c b/http-push.c
index 395a8cf..6dad188 100644
--- a/http-push.c
+++ b/http-push.c
@@ -663,7 +663,7 @@ static void add_fetch_request(struct object *obj)
 
 static int add_send_request(struct object *obj, struct remote_lock *lock)
 {
-	struct transfer_request *request = request_queue_head;
+	struct transfer_request *request;
 	struct packed_git *target;
 
 	/* Keep locks active */
-- 
1.8.3.3.754.g9c3c367.dirty
Previous: Stefan BellerNext: Junio C Hamano
Message 2 of 8 in “treewalk.c: Rename variable ret to cb_bits and remove some dead lines.”
  1. 1/3 treewalk.c: Rename variable ret to cb_bits and remove some dead lines.Stefan Beller, Jul 18, 2013
  2. 2/3 http-push.c, add_send_request: Do not initialize transfer_request.Stefan Beller, Jul 18, 2013
  3. Junio C HamanoJul 19, 2013
  4. 3/3 apply, find_name_traditional: Do not initialize len to the lines length.Stefan Beller, Jul 18, 2013
  5. Junio C HamanoJul 19, 2013
  6. Stefan BellerJul 19, 2013
  7. traverse_trees(): clarify return value of the callback.Stefan Beller, Jul 19, 2013
  8. Junio C HamanoJul 19, 2013

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.