diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-04-16 23:29:26 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-04-16 23:29:26 -0700 |
| commit | cb054eb26452e07a3cb34703e1579b97f5c7e6ab (patch) | |
| tree | bdb83f6ceb82421f173934431c1299dc167dbd06 /grep.c | |
| parent | cf11a67975b057a144618badf16dc4e3d25b9407 (diff) | |
| parent | 6a97da396470cb85e289a4810326fd7f50062b96 (diff) | |
| download | git-cb054eb26452e07a3cb34703e1579b97f5c7e6ab.tar.gz | |
Merge branch 'jk/snprintf-cleanups'
Code clean-up.
* jk/snprintf-cleanups:
daemon: use an argv_array to exec children
gc: replace local buffer with git_path
transport-helper: replace checked snprintf with xsnprintf
convert unchecked snprintf into xsnprintf
combine-diff: replace malloc/snprintf with xstrfmt
replace unchecked snprintf calls with heap buffers
receive-pack: print --pack-header directly into argv array
name-rev: replace static buffer with strbuf
create_branch: use xstrfmt for reflog message
create_branch: move msg setup closer to point of use
avoid using mksnpath for refs
avoid using fixed PATH_MAX buffers for refs
fetch: use heap buffer to format reflog
tag: use strbuf to format tag header
diff: avoid fixed-size buffer for patch-ids
odb_mkstemp: use git_path_buf
odb_mkstemp: write filename into strbuf
do not check odb_mkstemp return value for errors
Diffstat (limited to 'grep.c')
| -rw-r--r-- | grep.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1171,7 +1171,7 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol, } if (opt->linenum) { char buf[32]; - snprintf(buf, sizeof(buf), "%d", lno); + xsnprintf(buf, sizeof(buf), "%d", lno); output_color(opt, buf, strlen(buf), opt->color_lineno); output_sep(opt, sign); } @@ -1653,7 +1653,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle opt->color_filename); output_sep(opt, ':'); } - snprintf(buf, sizeof(buf), "%u\n", count); + xsnprintf(buf, sizeof(buf), "%u\n", count); opt->output(opt, buf, strlen(buf)); return 1; } |
