This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.19-100-g7b3551e


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 "GNU C Library master sources".

The branch, master has been updated
       via  7b3551e3a8f7278e123757987570c72f1216acc2 (commit)
      from  f08e9a26299db1972cb29a7e84b40b0cc9866bf2 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7b3551e3a8f7278e123757987570c72f1216acc2

commit 7b3551e3a8f7278e123757987570c72f1216acc2
Author: OndÅ?ej Bílka <neleai@seznam.cz>
Date:   Fri Feb 28 22:45:33 2014 +0100

    Make strtok benchmark competive.
    
    We include a generic version of strtok to result which could be faster
    when underlying primitives are better optimized than current version.

diff --git a/benchtests/bench-strtok.c b/benchtests/bench-strtok.c
index 5e80c1a..f2f3f57 100644
--- a/benchtests/bench-strtok.c
+++ b/benchtests/bench-strtok.c
@@ -20,66 +20,13 @@
 #define TEST_NAME "strtok"
 #include "bench-string.h"
 
-char *
-simple_strtok (char *s1, char *s2)
-{
-  static char *saveptr;
-  char *token;
-  ssize_t i = 0, j = 0;
-  int found = 0;
-  size_t s2len = strlen (s2);
-
-  if (s1 == NULL)
-    s1 = saveptr;
-  if (s1 == NULL || *s1 == '\0')
-    return NULL;
-
-  while (!found)
-    {
-      if (s1[i] == '\0')
-	{
-	  saveptr = NULL;
-	  return NULL;
-	}
-      for (j = 0; j < s2len; j++)
-	{
-	  if (s1[i] == s2[j])
-	    {
-	      i++;
-	      found = 0;
-	      break;
-	    }
-	  found = 1;
-	}
-    }
-  token = s1 + i;
-  i++;
-  found = 0;
-  while (!found)
-    {
-      if (s1[i] == '\0')
-	{
-	  saveptr = NULL;
-	  return token;
-	}
-      for (j = 0; j < s2len; j++)
-	{
-	  if (s1[i] == s2[j])
-	    {
-	      found = 1;
-	      break;
-	    }
-	}
-      i++;
-    }
-  s1[i - 1] = '\0';
-  saveptr = s1 + i;
-  return token;
-}
+#define STRTOK strtok_string
+#include <string/strtok.c>
+
 
 typedef char *(*proto_t) (const char *, const char *);
 
-IMPL (simple_strtok, 0)
+IMPL (strtok_string, 0)
 IMPL (strtok, 1)
 
 static void
diff --git a/string/strtok.c b/string/strtok.c
index f7f7099..2253440 100644
--- a/string/strtok.c
+++ b/string/strtok.c
@@ -22,6 +22,10 @@ static char *olds;
 
 #undef strtok
 
+#ifndef STRTOK
+# define STRTOK strtok
+#endif
+
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the last string strtok() was called with is
    used.  For example:
@@ -32,7 +36,7 @@ static char *olds;
 		// s = "abc\0=-def\0"
 */
 char *
-strtok (s, delim)
+STRTOK (s, delim)
      char *s;
      const char *delim;
 {

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

Summary of changes:
 benchtests/bench-strtok.c |   59 ++------------------------------------------
 string/strtok.c           |    6 ++++-
 2 files changed, 8 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]