Skip to content

Commit

Permalink
- Marcus was too quick. Let's put type before zstr in the macros.
Browse files Browse the repository at this point in the history
- Also mark get_include_path() and restore_include_path() with U.
  • Loading branch information
Andrei Zmievski committed Dec 19, 2006
1 parent 98dce57 commit e722dce
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 45 deletions.
44 changes: 22 additions & 22 deletions Zend/zend_API.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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 { \
Expand Down Expand Up @@ -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? \
Expand All @@ -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? \
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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) { \
{ \
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 */

Expand All @@ -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;
}
Expand Down
16 changes: 8 additions & 8 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 6 additions & 6 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
/* }}} */

Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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("<br />") - 1);
Expand Down Expand Up @@ -5963,7 +5963,7 @@ PHP_FUNCTION(nl2br)
}


RETURN_ZSTRL(tmp, new_length, str_type, 0);
RETURN_ZSTRL(str_type, tmp, new_length, 0);
}
/* }}} */

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit e722dce

Please sign in to comment.