Re: [PATCH v2 2/2] sha1_file: use strncmp for string comparison

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

 



On Mon, Jun 30, 2014 at 06:43:35PM +0200, René Scharfe wrote:

> Am 30.06.2014 16:22, schrieb Jeff King:
> >On Mon, Jun 30, 2014 at 08:59:53PM +0700, Duy Nguyen wrote:
> >
> >>On Mon, Jun 30, 2014 at 8:43 PM, Jeff King <peff@xxxxxxxx> wrote:
> >>>>diff --git a/sha1_file.c b/sha1_file.c
> >>>>index 394fa45..8adab14 100644
> >>>>--- a/sha1_file.c
> >>>>+++ b/sha1_file.c
> >>>>@@ -1207,7 +1207,8 @@ static void prepare_packed_git_one(char *objdir, int local)
> >>>>               if (has_extension(de->d_name, ".idx")) {
> >>>>                       /* Don't reopen a pack we already have. */
> >>>
> >>>If we don't follow my suggestion above, we still have this
> >>>has_extension. This is a reimplementation of ends_with, isn't it? We can
> >>>probably drop it and just use ends_with.
> >>
> >>This calls for another patch if we just want to kill has_extension()
> >>in favor of ends_with(). There are 12 call sites of it.
> >
> >Yes. Some of those would want to become ends_with, and some would
> >actually want to become strip_suffix. I'm working up a series now.
> 
> NB: has_extension is almost the same as ends_with, but it also checks if the
> string is longer than just the extension:
> 
> 	ends_with("x", "x") => 1
> 	has_extension("x", "x") => 0

Thanks, I didn't notice that. I don't think the distinction is
important in any callers, but I'll double check.

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