Skip to content

Commit 9a7bd3d

Browse files
committed
Merge branch 'rs/use-decimal-width' into maint-2.46
Code clean-up. * rs/use-decimal-width: log-tree: use decimal_width()
2 parents 5d0870d + 0c4d5aa commit 9a7bd3d

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

log-tree.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "tree.h"
3232
#include "wildmatch.h"
3333
#include "write-or-die.h"
34+
#include "pager.h"
3435

3536
static struct decoration name_decoration = { "object names" };
3637
static int decoration_loaded;
@@ -411,16 +412,6 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
411412
strbuf_release(&sb);
412413
}
413414

414-
static unsigned int digits_in_number(unsigned int number)
415-
{
416-
unsigned int i = 10, result = 1;
417-
while (i <= number) {
418-
i *= 10;
419-
result++;
420-
}
421-
return result;
422-
}
423-
424415
void fmt_output_subject(struct strbuf *filename,
425416
const char *subject,
426417
struct rev_info *info)
@@ -464,7 +455,7 @@ void fmt_output_email_subject(struct strbuf *sb, struct rev_info *opt)
464455
strbuf_addf(sb, "Subject: [%s%s%0*d/%d] ",
465456
opt->subject_prefix,
466457
*opt->subject_prefix ? " " : "",
467-
digits_in_number(opt->total),
458+
decimal_width(opt->total),
468459
opt->nr, opt->total);
469460
} else if (opt->total == 0 && opt->subject_prefix && *opt->subject_prefix) {
470461
strbuf_addf(sb, "Subject: [%s] ",

0 commit comments

Comments
 (0)