|
29 | 29 |
|
30 | 30 | #define MEMC_MAKE_ZVAL_COOKIE(my_zcookie, my_ptr) \
|
31 | 31 | do { \
|
32 |
| - char *cookie_buf; \ |
33 |
| - spprintf (&cookie_buf, 0, "%p", my_ptr); \ |
34 |
| - MAKE_STD_ZVAL(my_zcookie); \ |
35 |
| - ZVAL_STRING(my_zcookie, cookie_buf, 0); \ |
| 32 | + zend_string *cookie_buf; \ |
| 33 | + cookie_buf = zend_strpprintf(0, "%p", my_ptr); \ |
| 34 | + ZVAL_STR(&my_zcookie, cookie_buf); \ |
36 | 35 | } while (0)
|
37 | 36 |
|
38 | 37 | #define MEMC_MAKE_RESULT_CAS(my_zresult_cas, my_result_cas) \
|
39 | 38 | do { \
|
40 | 39 | my_result_cas = 0; \
|
41 |
| - if (Z_TYPE_P(my_zresult_cas) != IS_NULL) { \ |
42 |
| - convert_to_double (my_zresult_cas); \ |
43 |
| - my_result_cas = (uint64_t) Z_DVAL_P(my_zresult_cas); \ |
44 |
| - } \ |
| 40 | + my_result_cas = zval_get_double(my_zresult_cas); \ |
45 | 41 | } while (0)
|
46 | 42 |
|
47 | 43 |
|
@@ -78,9 +74,7 @@ long s_invoke_php_callback (php_memc_server_cb_t *cb, zval ***params, ssize_t pa
|
78 | 74 | efree (buf);
|
79 | 75 | }
|
80 | 76 | if (retval_ptr) {
|
81 |
| - convert_to_long (retval_ptr); |
82 |
| - retval = Z_LVAL_P(retval_ptr); |
83 |
| - zval_ptr_dtor(&retval_ptr); |
| 77 | + retval = zval_get_long(retval_ptr); |
84 | 78 | }
|
85 | 79 | return retval;
|
86 | 80 | }
|
@@ -223,10 +217,7 @@ protocol_binary_response_status s_incr_decr_handler (php_memc_event_t event, con
|
223 | 217 |
|
224 | 218 | retval = s_invoke_php_callback (&MEMC_GET_CB(event), params, 7);
|
225 | 219 |
|
226 |
| - if (Z_TYPE(zresult) != IS_LONG) { |
227 |
| - convert_to_long (&zresult); |
228 |
| - } |
229 |
| - *result = (uint64_t) Z_LVAL(zresult); |
| 220 | + *result = (uint64_t)zval_get_long(zresult); |
230 | 221 |
|
231 | 222 | MEMC_MAKE_RESULT_CAS(zresult_cas, *result_cas);
|
232 | 223 |
|
|
0 commit comments