From: Pierre Habouzit <madcoder@debian.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <gitster@pobox.com>,
Daniel Barkalow <barkalow@iabervon.org>,
git@vger.kernel.org
Subject: Re: [PATCH] alloc_ref(): allow for trailing NUL
Date: Fri, 28 Sep 2007 15:13:48 +0200 [thread overview]
Message-ID: <20070928131348.GB21309@artemis.corp> (raw)
In-Reply-To: <20070928124102.GA21309@artemis.corp>
[-- Attachment #1: Type: text/plain, Size: 883 bytes --]
On Fri, Sep 28, 2007 at 12:41:02PM +0000, Pierre Habouzit wrote:
> void *xflexdupz(size_t offset, void *src, size_t len)
> {
> char *p = xmalloc(offset + len + 1);
> memset(p, 0, offset);
> memcpy(p + offset, src, len);
> p[offset + len] = '\0';
> return p;
> }
>
> Then alloc_ref could be a wrapper around:
> xflexdupz(offsetof(struct ref, name), ..., ...).
>
> Of course right now alloc_ref doesn't perform any kind of copy, but a
> grep -A1 will convince you that it's not a problem:
[...]
> remote.c: ret = alloc_ref(strlen(name) + 6);
> remote.c- sprintf(ret->name, "refs/%s", name);
okay forget about me, my proposal doesn't work, too bad :)
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-09-28 13:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-28 2:57 [PATCH] alloc_ref(): allow for trailing NUL Johannes Schindelin
2007-09-28 5:03 ` Daniel Barkalow
2007-09-28 8:46 ` Junio C Hamano
2007-09-28 12:01 ` Johannes Schindelin
2007-09-28 12:41 ` Pierre Habouzit
2007-09-28 13:13 ` Pierre Habouzit [this message]
2007-09-28 15:44 ` Daniel Barkalow
2007-09-28 16:11 ` Johannes Schindelin
2007-09-28 18:08 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070928131348.GB21309@artemis.corp \
--to=madcoder@debian.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.