diffutils-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]