summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-09-27 15:18:00 +0000
committerSascha Schumann <sas@php.net>2000-09-27 15:18:00 +0000
commit1cc3e6b5e664c25836bc770322d8a44e3b90f48a (patch)
treeb4329706004e52b33702907eee0c27bbf2a9ddf7
parentd4cd24c22d33627277ec7da411fe2043b88cf31e (diff)
downloadphp-git-1cc3e6b5e664c25836bc770322d8a44e3b90f48a.tar.gz
Move php_memnstr to the header file, so that the function body is available
in all compilation units (note the static linkage).
-rw-r--r--ext/standard/php_string.h16
-rw-r--r--ext/standard/string.c14
2 files changed, 15 insertions, 15 deletions
diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h
index 6f247e0df2..d4d89c8778 100644
--- a/ext/standard/php_string.h
+++ b/ext/standard/php_string.h
@@ -104,7 +104,21 @@ PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len
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);
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 3baa4e2cb7..1f69c7feea 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2030,20 +2030,6 @@ PHPAPI void php_char_to_str(char *str,uint len,char from,char *to,int to_len,zva
}
-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)
{