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

Re: [PATCH 7/7] Avoid duplicating memory, and use xmemdupz instead of xstrdup.

From
Pierre Habouzit <madcoder@debian.org>
Date
Sep 21, 2007, 07:03 UTC
Message-ID
<20070921070329.GB5689@artemis.corp>
In-Reply-To
<20070920220506.GC17514@artemis.corp>
On jeu, sep 20, 2007 at 10:05:06 +0000, Pierre Habouzit wrote:
Show 14 quoted lines
> On mer, sep 19, 2007 at 10:42:16 +0000, Pierre Habouzit wrote:
> 
>   As someone pointed to me off-list the above should be:
>   +		if (rf_one) {
>   +			(*write_ref)[targets] = xmemdupz(rf_one + 1, buf.len - (rf_one + 1 - buf.buf));
>   +		} else {
> 
>   Or better:
>   +		if (rf_one) {
>   +			rf_one++; /* skip \t */
>   +			(*write_ref)[targets] = xmemdupz(rf_one, buf.buf + buf.len - rf_one);
>   +		} else {
> 
>   Which is definitely more readable.
  damn it was not the error that was reported to me, there is another
one, I'll roll a new patch, sorry :/
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Pierre HabouzitNext: Pierre Habouzit
Message 10 of 11 in “quote/strbuf series, take 3”
  1. Pierre HabouzitSep 19, 2007
  2. Junio C HamanoSep 20, 2007
  3. Christian CouderSep 20, 2007
  4. Pierre HabouzitSep 20, 2007
  5. 2/7 nfv?asprintf are broken without va_copy, workaround them.Pierre Habouzit, Sep 20, 2007
  6. Junio C HamanoSep 21, 2007
  7. Pierre HabouzitSep 21, 2007
  8. 4/7 sq_quote_argv and add_to_string rework with strbuf's.Pierre Habouzit, Sep 20, 2007
  9. Pierre HabouzitSep 20, 2007
  10. Pierre HabouzitSep 21, 2007
  11. 7/7 Pierre Habouzit, Sep 21, 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.