mirror of
https://github.com/php/php-src.git
synced 2025-01-22 19:54:13 +08:00
Move memnstr into Zend and make an alias for BC in PHP.
This commit is contained in:
parent
50f5fcb0fe
commit
2154cddd0e
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user