Re: [RFC/PATCH 09/11] branch.c: use 'ref-filter' data structures
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 28, 2015, 20:38 UTC
- Message-ID
- <CAOLa=ZSD-sz5Ed9xGqORo5teBuqzSKSeZS-2n06RsuGSZKUa4A@mail.gmail.com>
- In-Reply-To
- <CAP8UFD3L4QEYQMCda7AbByXGZcvgy5r9y0LMBqEysb6AZ+ydOQ@mail.gmail.com>
On Tue, Jul 28, 2015 at 1:47 PM, Christian Couder <christian.couder@gmail.com> wrote:
Show 14 quoted lines
> On Tue, Jul 28, 2015 at 8:56 AM, Karthik Nayak <karthik.188@gmail.com> wrote:
>
>> +static void ref_array_append(struct ref_array *array, const char *refname)
>> +{
>> + size_t len = strlen(refname);
>> + struct ref_array_item *ref = xcalloc(1, sizeof(struct ref_array_item) + len + 1);
>> + memcpy(ref->refname, refname, len);
>> + ref->refname[len] = '\0';
>> + REALLOC_ARRAY(array->items, array->nr + 1);
>> + array->items[array->nr++] = ref;
>> +}
>
> This function belongs more to ref-filter.{c,h}...
>Its a temporary function which is removed in the next patch.
Show 6 quoted lines
> >> - ALLOC_GROW(ref_list->list, ref_list->index + 1, ref_list->alloc); >> + ref_array_append(array, refname); >> + item = array->items[array->nr - 1]; > > ...and the above is a bit ugly.
Will fix that :)
-- Regards, Karthik Nayak