From e722dce5753a1af749217ef6b4104e588a95d2c4 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Tue, 19 Dec 2006 21:38:59 +0000 Subject: [PATCH] - Marcus was too quick. Let's put type before zstr in the macros. - Also mark get_include_path() and restore_include_path() with U. --- Zend/zend_API.h | 44 ++++++++++++++++----------------- Zend/zend_execute_API.c | 2 +- ext/reflection/php_reflection.c | 8 +++--- ext/standard/array.c | 8 +++--- ext/standard/basic_functions.c | 16 ++++++------ ext/standard/string.c | 12 ++++----- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index ccdb5383eb..dcad498633 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -389,13 +389,13 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value); #define add_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -532,13 +532,13 @@ ZEND_API int add_ascii_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *v #define add_ascii_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_ascii_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_ascii_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_ascii_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -676,13 +676,13 @@ ZEND_API int add_rt_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *valu #define add_rt_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_rt_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_rt_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_rt_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -820,13 +820,13 @@ ZEND_API int add_utf8_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *va #define add_utf8_assoc_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_utf8_assoc_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_utf8_assoc_zval_ex(arg, key, key_len, ___tmp); \ } while (0) #define add_utf8_assoc_text_ex(arg, key, key_len, str, duplicate) do { \ @@ -972,14 +972,14 @@ ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval #define add_utf8_property_zstr_ex(arg, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \ } while (0) #define add_utf8_property_zstrl_ex(arg, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_utf8_property_zval_ex(arg, key, key_len, ___tmp TSRMLS_CC); \ zval_ptr_dtor(&___tmp); /* write_property will add 1 to refcount */ \ } while (0) @@ -1092,13 +1092,13 @@ ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_ #define add_u_assoc_zstr_ex(arg, key_type, key, key_len, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_u_assoc_zval_ex(arg, key_type, key, key_len, ___tmp); \ } while (0) #define add_u_assoc_zstrl_ex(arg, key_type, key, key_len, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_u_assoc_zval_ex(arg, key_type, key, key_len, ___tmp); \ } while (0) #define add_u_assoc_text_ex(arg, type, key, key_len, str, duplicate) do { \ @@ -1236,13 +1236,13 @@ ZEND_API int add_index_zval(zval *arg, ulong index, zval *value); #define add_index_zstr(arg, idx, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_index_zval(arg, idx, ___tmp); \ } while (0) #define add_index_zstrl(arg, idx, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_index_zval(arg, idx, ___tmp); \ } while (0) #define add_index_text(arg, idx, str, duplicate) do { \ @@ -1359,13 +1359,13 @@ ZEND_API int add_next_index_zval(zval *arg, zval *value); #define add_next_index_zstr(arg, type, str, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTR(___tmp, str, type, duplicate); \ + ZVAL_ZSTR(___tmp, type, str, duplicate); \ add_next_index_zval(arg, ___tmp); \ } while (0) #define add_next_index_zstrl(arg, type, str, length, duplicate) do { \ zval *___tmp; \ MAKE_STD_ZVAL(___tmp); \ - ZVAL_ZSTRL(___tmp, str, type, length, duplicate); \ + ZVAL_ZSTRL(___tmp, type, str, length, duplicate); \ add_next_index_zval(arg, ___tmp); \ } while (0) #define add_next_index_text(arg, str, duplicate) do { \ @@ -1707,7 +1707,7 @@ END_EXTERN_C() Z_TYPE_P(z) = IS_UNICODE; \ } -#define ZVAL_ZSTR(z, zs, type, duplicate) { \ +#define ZVAL_ZSTR(z, type, zs, duplicate) { \ zstr __s=(zs); \ Z_UNILEN_P(z) = (type==IS_UNICODE)?u_strlen(__s.u):strlen(__s.s); \ Z_UNIVAL_P(z) = ZSTR(duplicate? \ @@ -1718,7 +1718,7 @@ END_EXTERN_C() Z_TYPE_P(z) = type; \ } -#define ZVAL_ZSTRL(z, zs, type, l, duplicate) { \ +#define ZVAL_ZSTRL(z, type, zs, l, duplicate) { \ zstr __s=(zs); int __l=l; \ Z_UNILEN_P(z) = __l; \ Z_UNIVAL_P(z) = ZSTR(duplicate? \ @@ -1819,8 +1819,8 @@ END_EXTERN_C() #define RETVAL_TEXT(t, duplicate) ZVAL_TEXT(return_value, t, duplicate) #define RETVAL_TEXTL(t, l, duplicate) ZVAL_TEXTL(return_value, t, l, duplicate) #define RETVAL_EMPTY_TEXT() ZVAL_EMPTY_TEXT(return_value) -#define RETVAL_ZSTR(s, type, duplicate) ZVAL_ZSTR(return_value, s, type, duplicate) -#define RETVAL_ZSTRL(s, l, type, duplicate) ZVAL_ZSTRL(return_value, s, type, l, duplicate) +#define RETVAL_ZSTR(type, s, duplicate) ZVAL_ZSTR(return_value, type, s, duplicate) +#define RETVAL_ZSTRL(type, s, l, duplicate) ZVAL_ZSTRL(return_value, type, s, l, duplicate) #define RETURN_RESOURCE(l) { RETVAL_RESOURCE(l); return; } #define RETURN_BOOL(b) { RETVAL_BOOL(b); return; } @@ -1848,8 +1848,8 @@ END_EXTERN_C() #define RETURN_RT_STRINGL(t, l, flags) { RETVAL_RT_STRINGL(t, l, flags); return; } #define RETURN_UTF8_STRING(t, flags) { RETVAL_UTF8_STRING(t, flags); return; } #define RETURN_UTF8_STRINGL(t, l, flags) { RETVAL_UTF8_STRINGL(t, l, flags); return; } -#define RETURN_ZSTR(s, type, duplicate) { RETVAL_ZSTR(s, type, duplicate); return; } -#define RETURN_ZSTRL(s, l, type, duplicate) { RETVAL_ZSTRL(s, l, type, duplicate); return; } +#define RETURN_ZSTR(type, s, duplicate) { RETVAL_ZSTR(type, s, duplicate); return; } +#define RETURN_ZSTRL(type, s, l, duplicate) { RETVAL_ZSTRL(type, s, l, duplicate); return; } #define SET_VAR_STRING(n, v) { \ { \ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 90d4cd761b..ee73ce48b2 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1134,7 +1134,7 @@ ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); - ZVAL_ZSTRL(class_name_ptr, name, type, name_length, 1); + ZVAL_ZSTRL(class_name_ptr, type, name, name_length, 1); args[0] = &class_name_ptr; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 007b473c59..2d1d8406d8 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1538,7 +1538,7 @@ ZEND_METHOD(reflection_function, getDocComment) METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0); GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment.v) { - RETURN_ZSTRL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, ZEND_STR_TYPE, 1); + RETURN_ZSTRL(ZEND_STR_TYPE, fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1); } RETURN_FALSE; } @@ -2190,7 +2190,7 @@ ZEND_METHOD(reflection_method, __construct) } else { tmp_len = tmp.s - name_str.s; } - ZVAL_ZSTRL(classname, name_str, type, tmp_len, 1); + ZVAL_ZSTRL(classname, type, name_str, tmp_len, 1); name_len = name_len - (tmp_len + 2); if (type == IS_UNICODE) { name_str.u = tmp.u + 2; @@ -2954,7 +2954,7 @@ ZEND_METHOD(reflection_class, getDocComment) METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0); GET_REFLECTION_OBJECT_PTR(ce); if (ce->type == ZEND_USER_CLASS && ce->doc_comment.v) { - RETURN_ZSTRL(ce->doc_comment, ce->doc_comment_len, ZEND_STR_TYPE, 1); + RETURN_ZSTRL(ZEND_STR_TYPE, ce->doc_comment, ce->doc_comment_len, 1); } RETURN_FALSE; } @@ -4154,7 +4154,7 @@ ZEND_METHOD(reflection_property, getDocComment) METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0); GET_REFLECTION_OBJECT_PTR(ref); if (ref->prop->doc_comment.v) { - RETURN_ZSTRL(ref->prop->doc_comment, ref->prop->doc_comment_len, ZEND_STR_TYPE, 1); + RETURN_ZSTRL(ZEND_STR_TYPE, ref->prop->doc_comment, ref->prop->doc_comment_len, 1); } RETURN_FALSE; } diff --git a/ext/standard/array.c b/ext/standard/array.c index c1dccdbcf7..3029953ebb 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1436,7 +1436,7 @@ PHP_FUNCTION(extract) break; } - ZVAL_ZSTRL(&final_name, var_name, key_type, var_name_len, 1); + ZVAL_ZSTRL(&final_name, key_type, var_name, var_name_len, 1); break; case EXTR_PREFIX_IF_EXISTS: @@ -1447,7 +1447,7 @@ PHP_FUNCTION(extract) case EXTR_PREFIX_SAME: if (!var_exists && var_name_len != 0) { - ZVAL_ZSTRL(&final_name, var_name, key_type, var_name_len, 1); + ZVAL_ZSTRL(&final_name, key_type, var_name, var_name_len, 1); } /* break omitted intentionally */ @@ -1462,14 +1462,14 @@ PHP_FUNCTION(extract) if (!php_valid_var_name(var_name, var_name_len, key_type)) { php_prefix_varname(&final_name, prefix, var_name, var_name_len, key_type, 1 TSRMLS_CC); } else { - ZVAL_ZSTRL(&final_name, var_name, key_type, var_name_len, 1); + ZVAL_ZSTRL(&final_name, key_type, var_name, var_name_len, 1); } } break; default: if (!var_exists) { - ZVAL_ZSTRL(&final_name, var_name, key_type, var_name_len, 1); + ZVAL_ZSTRL(&final_name, key_type, var_name, var_name_len, 1); } break; } diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 06fa7c4fb1..f816d1848e 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5779,33 +5779,33 @@ PHP_FUNCTION(set_include_path) /* }}} */ -/* {{{ proto string get_include_path() +/* {{{ proto string get_include_path() U Get the current include_path configuration option */ PHP_FUNCTION(get_include_path) { char *str; - if (ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; } str = zend_ini_string("include_path", sizeof("include_path"), 0); if (str == NULL) { RETURN_FALSE; } - RETURN_STRING(str, 1); + RETURN_UTF8_STRING(str, ZSTR_DUPLICATE); } /* }}} */ -/* {{{ proto void restore_include_path() +/* {{{ proto void restore_include_path() U Restore the value of the include_path configuration option */ PHP_FUNCTION(restore_include_path) { - if (ZEND_NUM_ARGS() != 0) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) { + return; } - zend_restore_ini_entry("include_path", sizeof("include_path"), PHP_INI_STAGE_RUNTIME); } diff --git a/ext/standard/string.c b/ext/standard/string.c index 9ef4e20270..f60e739a4d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2033,7 +2033,7 @@ PHP_FUNCTION(dirname) ret_len = php_dirname(ret.s, str_len); } - RETURN_ZSTRL(ret, ret_len, str_type, 0); + RETURN_ZSTRL(str_type, ret, ret_len, 0); } /* }}} */ @@ -3162,7 +3162,7 @@ PHP_FUNCTION(chunk_split) memcpy(result.s + str_len, ending.s, ending_len); result.s[result_len] = '\0'; } - RETURN_ZSTRL(result, result_len, str_type, 0); + RETURN_ZSTRL(str_type, result, result_len, 0); } if (!str_len) { @@ -3172,7 +3172,7 @@ PHP_FUNCTION(chunk_split) result.v = php_chunk_split(str.v, str_len, ending.v, ending_len, chunklen, &result_len, str_type); if (result.v) { - RETURN_ZSTRL(result, result_len, str_type, 0); + RETURN_ZSTRL(str_type, result, result_len, 0); } else { RETURN_FALSE; } @@ -5900,7 +5900,7 @@ PHP_FUNCTION(nl2br) } if (repl_cnt == 0) { - RETURN_ZSTRL(str, str_len, str_type, 1); + RETURN_ZSTRL(str_type, str, str_len, 1); } new_length = str_len + repl_cnt * (sizeof("
") - 1); @@ -5963,7 +5963,7 @@ PHP_FUNCTION(nl2br) } - RETURN_ZSTRL(tmp, new_length, str_type, 0); + RETURN_ZSTRL(str_type, tmp, new_length, 0); } /* }}} */ @@ -7441,7 +7441,7 @@ PHP_FUNCTION(str_shuffle) return; } - RETVAL_ZSTRL(str, str_len, str_type, 1); + RETVAL_ZSTRL(str_type, str, str_len, 1); if (Z_UNILEN_P(return_value) > 1) { php_string_shuffle(Z_UNIVAL_P(return_value), Z_UNILEN_P(return_value), Z_TYPE_P(return_value) TSRMLS_CC); } -- 2.50.1