X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-grep.c;h=f35f2d023cf56cb3c75c817455cfc53a98175f54;hb=0425ea90889f967c3966ace3e5a85b9a5a44c358;hp=3b1b1cbbfa7bf348c17c025afa217ffff97087e3;hpb=54851157acf707eb953eada2a84830897dde5c1d;p=git.git diff --git a/builtin-grep.c b/builtin-grep.c index 3b1b1cbbf..f35f2d023 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -136,7 +136,7 @@ static int grep_file(struct grep_opt *opt, const char *filename) if (i < 0) goto err_ret; data = xmalloc(st.st_size + 1); - if (st.st_size != xread(i, data, st.st_size)) { + if (st.st_size != read_in_full(i, data, st.st_size)) { error("'%s': short read %s", filename, strerror(errno)); close(i); free(data); @@ -527,9 +527,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) opt.word_regexp = 1; continue; } - if (!strncmp("-A", arg, 2) || - !strncmp("-B", arg, 2) || - !strncmp("-C", arg, 2) || + if (!prefixcmp(arg, "-A") || + !prefixcmp(arg, "-B") || + !prefixcmp(arg, "-C") || (arg[0] == '-' && '1' <= arg[1] && arg[1] <= '9')) { unsigned num; const char *scan;