Skip to content

Commit 3e3f347

Browse files
wandersgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4f732e0 commit 3e3f347

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pretty.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
13531353

13541354
if (skip_prefix(placeholder, "(trailers", &arg)) {
13551355
struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT;
1356+
size_t ret = 0;
13561357

13571358
opts.no_divider = 1;
13581359

@@ -1366,8 +1367,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
13661367
}
13671368
if (*arg == ')') {
13681369
format_trailers_from_commit(sb, msg + c->subject_off, &opts);
1369-
return arg - placeholder + 1;
1370+
ret = arg - placeholder + 1;
13701371
}
1372+
return ret;
13711373
}
13721374

13731375
return 0; /* unknown placeholder */

0 commit comments

Comments
 (0)