Skip to content

Commit d383b4f

Browse files
committed
Merge branch 'rs/userformat-find-requirements-simplify'
Code simplification. * rs/userformat-find-requirements-simplify: pretty: use strchr(3) in userformat_find_requirements()
2 parents 55e8fad + bd19ee9 commit d383b4f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pretty.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,14 +1876,13 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
18761876

18771877
void userformat_find_requirements(const char *fmt, struct userformat_want *w)
18781878
{
1879-
struct strbuf dummy = STRBUF_INIT;
1880-
18811879
if (!fmt) {
18821880
if (!user_format)
18831881
return;
18841882
fmt = user_format;
18851883
}
1886-
while (strbuf_expand_step(&dummy, &fmt)) {
1884+
while ((fmt = strchr(fmt, '%'))) {
1885+
fmt++;
18871886
if (skip_prefix(fmt, "%", &fmt))
18881887
continue;
18891888

@@ -1903,7 +1902,6 @@ void userformat_find_requirements(const char *fmt, struct userformat_want *w)
19031902
break;
19041903
}
19051904
}
1906-
strbuf_release(&dummy);
19071905
}
19081906

19091907
void repo_format_commit_message(struct repository *r,

0 commit comments

Comments
 (0)