Re: [PATCH 1/4] remote: use skip_prefix

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

 



On Mon, Feb 15, 2016 at 1:18 PM, Jeff King <peff@xxxxxxxx> wrote:
> This is definitely an improvement, but I think we can actually go a step
> further here, and use parse_config_key. Like:
>
> -       if (starts_with(key, "branch.")) {
> -               name = key + 7;
> -               subkey = strrchr(name, '.');
> -               if (!subkey)
> +       if (starts_with(key, "branch", &name, &namelen, &subkey)) {

I guess you meant: s/starts_with/parse_config_key/

> +               if (!name)
>                         return 0;
> -               branch = make_branch(name, subkey - name);
> +               branch = make_branch(name, namelen);
>                 if (!strcmp(subkey, ".remote")) {
>                         return git_config_string(&branch->remote_name, key, value);
>                 } else if (!strcmp(subkey, ".pushremote")) {
--
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]