Re: [PATCH 3/3] send-pack: assign remote errors to each ref

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

 



On Sat, Nov 17, 2007 at 08:47:11PM -0800, Junio C Hamano wrote:

>>> +     for (ref = refs; ref; ref = ref->next) {
>>> +             const char *msg;
>>> +             if (prefixcmp(line, ref->name))
>>> +                     continue;
>>> +             msg = line + strlen(ref->name);
>>> +             if (*msg++ != ' ')
>>> +                     continue;
>>> +             ref->status = REF_STATUS_REMOTE_REJECT;
>>> +             ref->error = xstrdup(msg);
>>> +             ref->error[strlen(ref->error)-1] = '\0';
>>> +             return ref;
>>> +     }
>>> +     return NULL;
>>> +}
> > It is actually _just_ prefixcmp. Or do you mean the strlen we call in
> > prefixcmp? If so, I think the right solution is to make prefixcmp
> > faster.  :)
> I was referring to strlen(ref->name) taken for all refs during
> the loop.  Micro-optimized one finds the end of refname on the
> "ng" line once before entering the loop.

I don't see such a strlen, except in the implementation of prefixcmp,
because we continue most of the time based on its result. If you have a
false match on the prefixcmp (i.e., a prefix of another ref), you do an
extra strlen.

But I don't think this is worth micro-optimizing.

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]

  Powered by Linux