Move memnstr into Zend and make an alias for BC in PHP.

This commit is contained in:
Andrei Zmievski 2003-04-08 15:04:26 +00:00
parent 50f5fcb0fe
commit 2154cddd0e
2 changed files with 27 additions and 0 deletions

View File

@ -143,6 +143,31 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
return 0;
}
static inline char *
zend_memnstr(char *haystack, char *needle, int needle_len, char *end)
{
char *p = haystack;
char ne = needle[needle_len-1];
end -= needle_len;
while (p <= end) {
if ((p = memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) {
if (!memcmp(needle, p, needle_len-1)) {
return p;
}
}
if (p == NULL) {
return NULL;
}
p++;
}
return NULL;
}
ZEND_API int increment_function(zval *op1);
ZEND_API int decrement_function(zval *op2);

View File

@ -289,6 +289,8 @@ PHPAPI void php_error_docref2(const char *docref TSRMLS_DC, const char *param1,
#define phprestart zendrestart
#define phpin zendin
#define php_memnstr zend_memnstr
/* functions */
int php_startup_internal_extensions(void);