Re: [PATCH] Avoid recalculating filename string pointer.

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

 



On Wed, Nov 21, 2007 at 10:59:41PM -0200, André Goddard Rosa wrote:
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -2304,11 +2304,13 @@ int main(int argc, const char **argv)
>  		else if (!prefixcmp(a, "--export-marks="))
>  			mark_file = a + 15;
>  		else if (!prefixcmp(a, "--export-pack-edges=")) {
> +			char *filename = a + 20;
> +
>  			if (pack_edges)
>  				fclose(pack_edges);
> -			pack_edges = fopen(a + 20, "a");
> +			pack_edges = fopen(filename, "a");
>  			if (!pack_edges)
> -				die("Cannot open %s: %s", a + 20, strerror(errno));
> +				die("Cannot open %s: %s", filename, strerror(errno));
>  		} else if (!strcmp(a, "--force"))
>  			force_update = 1;
>  		else if (!strcmp(a, "--quiet"))

Normally, the compiler takes care of such optimizations. It actually
takes care of it much better than you can do yourself, and doing it
yourself can even sometimes generate less optimized code because it
gets in the compiler optimizations'way.

Mike

-
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