Re: [PATCH v4 06/19] ref-filter: implement '--merged' and '--no-merged' options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 22, 2015 at 6:30 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> On Sun, Jun 21, 2015 at 1:48 PM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
>> +static void do_merge_filter(struct ref_filter_cbdata *ref_cbdata)
>> +{
>> +       struct rev_info revs;
>> +       int i, old_nr;
>> +       struct ref_filter *filter = ref_cbdata->filter;
>> +       struct ref_array *array = ref_cbdata->array;
>> +       struct commit_list *p, *to_clear = NULL;
>> +
>> +       init_revisions(&revs, NULL);
>> +
>> +       for (i = 0; i < array->nr; i++) {
>> +               struct ref_array_item *item = array->items[i];
>> +               add_pending_object(&revs, &item->commit->object, item->refname);
>> +               commit_list_insert(item->commit, &to_clear);
>
> Use of commit_list for an array of known number of commits feels somewhat
> wasteful. Couldn't to_clear be
>
>     struct commit **to_clear = xcalloc(sizeof(struct commit *), array->nr);
>
> instread?

Awesome! you're right, will drop the commit_list.
--
To unsubscribe from this list: send the line "unsubscribe git" in



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]