From: Derrick Stolee Date: Wed, 31 Jan 2018 22:14:33 GMT Subject: Re: [PATCH v2 14/27] connect: request remote refs using v2 Message-ID: <514f4a9a-6c88-1dbd-e126-de4dc4c31a8f@gmail.com> In-Reply-To: On 1/31/2018 3:10 PM, Eric Sunshine wrote: > On Wed, Jan 31, 2018 at 10:22 AM, Derrick Stolee wrote: >> On 1/25/2018 6:58 PM, Brandon Williams wrote: >>> +static int process_ref_v2(const char *line, struct ref ***list) >>> +{ >>> + int ret = 1; >>> + int i = 0; >> nit: you set 'i' here, but first use it in a for loop with blank >> initializer. Perhaps keep the first assignment closer to the first use? > Hmm, I see 'i' being incremented a couple times before the loop... > >>> + if (string_list_split(&line_sections, line, ' ', -1) < 2) { >>> + ret = 0; >>> + goto out; >>> + } >>> + >>> + if (get_oid_hex(line_sections.items[i++].string, &old_oid)) { > here... > >>> + ret = 0; >>> + goto out; >>> + } >>> + >>> + ref = alloc_ref(line_sections.items[i++].string); > and here... > >>> + >>> + oidcpy(&ref->old_oid, &old_oid); >>> + **list = ref; >>> + *list = &ref->next; >>> + >>> + for (; i < line_sections.nr; i++) { > then it is used in the loop. > >>> + const char *arg = line_sections.items[i].string; >>> + if (skip_prefix(arg, "symref-target:", &arg)) >>> + ref->symref = xstrdup(arg); Thanks! Sorry I missed this. -Stolee