Thread (30 messages) flat view 30 messages, 2 authors, 2016-06-15
STALE3753d

[PATCH v2 24/24] refs.c: let fprintf handle the formatting

From: Michael Haggerty <hidden>
Date: 2016-06-15 23:03:16
Subsystem: the rest · Maintainer: Linus Torvalds

From: Stefan Beller <redacted>

Instead of calculating whether to put a plus or minus sign, offload
the responsibilty to the fprintf function.

Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Michael Haggerty <redacted>
---
 refs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/refs.c b/refs.c
index 582a051..9e6d21c 100644
--- a/refs.c
+++ b/refs.c
@@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
 			printf("prune %s", message);
 	} else {
 		if (cb->newlog) {
-			char sign = (tz < 0) ? '-' : '+';
-			int zone = (tz < 0) ? (-tz) : tz;
-			fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
+			fprintf(cb->newlog, "%s %s %s %lu %+05d\t%s",
 				sha1_to_hex(osha1), sha1_to_hex(nsha1),
-				email, timestamp, sign, zone,
-				message);
+				email, timestamp, tz, message);
 			hashcpy(cb->last_kept_sha1, nsha1);
 		}
 		if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
-- 
2.1.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help