diff options
author | Andrei Zmievski <andrei@php.net> | 2003-04-08 15:04:26 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2003-04-08 15:04:26 +0000 |
commit | 2154cddd0ec3d68274dac88c420f52c3c000698b (patch) | |
tree | d4c92c0ec80f36ccfdb407b48e6de8b15bbe85ec /Zend/zend_operators.h | |
parent | 50f5fcb0fe264535196b749214634a96e0b1ce8f (diff) | |
download | php-git-2154cddd0ec3d68274dac88c420f52c3c000698b.tar.gz |
Move memnstr into Zend and make an alias for BC in PHP.
Diffstat (limited to 'Zend/zend_operators.h')
-rw-r--r-- | Zend/zend_operators.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 5aa17bcd03..8d724480cf 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -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); |