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

[PATCH] Use xcalloc instead of calloc

From
Jonas Fonseca <fonseca@diku.dk>
Date
Aug 28, 2006, 00:26 UTC
Message-ID
<20060828002607.GD20904@diku.dk>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 object-refs.c |    2 +-
 object.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/object-refs.c b/object-refs.c
index b1b8065..b0034e4 100644
--- a/object-refs.c
+++ b/object-refs.c
@@ -30,7 +30,7 @@ static void grow_refs_hash(void)
 	int new_hash_size = (refs_hash_size + 1000) * 3 / 2;
 	struct object_refs **new_hash;
 
-	new_hash = calloc(new_hash_size, sizeof(struct object_refs *));
+	new_hash = xcalloc(new_hash_size, sizeof(struct object_refs *));
 	for (i = 0; i < refs_hash_size; i++) {
 		struct object_refs *ref = refs_hash[i];
 		if (!ref)
diff --git a/object.c b/object.c
index 60bf16b..9281300 100644
--- a/object.c
+++ b/object.c
@@ -73,7 +73,7 @@ static void grow_object_hash(void)
 	int new_hash_size = obj_hash_size < 32 ? 32 : 2 * obj_hash_size;
 	struct object **new_hash;
 
-	new_hash = calloc(new_hash_size, sizeof(struct object *));
+	new_hash = xcalloc(new_hash_size, sizeof(struct object *));
 	for (i = 0; i < obj_hash_size; i++) {
 		struct object *obj = obj_hash[i];
 		if (!obj)
-- 
1.4.2.g2f76-dirty

-- 
Jonas Fonseca
Message 1 of 1 in “Use xcalloc instead of calloc”
  1. Use xcalloc instead of callocJonas Fonseca, Aug 28, 2006

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.