cvs: php4 /ext/standard php_string.h string.c

From: Date: Wed, 27 Sep 2000 15:18:00 +0000
Subject: cvs: php4 /ext/standard php_string.h string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1842@lists.php.net to get a copy of this message
sas Wed Sep 27 08:18:00 2000 EDT Modified files: /php4/ext/standard php_string.h string.c Log: Move php_memnstr to the header file, so that the function body is available in all compilation units (note the static linkage). Index: php4/ext/standard/php_string.h diff -u php4/ext/standard/php_string.h:1.26 php4/ext/standard/php_string.h:1.27 --- php4/ext/standard/php_string.h:1.26 Sat Sep 9 22:59:16 2000 +++ php4/ext/standard/php_string.h Wed Sep 27 08:18:00 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.26 2000/09/10 05:59:16 sterling Exp $ */ +/* $Id: php_string.h,v 1.27 2000/09/27 15:18:00 sas Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -104,7 +104,21 @@ PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value); PHPAPI void php_explode(pval *delim, pval *str, pval *return_value, int limit); -PHPAPI inline char *php_memnstr(char *haystack, char *needle, int needle_len, char *end); + +static inline char * +php_memnstr(char *haystack, char *needle, int needle_len, char *end) +{ + char *p = haystack; + char *s = NULL; + + for(; p <= end - needle_len && + (s = memchr(p, *needle, end - p - needle_len + 1)); p = s + 1) { + if(memcmp(s, needle, needle_len) == 0) + return s; + } + return NULL; +} + PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.158 php4/ext/standard/string.c:1.159 --- php4/ext/standard/string.c:1.158 Sun Sep 17 02:15:48 2000 +++ php4/ext/standard/string.c Wed Sep 27 08:18:00 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.158 2000/09/17 09:15:48 stas Exp $ */ +/* $Id: string.c,v 1.159 2000/09/27 15:18:00 sas Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2029,20 +2029,6 @@ *target = 0; } - -PHPAPI inline char * -php_memnstr(char *haystack, char *needle, int needle_len, char *end) -{ - char *p = haystack; - char *s = NULL; - - for(; p <= end - needle_len && - (s = memchr(p, *needle, end - p - needle_len + 1)); p = s + 1) { - if(memcmp(s, needle, needle_len) == 0) - return s; - } - return NULL; -} PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, int needle_len, char *str, int str_len, int *_new_length)

« previous php.cvs (#1842) next »