summaryrefslogtreecommitdiff
path: root/src/grep.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-09-07 17:20:11 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-09-07 19:49:33 -0700
commit0ede35a6cd21093560de8bd9843263ba199abf1f (patch)
tree24e6d114095d647ee70ae289f5c23645cdf4a1a1 /src/grep.c
parent71b5c685d0dd3e9b0298e1a9c37b32fbedece340 (diff)
downloadgrep-0ede35a6cd21093560de8bd9843263ba199abf1f.tar.gz
Simplify pattern_file_name
* src/grep.c (pattern_file_name): Make first argument origin-0, not origin-1, as this simplifies both caller and callee. All uses changed.
Diffstat (limited to 'src/grep.c')
-rw-r--r--src/grep.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/grep.c b/src/grep.c
index c359ea9b..ce2f2919 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -199,7 +199,7 @@ update_patterns (char *keys, ptrdiff_t dupfree_size, ptrdiff_t size,
return dst - keys;
}
-/* Map LINENO, the origin-1 line number of one of the input patterns,
+/* Map LINENO, the origin-0 line number of one of the input patterns,
to the name of the file from which it came. Return "-" if it was
read from stdin, "" if it was specified on the command line.
Set *NEW_LINENO to the origin-1 line number of PATTERN in the file,
@@ -207,7 +207,6 @@ update_patterns (char *keys, ptrdiff_t dupfree_size, ptrdiff_t size,
char const * _GL_ATTRIBUTE_PURE
pattern_file_name (size_t lineno, size_t *new_lineno)
{
- lineno--;
ptrdiff_t i;
for (i = 1; i < patlocs_used; i++)
if (lineno < patloc[i].lineno)