From 52e769d8835d06af547c7438282fd4c6fcd88583 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Thu, 16 Sep 1999 23:15:34 +0000 Subject: [PATCH] Introduce convert_to_*_ex() --- Zend/zend_operators.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 072d60e467..5764fc30e7 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -70,4 +70,44 @@ ZEND_API int zend_binary_strcmp(zval *s1, zval *s2); ZEND_API int zend_binary_strcasecmp(zval *s1, zval *s2); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); +#define convert_to_long_ex(ppzv) \ + if ((*ppzv)->type!=IS_LONG) { \ + if (!(*ppzv)->EA.is_ref) { \ + SEPARATE_ZVAL(ppzv); \ + } \ + convert_to_long(*ppzv); \ + } + +#define convert_to_double_ex(ppzv) \ + if ((*ppzv)->type!=IS_DOUBLE) { \ + if (!(*ppzv)->EA.is_ref) { \ + SEPARATE_ZVAL(ppzv); \ + } \ + convert_to_double(*ppzv); \ + } + +#define convert_to_string_ex(ppzv) \ + if ((*ppzv)->type!=IS_STRING) { \ + if (!(*ppzv)->EA.is_ref) { \ + SEPARATE_ZVAL(ppzv); \ + } \ + convert_to_string(*ppzv); \ + } + +#define convert_to_array_ex(ppzv) \ + if ((*ppzv)->type!=IS_ARRAY) { \ + if (!(*ppzv)->EA.is_ref) { \ + SEPARATE_ZVAL(ppzv); \ + } \ + convert_to_array(*ppzv); \ + } + +#define convert_to_object_ex(ppzv) \ + if ((*ppzv)->type!=IS_OBJECT) { \ + if (!(*ppzv)->EA.is_ref) { \ + SEPARATE_ZVAL(ppzv); \ + } \ + convert_to_object(*ppzv); \ + } + #endif -- 2.49.0