[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/17] diff: remove INT_MAX limit on -F/-p searches
From: |
Paul Eggert |
Subject: |
[PATCH 08/17] diff: remove INT_MAX limit on -F/-p searches |
Date: |
Sun, 22 Aug 2021 14:02:57 -0700 |
* src/context.c (find_function): Don’t limit function-line
searches to INT_MAX bytes, removing a FIXME.
---
src/context.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/context.c b/src/context.c
index c65f427..814408a 100644
--- a/src/context.c
+++ b/src/context.c
@@ -512,8 +512,9 @@ find_function (char const * const *linbuf, lin linenum)
char const *line = linbuf[i];
size_t linelen = linbuf[i + 1] - line - 1;
- /* FIXME: re_search's size args should be size_t, not int. */
- int len = MIN (linelen, INT_MAX);
+ /* This line is for documentation; in practice it's equivalent
+ to LEN = LINELEN and no machine code is generated. */
+ regoff_t len = MIN (linelen, TYPE_MAXIMUM (regoff_t));
if (0 <= re_search (&function_regexp, line, len, 0, len, NULL))
{
--
2.31.1
- [PATCH 01/17] build: update gnulib submodule to latest, Paul Eggert, 2021/08/22
- [PATCH 06/17] maint: omit unused function if not debugging, Paul Eggert, 2021/08/22
- [PATCH 12/17] diff3: simplify process_diff, Paul Eggert, 2021/08/22
- [PATCH 09/17] diff: remove printint, Paul Eggert, 2021/08/22
- [PATCH 14/17] diff: use mempcpy, Paul Eggert, 2021/08/22
- [PATCH 08/17] diff: remove INT_MAX limit on -F/-p searches,
Paul Eggert <=
- [PATCH 03/17] diff3: suppress -fanalyzer alarms, Paul Eggert, 2021/08/22
- [PATCH 16/17] maint: refactor integer overflow checking, Paul Eggert, 2021/08/22
- [PATCH 04/17] maint: zalloc → xzalloc, Paul Eggert, 2021/08/22
- [PATCH 13/17] sdiff: fix unlikely memory leak, Paul Eggert, 2021/08/22
- [PATCH 02/17] maint: remove January workaround for Gnulib issue, Paul Eggert, 2021/08/22
- [PATCH 17/17] diff: add integer overflow checking, Paul Eggert, 2021/08/22
- [PATCH 10/17] maint: lint → GCC_LINT, Paul Eggert, 2021/08/22
- [PATCH 05/17] maint: remove prepargs, Paul Eggert, 2021/08/22
- [PATCH 07/17] maint: .gitignore updates, Paul Eggert, 2021/08/22
- [PATCH 11/17] maint: modernize IF_LINT for GCC 11.2.1, Paul Eggert, 2021/08/22