Re: [PATCH 1/3] add alloc_ref_with_prefix()
- From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
- Date
- Oct 18, 2008, 09:39 UTC
- Message-ID
- <48F9AECA.3020606@lsrfire.ath.cx>
- In-Reply-To
- <36ca99e90810180227u367783f6vc3b7af0176f6df06@mail.gmail.com>
Show 8 quoted lines
>> +static struct ref *alloc_ref_with_prefix(const char *prefix, size_t prefixlen,
>> + const char *name)
>> +{
>> + size_t len = strlen(name);
>> + struct ref *ref = xcalloc(1, sizeof(struct ref) + prefixlen + len + 1);
>> + memcpy(ref->name, prefix, prefixlen);
>> + memcpy(ref->name + prefixlen, name, len);
> Where does you \0-terminate the string?xcalloc() calls calloc(), which zeroes the memory.
René