Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c12a873

Browse files
committed
Use module API version instead of PHP_MAJOR/MINOR version. Fix char as argument
1 parent 72a041c commit c12a873

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

library.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ redis_key_prefix(RedisSock *redis_sock, char **key, int *key_len TSRMLS_DC);
4242
PHPAPI int
4343
redis_unserialize(RedisSock *redis_sock, const char *val, int val_len, zval **return_value TSRMLS_DC);
4444

45-
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 4)
46-
# define REDIS_DOUBLE_TO_STRING(dbl_str, dbl_len, dbl) \
47-
dbl_str = _php_math_number_format_ex(dbl, 8, (char*)'.', 0, NULL, 0); \
45+
#if ZEND_MODULE_API_NO >= 20100000
46+
#define REDIS_DOUBLE_TO_STRING(dbl_str, dbl_len, dbl) \
47+
char dbl_decsep; \
48+
dbl_decsep = '.'; \
49+
dbl_str = _php_math_number_format_ex(dbl, 8, &dbl_decsep, 1, NULL, 0); \
4850
dbl_len = strlen(dbl_str);
4951
#else
50-
# define REDIS_DOUBLE_TO_STRING(dbl_str, dbl_len, dbl) \
52+
#define REDIS_DOUBLE_TO_STRING(dbl_str, dbl_len, dbl) \
5153
dbl_str = _php_math_number_format(dbl, 8, '.', '\x00'); \
5254
dbl_len = strlen(dbl_str);
5355
#endif
56+

0 commit comments

Comments
 (0)