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

Re: [PATCH 1/2] Added use of xmalloc() on diff-delta.c

From
Junio C Hamano <junkio@cox.net>
Date
Apr 4, 2007, 19:22 UTC
Message-ID
<7vejn02bcv.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<11757126093105-git-send-email-ribas@c3sl.ufpr.br>

These two functions, create_delta_index() and create_delta(), are already nicely libified. They allow the caller to deal with oom condition. The caller may die(), or it may decide to continue its operation with reduced functionality without using delta data. A good example of this is found a few lines after the lines the second patch touches. When create_delta() cannot find memory to work with, the entire function returns 0, saying "sorry, cannot deltify these two", which would cause the object stored without deltification.

These patches take that nice property away, making libification more difficult, which is the downside. Is there an upside?

If anything, I suspect that the part that calls die() you touched in the second patch could return NULL.

Previous: Bruno RibasNext: Linus Torvalds
Message 3 of 5 in “Added use of xmalloc() on diff-delta.c”
  1. 1/2 Added use of xmalloc() on diff-delta.cBruno Ribas, Apr 4, 2007
  2. 2/2 Removed NULL check on builtin-pack-objects.c from create_delta_index() as it just checks for Out of MemoryBruno Ribas, Apr 4, 2007
  3. Junio C HamanoApr 4, 2007
  4. Linus TorvaldsApr 4, 2007
  5. Junio C HamanoApr 5, 2007

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.