Re: [PATCH v2 12/23] query_refspecs(): move some constants out of the loop
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Oct 30, 2013, 17:31 UTC
- Message-ID
- <52714268.5010608@alum.mit.edu>
- In-Reply-To
- <CALkWK0m-qNcCe_Zmn6PeN91JEM-7Ki0F0b0Fp+1bhQTWdmR7EA@mail.gmail.com>
On 10/30/2013 12:05 PM, Ramkumar Ramachandra wrote:
Show 25 quoted lines
> Michael Haggerty wrote:
>> diff --git a/remote.c b/remote.c
>> index e42daa8..a5e6c7f 100644
>> --- a/remote.c
>> +++ b/remote.c
>> @@ -825,6 +825,8 @@ static int query_refspecs(struct refspec *refs, int ref_count, struct refspec *q
>> {
>> int i;
>> int find_src = !query->src;
>> + const char *needle = find_src ? query->dst : query->src;
>> + char **result = find_src ? &query->src : &query->dst;
>>
>> if (find_src && !query->dst)
>> return error("query_refspecs: need either src or dst");
>> @@ -833,8 +835,6 @@ static int query_refspecs(struct refspec *refs, int ref_count, struct refspec *q
>> struct refspec *refspec = &refs[i];
>> const char *key = find_src ? refspec->dst : refspec->src;
>> const char *value = find_src ? refspec->src : refspec->dst;
>> - const char *needle = find_src ? query->dst : query->src;
>> - char **result = find_src ? &query->src : &query->dst;
>>
>> if (!refspec->dst)
>> continue;
>
> Why? Is it used in some later patch?It's just improving the code hygiene in a function that I was reading to understand the other code affected by the patches. It's unrelated to the other patches.
Michael
-- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/