Rev 2534: Get rid of strchr in favor of memchr in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

John Arbash Meinel john at arbash-meinel.com
Wed Jul 11 22:57:35 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex

------------------------------------------------------------
revno: 2534
revision-id: john at arbash-meinel.com-20070711215705-x6l2fdioh050zxzp
parent: john at arbash-meinel.com-20070711214905-e2cxwnuoxr9r1o9r
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Wed 2007-07-11 16:57:05 -0500
message:
  Get rid of strchr in favor of memchr
modified:
  bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
-------------- next part --------------
=== modified file 'bzrlib/_dirstate_helpers_c.pyx'
--- a/bzrlib/_dirstate_helpers_c.pyx	2007-07-11 21:49:05 +0000
+++ b/bzrlib/_dirstate_helpers_c.pyx	2007-07-11 21:57:05 +0000
@@ -47,9 +47,7 @@
 
 
 cdef extern from "string.h":
-    char *strchr(char *s1, char c)
     int strncmp(char *s1, char *s2, int len)
-    int strcmp(char *s1, char *s2)
     void *memchr(void *s, int c, size_t len)
     int memcmp(void *b1, void *b2, size_t len)
     # ??? memrchr is a GNU extension :(
@@ -445,8 +443,7 @@
         """Return a pointer to the start of the next field."""
         cdef char *next
         next = self.cur
-        # XXX: Change this to not use 'memchr' instead of 'strchr'
-        self.cur = strchr(next, c'\0')
+        self.cur = <char*>memchr(next, c'\0', self.end_str-next)
         size[0] = self.cur - next
         self.cur = self.cur + 1
         return next



More information about the bazaar-commits mailing list