|
38 | 38 | #include <sys/socket.h> /* SO_KEEPALIVE */
|
39 | 39 | #else
|
40 | 40 | #include <winsock.h>
|
| 41 | + |
| 42 | + # if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 4 |
| 43 | + /* This proto is available from 5.5 on only */ |
| 44 | + PHP_REDIS_API int usleep(unsigned int useconds); |
| 45 | + # endif |
| 46 | +#endif |
| 47 | + |
| 48 | +#if (PHP_MAJOR_VERSION < 7) |
| 49 | + int (*_add_next_index_string)(zval *, const char *, int) = &add_next_index_string; |
| 50 | + int (*_add_next_index_stringl)(zval *, const char *, uint, int) = &add_next_index_stringl; |
| 51 | + int (*_add_assoc_bool_ex)(zval *, const char *, uint, int) = &add_assoc_bool_ex; |
| 52 | + int (*_add_assoc_long_ex)(zval *, const char *, uint, long) = &add_assoc_long_ex; |
| 53 | + int (*_add_assoc_double_ex)(zval *, const char *, uint, double) = &add_assoc_double_ex; |
| 54 | + int (*_add_assoc_string_ex)(zval *, const char *, uint, char *, int) = &add_assoc_string_ex; |
| 55 | + int (*_add_assoc_stringl_ex)(zval *, const char *, uint, char *, uint, int) = &add_assoc_stringl_ex; |
| 56 | + int (*_add_assoc_zval_ex)(zval *, const char *, uint, zval *) = &add_assoc_zval_ex; |
| 57 | + void (*_php_var_serialize)(smart_str *, zval **, php_serialize_data_t * TSRMLS_DC) = &php_var_serialize; |
| 58 | + int (*_php_var_unserialize)(zval **, const unsigned char **, const unsigned char *, php_unserialize_data_t * TSRMLS_DC) = &php_var_unserialize; |
| 59 | + |
| 60 | +#define strpprintf zend_strpprintf |
| 61 | + |
| 62 | +static zend_string * |
| 63 | +zend_strpprintf(size_t max_len, const char *format, ...) |
| 64 | +{ |
| 65 | + va_list ap; |
| 66 | + zend_string *zstr; |
| 67 | + |
| 68 | + va_start(ap, format); |
| 69 | + zstr = ecalloc(1, sizeof(*zstr)); |
| 70 | + ZSTR_LEN(zstr) = vspprintf(&ZSTR_VAL(zstr), max_len, format, ap); |
| 71 | + zstr->gc = 0x11; |
| 72 | + va_end(ap); |
| 73 | + return zstr; |
| 74 | +} |
| 75 | + |
41 | 76 | #endif
|
42 | 77 |
|
43 | 78 | extern zend_class_entry *redis_ce;
|
@@ -1738,7 +1773,7 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock TSRMLS_DC)
|
1738 | 1773 | }
|
1739 | 1774 |
|
1740 | 1775 | gettimeofday(&tv, NULL);
|
1741 |
| - persistent_id = strpprintf(0, "phpredis_%ld%ld", (long)tv.tv_sec, (long)tv.tv_usec); |
| 1776 | + persistent_id = strpprintf(0, "phpredis_%d%d", tv.tv_sec, tv.tv_usec); |
1742 | 1777 | } else {
|
1743 | 1778 | if (redis_sock->persistent_id) {
|
1744 | 1779 | persistent_id = strpprintf(0, "phpredis:%s:%s", host, ZSTR_VAL(redis_sock->persistent_id));
|
|
0 commit comments