]> granicus.if.org Git - php/commitdiff
Generalize macros
authorZeev Suraski <zeev@php.net>
Sat, 19 Feb 2000 13:11:39 +0000 (13:11 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 19 Feb 2000 13:11:39 +0000 (13:11 +0000)
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_execute.c
Zend/zend_operators.c
Zend/zend_operators.h

index 4cf4eb6e22f5e991f7c216e6ba0198b01ccffd15..8e5cd4acad7153a8cae17d4e2e472fcb299cb5ae 100644 (file)
@@ -35,7 +35,7 @@ static int module_count=0;
 HashTable list_destructors, module_registry;
 
 /* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters(int ht, int param_count,...)
+ZEND_API int zend_get_parameters(int ht, int param_count, ...)
 {
        void **p;
        int arg_count;
@@ -115,7 +115,7 @@ ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_
 
 /* Zend-optimized Extended functions */
 /* this function doesn't check for too many parameters */
-ZEND_API int zend_get_parameters_ex(int param_count,...)
+ZEND_API int zend_get_parameters_ex(int param_count, ...)
 {
        void **p;
        int arg_count;
index cdd464248ff0b7e197ddb02d754ab0fd841c8641..6222823ed9f0abed21245c0d5db84f402ea92a93 100644 (file)
@@ -57,9 +57,9 @@
 
 int zend_next_free_module(void);
 
-ZEND_API int zend_get_parameters(int ht, int param_count,...);
+ZEND_API int zend_get_parameters(int ht, int param_count, ...);
 ZEND_API int zend_get_parameters_array(int ht, int param_count, zval **argument_array);
-ZEND_API int zend_get_parameters_ex(int param_count,...);
+ZEND_API int zend_get_parameters_ex(int param_count, ...);
 ZEND_API int zend_get_parameters_array_ex(int param_count, zval ***argument_array);
 
 ZEND_API int ParameterPassedByReference(int ht, uint n);
index 017b072cba158636b9b953ae3a774f8acbf3ecc8..12a790b7901773bc7092b86bf087adf2f6ba9d1e 100644 (file)
@@ -2023,7 +2023,7 @@ send_by_ref:
                                        }                                       
                                        switch (opline->op2.u.constant.type) {
                                                case IS_NULL:
-                                                       convert_to_unset(result);
+                                                       convert_to_null(result);
                                                        break;
                                                case IS_BOOL:
                                                        convert_to_boolean(result);
index f76cbb88495da2fbc7e01fe61a03ad6f56464882..4346fe75f177a8ae37beabd8e19308b0722f7ac8 100644 (file)
@@ -257,7 +257,7 @@ ZEND_API void convert_to_double(zval *op)
 }
 
 
-ZEND_API void convert_to_unset(zval *op)
+ZEND_API void convert_to_null(zval *op)
 {
        zval_dtor(op);
        op->type = IS_NULL;
index e106f1481bdf2065a658b4056466b3bce440d622..6a00fe7e650b40697433720b3c1def899e77bd5a 100644 (file)
@@ -55,14 +55,14 @@ BEGIN_EXTERN_C()
 ZEND_API void convert_scalar_to_number(zval *op);
 ZEND_API void convert_to_string(zval *op);
 ZEND_API void convert_to_long(zval *op);
+ZEND_API void convert_to_double(zval *op);
 ZEND_API void convert_to_long_base(zval *op, int base);
-ZEND_API void convert_to_unset(zval *op);
+ZEND_API void convert_to_null(zval *op);
 ZEND_API void convert_to_boolean(zval *op);
 ZEND_API void convert_to_array(zval *op);
 ZEND_API void convert_to_object(zval *op);
 ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2);
 ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2);
-ZEND_API void convert_to_double(zval *op);
 END_EXTERN_C()
 
 ZEND_API int zval_is_true(zval *op);
@@ -77,53 +77,21 @@ ZEND_API int zend_binary_strcasecmp(char *s1, uint len1, char *s2, uint len2);
 
 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)->is_ref) {                                                 \
-                       SEPARATE_ZVAL(ppzv);                                                    \
-               }                                                                                                       \
-               convert_to_long(*ppzv);                                                         \
-       }
-
-#define convert_to_double_ex(ppzv)                                                     \
-       if ((*ppzv)->type!=IS_DOUBLE) {                                                 \
-               if (!(*ppzv)->is_ref) {                                                 \
+#define convert_to_ex_master(ppzv, lower_type, upper_type)     \
+       if ((*ppzv)->type!=IS_##upper_type) {                                   \
+               if (!(*ppzv)->is_ref) {                                                         \
                        SEPARATE_ZVAL(ppzv);                                                    \
                }                                                                                                       \
-               convert_to_double(*ppzv);                                                       \
+               convert_to_##lower_type(*ppzv);                                         \
        }
 
-#define convert_to_string_ex(ppzv)                                                     \
-       if ((*ppzv)->type!=IS_STRING) {                                                 \
-               if (!(*ppzv)->is_ref) {                                                 \
-                       SEPARATE_ZVAL(ppzv);                                                    \
-               }                                                                                                       \
-               convert_to_string(*ppzv);                                                       \
-       }
-
-#define convert_to_array_ex(ppzv)                                                      \
-       if ((*ppzv)->type!=IS_ARRAY) {                                                  \
-               if (!(*ppzv)->is_ref) {                                                 \
-                       SEPARATE_ZVAL(ppzv);                                                    \
-               }                                                                                                       \
-               convert_to_array(*ppzv);                                                        \
-       }
-
-#define convert_to_object_ex(ppzv)                                                     \
-       if ((*ppzv)->type!=IS_OBJECT) {                                                 \
-               if (!(*ppzv)->is_ref) {                                                 \
-                       SEPARATE_ZVAL(ppzv);                                                    \
-               }                                                                                                       \
-               convert_to_object(*ppzv);                                                       \
-       }
-
-#define convert_to_boolean_ex(ppzv)                                                    \
-       if ((*ppzv)->type!=IS_BOOL) {                                                   \
-               if (!(*ppzv)->is_ref) {                                                 \
-                       SEPARATE_ZVAL(ppzv);                                                    \
-               }                                                                                                       \
-               convert_to_boolean(*ppzv);                                                      \
-       }
+#define convert_to_boolean_ex(ppzv)    convert_to_ex_master(ppzv, boolean, BOOL)
+#define convert_to_long_ex(ppzv)       convert_to_ex_master(ppzv, long, LONG)
+#define convert_to_double_ex(ppzv)     convert_to_ex_master(ppzv, double, DOUBLE)
+#define convert_to_string_ex(ppzv)     convert_to_ex_master(ppzv, string, STRING)
+#define convert_to_array_ex(ppzv)      convert_to_ex_master(ppzv, array, ARRAY)
+#define convert_to_object_ex(ppzv)     convert_to_ex_master(ppzv, object, OBJECT)
+#define convert_to_null_ex(ppzv)       convert_to_ex_master(ppzv, null, NULL)
 
 #define convert_scalar_to_number_ex(ppzv)                                                      \
        if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) {               \