X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=f6cd59ffe624278ddc42ceae916ef54584286396;hp=bc5185161a0f102afab995025a2a2d40b97ec0ad;hb=dec77e7f26b565cbd399c6a73357e3abbcf1e423;hpb=e83a7438dc70ed96630887246a1d3aefcf155b1c diff --git a/php_http_api.h b/php_http_api.h index bc51851..f6cd59f 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -144,9 +144,10 @@ static inline zval *_convert_to_type(int type, zval *z) } return z; } -#define convert_to_type_ex(t, z) _convert_to_type_ex((t), (z)) -static inline zval *_convert_to_type_ex(int type, zval *z) +#define convert_to_type_ex(t, z, p) _convert_to_type_ex((t), (z), (p)) +static inline zval *_convert_to_type_ex(int type, zval *z, zval **p) { + *p = z; if (Z_TYPE_P(z) != type) { switch (type) { @@ -159,6 +160,11 @@ static inline zval *_convert_to_type_ex(int type, zval *z) case IS_OBJECT: convert_to_object_ex(&z); break; } } + if (*p == z) { + *p = NULL; + } else { + *p = z; + } return z; }