Re: [PATCH 3/3] for-each-ref: introduce %(upstream:track[short])

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

 



Am 9/27/2013 14:10, schrieb Ramkumar Ramachandra:
> +			else if (!strcmp(formatp, "track") &&
> +				!prefixcmp(name, "upstream")) {
> +				char buf[40];
> +
> +				if (!upstream_present)
> +					continue;
> +				stat_tracking_info(branch, &num_ours, &num_theirs);
> +				if (!num_ours && !num_theirs)
> +					v->s = "";
> +				else if (!num_ours) {
> +					sprintf(buf, "[behind %d]", num_theirs);
> +					v->s = xstrdup(buf);
> +				} else if (!num_theirs) {
> +					sprintf(buf, "[ahead %d]", num_ours);
> +					v->s = xstrdup(buf);
> +				} else {
> +					sprintf(buf, "[ahead %d, behind %d]",
> +						num_ours, num_theirs);
> +					v->s = xstrdup(buf);
> +				}

These strdupped strings are leaked, right?

> +				continue;
> +			} else if (!strcmp(formatp, "trackshort") &&
> +				!prefixcmp(name, "upstream")) {
> +				if (!upstream_present)
> +					continue;
> +				stat_tracking_info(branch, &num_ours, &num_theirs);
> +				if (!num_ours && !num_theirs)
> +					v->s = "=";
> +				else if (!num_ours)
> +					v->s = "<";
> +				else if (!num_theirs)
> +					v->s = ">";
> +				else
> +					v->s = "<>";
> +				continue;
> +			} else
>  				die("unknown %.*s format %s",
>  				    (int)(formatp - name), name, formatp);
>  		}
> 

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