Skip to content

Commit 4416b86

Browse files
rscharfegitster
authored andcommitted
strbuf: simplify strbuf_expand_literal_cb()
Now that strbuf_expand_literal_cb() is no longer used as a callback, drop its "_cb" name suffix and unused context parameter. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f1e2d5 commit 4416b86

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

builtin/ls-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static void show_ce_fmt(struct repository *repo, const struct cache_entry *ce,
274274

275275
if (skip_prefix(format, "%", &format))
276276
strbuf_addch(&sb, '%');
277-
else if ((len = strbuf_expand_literal_cb(&sb, format, NULL)))
277+
else if ((len = strbuf_expand_literal(&sb, format)))
278278
format += len;
279279
else if (*format != '(')
280280
die(_("bad ls-files format: element '%s' "

builtin/ls-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,
108108

109109
if (skip_prefix(format, "%", &format))
110110
strbuf_addch(&sb, '%');
111-
else if ((len = strbuf_expand_literal_cb(&sb, format, NULL)))
111+
else if ((len = strbuf_expand_literal(&sb, format)))
112112
format += len;
113113
else if (*format != '(')
114114
die(_("bad ls-tree format: element '%s' "

pretty.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ static struct strbuf *expand_separator(struct strbuf *sb,
12621262

12631263
if (skip_prefix(format, "%", &format))
12641264
strbuf_addch(sb, '%');
1265-
else if ((len = strbuf_expand_literal_cb(sb, format, NULL)))
1265+
else if ((len = strbuf_expand_literal(sb, format)))
12661266
format += len;
12671267
else
12681268
strbuf_addch(sb, '%');
@@ -1395,7 +1395,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
13951395
char **slot;
13961396

13971397
/* these are independent of the commit */
1398-
res = strbuf_expand_literal_cb(sb, placeholder, NULL);
1398+
res = strbuf_expand_literal(sb, placeholder);
13991399
if (res)
14001400
return res;
14011401

strbuf.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,7 @@ int strbuf_expand_step(struct strbuf *sb, const char **formatp)
427427
return 1;
428428
}
429429

430-
size_t strbuf_expand_literal_cb(struct strbuf *sb,
431-
const char *placeholder,
432-
void *context UNUSED)
430+
size_t strbuf_expand_literal(struct strbuf *sb, const char *placeholder)
433431
{
434432
int ch;
435433

strbuf.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,9 @@ const char *strbuf_join_argv(struct strbuf *buf, int argc,
320320
/**
321321
* Used with `strbuf_expand_step` to expand the literals %n and %x
322322
* followed by two hexadecimal digits. Returns the number of recognized
323-
* characters. The context argument is ignored.
323+
* characters.
324324
*/
325-
size_t strbuf_expand_literal_cb(struct strbuf *sb,
326-
const char *placeholder,
327-
void *context);
325+
size_t strbuf_expand_literal(struct strbuf *sb, const char *placeholder);
328326

329327
/**
330328
* If the string pointed to by `formatp` contains a percent sign ("%"),

0 commit comments

Comments
 (0)