[Resend PATCH] Avoid recalculating filename string pointer.

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

 



Hi, all!

   Avoid calculating string position in 2 different places.

From b6b05d9f8d8e053df4e971cd229e03b778c4d163 Mon Sep 17 00:00:00 2001
From: Andre Goddard Rosa <andre.goddard@xxxxxxxxx>
Date: Tue, 27 Nov 2007 10:17:54 -0200
Subject: [PATCH] Avoid recalculating filename string pointer.

Signed-off-by: Andre Goddard Rosa <andre.goddard@xxxxxxxxx>
---
 fast-import.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index 98c2bd5..2d262eb 100644
--- 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"))
--
1.5.3.6.861.gd794-dirty



-- 
[]s,
André Goddard
From b6b05d9f8d8e053df4e971cd229e03b778c4d163 Mon Sep 17 00:00:00 2001
From: Andre Goddard Rosa <andre.goddard@xxxxxxxxx>
Date: Tue, 27 Nov 2007 10:17:54 -0200
Subject: [PATCH] Avoid recalculating filename string pointer.

Signed-off-by: Andre Goddard Rosa <andre.goddard@xxxxxxxxx>
---
 fast-import.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index 98c2bd5..2d262eb 100644
--- 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"))
-- 
1.5.3.6.861.gd794-dirty


[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