summary refs log tree commit diff
path: root/pretty.c
diff options
context:
space:
mode:
authorAnders Waldenborg <anders@0x63.nu>2019-01-28 22:33:33 +0100
committerJunio C Hamano <gitster@pobox.com>2019-01-29 10:03:32 -0800
commit3e3f34781964c225ca199ac50527f3ce6feddb84 (patch)
treef5cd370c3ad0942f02bf6ca4d755967094e9adc1 /pretty.c
parent4f732e0fd7a524759424c817b92848949db1e2db (diff)
pretty: single return path in %(trailers) handling
No functional change intended.

This change may not seem useful on its own, but upcoming commits will do
memory allocation in there, and a single return path makes deallocation
easier.

Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pretty.c b/pretty.c
index 4dfbd38cf6..610837e439 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1353,6 +1353,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 
 	if (skip_prefix(placeholder, "(trailers", &arg)) {
 		struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
+		size_t ret = 0;
 
 		opts.no_divider = 1;
 
@@ -1366,8 +1367,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
 		}
 		if (*arg == ')') {
 			format_trailers_from_commit(sb, msg + c->subject_off, &opts);
-			return arg - placeholder + 1;
+			ret = arg - placeholder + 1;
 		}
+		return ret;
 	}
 
 	return 0;	/* unknown placeholder */