grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v3.11-20-gdd8f049


From: Paul Eggert
Subject: grep branch, master, updated. v3.11-20-gdd8f049
Date: Mon, 11 Sep 2023 23:52:03 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  dd8f04957c8cd076fc3d41a83bf1af39f60f4a38 (commit)
       via  554e5b25fe6e0632a6e541938dd73f21ea114f45 (commit)
      from  052282642ca76847947eb164a3b95c9cc1e9aee3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=dd8f04957c8cd076fc3d41a83bf1af39f60f4a38


commit dd8f04957c8cd076fc3d41a83bf1af39f60f4a38
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Mon Sep 11 22:49:25 2023 -0500

    grep: simplify wordchars_count
    
    * src/searchutils.c (wordchars_count): Simplify slightly
    by using a pointer rather than an offset.

diff --git a/src/searchutils.c b/src/searchutils.c
index 2015694..68d7a67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -164,27 +164,27 @@ mb_goback (char const **mb_start, idx_t *mbclen, char 
const *cur,
 static idx_t
 wordchars_count (char const *buf, char const *end, bool countall)
 {
-  idx_t n = 0;
   mbstate_t mbs; mbszero (&mbs);
-  while (n < end - buf)
+  char const *p = buf;
+  while (p < end)
     {
-      unsigned char b = buf[n];
+      unsigned char b = *p;
       if (sbwordchar[b])
-        n++;
+        p++;
       else if (localeinfo.sbclen[b] != -2)
         break;
       else
         {
           char32_t wc = 0;
-          size_t wcbytes = mbrtoc32 (&wc, buf + n, end - buf - n, &mbs);
+          size_t wcbytes = mbrtoc32 (&wc, p, end - p, &mbs);
           if (!wordchar (wc))
             break;
-          n += wcbytes + !wcbytes;
+          p += wcbytes + !wcbytes;
         }
       if (!countall)
         break;
     }
-  return n;
+  return p - buf;
 }
 
 /* Examine the start of BUF for the longest prefix containing just

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=554e5b25fe6e0632a6e541938dd73f21ea114f45


commit dd8f04957c8cd076fc3d41a83bf1af39f60f4a38
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Mon Sep 11 22:49:25 2023 -0500

    grep: simplify wordchars_count
    
    * src/searchutils.c (wordchars_count): Simplify slightly
    by using a pointer rather than an offset.

diff --git a/src/searchutils.c b/src/searchutils.c
index 2015694..68d7a67 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -164,27 +164,27 @@ mb_goback (char const **mb_start, idx_t *mbclen, char 
const *cur,
 static idx_t
 wordchars_count (char const *buf, char const *end, bool countall)
 {
-  idx_t n = 0;
   mbstate_t mbs; mbszero (&mbs);
-  while (n < end - buf)
+  char const *p = buf;
+  while (p < end)
     {
-      unsigned char b = buf[n];
+      unsigned char b = *p;
       if (sbwordchar[b])
-        n++;
+        p++;
       else if (localeinfo.sbclen[b] != -2)
         break;
       else
         {
           char32_t wc = 0;
-          size_t wcbytes = mbrtoc32 (&wc, buf + n, end - buf - n, &mbs);
+          size_t wcbytes = mbrtoc32 (&wc, p, end - p, &mbs);
           if (!wordchar (wc))
             break;
-          n += wcbytes + !wcbytes;
+          p += wcbytes + !wcbytes;
         }
       if (!countall)
         break;
     }
-  return n;
+  return p - buf;
 }
 
 /* Examine the start of BUF for the longest prefix containing just

-----------------------------------------------------------------------

Summary of changes:
 bootstrap.conf    |  1 +
 src/grep.c        | 12 ++++++------
 src/searchutils.c | 20 ++++++++++----------
 3 files changed, 17 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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