grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.20-3-gb342369


From: Paul Eggert
Subject: grep branch, master, updated. v2.20-3-gb342369
Date: Thu, 05 Jun 2014 16:40:22 +0000

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  b342369b8f6d0bee5f7eda04e63b694dbccc912a (commit)
       via  d5dfa69b98df5717d8f77f79665dc350951f0e61 (commit)
      from  9c3a392da4d281a7b2947fc5491578f07b8c8e26 (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=b342369b8f6d0bee5f7eda04e63b694dbccc912a


commit b342369b8f6d0bee5f7eda04e63b694dbccc912a
Author: Paul Eggert <address@hidden>
Date:   Thu Jun 5 09:39:42 2014 -0700

    grep: use system strstr if available and fast
    
    Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/17700
    * NEWS: Document this.
    * bootstrap.conf (gnulib_modules): Add strstr.
    * src/dfa.c (istrstr): Remove.
    (enlist): Use strstr instead.  Wait until we need memory before
    allocating it; this can save an unnecessary allocate and free.

diff --git a/NEWS b/NEWS
index fdad83c..1af3def 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU grep NEWS                                    -*- outline 
-*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Improvements
+
+  Performance has improved for very long strings in patterns.
+
 
 * Noteworthy changes in release 2.20 (2014-06-03) [stable]
 
diff --git a/bootstrap.conf b/bootstrap.conf
index 9f3457d..1ab730d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -77,6 +77,7 @@ stdlib
 stpcpy
 strerror
 string
+strstr
 strtoull
 strtoumax
 sys_stat
diff --git a/src/dfa.c b/src/dfa.c
index 48a83cd..33319dd 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3752,19 +3752,6 @@ icatalloc (char *old, char const *new)
   return result;
 }
 
-static char *_GL_ATTRIBUTE_PURE
-istrstr (char const *lookin, char const *lookfor)
-{
-  char const *cp;
-  size_t len;
-
-  len = strlen (lookfor);
-  for (cp = lookin; *cp != '\0'; ++cp)
-    if (strncmp (cp, lookfor, len) == 0)
-      return (char *) cp;
-  return NULL;
-}
-
 static void
 freelist (char **cpp)
 {
@@ -3776,19 +3763,16 @@ static char **
 enlist (char **cpp, char *new, size_t len)
 {
   size_t i, j;
-  new = memcpy (xmalloc (len + 1), new, len);
-  new[len] = '\0';
   /* Is there already something in the list that's new (or longer)?  */
   for (i = 0; cpp[i] != NULL; ++i)
-    if (istrstr (cpp[i], new) != NULL)
-      {
-        free (new);
-        return cpp;
-      }
+    if (strstr (cpp[i], new) != NULL)
+      return cpp;
+  new = memcpy (xmalloc (len + 1), new, len);
+  new[len] = '\0';
   /* Eliminate any obsoleted strings.  */
   j = 0;
   while (cpp[j] != NULL)
-    if (istrstr (new, cpp[j]) == NULL)
+    if (strstr (new, cpp[j]) == NULL)
       ++j;
     else
       {

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


commit b342369b8f6d0bee5f7eda04e63b694dbccc912a
Author: Paul Eggert <address@hidden>
Date:   Thu Jun 5 09:39:42 2014 -0700

    grep: use system strstr if available and fast
    
    Problem reported by Norihiro Tanaka in: http://bugs.gnu.org/17700
    * NEWS: Document this.
    * bootstrap.conf (gnulib_modules): Add strstr.
    * src/dfa.c (istrstr): Remove.
    (enlist): Use strstr instead.  Wait until we need memory before
    allocating it; this can save an unnecessary allocate and free.

diff --git a/NEWS b/NEWS
index fdad83c..1af3def 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU grep NEWS                                    -*- outline 
-*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Improvements
+
+  Performance has improved for very long strings in patterns.
+
 
 * Noteworthy changes in release 2.20 (2014-06-03) [stable]
 
diff --git a/bootstrap.conf b/bootstrap.conf
index 9f3457d..1ab730d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -77,6 +77,7 @@ stdlib
 stpcpy
 strerror
 string
+strstr
 strtoull
 strtoumax
 sys_stat
diff --git a/src/dfa.c b/src/dfa.c
index 48a83cd..33319dd 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -3752,19 +3752,6 @@ icatalloc (char *old, char const *new)
   return result;
 }
 
-static char *_GL_ATTRIBUTE_PURE
-istrstr (char const *lookin, char const *lookfor)
-{
-  char const *cp;
-  size_t len;
-
-  len = strlen (lookfor);
-  for (cp = lookin; *cp != '\0'; ++cp)
-    if (strncmp (cp, lookfor, len) == 0)
-      return (char *) cp;
-  return NULL;
-}
-
 static void
 freelist (char **cpp)
 {
@@ -3776,19 +3763,16 @@ static char **
 enlist (char **cpp, char *new, size_t len)
 {
   size_t i, j;
-  new = memcpy (xmalloc (len + 1), new, len);
-  new[len] = '\0';
   /* Is there already something in the list that's new (or longer)?  */
   for (i = 0; cpp[i] != NULL; ++i)
-    if (istrstr (cpp[i], new) != NULL)
-      {
-        free (new);
-        return cpp;
-      }
+    if (strstr (cpp[i], new) != NULL)
+      return cpp;
+  new = memcpy (xmalloc (len + 1), new, len);
+  new[len] = '\0';
   /* Eliminate any obsoleted strings.  */
   j = 0;
   while (cpp[j] != NULL)
-    if (istrstr (new, cpp[j]) == NULL)
+    if (strstr (new, cpp[j]) == NULL)
       ++j;
     else
       {

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

Summary of changes:
 NEWS           |    4 ++++
 bootstrap.conf |    1 +
 gnulib         |    2 +-
 src/dfa.c      |   26 +++++---------------------
 4 files changed, 11 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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