diff options
author | Andrei Zmievski <andrei@php.net> | 2000-02-08 17:19:43 +0000 |
---|---|---|
committer | Andrei Zmievski <andrei@php.net> | 2000-02-08 17:19:43 +0000 |
commit | c2fd6752cf57d3dbe1094d04a9b3b70ae69379f8 (patch) | |
tree | d8ffe0d412c480ff9777643ef867a847b58b0e3a /Zend/zend_operators.c | |
parent | 3b5659ae9266c3a9e3cd70729debbd92753e1e97 (diff) | |
download | php-git-c2fd6752cf57d3dbe1094d04a9b3b70ae69379f8.tar.gz |
Patches from Walter for strncmp() stuff.
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r-- | Zend/zend_operators.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 7bbf4ccc3f..b8de6d3562 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -1230,6 +1230,18 @@ ZEND_API int zend_binary_strcmp(char *s1, uint len1, char *s2, uint len2) } } +ZEND_API int zend_binary_strncmp(char *s1, uint len1, char *s2, uint len2, int length) +{ + int retval; + + retval = memcmp(s1, s2, MIN(length, MIN(len1, len2))); + if (!retval) { + return (len1 - len2); + } else { + return retval; + } +} + ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2) { @@ -1256,6 +1268,11 @@ ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) return zend_binary_strcmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len); } +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) +{ + return zend_binary_strncmp(s1->value.str.val, s1->value.str.len, s2->value.str.val, s2->value.str.len, s3->value.lval); +} + ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) { @@ -1263,7 +1280,6 @@ ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) } - ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) { int ret1,ret2; |