cvs: ZendEngine2 / zend_operators.h php4/main php.h

From: Date: Tue, 08 Apr 2003 15:04:27 +0000
Subject: cvs: ZendEngine2 / zend_operators.h php4/main php.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1117@lists.php.net to get a copy of this message
andrei Tue Apr 8 11:04:27 2003 EDT Modified files: /php4/main php.h /ZendEngine2 zend_operators.h Log: Move memnstr into Zend and make an alias for BC in PHP. Index: php4/main/php.h diff -u php4/main/php.h:1.184 php4/main/php.h:1.185 --- php4/main/php.h:1.184 Fri Apr 4 10:38:20 2003 +++ php4/main/php.h Tue Apr 8 11:04:26 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php.h,v 1.184 2003/04/04 15:38:20 andrei Exp $ */ +/* $Id: php.h,v 1.185 2003/04/08 15:04:26 andrei Exp $ */ #ifndef PHP_H #define PHP_H @@ -288,6 +288,8 @@ #define phpparse zendparse #define phprestart zendrestart #define phpin zendin + +#define php_memnstr zend_memnstr /* functions */ int php_startup_internal_extensions(void); Index: ZendEngine2/zend_operators.h diff -u ZendEngine2/zend_operators.h:1.71 ZendEngine2/zend_operators.h:1.72 --- ZendEngine2/zend_operators.h:1.71 Wed Mar 26 02:44:09 2003 +++ ZendEngine2/zend_operators.h Tue Apr 8 11:04:26 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.h,v 1.71 2003/03/26 07:44:09 sebastian Exp $ */ +/* $Id: zend_operators.h,v 1.72 2003/04/08 15:04:26 andrei Exp $ */ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H @@ -141,6 +141,31 @@ } } 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);

« previous php.zend-engine.cvs (#1117) next »