X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=628837c90c6a9941daed926ab0e1d849d904086f;hp=9f8eda9537900929c8313eb28fc7b8e45a97a966;hb=960586b99568624a207faa24fe56233582b6d0dc;hpb=9287fdda2887622c8fe69f7b63d6803d60827ded diff --git a/php_http_api.h b/php_http_api.h index 9f8eda9..628837c 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -192,6 +192,29 @@ static inline zval *_convert_to_type_ex(int type, zval *z, zval **p) return z; } +#define zval_copy(t, z) _zval_copy((t), (z) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) +static inline zval *_zval_copy(int type, zval *z ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +{ + zval *copy; + + copy = emalloc_rel(sizeof(zval)); + *copy = *z; + zval_copy_ctor(copy); + convert_to_type(type, copy); + copy->refcount = 0; + copy->is_ref = 0; + + return copy; +} + +#define zval_free(z) _zval_free(z) +static inline void _zval_free(zval **z) +{ + zval_dtor(*z); + FREE_ZVAL(*z); + *z = NULL; +} + #endif /*