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

[PATCH 2/2] replace-object.c: remove the_repository from prepare_replace_object

From
Stefan Beller <sbeller@google.com>
Date
May 9, 2018, 23:40 UTC
Message-ID
<20180509234059.52156-2-sbeller@google.com>
In-Reply-To
<20180509234059.52156-1-sbeller@google.com>

This was missed in 5982da9d2ce (replace-object: allow prepare_replace_object to handle arbitrary repositories, 2018-04-11)

Technically the code works correctly as the replace_map is the same size in different repositories, however it is hard to read. So convert the code to the familiar pattern of dereferencing the pointer that we assign in the sizeof itself.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 replace_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/replace_object.c b/replace_object.c
index 246b98cd4f1..801b5c16789 100644
--- a/replace_object.c
+++ b/replace_object.c
@@ -37,7 +37,7 @@ static void prepare_replace_object(struct repository *r)
 		return;
 
 	r->objects->replace_map =
-		xmalloc(sizeof(*the_repository->objects->replace_map));
+		xmalloc(sizeof(*r->objects->replace_map));
 	oidmap_init(r->objects->replace_map, 0);
 
 	for_each_replace_ref(r, register_replace_ref, NULL);
-- 
2.17.0.255.g8bfb7c0704
Previous: Stefan BellerNext: Junio C Hamano
Message 2 of 8 in “object.c: free replace map in raw_object_store_clear”
  1. 1/2 object.c: free replace map in raw_object_store_clearStefan Beller, May 9, 2018
  2. 2/2 replace-object.c: remove the_repository from prepare_replace_objectStefan Beller, May 9, 2018
  3. Junio C HamanoMay 10, 2018
  4. Jeff KingMay 10, 2018
  5. Derrick StoleeMay 10, 2018
  6. Stefan BellerMay 10, 2018
  7. Junio C HamanoMay 10, 2018
  8. Stefan BellerMay 10, 2018

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.