com php-src: reverted compare funcs and return values, should be int anyway: Zend/zend_ini.c Zend/zend_operators.c Zend/ zend_operators.h
| From: | Anatol Belski | Date: | Sat, 09 Nov 2013 12:16:15 +0000 |
| Subject: | com php-src: reverted compare funcs and return values, should be int anyway: Zend/zend_ini.c Zend/zend_operators.c Zend/ zend_operators.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73912@lists.php.net to get a copy of this message | ||
Commit: 36cbe38201d199177135f7bf9b6fc7403e7fe2db
Author: Anatol Belski <ab@php.net> Sat, 9 Nov 2013 13:16:15 +0100
Parents: ad675f6ac20dfc310e5c463e700918feb8762350
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=36cbe38201d199177135f7bf9b6fc7403e7fe2db
Log:
reverted compare funcs and return values, should be int anyway
Changed paths:
M Zend/zend_ini.c
M Zend/zend_operators.c
M Zend/zend_operators.h
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 73fac48..132dfee 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -145,7 +145,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ /* }}} */ #endif -static zend_str_size_int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { const Bucket *f; const Bucket *s; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f238893..bd33fc0 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2074,39 +2074,39 @@ ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length) /* {{{ */ } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; } retval = memcmp(s1, s2, MIN(len1, len2)); if (!retval) { - return (len1 - len2); + return (int)(len1 - len2); } else { return retval; } } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; } retval = memcmp(s1, s2, MIN(length, MIN(len1, len2))); if (!retval) { - return (MIN(length, len1) - MIN(length, len2)); + return (int)(MIN(length, len1) - MIN(length, len2)); } else { return retval; } } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2120,15 +2120,15 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_ c1 = zend_tolower_ascii(*(unsigned char *)s1++); c2 = zend_tolower_ascii(*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return len1 - len2; + return (int)(len1 - len2); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2141,15 +2141,15 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size c1 = zend_tolower_ascii(*(unsigned char *)s1++); c2 = zend_tolower_ascii(*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return MIN(length, len1) - MIN(length, len2); + return (int)(MIN(length, len1) - MIN(length, len2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2163,15 +2163,15 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_siz c1 = zend_tolower((int)*(unsigned char *)s1++); c2 = zend_tolower((int)*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return len1 - len2; + return (int)(len1 - len2); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2184,33 +2184,33 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_si c1 = zend_tolower((int)*(unsigned char *)s1++); c2 = zend_tolower((int)*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return MIN(length, len1) - MIN(length, len2); + return (int)(MIN(length, len1) - MIN(length, len2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } @@ -2275,7 +2275,7 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { return 1; } - return Z_LVAL(result); + return (int)Z_LVAL(result); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 961e30e..0bfd77b 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -361,15 +361,15 @@ ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length); ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length); ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 73fac48..132dfee 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -145,7 +145,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ /* }}} */ #endif -static zend_str_size_int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ +static int ini_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ { const Bucket *f; const Bucket *s; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index f238893..bd33fc0 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2074,39 +2074,39 @@ ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length) /* {{{ */ } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; } retval = memcmp(s1, s2, MIN(len1, len2)); if (!retval) { - return (len1 - len2); + return (int)(len1 - len2); } else { return retval; } } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { - zend_str_size retval; + int retval; if (s1 == s2) { return 0; } retval = memcmp(s1, s2, MIN(length, MIN(len1, len2))); if (!retval) { - return (MIN(length, len1) - MIN(length, len2)); + return (int)(MIN(length, len1) - MIN(length, len2)); } else { return retval; } } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2120,15 +2120,15 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_ c1 = zend_tolower_ascii(*(unsigned char *)s1++); c2 = zend_tolower_ascii(*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return len1 - len2; + return (int)(len1 - len2); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2141,15 +2141,15 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size c1 = zend_tolower_ascii(*(unsigned char *)s1++); c2 = zend_tolower_ascii(*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return MIN(length, len1) - MIN(length, len2); + return (int)(MIN(length, len1) - MIN(length, len2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ +ZEND_API int zend_binary_strcasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2163,15 +2163,15 @@ ZEND_API zend_str_size_int zend_binary_strcasecmp_l(const char *s1, zend_str_siz c1 = zend_tolower((int)*(unsigned char *)s1++); c2 = zend_tolower((int)*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return len1 - len2; + return (int)(len1 - len2); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ +ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length) /* {{{ */ { zend_str_size len; zend_str_size c1, c2; @@ -2184,33 +2184,33 @@ ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_si c1 = zend_tolower((int)*(unsigned char *)s1++); c2 = zend_tolower((int)*(unsigned char *)s2++); if (c1 != c2) { - return c1 - c2; + return (int)(c1 - c2); } } - return MIN(length, len1) - MIN(length, len2); + return (int)(MIN(length, len1) - MIN(length, len2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncmp(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2) /* {{{ */ { return zend_binary_strcasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2)); } /* }}} */ -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3) /* {{{ */ { return zend_binary_strncasecmp_l(Z_STRVAL_P(s1), Z_STRSIZE_P(s1), Z_STRVAL_P(s2), Z_STRSIZE_P(s2), Z_LVAL_P(s3)); } @@ -2275,7 +2275,7 @@ static int hash_zval_compare_function(const zval **z1, const zval **z2 TSRMLS_DC if (compare_function(&result, (zval *) *z1, (zval *) *z2 TSRMLS_CC)==FAILURE) { return 1; } - return Z_LVAL(result); + return (int)Z_LVAL(result); } /* }}} */ diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 961e30e..0bfd77b 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -361,15 +361,15 @@ ZEND_API void zend_str_tolower(char *str, zend_str_size_uint length); ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, zend_str_size_uint length); ZEND_API char *zend_str_tolower_dup(const char *source, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_zval_strcasecmp(zval *s1, zval *s2); -ZEND_API zend_str_size_int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); -ZEND_API zend_str_size_int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); -ZEND_API zend_str_size_int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); -ZEND_API zend_str_size_int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2); +ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3); +ZEND_API int zend_binary_strcmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API int zend_binary_strncmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_strcasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2); +ZEND_API int zend_binary_strncasecmp(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); +ZEND_API int zend_binary_strncasecmp_l(const char *s1, zend_str_size_uint len1, const char *s2, zend_str_size_uint len2, zend_str_size_uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);