cvs: php-src /ext/dom dom_iterators.c php_dom.c /ext/hash hash.c /ext/libxml libxml.c /ext/mysql php_mysql.c /ext/openssl openssl.c /ext/pcre
php_pcre.c /ext/pdo pdo_dbh.c pdo_stmt.c /ext/reflection php_reflection.c /ext/session php_session.h session.c /ext/simplexml simplexml.c
/ext/soap php_encoding.c soap.c /ext/spl php_spl.c spl_array.c spl_directory.c spl_engine.h spl_iterators.c spl_iterators.h /ext/sqlite sqlite.c
/ext/standard array.c basic_functions.c http.c incomplete_class.c info.c php_incomplete_class.h proc_open.c streamsfuncs.c string.c type.c
user_filters.c var.c /main main.c output.c php_variables.c rfc1867.c /main/streams streams.c /sapi/cli php_cli.c ZendEngine2 zend.c zend.h
zend_API.c zend_API.h zend_alloc.c zend_alloc.h zend_builtin_functions.c zend_compile.c zend_compile.h zend_constants.c zend_constants.h
zend_exceptions.c zend_execute.c zend_execute.h zend_execute_API.c zend_hash.c zend_hash.h zend_highlight.c zend_ini.c zend! _interfaces.c
zend_interfaces.h zend_iterators.c zend_iterators.h zend_language_scanner.l zend_list.c zend_object_handlers.c zend_object_handlers.h zend_objects.c
zend_opcode.c zend_operators.c zend_operators.h zend_strtol.c zend_unicode.c zend_unicode.h zend_vm_def.h zend_vm_execute.h

From: Date: Tue, 21 Feb 2006 20:12:44 +0000
Subject: cvs: php-src /ext/dom dom_iterators.c php_dom.c /ext/hash hash.c /ext/libxml libxml.c /ext/mysql php_mysql.c /ext/openssl openssl.c /ext/pcre
php_pcre.c /ext/pdo pdo_dbh.c pdo_stmt.c /ext/reflection php_reflection.c /ext/session php_session.h session.c /ext/simplexml simplexml.c
/ext/soap php_encoding.c soap.c /ext/spl php_spl.c spl_array.c spl_directory.c spl_engine.h spl_iterators.c spl_iterators.h /ext/sqlite sqlite.c
/ext/standard array.c basic_functions.c http.c incomplete_class.c info.c php_incomplete_class.h proc_open.c streamsfuncs.c string.c type.c
user_filters.c var.c /main main.c output.c php_variables.c rfc1867.c /main/streams streams.c /sapi/cli php_cli.c ZendEngine2 zend.c zend.h
zend_API.c zend_API.h zend_alloc.c zend_alloc.h zend_builtin_functions.c zend_compile.c zend_compile.h zend_constants.c zend_constants.h
zend_exceptions.c zend_execute.c zend_execute.h zend_execute_API.c zend_hash.c zend_hash.h zend_highlight.c zend_ini.c zend! _interfaces.c
zend_interfaces.h zend_iterators.c zend_iterators.h zend_language_scanner.l zend_list.c zend_object_handlers.c zend_object_handlers.h zend_objects.c
zend_opcode.c zend_operators.c zend_operators.h zend_strtol.c zend_unicode.c zend_unicode.h zend_vm_def.h zend_vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-36964@lists.php.net to get a copy of this message
dmitry Tue Feb 21 20:12:44 2006 UTC Modified files: /ZendEngine2 zend.c zend.h zend_API.c zend_API.h zend_alloc.c zend_alloc.h zend_builtin_functions.c zend_compile.c zend_compile.h zend_constants.c zend_constants.h zend_exceptions.c zend_execute.c zend_execute.h zend_execute_API.c zend_hash.c zend_hash.h zend_highlight.c zend_ini.c zend_interfaces.c zend_interfaces.h zend_iterators.c zend_iterators.h zend_language_scanner.l zend_list.c zend_object_handlers.c zend_object_handlers.h zend_objects.c zend_opcode.c zend_operators.c zend_operators.h zend_strtol.c zend_unicode.c zend_unicode.h zend_vm_def.h zend_vm_execute.h /php-src/ext/dom dom_iterators.c php_dom.c /php-src/ext/hash hash.c /php-src/ext/libxml libxml.c /php-src/ext/mysql php_mysql.c /php-src/ext/openssl openssl.c /php-src/ext/pcre php_pcre.c /php-src/ext/pdo pdo_dbh.c pdo_stmt.c /php-src/ext/reflection php_reflection.c /php-src/ext/session php_session.h session.c /php-src/ext/simplexml simplexml.c /php-src/ext/soap php_encoding.c soap.c /php-src/ext/spl php_spl.c spl_array.c spl_directory.c spl_engine.h spl_iterators.c spl_iterators.h /php-src/ext/sqlite sqlite.c /php-src/ext/standard array.c basic_functions.c http.c incomplete_class.c info.c php_incomplete_class.h proc_open.c streamsfuncs.c string.c type.c user_filters.c var.c /php-src/main main.c output.c php_variables.c rfc1867.c /php-src/main/streams streams.c /php-src/sapi/cli php_cli.c Log: Portable unicode string API: - use the same type (int) for zval.value.usr.len and zval.value.str.len - use union "zstr" as char*/UChar* mixture instead of void* - Z_UNISTR() and Z_UNILEN() no longer check for Z_TYPE() - nuke int32_t from ZE (not finisned)

http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.c?r1=1.336&r2=1.337&diff_format=u Index: ZendEngine2/zend.c diff -u ZendEngine2/zend.c:1.336 ZendEngine2/zend.c:1.337 --- ZendEngine2/zend.c:1.336 Mon Feb 20 19:03:42 2006 +++ ZendEngine2/zend.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.c,v 1.336 2006/02/20 19:03:42 dmitry Exp $ */ +/* $Id: zend.c,v 1.337 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_extensions.h" @@ -244,7 +244,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) { zval **tmp; - char *string_key; + zstr string_key; HashPosition iterator; ulong num_key; uint str_len; @@ -272,12 +272,12 @@ ztype = IS_UNICODE; str_type: if (is_object) { - char *prop_name, *class_name; + zstr prop_name, class_name; zend_u_unmangle_property_name(ztype, string_key, &class_name, &prop_name); - if (class_name) { - if (class_name[0]=='*') { + if (class_name.v) { + if (class_name.s[0]=='*') { zend_printf("%R:protected", ztype, prop_name); } else { zend_printf("%R:%v:private", ztype, prop_name, class_name); @@ -308,7 +308,7 @@ static void print_flat_hash(HashTable *ht TSRMLS_DC) { zval **tmp; - char *string_key; + zstr string_key; HashPosition iterator; ulong num_key; uint str_len; @@ -322,10 +322,10 @@ ZEND_PUTS("["); switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { case HASH_KEY_IS_STRING: - ZEND_PUTS(string_key); + ZEND_PUTS(string_key.s); break; case HASH_KEY_IS_UNICODE: - zend_printf("%r", string_key); + zend_printf("%r", string_key.u); break; case HASH_KEY_IS_LONG: zend_printf("%ld", num_key); @@ -527,19 +527,19 @@ case IS_OBJECT: { HashTable *properties = NULL; - char *class_name = NULL; + zstr class_name = (zstr)NULL; zend_uint clen; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); } - if (class_name) { - zend_printf("%v Object (", class_name); + if (class_name.v) { + zend_printf("%v Object (", class_name.v); } else { zend_printf("%s Object (", "Unknown Class"); } - if (class_name) { - efree(class_name); + if (class_name.v) { + efree(class_name.v); } if (Z_OBJ_HANDLER_P(expr, get_properties)) { properties = Z_OBJPROP_P(expr); @@ -584,19 +584,19 @@ case IS_OBJECT: { HashTable *properties = NULL; - char *class_name = NULL; + zstr class_name = (zstr)NULL; zend_uint clen; if (Z_OBJ_HANDLER_P(expr, get_class_name)) { Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC); } - if (class_name) { - zend_printf("%v Object\n", class_name); + if (class_name.v) { + zend_printf("%v Object\n", class_name.v); } else { zend_printf("%s Object\n", "Unknown Class"); } - if (class_name) { - efree(class_name); + if (class_name.v) { + efree(class_name.v); } if (Z_OBJ_HANDLER_P(expr, get_properties)) { properties = Z_OBJPROP_P(expr); @@ -634,7 +634,7 @@ zend_standard_class_def->type = ZEND_INTERNAL_CLASS; zend_standard_class_def->name_length = sizeof("stdClass") - 1; - zend_standard_class_def->name = zend_strndup("stdClass", zend_standard_class_def->name_length); + zend_standard_class_def->name.s = zend_strndup("stdClass", zend_standard_class_def->name_length); zend_initialize_class_data(zend_standard_class_def, 1 TSRMLS_CC); zend_hash_add(CG(class_table), "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry *), NULL); @@ -672,19 +672,19 @@ destroy_zend_function(function TSRMLS_CC); if (function->type == ZEND_INTERNAL_FUNCTION) { - if (function->common.function_name) { - free(function->common.function_name); + if (function->common.function_name.v) { + free(function->common.function_name.v); } if (function->common.arg_info) { int n = function->common.num_args; while (n > 0) { --n; - if (function->common.arg_info[n].name) { - free(function->common.arg_info[n].name); + if (function->common.arg_info[n].name.v) { + free(function->common.arg_info[n].name.v); } - if (function->common.arg_info[n].class_name) { - free(function->common.arg_info[n].class_name); + if (function->common.arg_info[n].class_name.v) { + free(function->common.arg_info[n].class_name.v); } } free(function->common.arg_info); @@ -699,18 +699,18 @@ } else { zval_internal_dtor(&c->value); } - free(c->name); + free(c->name.v); } static void function_to_unicode(zend_function *func TSRMLS_DC) { - if (func->common.function_name) { + if (func->common.function_name.s) { UChar *uname; - int len = strlen(func->common.function_name)+1; + int len = strlen(func->common.function_name.s)+1; uname = malloc(UBYTES(len)); - u_charsToUChars(func->common.function_name, uname, len); - func->common.function_name = (char*)uname; + u_charsToUChars(func->common.function_name.s, uname, len); + func->common.function_name.u = uname; } if (func->common.arg_info) { zend_arg_info *args; @@ -720,15 +720,15 @@ memcpy(args, func->common.arg_info, (n + 1) * sizeof(zend_arg_info)); while (n > 0) { --n; - if (args[n].name) { + if (args[n].name.s) { UChar *uname = malloc(UBYTES(args[n].name_len)); - u_charsToUChars(args[n].name, uname, args[n].name_len); - args[n].name = (char*)uname; + u_charsToUChars(args[n].name.s, uname, args[n].name_len); + args[n].name.u = uname; } - if (args[n].class_name) { + if (args[n].class_name.s) { UChar *uname = malloc(UBYTES(args[n].class_name_len)); - u_charsToUChars(args[n].class_name, uname, args[n].class_name_len); - args[n].class_name = (char*)uname; + u_charsToUChars(args[n].class_name.s, uname, args[n].class_name_len); + args[n].class_name.u = uname; } } func->common.arg_info = args; @@ -737,13 +737,13 @@ static void property_info_to_unicode(zend_property_info *info TSRMLS_DC) { - if (info->name) { + if (info->name.s) { UChar *uname; uname = malloc(UBYTES(info->name_length+1)); - u_charsToUChars(info->name, uname, info->name_length+1); - free(info->name); - info->name = (char*)uname; + u_charsToUChars(info->name.s, uname, info->name_length+1); + free(info->name.s); + info->name.u = uname; info->h = zend_u_get_hash_value(IS_UNICODE, info->name, info->name_length+1); } } @@ -757,11 +757,11 @@ { UChar *uname; - if (c->name) { + if (c->name.s) { uname = malloc(UBYTES(c->name_len)); - u_charsToUChars(c->name, uname, c->name_len); - free(c->name); - c->name = (char*)uname; + u_charsToUChars(c->name.s, uname, c->name_len); + free(c->name.s); + c->name.u = uname; } if (Z_TYPE(c->value) == IS_STRING || Z_TYPE(c->value) == IS_CONSTANT) { UChar *ustr; @@ -776,12 +776,12 @@ static void class_to_unicode(zend_class_entry **ce TSRMLS_DC) { /* Convert name to unicode */ - if ((*ce)->name) { + if ((*ce)->name.s) { UChar *uname = malloc(UBYTES((*ce)->name_length+1)); - u_charsToUChars((*ce)->name, uname, (*ce)->name_length+1); - free((*ce)->name); - (*ce)->name = (char*)uname; + u_charsToUChars((*ce)->name.s, uname, (*ce)->name_length+1); + free((*ce)->name.s); + (*ce)->name.u = uname; } zend_hash_to_unicode(&(*ce)->function_table, (apply_func_t)function_to_unicode TSRMLS_CC); @@ -1564,7 +1564,8 @@ if (EG(exception)) { char ex_class_name[128]; if (Z_TYPE_P(EG(exception)) == IS_OBJECT) { - strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)), 127); + /* CHECK ME: why strings only */ + strncpy(ex_class_name, Z_OBJ_CLASS_NAME_P(EG(exception)).s, 127); ex_class_name[127] = '\0'; } else { strcpy(ex_class_name, "Unknown Exception"); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend.h?r1=1.312&r2=1.313&diff_format=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.312 ZendEngine2/zend.h:1.313 --- ZendEngine2/zend.h:1.312 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.312 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend.h,v 1.313 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -240,6 +240,12 @@ #define LONG_MIN (- LONG_MAX - 1) #endif +typedef union _zstr { + char *s; + UChar *u; + void *v; +} zstr; + #define EMPTY_STR ((UChar*)"\0\0") #undef SUCCESS @@ -294,7 +300,7 @@ } str; struct { /* Unicode string type */ UChar *val; - int32_t len; + int len; } ustr; HashTable *ht; /* hash table value */ zend_object_value obj; @@ -326,7 +332,7 @@ struct _zend_class_entry { char type; - char *name; + zstr name; zend_uint name_length; struct _zend_class_entry *parent; int refcount; @@ -663,8 +669,8 @@ #define ZEND_U_EQUAL(type, ustr, ulen, str, slen) \ ((type == IS_STRING)? \ - (!memcmp((ustr),(str),(slen))): \ - (!zend_cmp_unicode_and_literal(((UChar*)(ustr)), ulen, str, slen))) + (!memcmp((ustr).s,(str),(slen))): \ + (!zend_cmp_unicode_and_literal((ustr).u, ulen, str, slen))) #endif /* ZEND_H */ http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.c?r1=1.344&r2=1.345&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.344 ZendEngine2/zend_API.c:1.345 --- ZendEngine2/zend_API.c:1.344 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_API.c Tue Feb 21 20:12:41 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.344 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.345 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -156,7 +156,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_PP(value) == IS_OBJECT) { zval *value_ptr; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -165,9 +165,9 @@ ALLOC_ZVAL(value_ptr); *value_ptr = **value; INIT_PZVAL(value_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v); if(!dup) { - efree(class_name); + efree(class_name.v); } Z_OBJVAL_P(value_ptr) = Z_OBJ_HANDLER_PP(value, clone_obj)(*value TSRMLS_CC); zval_ptr_dtor(value); @@ -206,7 +206,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "Wrong parameter count for %v%s%v()", class_name, space, get_active_function_name(TSRMLS_C)); } @@ -260,7 +260,7 @@ } /* returns 1 if you need to copy result, 0 if it's already a copy */ -ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC) +ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC) { if (Z_OBJ_HT_P(object)->get_class_name == NULL || Z_OBJ_HT_P(object)->get_class_name(object, class_name, class_name_len, 0 TSRMLS_CC) != SUCCESS) { @@ -440,7 +440,7 @@ case 'u': { UChar **p = va_arg(*va, UChar **); - int32_t *pl = va_arg(*va, int32_t *); + int *pl = va_arg(*va, int *); switch (Z_TYPE_PP(arg)) { case IS_NULL: if (return_null) { @@ -485,7 +485,7 @@ if (T_arg_type != -1) { void **p = va_arg(*va, void **); - int32_t *pl = va_arg(*va, int32_t *); + int *pl = va_arg(*va, int *); zend_uchar *type = va_arg(*va, zend_uchar *); switch (Z_TYPE_PP(arg)) { case IS_NULL: @@ -511,7 +511,7 @@ } else { if (Z_TYPE_PP(arg) == IS_UNICODE) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v() does not allow mixing binary and Unicode parameters", class_name, space, get_active_function_name(TSRMLS_C)); return ""; @@ -523,7 +523,8 @@ if (Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); if (Z_OBJ_HANDLER_PP(arg, cast_object)(*arg, *arg, T_arg_type TSRMLS_CC) == SUCCESS) { - *(char**)p = Z_UNIVAL_PP(arg); + /* FIXME: Unicode support??? */ + *(char**)p = Z_STRVAL_PP(arg); *pl = Z_UNILEN_PP(arg); *type = Z_TYPE_PP(arg); RETURN_AS_UNICODE(arg, p, pl, type); @@ -545,7 +546,7 @@ case 't': { void **p = va_arg(*va, void **); - int32_t *pl = va_arg(*va, int32_t *); + int *pl = va_arg(*va, int *); zend_uchar *type = va_arg(*va, zend_uchar *); switch (Z_TYPE_PP(arg)) { case IS_NULL: @@ -696,7 +697,8 @@ if (Z_TYPE_PP(arg) == IS_NULL && return_null) { *p = NULL; } else { - return ce ? ce->name : "object"; + /* FIXME: Unicode support??? */ + return ce ? ce->name.s : "object"; } } } @@ -707,12 +709,8 @@ zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **); zend_class_entry *ce_base = *pce; - if (UG(unicode)) { - convert_to_unicode_ex(arg); - } else { - convert_to_string_ex(arg); - } - if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { + convert_to_text_ex(arg); + if (zend_u_lookup_class(Z_TYPE_PP(arg), Z_UNIVAL_PP(arg), Z_UNILEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { *pce = NULL; } else { *pce = *lookup; @@ -720,7 +718,7 @@ if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC)) && !return_null) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v() expects parameter %d to be a class name derived from %v, '%v' given", class_name, space, get_active_function_name(TSRMLS_C), arg_num, ce_base->name, Z_STRVAL_PP(arg)); @@ -730,7 +728,7 @@ } if (!*pce && !return_null) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v() expects parameter %d to be a valid class name, '%v' given", class_name, space, get_active_function_name(TSRMLS_C), arg_num, Z_STRVAL_PP(arg)); @@ -778,7 +776,7 @@ if (expected_type) { if (!quiet && *expected_type) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v() expects parameter %d to be %s, %s given", class_name, space, get_active_function_name(TSRMLS_C), arg_num, expected_type, @@ -832,7 +830,7 @@ default: if (!quiet) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v(): bad type specifier while parsing parameters", class_name, space, get_active_function_name(TSRMLS_C)); @@ -848,7 +846,7 @@ if (num_args < min_num_args || num_args > max_num_args) { if (!quiet) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_error(E_WARNING, "%v%s%v() expects %s %d parameter%s, %d given", class_name, space, get_active_function_name(TSRMLS_C), @@ -1027,9 +1025,9 @@ MAKE_STD_ZVAL(member); if (hash_key->type == IS_STRING) { - ZVAL_STRINGL(member, hash_key->u.string, hash_key->nKeyLength-1, 1); + ZVAL_STRINGL(member, hash_key->arKey.s, hash_key->nKeyLength-1, 1); } else if (hash_key->type == IS_UNICODE) { - ZVAL_UNICODEL(member, hash_key->u.unicode, hash_key->nKeyLength-1, 1); + ZVAL_UNICODEL(member, hash_key->arKey.u, hash_key->nKeyLength-1, 1); } obj_ht->write_property(obj, member, *value TSRMLS_CC); @@ -1082,7 +1080,7 @@ zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos); while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) { - char *str_index; + zstr str_index; uint str_length; ulong num_index; zend_uchar utype; @@ -1248,7 +1246,7 @@ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &tmp, sizeof(zval *), NULL); } -ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, void *str, int duplicate) +ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate) { zval *tmp; @@ -1259,7 +1257,7 @@ } -ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, void *str, uint length, int duplicate) +ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate) { zval *tmp; @@ -1274,7 +1272,7 @@ return zend_symtable_update(Z_ARRVAL_P(arg), key, key_len, (void *) &value, sizeof(zval *), NULL); } -ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, void *key, uint key_len, zval *value) +ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value) { return zend_u_symtable_update(Z_ARRVAL_P(arg), type, key, key_len, (void *) &value, sizeof(zval *), NULL); } @@ -1964,16 +1962,16 @@ ZEND_API void zend_check_magic_method_implementation(zend_class_entry *ce, zend_function *fptr, int error_type TSRMLS_DC) { unsigned int lcname_len; - char *lcname; + zstr lcname; int name_len; zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; /* we don't care if the function name is longer, in fact lowercasing only * the beginning of the name speeds up the check process */ if (UG(unicode)) { - name_len = u_strlen((UChar*)fptr->common.function_name); + name_len = u_strlen(fptr->common.function_name.u); } else { - name_len = strlen(fptr->common.function_name); + name_len = strlen(fptr->common.function_name.s); } lcname = zend_u_str_case_fold(utype, fptr->common.function_name, name_len, 0, &lcname_len); @@ -2002,7 +2000,7 @@ ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0) { zend_error(error_type, "Method %v::%s() cannot take arguments", ce->name, ZEND_CALL_FUNC_NAME); } - efree(lcname); + efree(lcname.v); } /* registers all functions in *library_functions in the function hash */ @@ -2034,12 +2032,12 @@ if (scope) { class_name_len = scope->name_length; - lc_class_name = zend_str_tolower_dup(scope->name, class_name_len); + lc_class_name = zend_str_tolower_dup(scope->name.s, class_name_len); } while (ptr->fname) { internal_function->handler = ptr->handler; - internal_function->function_name = ptr->fname; + internal_function->function_name.s = ptr->fname; internal_function->scope = scope; internal_function->prototype = NULL; if (ptr->arg_info) { @@ -2062,7 +2060,7 @@ } if (ptr->flags) { if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { - zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname); internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags; } else { internal_function->fn_flags = ptr->flags; @@ -2082,7 +2080,7 @@ } } if (ptr->flags & ZEND_ACC_STATIC && (!scope || (scope->ce_flags & ZEND_ACC_INTERFACE))) { - zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname); } } else { if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { @@ -2094,7 +2092,7 @@ if (scope) { efree(lc_class_name); } - zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname); zend_unregister_functions(functions, count, target_function_table TSRMLS_CC); return FAILURE; } @@ -2152,7 +2150,7 @@ } while (ptr->fname) { if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) { - zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name.s : "", scope ? "::" : "", ptr->fname); } ptr++; } @@ -2366,7 +2364,7 @@ zend_register_functions(class_entry, class_entry->builtin_functions, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC); } - zend_str_tolower_copy(lowercase_name, orig_class_entry->name, class_entry->name_length); + zend_str_tolower_copy(lowercase_name, orig_class_entry->name.s, class_entry->name_length); zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, &class_entry, sizeof(zend_class_entry *), NULL); free(lowercase_name); return class_entry; @@ -2513,7 +2511,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC) { int retval; - char *lcname, *lmname, *mname, *colon; + zstr lcname, lmname, mname, colon; unsigned int clen, mlen; zend_function *fptr; zend_class_entry **pce; @@ -2523,30 +2521,31 @@ *fptr_ptr = NULL; if (Z_TYPE_P(callable) == IS_UNICODE) { - if ((colon = (char*)u_strstr((UChar*)Z_UNIVAL_P(callable), (UChar*)":\0:\0")) != NULL) { - mlen = u_strlen((UChar*)(colon+4)); - clen = Z_UNILEN_P(callable) - mlen - 2; - mname = colon + 4; + if ((colon.u = u_strstr(Z_USTRVAL_P(callable), (UChar*)":\0:\0")) != NULL) { + mlen = u_strlen(colon.u+2); + clen = Z_USTRLEN_P(callable) - mlen - 2; + mname.u = colon.u + 2; } } else { - if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) { - clen = colon - Z_STRVAL_P(callable); + if ((colon.s = strstr(Z_STRVAL_P(callable), "::")) != NULL) { + clen = colon.s - Z_STRVAL_P(callable); mlen = Z_STRLEN_P(callable) - clen - 2; - mname = colon + 2; + mname.s = colon.s + 2; } } - if (colon != NULL) { - if (zend_u_lookup_class(Z_TYPE_P(callable), Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { + if (colon.v != NULL) { + if (zend_u_lookup_class(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) { *ce_ptr = *pce; } else { lcname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), clen, 0, &clen); /* caution: lcname is not '\0' terminated */ - if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { + /* FIXME: Unicode support??? */ + if (clen == sizeof("self") - 1 && memcmp(lcname.s, "self", sizeof("self") - 1) == 0) { *ce_ptr = EG(scope); - } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { + } else if (clen == sizeof("parent") - 1 && memcmp(lcname.s, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { *ce_ptr = EG(scope) ? EG(scope)->parent : NULL; } - efree(lcname); + efree(lcname.v); } if (!*ce_ptr) { return 0; @@ -2557,7 +2556,7 @@ } lmname = zend_u_str_case_fold(Z_TYPE_P(callable), mname, mlen, 0, &mlen); } else { - lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_STRVAL_P(callable), Z_STRLEN_P(callable), 0, &mlen); + lmname = zend_u_str_case_fold(Z_TYPE_P(callable), Z_UNIVAL_P(callable), Z_UNILEN_P(callable), 0, &mlen); if (ce_org) { ftable = &ce_org->function_table; *ce_ptr = ce_org; @@ -2566,7 +2565,7 @@ } } - retval = zend_hash_find(ftable, lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0; + retval = zend_u_hash_find(ftable, Z_TYPE_P(callable), lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0; if (!retval) { if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) { @@ -2596,13 +2595,13 @@ } } } - efree(lmname); + efree(lmname.v); return retval; } ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, zval *callable_name, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC) { - char *lcname; + zstr lcname; unsigned int lcname_len; zend_class_entry *ce_local, **pce; zend_function *fptr_local; @@ -2724,7 +2723,7 @@ } else if (zend_u_lookup_class(Z_TYPE_PP(obj), Z_UNIVAL_PP(obj), Z_UNILEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) { ce = *pce; } - efree(lcname); + efree(lcname.v); } else { ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */ @@ -2735,7 +2734,7 @@ Z_TYPE_P(callable_name) = IS_UNICODE; Z_USTRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2; Z_USTRVAL_P(callable_name) = eumalloc(Z_USTRLEN_P(callable_name)+1); - memcpy(Z_USTRVAL_P(callable_name), ce->name, UBYTES(ce->name_length)); + memcpy(Z_USTRVAL_P(callable_name), ce->name.u, UBYTES(ce->name_length)); Z_USTRVAL_P(callable_name)[ce->name_length] = ':'; Z_USTRVAL_P(callable_name)[ce->name_length+1] = ':'; if (Z_TYPE_PP(method) == IS_UNICODE) { @@ -2752,7 +2751,7 @@ Z_TYPE_P(callable_name) = IS_STRING; Z_STRLEN_P(callable_name) = ce->name_length + Z_UNILEN_PP(method) + 2; Z_STRVAL_P(callable_name) = emalloc(Z_STRLEN_P(callable_name)+1); - memcpy(Z_STRVAL_P(callable_name), ce->name, ce->name_length); + memcpy(Z_STRVAL_P(callable_name), ce->name.s, ce->name_length); Z_STRVAL_P(callable_name)[ce->name_length] = ':'; Z_STRVAL_P(callable_name)[ce->name_length+1] = ':'; if (Z_TYPE_PP(method) == IS_STRING) { @@ -2849,7 +2848,7 @@ return module->version; } -ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) +ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) { zend_property_info property_info; HashTable *target_symbol_table; @@ -2876,7 +2875,7 @@ } switch (access_type & ZEND_ACC_PPP_MASK) { case ZEND_ACC_PRIVATE: { - char *priv_name; + zstr priv_name; int priv_name_length; zend_u_mangle_property_name(&priv_name, &priv_name_length, type, ce->name, ce->name_length, name, name_length, ce->type & ZEND_INTERNAL_CLASS); @@ -2886,10 +2885,10 @@ } break; case ZEND_ACC_PROTECTED: { - char *prot_name; + zstr prot_name; int prot_name_length; - zend_u_mangle_property_name(&prot_name, &prot_name_length, type, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_u_hash_update(target_symbol_table, type, prot_name, prot_name_length+1, &property, sizeof(zval *), NULL); property_info.name = prot_name; property_info.name_length = prot_name_length; @@ -2897,17 +2896,17 @@ break; case ZEND_ACC_PUBLIC: if (ce->parent) { - char *prot_name; + zstr prot_name; int prot_name_length; - zend_u_mangle_property_name(&prot_name, &prot_name_length, type, "*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_u_mangle_property_name(&prot_name, &prot_name_length, type, (zstr)"*", 1, name, name_length, ce->type & ZEND_INTERNAL_CLASS); zend_u_hash_del(target_symbol_table, type, prot_name, prot_name_length+1); - pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS); } zend_u_hash_update(target_symbol_table, type, name, name_length+1, &property, sizeof(zval *), NULL); - property_info.name = ce->type & ZEND_INTERNAL_CLASS ? - (type==IS_UNICODE?(char*)zend_ustrndup(name, name_length):zend_strndup(name, name_length)) : - (type==IS_UNICODE?(char*)eustrndup(name, name_length):estrndup(name, name_length)); + property_info.name.s = ce->type & ZEND_INTERNAL_CLASS ? + (type==IS_UNICODE?(char*)zend_ustrndup(name.u, name_length):zend_strndup(name.s, name_length)) : + (type==IS_UNICODE?(char*)eustrndup(name.u, name_length):estrndup(name.s, name_length)); property_info.name_length = name_length; break; } @@ -2924,17 +2923,17 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC) { - return zend_u_declare_property_ex(ce, IS_STRING, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); + return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC); } -ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type TSRMLS_DC) +ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC) { return zend_u_declare_property_ex(ce, type, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); } ZEND_API int zend_declare_property(zend_class_entry *ce, char *name, int name_length, zval *property, int access_type TSRMLS_DC) { - return zend_u_declare_property_ex(ce, IS_STRING, name, name_length, property, access_type, NULL, 0 TSRMLS_CC); + return zend_u_declare_property_ex(ce, IS_STRING, (zstr)name, name_length, property, access_type, NULL, 0 TSRMLS_CC); } ZEND_API int zend_declare_property_null(zend_class_entry *ce, char *name, int name_length, int access_type TSRMLS_DC) @@ -3098,12 +3097,12 @@ EG(scope) = scope; if (!Z_OBJ_HT_P(object)->write_property) { - char *class_name; + zstr class_name; zend_uint class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); - zend_error(E_CORE_ERROR, "Property %s of class %v cannot be updated", name, class_name); + zend_error(E_CORE_ERROR, "Property %s of class %v cannot be updated", name, class_name.v); } MAKE_STD_ZVAL(property); ZVAL_ASCII_STRINGL(property, name, name_length, 1); @@ -3251,7 +3250,7 @@ zend_class_entry *old_scope = EG(scope); EG(scope) = scope; - property = zend_std_get_static_property(scope, IS_STRING, name, name_length, 0 TSRMLS_CC); + property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, 0 TSRMLS_CC); EG(scope) = old_scope; if (!property) { return FAILURE; @@ -3419,11 +3418,11 @@ EG(scope) = scope; if (!Z_OBJ_HT_P(object)->read_property) { - char *class_name; + zstr class_name; zend_uint class_name_len; zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); - zend_error(E_CORE_ERROR, "Property %s of class %v cannot be read", name, class_name); + zend_error(E_CORE_ERROR, "Property %s of class %v cannot be read", name, class_name.v); } MAKE_STD_ZVAL(property); @@ -3441,7 +3440,7 @@ zend_class_entry *old_scope = EG(scope); EG(scope) = scope; - property = zend_std_get_static_property(scope, IS_STRING, name, name_length, silent TSRMLS_CC); + property = zend_std_get_static_property(scope, IS_STRING, (zstr)name, name_length, silent TSRMLS_CC); EG(scope) = old_scope; return property?*property:NULL; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_API.h?r1=1.232&r2=1.233&diff_format=u Index: ZendEngine2/zend_API.h diff -u ZendEngine2/zend_API.h:1.232 ZendEngine2/zend_API.h:1.233 --- ZendEngine2/zend_API.h:1.232 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_API.h Tue Feb 21 20:12:41 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.h,v 1.232 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_API.h,v 1.233 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_API_H #define ZEND_API_H @@ -57,13 +57,13 @@ ZEND_FENTRY(name, ZEND_FN(classname##_##alias), arg_info, flags) #define ZEND_ME_MAPPING(name, func_name, arg_types) ZEND_NAMED_FE(name, ZEND_FN(func_name), arg_types) -#define ZEND_ARG_INFO(pass_by_ref, name) { #name, sizeof(#name)-1, NULL, 0, 0, 0, pass_by_ref, 0, 0 }, -#define ZEND_ARG_PASS_INFO(pass_by_ref) { NULL, 0, NULL, 0, 0, 0, pass_by_ref, 0, 0 }, -#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { #name, sizeof(#name)-1, #classname, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 }, -#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { #name, sizeof(#name)-1, NULL, 0, 1, allow_null, pass_by_ref, 0, 0 }, +#define ZEND_ARG_INFO(pass_by_ref, name) { {#name}, sizeof(#name)-1, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 }, +#define ZEND_ARG_PASS_INFO(pass_by_ref) { {NULL}, 0, {NULL}, 0, 0, 0, pass_by_ref, 0, 0 }, +#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) { {#name}, sizeof(#name)-1, {#classname}, sizeof(#classname)-1, 0, allow_null, pass_by_ref, 0, 0 }, +#define ZEND_ARG_ARRAY_INFO(pass_by_ref, name, allow_null) { {#name}, sizeof(#name)-1, {NULL}, 0, 1, allow_null, pass_by_ref, 0, 0 }, #define ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, return_reference, required_num_args) \ zend_arg_info name[] = { \ - { NULL, 0, NULL, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args }, + { {NULL}, 0, {NULL}, 0, 0, 0, pass_rest_by_reference, return_reference, required_num_args }, #define ZEND_BEGIN_ARG_INFO(name, pass_rest_by_reference) \ ZEND_BEGIN_ARG_INFO_EX(name, pass_rest_by_reference, ZEND_RETURN_VALUE, -1) #define ZEND_END_ARG_INFO() }; @@ -118,7 +118,7 @@ #define INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset, handle_propunset, handle_propisset) \ { \ - class_container.name = strdup(class_name); \ + class_container.name.s = strdup(class_name); \ class_container.name_length = sizeof(class_name) - 1; \ class_container.builtin_functions = functions; \ class_container.constructor = NULL; \ @@ -223,8 +223,8 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC); ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC); -ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type TSRMLS_DC); -ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, void *name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC); +ZEND_API int zend_u_declare_property(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type TSRMLS_DC); +ZEND_API int zend_u_declare_property_ex(zend_class_entry *ce, zend_uchar type, zstr name, int name_length, zval *property, int access_type, char *doc_comment, int doc_comment_len TSRMLS_DC); ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC); ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC); @@ -267,7 +267,7 @@ ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC); ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC); -ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC); +ZEND_API int zend_get_object_classname(zval *object, zstr *class_name, zend_uint *class_name_len TSRMLS_DC); ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...); #define getThis() (this_ptr) @@ -304,22 +304,22 @@ ZEND_API int add_assoc_double_ex(zval *arg, char *key, uint key_len, double d); ZEND_API int add_assoc_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate); ZEND_API int add_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate); -ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, void *str, int duplicate); -ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, void *str, uint length, int duplicate); +ZEND_API int add_assoc_unicode_ex(zval *arg, char *key, uint key_len, UChar *str, int duplicate); +ZEND_API int add_assoc_unicodel_ex(zval *arg, char *key, uint key_len, UChar *str, uint length, int duplicate); ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value); #define add_assoc_text_ex(arg, key, key_len, str, duplicate) \ if (UG(unicode)) { \ - add_assoc_unicode_ex(arg, key, key_len, (UChar*)(str), duplicate); \ + add_assoc_unicode_ex(arg, key, key_len, (str).u, duplicate); \ } else { \ - add_assoc_string_ex(arg, key, key_len, (char*)(str), duplicate); \ + add_assoc_string_ex(arg, key, key_len, (str).s, duplicate); \ } #define add_assoc_textl_ex(arg, key, key_len, str, length, duplicate) \ if (UG(unicode)) { \ - add_assoc_unicodel_ex(arg, key, key_len, (UChar*)(str), length, duplicate); \ + add_assoc_unicodel_ex(arg, key, key_len, (str).u, length, duplicate); \ } else { \ - add_assoc_stringl_ex(arg, key, key_len, (char*)(str), length, duplicate); \ + add_assoc_stringl_ex(arg, key, key_len, (str).s, length, duplicate); \ } #define add_assoc_ascii_string_ex(arg, key, key_len, str, duplicate) \ @@ -343,7 +343,7 @@ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ int length = strlen(str); \ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \ @@ -355,7 +355,7 @@ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ add_assoc_unicodel_ex(arg, key, key_len, u_str, u_len, 0); \ } else { \ @@ -406,9 +406,9 @@ add_assoc_stringl(arg, key, (char*)(str), length, duplicate); \ } -ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, void *key, uint key_len, zval *value); +ZEND_API int add_u_assoc_zval_ex(zval *arg, zend_uchar type, zstr key, uint key_len, zval *value); -#define add_u_assoc_zval(__arg, __type, __key, __value) add_u_assoc_zval_ex(__arg, __type, __key, (((__type)==IS_UNICODE)?u_strlen((UChar*)__key):strlen(__key))+1, __value) +#define add_u_assoc_zval(__arg, __type, __key, __value) add_u_assoc_zval_ex(__arg, __type, __key, (((__type)==IS_UNICODE)?u_strlen((__key).u):strlen((__key).s))+1, __value) /* unset() functions are only suported for legacy modules and null() functions should be used */ #define add_assoc_unset(__arg, __key) add_assoc_null_ex(__arg, __key, strlen(__key) + 1) @@ -471,16 +471,16 @@ #define add_next_index_text(arg, str, duplicate) \ if (UG(unicode)) { \ - add_next_index_unicode(arg, (UChar*)(str), duplicate); \ + add_next_index_unicode(arg, (str).u, duplicate); \ } else { \ - add_next_index_string(arg, (char*)(str), duplicate); \ + add_next_index_string(arg, (str).s, duplicate); \ } #define add_next_index_textl(arg, str, length, duplicate) \ if (UG(unicode)) { \ - add_next_index_unicodel(arg, (UChar*)(str), length, duplicate); \ + add_next_index_unicodel(arg, (str).u, length, duplicate); \ } else { \ - add_next_index_stringl(arg, (char*)(str), length, duplicate); \ + add_next_index_stringl(arg, (str).s, length, duplicate); \ } #define add_next_index_ascii_string(arg, str, duplicate) \ @@ -504,7 +504,7 @@ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ int length = strlen(str); \ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ add_next_index_unicodel(arg, u_str, u_len, 0); \ @@ -516,7 +516,7 @@ if (UG(unicode)) { \ UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, str, length, &status); \ add_next_index_unicodel(arg, u_str, u_len, 0); \ } else { \ @@ -600,7 +600,7 @@ zend_bool is_ref, int num_symbol_tables, ...); ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC); -ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name_len TSRMLS_DC); +ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC); ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC); @@ -690,9 +690,9 @@ #define ZVAL_U_STRING(conv, z, s, duplicate) \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ + UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ uint length = strlen(s); \ zend_convert_to_unicode(conv, &u_str, &u_len, s, length, &status); \ ZVAL_UNICODEL(z, u_str, u_len, 0); \ @@ -705,9 +705,9 @@ #define ZVAL_U_STRINGL(conv, z, s, l, duplicate) \ if (UG(unicode)) { \ - UErrorCode status = U_ZERO_ERROR; \ + UErrorCode status = U_ZERO_ERROR; \ UChar *u_str; \ - int32_t u_len; \ + int u_len; \ zend_convert_to_unicode(conv, &u_str, &u_len, s, l, &status); \ ZVAL_UNICODEL(z, u_str, u_len, 0); \ } else { \ @@ -731,8 +731,8 @@ } #define ZVAL_UNICODEL(z, u, l, duplicate) { \ - UChar *__u=(u); int32_t __l=l; \ - Z_USTRLEN_P(z) = __l; \ + UChar *__u=(u); int __l=l; \ + Z_USTRLEN_P(z) = __l; \ Z_USTRVAL_P(z) = (duplicate?eustrndup(__u, __l):__u); \ Z_TYPE_P(z) = IS_UNICODE; \ } @@ -770,18 +770,18 @@ #define ZVAL_TEXT(z, t, duplicate) \ do { \ if (UG(unicode)) { \ - ZVAL_UNICODE(z, (UChar*)(t), duplicate); \ + ZVAL_UNICODE(z, t.u, duplicate); \ } else { \ - ZVAL_STRING(z, (char*)(t), duplicate); \ + ZVAL_STRING(z, t.s, duplicate); \ } \ } while (0); #define ZVAL_TEXTL(z, t, l, duplicate) \ do { \ if (UG(unicode)) { \ - ZVAL_UNICODEL(z, (UChar*)(t), l, duplicate); \ + ZVAL_UNICODEL(z, t.u, l, duplicate);\ } else { \ - ZVAL_STRINGL(z, (char*)(t), l, duplicate); \ + ZVAL_STRINGL(z, t.s, l, duplicate); \ } \ } while (0); @@ -910,7 +910,7 @@ } #define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \ - ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, name, name_length, var, _refcount, _is_ref) + ZEND_U_SET_SYMBOL_WITH_LENGTH(symtable, IS_STRING, (zstr)name, name_length, var, _refcount, _is_ref) #define ZEND_SET_GLOBAL_VAR(name, var) \ ZEND_SET_SYMBOL(&EG(symbol_table), name, var) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_alloc.c?r1=1.150&r2=1.151&diff_format=u Index: ZendEngine2/zend_alloc.c diff -u ZendEngine2/zend_alloc.c:1.150 ZendEngine2/zend_alloc.c:1.151 --- ZendEngine2/zend_alloc.c:1.150 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_alloc.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.c,v 1.150 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_alloc.c,v 1.151 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_alloc.h" @@ -446,7 +446,7 @@ } -ZEND_API UChar *_eustrndup(const UChar *s, int32_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) +ZEND_API UChar *_eustrndup(const UChar *s, int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { UChar *p; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_alloc.h?r1=1.70&r2=1.71&diff_format=u Index: ZendEngine2/zend_alloc.h diff -u ZendEngine2/zend_alloc.h:1.70 ZendEngine2/zend_alloc.h:1.71 --- ZendEngine2/zend_alloc.h:1.70 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_alloc.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_alloc.h,v 1.70 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_alloc.h,v 1.71 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_ALLOC_H #define ZEND_ALLOC_H @@ -87,7 +87,7 @@ ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; ZEND_API UChar *_eustrdup(const UChar *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; -ZEND_API UChar *_eustrndup(const UChar *s, int32_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; +ZEND_API UChar *_eustrndup(const UChar *s, int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC; #if USE_ZEND_ALLOC http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.303&r2=1.304&diff_format=u Index: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.303 ZendEngine2/zend_builtin_functions.c:1.304 --- ZendEngine2/zend_builtin_functions.c:1.303 Mon Feb 20 19:03:42 2006 +++ ZendEngine2/zend_builtin_functions.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_builtin_functions.c,v 1.303 2006/02/20 19:03:42 dmitry Exp $ */ +/* $Id: zend_builtin_functions.c,v 1.304 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -304,7 +304,7 @@ ZEND_FUNCTION(strcmp) { void *s1, *s2; - int32_t s1_len, s2_len; + int s1_len, s2_len; zend_uchar s1_type, s2_type; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len, @@ -325,7 +325,7 @@ ZEND_FUNCTION(strncmp) { void *s1, *s2; - int32_t s1_len, s2_len; + int s1_len, s2_len; long count; zend_uchar s1_type, s2_type; @@ -347,7 +347,7 @@ ZEND_FUNCTION(strcasecmp) { void *s1, *s2; - int32_t s1_len, s2_len; + int s1_len, s2_len; zend_uchar s1_type, s2_type; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &s1, &s1_len, @@ -390,7 +390,7 @@ ZEND_FUNCTION(each) { zval **array, *entry, **entry_ptr, *tmp; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; zval **inserted_pointer; @@ -428,10 +428,10 @@ /* add the key elements */ switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_key_len, &num_key, 1, NULL)) { case HASH_KEY_IS_STRING: - add_get_index_stringl(return_value, 0, string_key, string_key_len-1, (void **) &inserted_pointer, 0); + add_get_index_stringl(return_value, 0, string_key.s, string_key_len-1, (void **) &inserted_pointer, 0); break; case HASH_KEY_IS_UNICODE: - add_get_index_unicodel(return_value, 0, (UChar*)string_key, string_key_len-1, (void **) &inserted_pointer, 0); + add_get_index_unicodel(return_value, 0, string_key.u, string_key_len-1, (void **) &inserted_pointer, 0); break; case HASH_KEY_IS_LONG: add_get_index_long(return_value, 0, num_key, (void **) &inserted_pointer); @@ -526,9 +526,9 @@ zval_copy_ctor(&c.value); c.flags = case_sensitive; /* non persistent */ if (Z_TYPE_PP(var) == IS_UNICODE) { - c.name = (char*)zend_ustrndup(Z_USTRVAL_PP(var), Z_USTRLEN_PP(var)); + c.name.u = zend_ustrndup(Z_USTRVAL_PP(var), Z_USTRLEN_PP(var)); } else { - c.name = zend_strndup(Z_STRVAL_PP(var), Z_STRLEN_PP(var)); + c.name.s = zend_strndup(Z_STRVAL_PP(var), Z_STRLEN_PP(var)); } c.name_len = Z_UNILEN_PP(var)+1; c.module_number = PHP_USER_CONSTANT; @@ -568,7 +568,7 @@ ZEND_FUNCTION(get_class) { zval **arg; - char *name = (char*)EMPTY_STR; + zstr name = (zstr)EMPTY_STR; zend_uint name_len = 0; int dup; @@ -599,7 +599,7 @@ { zval **arg; zend_class_entry *ce = NULL; - char *name; + zstr name; zend_uint name_length; if (!ZEND_NUM_ARGS()) { @@ -727,7 +727,7 @@ zend_hash_internal_pointer_reset_ex(properties, &pos); while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { - char *key, *class_name, *prop_name; + zstr key, class_name, prop_name; uint key_len; ulong num_index; zval *prop_copy; @@ -735,9 +735,10 @@ key_type = zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(properties, &pos); - zend_unmangle_property_name(key, &class_name, &prop_name); - if (class_name) { - if (class_name[0] != '*' && strcmp(class_name, ce->name)) { + zend_u_unmangle_property_name(key_type, key, &class_name, &prop_name); + if (class_name.v) { + /* FIXME: Unicode support??? */ + if (class_name.s[0] != '*' && strcmp(class_name.s, ce->name.s)) { /* filter privates from base classes */ continue; } else if (!instanceof) { @@ -769,7 +770,7 @@ Returns an array of default properties of the class. */ ZEND_FUNCTION(get_class_vars) { - char *class_name; + zstr class_name; int class_name_len; zend_uchar type; zend_class_entry **pce; @@ -798,7 +799,7 @@ zval **value; HashTable *properties; HashPosition pos; - char *key, *prop_name, *class_name; + zstr key, prop_name, class_name; uint key_len; ulong num_index; int instanceof; @@ -829,14 +830,14 @@ while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) { if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, &class_name, &prop_name); - if (class_name == NULL) { + if (class_name.v == NULL) { /* Not separating references */ (*value)->refcount++; add_u_assoc_zval_ex(return_value, UG(unicode)?IS_UNICODE:IS_STRING, key, key_len, *value); } else if (instanceof) { - if (class_name[0] == '*' || + if (class_name.s[0] == '*' || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && - UG(unicode)?!u_strcmp((UChar*)Z_OBJCE_P(EG(This))->name, (UChar*)class_name):!strcmp(Z_OBJCE_P(EG(This))->name, class_name))) { + UG(unicode)?!u_strcmp(Z_OBJCE_P(EG(This))->name.u, class_name.u):!strcmp(Z_OBJCE_P(EG(This))->name.s, class_name.s))) { /* Not separating references */ (*value)->refcount++; add_u_assoc_zval(return_value, UG(unicode)?IS_UNICODE:IS_STRING, prop_name, *value); @@ -905,7 +906,7 @@ { zval **klass, **method_name; unsigned int lcname_len; - char *lcname; + zstr lcname; zend_class_entry * ce, **pce; if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &klass, &method_name)==FAILURE) { @@ -927,20 +928,20 @@ } lcname = zend_u_str_case_fold(Z_TYPE_PP(method_name), Z_UNIVAL_PP(method_name), Z_UNILEN_PP(method_name), 1, &lcname_len); if (zend_u_hash_exists(&ce->function_table, Z_TYPE_PP(method_name), lcname, lcname_len+1)) { - efree(lcname); + efree(lcname.v); RETURN_TRUE; } else { union _zend_function *func = NULL; - efree(lcname); + efree(lcname.v); if (Z_TYPE_PP(klass) == IS_OBJECT && Z_OBJ_HT_PP(klass)->get_method != NULL - && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_STRVAL_PP(method_name), Z_STRLEN_PP(method_name) TSRMLS_CC)) != NULL + && (func = Z_OBJ_HT_PP(klass)->get_method(klass, Z_UNIVAL_PP(method_name), Z_UNILEN_PP(method_name) TSRMLS_CC)) != NULL ) { if (func->type == ZEND_INTERNAL_FUNCTION && ((zend_internal_function*)func)->handler == zend_std_call_user_call ) { - efree(((zend_internal_function*)func)->function_name); + efree(((zend_internal_function*)func)->function_name.v); efree(func); RETURN_FALSE; } @@ -958,7 +959,7 @@ zval **object, **property; zend_class_entry *ce, **pce; zend_property_info *property_info; - char *prop_name, *class_name; + zstr prop_name, class_name; if (ZEND_NUM_ARGS()!= 2 || zend_get_parameters_ex(2, &object, &property)==FAILURE) { ZEND_WRONG_PARAM_COUNT(); @@ -993,7 +994,7 @@ RETURN_TRUE; } zend_u_unmangle_property_name(Z_TYPE_PP(property), property_info->name, &class_name, &prop_name); - if (class_name[0] == '*') { + if (class_name.s[0] == '*') { if (instanceof_function(EG(scope), ce TSRMLS_CC)) { RETURN_TRUE; } @@ -1026,7 +1027,7 @@ ZEND_FUNCTION(class_exists) { unsigned int lc_name_len; - void *class_name, *lc_name; + zstr class_name, lc_name; zend_class_entry **ce; int class_name_len; zend_bool autoload = 1; @@ -1040,7 +1041,7 @@ if (!autoload) { lc_name = zend_u_str_case_fold(type, class_name, class_name_len, 1, &lc_name_len); found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce); - efree(lc_name); + efree(lc_name.v); RETURN_BOOL(found == SUCCESS && !((*ce)->ce_flags & ZEND_ACC_INTERFACE)); } @@ -1057,7 +1058,7 @@ ZEND_FUNCTION(interface_exists) { unsigned int lc_name_len; - void *iface_name, *lc_name; + zstr iface_name, lc_name; zend_class_entry **ce; int iface_name_len; zend_uchar type; @@ -1071,7 +1072,7 @@ if (!autoload) { lc_name = zend_u_str_case_fold(type, iface_name, iface_name_len, 1, &lc_name_len); found = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) &ce); - efree(lc_name); + efree(lc_name.v); RETURN_BOOL(found == SUCCESS && (*ce)->ce_flags & ZEND_ACC_INTERFACE); } @@ -1091,7 +1092,7 @@ zval **function_name; zend_function *func; unsigned int lcname_len; - char *lcname; + zstr lcname; zend_bool retval; if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { @@ -1102,7 +1103,7 @@ retval = (zend_u_hash_find(EG(function_table), Z_TYPE_PP(function_name), lcname, lcname_len+1, (void **)&func) == SUCCESS); - efree(lcname); + efree(lcname.v); /* * A bit of a hack, but not a bad one: we see if the handler of the function @@ -1152,7 +1153,7 @@ Returns an array with the file names that were include_once()'d */ ZEND_FUNCTION(get_included_files) { - char *entry; + zstr entry; if (ZEND_NUM_ARGS() != 0) { ZEND_WRONG_PARAM_COUNT(); } @@ -1160,7 +1161,7 @@ array_init(return_value); zend_hash_internal_pointer_reset(&EG(included_files)); while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) { - add_next_index_rt_string(return_value, entry, 1); + add_next_index_rt_string(return_value, entry.s, 1); zend_hash_move_forward(&EG(included_files)); } } @@ -1350,8 +1351,8 @@ TSRMLS_FETCH(); if ((hash_key->nKeyLength==0 || - (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] != 0) || - (hash_key->type == IS_STRING && hash_key->u.string[0] != 0)) + (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] != 0) || + (hash_key->type == IS_STRING && hash_key->arKey.s[0] != 0)) && (comply_mask == (ce->ce_flags & mask))) { add_next_index_textl(array, ce->name, ce->name_length, 1); } @@ -1398,22 +1399,22 @@ *user_ar = va_arg(args, zval *); if (hash_key->nKeyLength == 0 || - (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == 0) || - (hash_key->type == IS_STRING && hash_key->u.unicode[0] == 0)) { + (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0) || + (hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0)) { return 0; } if (func->type == ZEND_INTERNAL_FUNCTION) { if (hash_key->type == IS_STRING) { - add_next_index_stringl(internal_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); + add_next_index_stringl(internal_ar, hash_key->arKey.s, hash_key->nKeyLength-1, 1); } else { - add_next_index_unicodel(internal_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1); + add_next_index_unicodel(internal_ar, hash_key->arKey.u, hash_key->nKeyLength-1, 1); } } else if (func->type == ZEND_USER_FUNCTION) { if (hash_key->type == IS_STRING) { - add_next_index_stringl(user_ar, hash_key->u.string, hash_key->nKeyLength-1, 1); + add_next_index_stringl(user_ar, hash_key->arKey.s, hash_key->nKeyLength-1, 1); } else { - add_next_index_unicodel(user_ar, hash_key->u.unicode, hash_key->nKeyLength-1, 1); + add_next_index_unicodel(user_ar, hash_key->arKey.u, hash_key->nKeyLength-1, 1); } } @@ -1662,7 +1663,8 @@ zval_copy_ctor(const_val); INIT_PZVAL(const_val); - add_assoc_zval_ex(modules[module_number], val->name, val->name_len, const_val); + /* FIXME: Unicode support??? */ + add_assoc_zval_ex(modules[module_number], val->name.s, val->name_len, const_val); bad_module_id: zend_hash_move_forward_ex(EG(zend_constants), &pos); } @@ -1723,9 +1725,9 @@ { zend_execute_data *ptr, *skip; int lineno; - char *function_name; + zstr function_name; char *filename; - char *class_name = NULL; + zstr class_name; char *call_type; char *include_filename = NULL; zval *arg_array = NULL; @@ -1774,10 +1776,11 @@ array_init(return_value); while (ptr) { - char *free_class_name = NULL; + zstr free_class_name = (zstr)NULL; int function_name_string = 1; - class_name = call_type = NULL; + class_name = (zstr)NULL; + call_type = NULL; arg_array = NULL; skip = ptr; @@ -1801,7 +1804,7 @@ function_name = ptr->function_state.function->common.function_name; - if (function_name) { + if (function_name.v) { function_name_string = !UG(unicode); if (ptr->object) { if (ptr->function_state.function->common.scope) { @@ -1821,7 +1824,7 @@ class_name = ptr->function_state.function->common.scope->name; call_type = "::"; } else { - class_name = NULL; + class_name = (zstr)NULL; call_type = NULL; } if ((! ptr->opline) || ((ptr->opline->opcode == ZEND_DO_FCALL_BY_NAME) || (ptr->opline->opcode == ZEND_DO_FCALL))) { @@ -1836,30 +1839,30 @@ if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) { /* can happen when calling eval from a custom sapi */ - function_name = "unknown"; + function_name.s = "unknown"; build_filename_arg = 0; } else switch (Z_LVAL(ptr->opline->op2.u.constant)) { case ZEND_EVAL: - function_name = "eval"; + function_name.s = "eval"; build_filename_arg = 0; break; case ZEND_INCLUDE: - function_name = "include"; + function_name.s = "include"; break; case ZEND_REQUIRE: - function_name = "require"; + function_name.s = "require"; break; case ZEND_INCLUDE_ONCE: - function_name = "include_once"; + function_name.s = "include_once"; break; case ZEND_REQUIRE_ONCE: - function_name = "require_once"; + function_name.s = "require_once"; break; default: /* this can actually happen if you use debug_backtrace() in your error_handler and * you're in the top-scope */ - function_name = "unknown"; + function_name.s = "unknown"; build_filename_arg = 0; break; } @@ -1872,18 +1875,18 @@ call_type = NULL; } zend_printf("#%-2d ", indent); - if (class_name) { + if (class_name.v) { if (UG(unicode)) { - zend_printf("%r", class_name); + zend_printf("%r", class_name.u); } else { - ZEND_PUTS(class_name); + ZEND_PUTS(class_name.s); } ZEND_PUTS(call_type); } if (function_name_string) { - zend_printf("%s(", function_name?function_name:"main"); + zend_printf("%s(", function_name.s?function_name.s:"main"); } else { - zend_printf("%r(", function_name); + zend_printf("%r(", function_name.u); } if (arg_array) { debug_print_backtrace_args(arg_array TSRMLS_CC); @@ -1893,8 +1896,8 @@ include_filename = filename; ptr = skip->prev_execute_data; ++indent; - if (free_class_name) { - efree(free_class_name); + if (free_class_name.v) { + efree(free_class_name.v); } } } @@ -1905,9 +1908,9 @@ { zend_execute_data *ptr, *skip; int lineno; - char *function_name; + zstr function_name; char *filename; - char *class_name; + zstr class_name; char *include_filename = NULL; zval *stack_frame; void **cur_arg_pos = EG(argument_stack).top_element; @@ -1987,7 +1990,7 @@ function_name = ptr->function_state.function->common.function_name; - if (function_name) { + if (function_name.v) { add_assoc_text_ex(stack_frame, "function", sizeof("function"), function_name, 1); if (ptr->object && Z_TYPE_P(ptr->object) == IS_OBJECT) { @@ -2023,30 +2026,30 @@ if (!ptr->opline || ptr->opline->opcode != ZEND_INCLUDE_OR_EVAL) { /* can happen when calling eval from a custom sapi */ - function_name = "unknown"; + function_name.s = "unknown"; build_filename_arg = 0; } else switch (Z_LVAL(ptr->opline->op2.u.constant)) { case ZEND_EVAL: - function_name = "eval"; + function_name.s = "eval"; build_filename_arg = 0; break; case ZEND_INCLUDE: - function_name = "include"; + function_name.s = "include"; break; case ZEND_REQUIRE: - function_name = "require"; + function_name.s = "require"; break; case ZEND_INCLUDE_ONCE: - function_name = "include_once"; + function_name.s = "include_once"; break; case ZEND_REQUIRE_ONCE: - function_name = "require_once"; + function_name.s = "require_once"; break; default: /* this can actually happen if you use debug_backtrace() in your error_handler and * you're in the top-scope */ - function_name = "unknown"; + function_name.s = "unknown"; build_filename_arg = 0; break; } @@ -2065,7 +2068,7 @@ add_assoc_zval_ex(stack_frame, "args", sizeof("args"), arg_array); } - add_assoc_ascii_string_ex(stack_frame, "function", sizeof("function"), function_name, 1); + add_assoc_ascii_string_ex(stack_frame, "function", sizeof("function"), function_name.s, 1); } add_next_index_zval(return_value, stack_frame); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_compile.c?r1=1.683&r2=1.684&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.683 ZendEngine2/zend_compile.c:1.684 --- ZendEngine2/zend_compile.c:1.683 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_compile.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.683 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.684 2006/02/21 20:12:41 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -40,9 +40,9 @@ TSRMLS_FETCH(); if (UG(unicode)) { - property_info->name = (char*)eustrndup((UChar*)property_info->name, property_info->name_length); + property_info->name.u = eustrndup(property_info->name.u, property_info->name_length); } else { - property_info->name = estrndup(property_info->name, property_info->name_length); + property_info->name.s = estrndup(property_info->name.s, property_info->name_length); } if (property_info->doc_comment) { property_info->doc_comment = estrndup(property_info->doc_comment, property_info->doc_comment_len); @@ -55,16 +55,16 @@ TSRMLS_FETCH(); if (UG(unicode)) { - property_info->name = (char*)zend_ustrndup((UChar*)property_info->name, property_info->name_length); + property_info->name.u = zend_ustrndup(property_info->name.u, property_info->name_length); } else { - property_info->name = zend_strndup(property_info->name, property_info->name_length); + property_info->name.s = zend_strndup(property_info->name.s, property_info->name_length); } } static void zend_destroy_property_info(zend_property_info *property_info) { - efree(property_info->name); + efree(property_info->name.v); if (property_info->doc_comment) { efree(property_info->doc_comment); } @@ -73,7 +73,7 @@ static void zend_destroy_property_info_internal(zend_property_info *property_info) { - free(property_info->name); + free(property_info->name.v); } static void build_runtime_defined_function_key(zval *result, zend_uchar type, char *name, int name_length TSRMLS_DC) @@ -250,7 +250,7 @@ return (op_array->T)++ * sizeof(temp_variable); } -static int lookup_cv(zend_op_array *op_array, zend_uchar type, void *name, int name_len) +static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr name, int name_len) { int i = 0; ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1); @@ -258,8 +258,8 @@ while (i < op_array->last_var) { if (op_array->vars[i].hash_value == hash_value && op_array->vars[i].name_len == name_len && - !memcmp(op_array->vars[i].name, name, type==IS_UNICODE?UBYTES(name_len):name_len)) { - efree(name); + !memcmp(op_array->vars[i].name.v, name.v, type==IS_UNICODE?UBYTES(name_len):name_len)) { + efree(name.v); return i; } i++; @@ -1090,12 +1090,12 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC) { zend_op_array op_array; - char *name = Z_UNIVAL(function_name->u.constant); + zstr name = Z_UNIVAL(function_name->u.constant); int name_len = Z_UNILEN(function_name->u.constant); int function_begin_line = function_token->u.opline_num; zend_uint fn_flags; unsigned int lcname_len; - char *lcname; + zstr lcname; if (is_method) { if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { @@ -1109,7 +1109,7 @@ fn_flags = 0; } if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { - zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : "", is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); + zend_error(E_COMPILE_ERROR, "Static function %v%s%R() cannot be abstract", is_method ? CG(active_class_entry)->name : (zstr)EMPTY_STR, is_method ? "::" : "", Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant)); } function_token->u.op_array = CG(active_op_array); @@ -1128,7 +1128,7 @@ op_array.line_start = zend_get_compiled_lineno(TSRMLS_C); if (is_method) { - char *short_class_name = CG(active_class_entry)->name; + zstr short_class_name = CG(active_class_entry)->name; unsigned int short_class_name_length = CG(active_class_entry)->name_length; if (zend_u_hash_add(&CG(active_class_entry)->function_table, Z_TYPE(function_name->u.constant), lcname, lcname_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)) == FAILURE) { @@ -1139,7 +1139,7 @@ && (child_op_array == parent_op_array)) { zend_u_hash_update(&CG(active_class_entry)->function_table, Z_TYPE(function_name->u.constant), name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); } else { - efree(lcname); + efree(lcname.v); zend_error(E_COMPILE_ERROR, "Cannot redeclare %v::%R()", CG(active_class_entry)->name, Z_TYPE(function_name->u.constant), name); } } @@ -1156,7 +1156,7 @@ short_class_name = zend_u_str_case_fold(UG(unicode)?IS_UNICODE:IS_STRING, CG(active_class_entry)->name, short_class_name_length, 0, &short_class_name_length); /* Improve after RC: cache the lowercase class name */ - if ((short_class_name_length == name_len) && (!memcmp(short_class_name, lcname, UG(unicode)?UBYTES(lcname_len):lcname_len))) { + if ((short_class_name_length == name_len) && (!memcmp(short_class_name.v, lcname.v, UG(unicode)?UBYTES(lcname_len):lcname_len))) { if (CG(active_class_entry)->constructor) { zend_error(E_STRICT, "Redefining already defined constructor for class %v", CG(active_class_entry)->name); } else { @@ -1186,19 +1186,19 @@ } else if (!(fn_flags & ZEND_ACC_STATIC)) { CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC; } - efree(short_class_name); + efree(short_class_name.v); } - efree(lcname); + efree(lcname.v); } else { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_DECLARE_FUNCTION; opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(function_name->u.constant), lcname, lcname_len TSRMLS_CC); + build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(function_name->u.constant), lcname.s, lcname_len TSRMLS_CC); opline->op2.op_type = IS_CONST; Z_TYPE(opline->op2.u.constant) = Z_TYPE(function_name->u.constant); - Z_STRVAL(opline->op2.u.constant) = lcname; + Z_STRVAL(opline->op2.u.constant) = lcname.s; Z_STRLEN(opline->op2.u.constant) = lcname_len; opline->op2.u.constant.refcount = 1; opline->extended_value = ZEND_DECLARE_FUNCTION; @@ -1256,7 +1256,7 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC) { unsigned int lcname_len; - char *lcname; + zstr lcname; char lcname_buf[16]; int name_len; @@ -1275,22 +1275,22 @@ * the beginning of the name speeds up the check process */ if (UG(unicode)) { utype = IS_UNICODE; - name_len = u_strlen((UChar*)CG(active_op_array)->function_name); + name_len = u_strlen(CG(active_op_array)->function_name.u); lcname = zend_u_str_case_fold(utype, CG(active_op_array)->function_name, name_len, 0, &lcname_len); } else { utype = IS_STRING; - lcname_len = name_len = strlen(CG(active_op_array)->function_name); - zend_str_tolower_copy(lcname_buf, CG(active_op_array)->function_name, MIN(name_len, sizeof(lcname_buf)-1)); + lcname_len = name_len = strlen(CG(active_op_array)->function_name.s); + zend_str_tolower_copy(lcname_buf, CG(active_op_array)->function_name.s, MIN(name_len, sizeof(lcname_buf)-1)); lcname_buf[sizeof(lcname_buf)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */ - lcname = lcname_buf; + lcname.s = lcname_buf; } if (lcname_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)-1) && CG(active_op_array)->num_args != 1) { zend_error(E_COMPILE_ERROR, "%s() must take exactly 1 argument", ZEND_AUTOLOAD_FUNC_NAME); } - if (lcname != lcname_buf) { - efree(lcname); + if (lcname.s != lcname_buf) { + efree(lcname.s); } } @@ -1304,15 +1304,15 @@ } -static inline int ZEND_U_CASE_EQUAL(zend_uchar type, void *ustr, int ulen, char *str, int slen) +static inline int ZEND_U_CASE_EQUAL(zend_uchar type, zstr ustr, int ulen, char *str, int slen) { - void* lcname; + zstr lcname; unsigned int lcname_len; int ret; lcname = zend_u_str_case_fold(type, ustr, ulen, 0, &lcname_len); ret = ZEND_U_EQUAL(type, lcname, lcname_len, str, slen); - efree(lcname); + efree(lcname.v); return ret; } @@ -1335,9 +1335,9 @@ CG(active_op_array)->arg_info = erealloc(CG(active_op_array)->arg_info, sizeof(zend_arg_info)*(CG(active_op_array)->num_args)); cur_arg_info = &CG(active_op_array)->arg_info[CG(active_op_array)->num_args-1]; if (Z_TYPE(varname->u.constant) == IS_UNICODE) { - cur_arg_info->name = (char*)eustrndup(Z_USTRVAL(varname->u.constant), Z_USTRLEN(varname->u.constant)); + cur_arg_info->name.u = eustrndup(Z_USTRVAL(varname->u.constant), Z_USTRLEN(varname->u.constant)); } else { - cur_arg_info->name = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)); + cur_arg_info->name.s = estrndup(Z_STRVAL(varname->u.constant), Z_STRLEN(varname->u.constant)); } cur_arg_info->name_len = Z_UNILEN(varname->u.constant); cur_arg_info->array_type_hint = 0; @@ -1361,7 +1361,7 @@ } } else { cur_arg_info->array_type_hint = 1; - cur_arg_info->class_name = NULL; + cur_arg_info->class_name.v = NULL; cur_arg_info->class_name_len = 0; if (op == ZEND_RECV_INIT) { if (Z_TYPE(initialization->u.constant) == IS_NULL || @@ -1375,7 +1375,7 @@ } } } else { - cur_arg_info->class_name = NULL; + cur_arg_info->class_name.v = NULL; cur_arg_info->class_name_len = 0; } opline->result.u.EA.type |= EXT_TYPE_UNUSED; @@ -1386,20 +1386,20 @@ { zend_function *function; unsigned int lcname_len; - char *lcname; + zstr lcname; lcname = zend_u_str_case_fold(Z_TYPE(function_name->u.constant), Z_UNIVAL(function_name->u.constant), Z_UNILEN(function_name->u.constant), 0, &lcname_len); if (zend_u_hash_find(CG(function_table), Z_TYPE(function_name->u.constant), lcname, lcname_len+1, (void **) &function)==FAILURE) { zend_do_begin_dynamic_function_call(function_name TSRMLS_CC); - efree(lcname); + efree(lcname.v); return 1; /* Dynamic */ } - efree(Z_UNIVAL(function_name->u.constant)); + efree(Z_UNIVAL(function_name->u.constant).v); if (Z_TYPE(function_name->u.constant) == IS_UNICODE) { - Z_USTRVAL(function_name->u.constant) = (UChar *)lcname; + Z_USTRVAL(function_name->u.constant) = lcname.u; Z_USTRLEN(function_name->u.constant) = lcname_len; } else { - Z_STRVAL(function_name->u.constant) = lcname; + Z_STRVAL(function_name->u.constant) = lcname.s; } switch (function->type) { @@ -1565,14 +1565,14 @@ } else { if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) { unsigned int lcname_len; - UChar *lcname; + zstr lcname; lcname = zend_u_str_case_fold(Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant), 0, &lcname_len); efree(Z_USTRVAL(opline->op2.u.constant)); - Z_USTRVAL(opline->op2.u.constant) = lcname; + Z_USTRVAL(opline->op2.u.constant) = lcname.u; Z_USTRLEN(opline->op2.u.constant) = lcname_len; } else { - zend_str_tolower(Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant)); + zend_str_tolower(Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)); } } } @@ -1633,7 +1633,7 @@ "allow_call_time_pass_reference to true in your INI file. " "However, future versions may not support this any longer. ", (function_ptr && UG(unicode))?IS_UNICODE:IS_STRING, - (function_ptr?function_ptr->common.function_name:"[runtime function name]")); + (function_ptr?function_ptr->common.function_name.s:"[runtime function name]")); } if (function_ptr) { @@ -1960,8 +1960,8 @@ } else { /* Don't inherit the old style constructor if we already have the new style constructor */ unsigned int lc_class_name_len, lc_parent_class_name_len; - char *lc_class_name; - char *lc_parent_class_name; + zstr lc_class_name; + zstr lc_parent_class_name; zend_uchar utype = UG(unicode)?IS_UNICODE:IS_STRING; lc_class_name = zend_u_str_case_fold(utype, ce->name, ce->name_length, 0, &lc_class_name_len); @@ -1974,9 +1974,9 @@ function_add_ref(function TSRMLS_CC); } } - efree(lc_parent_class_name); + efree(lc_parent_class_name.v); } - efree(lc_class_name); + efree(lc_class_name.v); } ce->constructor = ce->parent->constructor; } @@ -2038,12 +2038,13 @@ } for (i=0; i < proto->common.num_args; i++) { - if (ZEND_LOG_XOR(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)) { + if (ZEND_LOG_XOR(fe->common.arg_info[i].class_name.v, proto->common.arg_info[i].class_name.v)) { /* Only one has a type hint and the other one doesn't */ return 0; } - if (fe->common.arg_info[i].class_name - && strcmp(fe->common.arg_info[i].class_name, proto->common.arg_info[i].class_name)!=0) { + if (fe->common.arg_info[i].class_name.v + && strcmp(fe->common.arg_info[i].class_name.s, proto->common.arg_info[i].class_name.s)!=0) { + /* FIXME: Unicode support??? */ return 0; } if (fe->common.arg_info[i].array_type_hint != proto->common.arg_info[i].array_type_hint) { @@ -2073,7 +2074,7 @@ zend_function *child; TSRMLS_FETCH(); - if (zend_u_hash_quick_find(child_function_table, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) { + if (zend_u_hash_quick_find(child_function_table, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child)==FAILURE) { if (parent_flags & (ZEND_ACC_ABSTRACT)) { child_ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; } @@ -2090,7 +2091,7 @@ } if (parent_flags & ZEND_ACC_FINAL) { - zend_error(E_COMPILE_ERROR, "Cannot override final method %v::%v()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name); + zend_error(E_COMPILE_ERROR, "Cannot override final method %v::%v()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name.v); } child_flags = child->common.fn_flags; @@ -2153,10 +2154,10 @@ utype = UG(unicode)?IS_UNICODE:IS_STRING; if (parent_info->flags & (ZEND_ACC_PRIVATE|ZEND_ACC_SHADOW)) { - if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { + if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { child_info->flags |= ZEND_ACC_CHANGED; } else { - zend_u_hash_quick_update(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info); + zend_u_hash_quick_update(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, parent_info, sizeof(zend_property_info), (void **) &child_info); if(ce->type & ZEND_INTERNAL_CLASS) { zend_duplicate_property_info_internal(child_info); } else { @@ -2168,11 +2169,11 @@ return 0; /* don't copy access information to child */ } - if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { + if (zend_u_hash_quick_find(&ce->properties_info, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **) &child_info)==SUCCESS) { if ((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC)) { zend_error(E_COMPILE_ERROR, "Cannot redeclare %s%v::$%R as %s%v::$%R", - (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->type, hash_key->u.string, - (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->type, hash_key->u.string); + (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", parent_ce->name, hash_key->type, hash_key->arKey, + (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name, hash_key->type, hash_key->arKey); } if(parent_info->flags & ZEND_ACC_CHANGED) { @@ -2180,7 +2181,7 @@ } if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) { - zend_error(E_COMPILE_ERROR, "Access level to %v::$%R must be %s (as in class %v)%s", ce->name, hash_key->type, hash_key->u.string, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error(E_COMPILE_ERROR, "Access level to %v::$%R must be %s (as in class %v)%s", ce->name, hash_key->type, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if (child_info->flags & ZEND_ACC_IMPLICIT_PUBLIC) { if (!(parent_info->flags & ZEND_ACC_IMPLICIT_PUBLIC)) { /* Explicitly copy the default value from the parent (if it has one) */ @@ -2194,10 +2195,10 @@ } return 1; /* Inherit from the parent */ } else if ((child_info->flags & ZEND_ACC_PUBLIC) && (parent_info->flags & ZEND_ACC_PROTECTED)) { - char *prot_name; + zstr prot_name; int prot_name_length; - zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS); + zend_u_mangle_property_name(&prot_name, &prot_name_length, utype, (zstr)"*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS); if (child_info->flags & ZEND_ACC_STATIC) { zval **prop; HashTable *ht; @@ -2212,7 +2213,7 @@ zval **new_prop; if (zend_u_hash_find(&ce->default_static_members, utype, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) { if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) { - char *prop_name, *tmp; + zstr prop_name, tmp; zend_u_unmangle_property_name(utype, child_info->name, &tmp, &prop_name); zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %v::$%v in class %v", @@ -2226,7 +2227,7 @@ } else { zend_u_hash_del(&ce->default_properties, utype, prot_name, prot_name_length+1); } - pefree(prot_name, ce->type & ZEND_INTERNAL_CLASS); + pefree(prot_name.v, ce->type & ZEND_INTERNAL_CLASS); } return 0; /* Don't copy from parent */ } else { @@ -2332,9 +2333,9 @@ { zval **old_constant; - if (zend_u_hash_quick_find(child_constants_table, hash_key->type, hash_key->u.string, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) { + if (zend_u_hash_quick_find(child_constants_table, hash_key->type, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) { if (*old_constant != *parent_constant) { - zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %R from interface %v", hash_key->type, hash_key->u.string, iface->name); + zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %R from interface %v", hash_key->type, hash_key->arKey, iface->name); } return 0; } @@ -2813,7 +2814,7 @@ int doing_inheritance = 0; zend_class_entry *new_class_entry = emalloc(sizeof(zend_class_entry)); unsigned int lcname_len; - char *lcname = zend_u_str_case_fold(Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant), Z_UNILEN(class_name->u.constant), 0, &lcname_len); + zstr lcname = zend_u_str_case_fold(Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant), Z_UNILEN(class_name->u.constant), 0, &lcname_len); if (CG(active_class_entry)) { zend_error(E_COMPILE_ERROR, "Class declarations may not be nested"); @@ -2824,7 +2825,7 @@ ZEND_U_EQUAL(Z_TYPE(class_name->u.constant), lcname, lcname_len, "self", sizeof("self")-1)) || (lcname_len == sizeof("parent")-1 && ZEND_U_EQUAL(Z_TYPE(class_name->u.constant), lcname, lcname_len, "parent", sizeof("parent")-1))) { - efree(lcname); + efree(lcname.v); zend_error(E_COMPILE_ERROR, "Cannot use '%R' as class name as it is reserved", Z_TYPE(class_name->u.constant), Z_UNIVAL(class_name->u.constant)); } @@ -2853,7 +2854,7 @@ opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(class_name->u.constant), lcname, lcname_len TSRMLS_CC); + build_runtime_defined_function_key(&opline->op1.u.constant, Z_TYPE(class_name->u.constant), lcname.s, lcname_len TSRMLS_CC); opline->op2.op_type = IS_CONST; Z_TYPE(opline->op2.u.constant) = Z_TYPE(class_name->u.constant); @@ -2867,10 +2868,10 @@ } if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) { - Z_USTRVAL(opline->op2.u.constant) = (UChar *)lcname; + Z_USTRVAL(opline->op2.u.constant) = lcname.u; Z_USTRLEN(opline->op2.u.constant) = lcname_len; } else { - Z_STRVAL(opline->op2.u.constant) = lcname; + Z_STRVAL(opline->op2.u.constant) = lcname.s; Z_STRLEN(opline->op2.u.constant) = lcname_len; } @@ -2987,7 +2988,7 @@ *dest_length = prop_name_length; } -ZEND_API void zend_u_mangle_property_name(char **dest, int *dest_length, zend_uchar type, char *src1, int src1_length, char *src2, int src2_length, int internal) +ZEND_API void zend_u_mangle_property_name(zstr *dest, int *dest_length, zend_uchar type, zstr src1, int src1_length, zstr src2, int src2_length, int internal) { if (type == IS_UNICODE) { UChar *prop_name; @@ -2996,18 +2997,18 @@ prop_name_length = 1 + src1_length + 1 + src2_length; prop_name = pemalloc(UBYTES(prop_name_length + 1), internal); prop_name[0] = 0; - if (src1_length == 1 && src1[0] == '*') { + if (src1_length == 1 && src1.s[0] == '*') { prop_name[1] = '*'; prop_name[2] = 0; } else { - memcpy(prop_name + 1, src1, UBYTES(src1_length+1)); + memcpy(prop_name + 1, src1.s, UBYTES(src1_length+1)); } - memcpy(prop_name + 1 + src1_length + 1, src2, UBYTES(src2_length+1)); + memcpy(prop_name + 1 + src1_length + 1, src2.s, UBYTES(src2_length+1)); - *dest = (char*)prop_name; + dest->u = prop_name; *dest_length = prop_name_length; } else { - zend_mangle_property_name(dest, dest_length, src1, src1_length, src2, src2_length, internal); + zend_mangle_property_name(&dest->s, dest_length, src1.s, src1_length, src2.s, src2_length, internal); } } @@ -3024,23 +3025,23 @@ *prop_name = (*class_name)+strlen(*class_name)+1; } -ZEND_API void zend_u_unmangle_property_name(zend_uchar type, char *mangled_property, char **class_name, char **prop_name) +ZEND_API void zend_u_unmangle_property_name(zend_uchar type, zstr mangled_property, zstr *class_name, zstr *prop_name) { if (type == IS_UNICODE) { - *prop_name = *class_name = NULL; + prop_name->v = class_name->v = NULL; - if (((UChar*)mangled_property)[0]!=0) { + if ((mangled_property.u)[0]!=0) { *prop_name = mangled_property; return; } - *class_name = mangled_property+UBYTES(1); - *prop_name = (*class_name)+UBYTES(u_strlen((UChar*)*class_name)+1); - if ((*(UChar**)class_name)[0] == '*') { - *class_name = "*"; + class_name->u = mangled_property.u + 1; + prop_name->u = class_name->u + u_strlen(class_name->u)+1; + if (class_name->u[0] == '*') { + class_name->s = "*"; } } else { - zend_unmangle_property_name(mangled_property, class_name, prop_name); + zend_unmangle_property_name(mangled_property.s, &class_name->s, &prop_name->s); } } @@ -4128,7 +4129,7 @@ } -zend_bool zend_u_is_auto_global(zend_uchar type, void *name, uint name_len TSRMLS_DC) +zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint name_len TSRMLS_DC) { zend_auto_global *auto_global; @@ -4143,7 +4144,7 @@ zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC) { - return zend_u_is_auto_global(IS_STRING, name, name_len TSRMLS_CC); + return zend_u_is_auto_global(IS_STRING, (zstr)name, name_len TSRMLS_CC); } @@ -4262,7 +4263,7 @@ } -int zend_get_class_fetch_type(zend_uchar type, char *class_name, uint class_name_len) +int zend_get_class_fetch_type(zend_uchar type, zstr class_name, uint class_name_len) { if ((class_name_len == sizeof("self")-1) && ZEND_U_EQUAL(type, class_name, class_name_len, "self", sizeof("self")-1)) { @@ -4275,7 +4276,7 @@ } } -ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len) +ZEND_API zstr zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len) { if (name_len) { *name_len = op_array->vars[var].name_len; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_compile.h?r1=1.332&r2=1.333&diff_format=u Index: ZendEngine2/zend_compile.h diff -u ZendEngine2/zend_compile.h:1.332 ZendEngine2/zend_compile.h:1.333 --- ZendEngine2/zend_compile.h:1.332 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_compile.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.h,v 1.332 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_compile.h,v 1.333 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_COMPILE_H #define ZEND_COMPILE_H @@ -144,7 +144,7 @@ typedef struct _zend_property_info { zend_uint flags; - char *name; + zstr name; int name_length; ulong h; char *doc_comment; @@ -153,9 +153,9 @@ typedef struct _zend_arg_info { - char *name; + zstr name; zend_uint name_len; - char *class_name; + zstr class_name; zend_uint class_name_len; zend_bool array_type_hint; zend_bool allow_null; @@ -165,7 +165,7 @@ } zend_arg_info; typedef struct _zend_compiled_variable { - char *name; + zstr name; int name_len; ulong hash_value; } zend_compiled_variable; @@ -173,7 +173,7 @@ struct _zend_op_array { /* Common elements */ zend_uchar type; - char *function_name; + zstr function_name; zend_class_entry *scope; zend_uint fn_flags; union _zend_function *prototype; @@ -227,7 +227,7 @@ typedef struct _zend_internal_function { /* Common elements */ zend_uchar type; - char *function_name; + zstr function_name; zend_class_entry *scope; zend_uint fn_flags; union _zend_function *prototype; @@ -242,14 +242,14 @@ struct _zend_module_entry *module; } zend_internal_function; -#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : (char*)EMPTY_STR) +#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : (zstr)EMPTY_STR) typedef union _zend_function { zend_uchar type; /* MUST be the first element of this struct! */ struct { zend_uchar type; /* never used */ - char *function_name; + zstr function_name; zend_class_entry *scope; zend_uint fn_flags; union _zend_function *prototype; @@ -335,10 +335,10 @@ ZEND_API void zend_restore_compiled_script_encoding(char *original_script_enc TSRMLS_DC); ZEND_API char *zend_get_compiled_script_encoding(TSRMLS_D); -ZEND_API char* zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len); +ZEND_API zstr zend_get_compiled_variable_name(zend_op_array *op_array, zend_uint var, int* name_len); ZEND_API int zend_prepare_scanner_converters(const char *onetime_encoding, int run_time TSRMLS_DC); -ZEND_API int32_t zend_convert_scanner_output(UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status TSRMLS_DC); +ZEND_API int zend_convert_scanner_output(UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status TSRMLS_DC); int zend_unicode_yyinput(zend_file_handle *file_handle, char *buf, size_t len TSRMLS_DC); #ifdef ZTS @@ -537,8 +537,8 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal); ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name); -ZEND_API void zend_u_mangle_property_name(char **dest, int *dest_length, zend_uchar type, char *src1, int src1_length, char *src2, int src2_length, int internal); -ZEND_API void zend_u_unmangle_property_name(zend_uchar type, char *mangled_property, char **prop_name, char **class_name); +ZEND_API void zend_u_mangle_property_name(zstr *dest, int *dest_length, zend_uchar type, zstr src1, int src1_length, zstr src2, int src2_length, int internal); +ZEND_API void zend_u_unmangle_property_name(zend_uchar type, zstr mangled_property, zstr *prop_name, zstr *class_name); #define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor @@ -557,7 +557,7 @@ ZEND_API zend_bool zend_is_compiling(TSRMLS_D); ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC); ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC); -int zend_get_class_fetch_type(zend_uchar type, char *class_name, uint class_name_len); +int zend_get_class_fetch_type(zend_uchar type, zstr class_name, uint class_name_len); typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC); typedef struct _zend_auto_global { @@ -570,7 +570,7 @@ void zend_auto_global_dtor(zend_auto_global *auto_global); ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC); ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC); -ZEND_API zend_bool zend_u_is_auto_global(zend_uchar type, void *name, uint name_len TSRMLS_DC); +ZEND_API zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint name_len TSRMLS_DC); ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint varname_length TSRMLS_DC); int zendlex(znode *zendlval TSRMLS_DC); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_constants.c?r1=1.78&r2=1.79&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.78 ZendEngine2/zend_constants.c:1.79 --- ZendEngine2/zend_constants.c:1.78 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_constants.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.78 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_constants.c,v 1.79 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -32,13 +32,14 @@ if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } - free(c->name); + free(c->name.v); } void copy_zend_constant(zend_constant *c) { - c->name = zend_strndup(c->name, c->name_len - 1); + /* FIXME: Unicode support??? */ + c->name.s = zend_strndup(c->name.s, c->name_len - 1); if (!(c->flags & CONST_PERSISTENT)) { zval_copy_ctor(&c->value); } @@ -122,25 +123,25 @@ c.flags = CONST_PERSISTENT; c.module_number = 0; - c.name = zend_strndup(ZEND_STRL("TRUE")); + c.name.s = zend_strndup(ZEND_STRL("TRUE")); c.name_len = sizeof("TRUE"); Z_LVAL(c.value) = 1; Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); - c.name = zend_strndup(ZEND_STRL("FALSE")); + c.name.s = zend_strndup(ZEND_STRL("FALSE")); c.name_len = sizeof("FALSE"); Z_LVAL(c.value) = 0; Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); - c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE")); + c.name.s = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE")); c.name_len = sizeof("ZEND_THREAD_SAFE"); Z_LVAL(c.value) = ZTS_V; Z_TYPE(c.value) = IS_BOOL; zend_register_constant(&c TSRMLS_CC); - c.name = zend_strndup(ZEND_STRL("NULL")); + c.name.s = zend_strndup(ZEND_STRL("NULL")); c.name_len = sizeof("NULL"); Z_TYPE(c.value) = IS_NULL; zend_register_constant(&c TSRMLS_CC); @@ -173,7 +174,7 @@ Z_TYPE(c.value) = IS_LONG; Z_LVAL(c.value) = lval; c.flags = flags; - c.name = zend_strndup(name, name_len-1); + c.name.s = zend_strndup(name, name_len-1); c.name_len = name_len; c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); @@ -187,7 +188,7 @@ Z_TYPE(c.value) = IS_DOUBLE; Z_DVAL(c.value) = dval; c.flags = flags; - c.name = zend_strndup(name, name_len-1); + c.name.s = zend_strndup(name, name_len-1); c.name_len = name_len; c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); @@ -202,7 +203,7 @@ Z_STRVAL(c.value) = strval; Z_STRLEN(c.value) = strlen; c.flags = flags; - c.name = zend_strndup(name, name_len-1); + c.name.s = zend_strndup(name, name_len-1); c.name_len = name_len; c.module_number = module_number; zend_register_constant(&c TSRMLS_CC); @@ -215,22 +216,27 @@ } -ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zval *result TSRMLS_DC) +ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result TSRMLS_DC) { zend_constant *c; int retval = 1; - char *lookup_name; - char *colon; + zstr lookup_name; + zstr colon; - if ((UG(unicode) && (colon = (char*)u_memchr((UChar*)name, ':', name_len)) && ((UChar*)colon)[1] == ':') || - (!UG(unicode) && (colon = memchr(name, ':', name_len)) && colon[1] == ':')) { + if ((UG(unicode) && (colon.u = u_memchr(name.u, ':', name_len)) && colon.u[1] == ':') || + (!UG(unicode) && (colon.s = memchr(name.s, ':', name_len)) && colon.s[1] == ':')) { /* class constant */ zend_class_entry **ce = NULL, *scope; - int class_name_len = UG(unicode)?((colon-(char*)name)/sizeof(UChar)):colon-(char*)name; + int class_name_len = UG(unicode)?colon.u-name.u:colon.s-name.s; int const_name_len = name_len - class_name_len - 2; - char *constant_name = colon + (UG(unicode)?UBYTES(2):2); + zstr constant_name, class_name; zval **ret_constant; - char *class_name; + + if (UG(unicode)) { + constant_name.u = colon.u + 2; + } else { + constant_name.s = colon.s + 2; + } if (EG(in_execution)) { scope = EG(scope); @@ -239,9 +245,9 @@ } if (UG(unicode)) { - class_name = (char*)eustrndup((UChar*)name, class_name_len); + class_name.u = eustrndup(name.u, class_name_len); } else { - class_name = estrndup(name, class_name_len); + class_name.s = estrndup(name.s, class_name_len); } if (class_name_len == sizeof("self")-1 && @@ -266,7 +272,7 @@ retval = 0; } } - efree(class_name); + efree(class_name.v); if (retval && ce) { if (zend_u_hash_find(&((*ce)->constants_table), type, constant_name, const_name_len+1, (void **) &ret_constant) != SUCCESS) { @@ -291,13 +297,13 @@ lookup_name = zend_u_str_case_fold(type, name, name_len, 1, &lookup_name_len); if (zend_u_hash_find(EG(zend_constants), type, lookup_name, lookup_name_len+1, (void **) &c)==SUCCESS) { - if ((c->flags & CONST_CS) && memcmp(c->name, name, UG(unicode)?UBYTES(name_len):name_len)!=0) { + if ((c->flags & CONST_CS) && memcmp(c->name.v, name.v, UG(unicode)?UBYTES(name_len):name_len)!=0) { retval=0; } } else { retval=0; } - efree(lookup_name); + efree(lookup_name.v); } if (retval) { @@ -312,14 +318,14 @@ ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC) { - return zend_u_get_constant(IS_STRING, name, name_len, result TSRMLS_CC); + return zend_u_get_constant(IS_STRING, (zstr)name, name_len, result TSRMLS_CC); } ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c TSRMLS_DC) { unsigned int lookup_name_len; - char *lookup_name = NULL; - char *name; + zstr lookup_name; + zstr name; int ret = SUCCESS; #if 0 @@ -333,18 +339,19 @@ } else { lookup_name_len = c->name_len; name = c->name; + lookup_name.v = NULL; } if (zend_u_hash_add(EG(zend_constants), type, name, lookup_name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { zend_error(E_NOTICE,"Constant %R already defined", type, name); - free(c->name); + free(c->name.v); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } ret = FAILURE; } - if (lookup_name) { - efree(lookup_name); + if (lookup_name.v) { + efree(lookup_name.v); } return ret; } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_constants.h?r1=1.35&r2=1.36&diff_format=u Index: ZendEngine2/zend_constants.h diff -u ZendEngine2/zend_constants.h:1.35 ZendEngine2/zend_constants.h:1.36 --- ZendEngine2/zend_constants.h:1.35 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_constants.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.h,v 1.35 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_constants.h,v 1.36 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_CONSTANTS_H #define ZEND_CONSTANTS_H @@ -32,7 +32,7 @@ typedef struct _zend_constant { zval value; int flags; - char *name; + zstr name; uint name_len; int module_number; } zend_constant; @@ -55,7 +55,7 @@ void zend_register_standard_constants(TSRMLS_D); void clean_non_persistent_constants(TSRMLS_D); ZEND_API int zend_get_constant(char *name, uint name_len, zval *result TSRMLS_DC); -ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len, zval *result TSRMLS_DC); +ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint name_len, zval *result TSRMLS_DC); ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number TSRMLS_DC); ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number TSRMLS_DC); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_exceptions.c?r1=1.98&r2=1.99&diff_format=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.98 ZendEngine2/zend_exceptions.c:1.99 --- ZendEngine2/zend_exceptions.c:1.98 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_exceptions.c Tue Feb 21 20:12:41 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.98 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_exceptions.c,v 1.99 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -143,7 +143,7 @@ } else if (UG(unicode)) { UErrorCode status = U_ZERO_ERROR; UChar *u_str; - int32_t u_len; + int u_len; zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); @@ -180,9 +180,9 @@ if (message_type == IS_UNICODE) { zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, message, message_len TSRMLS_CC); } else if (UG(unicode)) { - UErrorCode status = U_ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UChar *u_str; - int32_t u_len; + int u_len; zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u_str, &u_len, message, message_len, &status); zend_update_property_unicodel(default_exception_ce, object, "message", sizeof("message")-1, u_str, u_len TSRMLS_CC); @@ -438,7 +438,7 @@ TRACE_APPEND_STR("Array, "); break; case IS_OBJECT: { - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; TSRMLS_FETCH(); @@ -450,15 +450,15 @@ if (UG(unicode)) { zval tmp; - ZVAL_UNICODEL(&tmp, (UChar*)class_name, class_name_len, 1); + ZVAL_UNICODEL(&tmp, class_name.u, class_name_len, 1); convert_to_string_with_converter(&tmp, ZEND_U_CONVERTER(UG(output_encoding_conv))); TRACE_APPEND_STRL(Z_STRVAL(tmp), Z_STRLEN(tmp)); zval_dtor(&tmp); } else { - TRACE_APPEND_STRL(class_name, class_name_len); + TRACE_APPEND_STRL(class_name.s, class_name_len); } if(!dup) { - efree(class_name); + efree(class_name.v); } TRACE_APPEND_STR("), "); @@ -760,7 +760,8 @@ if (Z_TYPE_P(str) != IS_STRING) { zend_error(E_WARNING, "%v::__toString() must return a string", ce_exception->name); } else { - zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC); + /* FIXME: Unicode support??? */ + zend_update_property_string(default_exception_ce, exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name.s : Z_STRVAL_P(str) TSRMLS_CC); } } zval_ptr_dtor(&str); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_execute.c?r1=1.736&r2=1.737&diff_format=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.736 ZendEngine2/zend_execute.c:1.737 --- ZendEngine2/zend_execute.c:1.736 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_execute.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.736 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.737 2006/02/21 20:12:41 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -474,7 +474,8 @@ { zend_arg_info *cur_arg_info; zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; - char *fclass, *fsep, *fname; + char *fsep; + zstr fclass, fname; if (!zf->common.arg_info || arg_num>zf->common.num_args) { @@ -483,10 +484,10 @@ cur_arg_info = &zf->common.arg_info[arg_num-1]; fname = zf->common.function_name; - fsep = zf->common.scope ? "::" : (char*)EMPTY_STR; - fclass = zf->common.scope ? zf->common.scope->name : (char*)EMPTY_STR; + fsep = zf->common.scope ? "::" : ""; + fclass = zf->common.scope ? zf->common.scope->name : (zstr)EMPTY_STR; - if (cur_arg_info->class_name) { + if (cur_arg_info->class_name.v) { if (!arg) { if (ptr && ptr->op_array) { zend_error(E_RECOVERABLE_ERROR, "Argument %d passed to %v%s%v() must be an object of class %v, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno); @@ -599,7 +600,7 @@ /* separate our value if necessary */ if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { zval *orig_value = value; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -609,12 +610,12 @@ value->refcount = 0; dup = zend_get_object_classname(orig_value, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name.v); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v); Z_OBJVAL_P(value) = Z_OBJ_HANDLER_P(orig_value, clone_obj)(orig_value TSRMLS_CC); if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (value_op->op_type == IS_TMP_VAR) { zval *orig_value = value; @@ -812,14 +813,14 @@ } if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name.v); } else if (PZVAL_IS_REF(variable_ptr)) { if (variable_ptr != value) { zend_uint refcount = variable_ptr->refcount; @@ -832,7 +833,7 @@ *variable_ptr = *value; variable_ptr->refcount = refcount; variable_ptr->is_ref = 1; - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v); Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); if (type != IS_TMP_VAR) { value->refcount--; @@ -851,13 +852,13 @@ } *variable_ptr = *value; INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v); Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); zval_ptr_dtor(&value); } } if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (PZVAL_IS_REF(variable_ptr)) { if (variable_ptr!=value) { @@ -952,25 +953,25 @@ zval *variable_ptr = *variable_ptr_ptr; if (EG(ze1_compatibility_mode) && Z_TYPE_P(value) == IS_OBJECT) { - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; dup = zend_get_object_classname(value, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HANDLER_P(value, clone_obj) == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name.v); } else { variable_ptr->refcount--; ALLOC_ZVAL(variable_ptr); *variable_ptr_ptr = variable_ptr; *variable_ptr = *value; INIT_PZVAL(variable_ptr); - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name.v); Z_OBJVAL_P(variable_ptr) = Z_OBJ_HANDLER_P(value, clone_obj)(value TSRMLS_CC); } if (!dup) { - efree(class_name); + efree(class_name.v); } } else { variable_ptr->refcount--; @@ -1029,7 +1030,7 @@ static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, zval *dim, int type TSRMLS_DC) { zval **retval; - char *offset_key; + zstr offset_key; int offset_key_length; zend_uchar ztype = Z_TYPE_P(dim); int free_offset = 0; @@ -1037,7 +1038,7 @@ switch (ztype) { case IS_NULL: ztype = IS_STRING; - offset_key = ""; + offset_key.s = ""; offset_key_length = 1; goto fetch_string_dim; case IS_STRING: @@ -1050,12 +1051,12 @@ if (UG(unicode) && ht == &EG(symbol_table) && ztype == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, (UChar*)offset_key, offset_key_length, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_key_length, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_key_length = norm_len; free_offset = 1; } @@ -1082,7 +1083,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; case IS_RESOURCE: http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_execute.h?r1=1.94&r2=1.95&diff_format=u Index: ZendEngine2/zend_execute.h diff -u ZendEngine2/zend_execute.h:1.94 ZendEngine2/zend_execute.h:1.95 --- ZendEngine2/zend_execute.h:1.94 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_execute.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.94 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_execute.h,v 1.95 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H @@ -65,12 +65,12 @@ } } ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry ***ce TSRMLS_DC); -ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC); +ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC); ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC); ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); -ZEND_API int zend_u_eval_string(zend_uchar type, void *str, zval *retval_ptr, char *string_name TSRMLS_DC); -ZEND_API int zend_u_eval_string_ex(zend_uchar type, void *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); +ZEND_API int zend_u_eval_string(zend_uchar type, zstr str, zval *retval_ptr, char *string_name TSRMLS_DC); +ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC); static inline int i_zend_is_true(zval *op) { @@ -175,8 +175,8 @@ /* services */ -ZEND_API char *get_active_class_name(char **space TSRMLS_DC); -ZEND_API char *get_active_function_name(TSRMLS_D); +ZEND_API zstr get_active_class_name(char **space TSRMLS_DC); +ZEND_API zstr get_active_function_name(TSRMLS_D); ZEND_API char *zend_get_executed_filename(TSRMLS_D); ZEND_API uint zend_get_executed_lineno(TSRMLS_D); ZEND_API zend_bool zend_is_executing(TSRMLS_D); @@ -185,7 +185,7 @@ ZEND_API void zend_unset_timeout(TSRMLS_D); ZEND_API void zend_timeout(int dummy); ZEND_API zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC); -ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, void *class_name, uint class_name_len, int fetch_type TSRMLS_DC); +ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC); void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC); #ifdef ZEND_WIN32 @@ -203,7 +203,7 @@ /* The following tries to resolve the classname of a zval of type object. * Since it is slow it should be only used in error messages. */ -#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : (char*)EMPTY_STR) +#define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : (zstr)EMPTY_STR) ZEND_API zval** zend_get_compiled_variable_value(zend_execute_data *execute_data_ptr, zend_uint var); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_execute_API.c?r1=1.359&r2=1.360&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.359 ZendEngine2/zend_execute_API.c:1.360 --- ZendEngine2/zend_execute_API.c:1.359 Tue Feb 21 08:00:38 2006 +++ ZendEngine2/zend_execute_API.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.359 2006/02/21 08:00:38 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.360 2006/02/21 20:12:41 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -78,7 +78,7 @@ fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n", active_opline->opcode, active_opline-EG(active_op_array)->opcodes, - get_active_function_name(TSRMLS_C), + get_active_function_name(TSRMLS_C).s, zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C)); } @@ -308,13 +308,13 @@ /* return class name and "::" or "". */ -ZEND_API char *get_active_class_name(char **space TSRMLS_DC) +ZEND_API zstr get_active_class_name(char **space TSRMLS_DC) { if (!zend_is_executing(TSRMLS_C)) { if (space) { *space = ""; } - return (char*)EMPTY_STR; + return (zstr)EMPTY_STR; } switch (EG(function_state_ptr)->function->type) { case ZEND_USER_FUNCTION: @@ -325,30 +325,30 @@ if (space) { *space = ce ? "::" : ""; } - return ce ? ce->name : (char*)EMPTY_STR; + return ce ? ce->name : (zstr)EMPTY_STR; } default: if (space) { *space = ""; } - return (char*)EMPTY_STR; + return (zstr)EMPTY_STR; } } -ZEND_API char *get_active_function_name(TSRMLS_D) +ZEND_API zstr get_active_function_name(TSRMLS_D) { if (!zend_is_executing(TSRMLS_C)) { - return NULL; + return (zstr)NULL; } switch (EG(function_state_ptr)->function->type) { case ZEND_USER_FUNCTION: { - char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name; + zstr function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name; - if (function_name) { + if (function_name.v) { return function_name; } else { - return UG(unicode)?(char*)u_main:"main"; + return UG(unicode)?(zstr)u_main:(zstr)"main"; } } break; @@ -356,7 +356,7 @@ return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name; break; default: - return NULL; + return (zstr)NULL; } } @@ -466,7 +466,7 @@ p->is_ref = is_ref; } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) { zval **element, *new_val; - char *str_index; + zstr str_index; uint str_index_len; ulong num_index; @@ -495,7 +495,7 @@ if (UG(unicode)) { if (Z_TYPE(const_value) == IS_UNICODE && Z_USTRLEN(const_value) == str_index_len-1 && - !u_strncmp(Z_USTRVAL(const_value), (UChar*)str_index, str_index_len)) { + !u_strncmp(Z_USTRVAL(const_value), str_index.u, str_index_len)) { /* constant value is the same as its name */ zval_dtor(&const_value); zend_hash_move_forward(Z_ARRVAL_P(p)); @@ -504,7 +504,7 @@ } else { if (Z_TYPE(const_value) == IS_STRING && Z_STRLEN(const_value) == str_index_len-1 && - !strncmp(Z_STRVAL(const_value), str_index, str_index_len)) { + !strncmp(Z_STRVAL(const_value), str_index.s, str_index_len)) { /* constant value is the same as its name */ zval_dtor(&const_value); zend_hash_move_forward(Z_ARRVAL_P(p)); @@ -530,13 +530,13 @@ break; case IS_BOOL: case IS_LONG: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value)); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, Z_LVAL(const_value)); break; case IS_DOUBLE: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, (long)Z_DVAL(const_value)); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, (zstr)NULL, 0, (long)Z_DVAL(const_value)); break; case IS_NULL: - zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0); + zend_hash_update_current_key(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, (zstr)EMPTY_STR, 1, 0); break; } zend_hash_move_forward(Z_ARRVAL_P(p)); @@ -614,7 +614,8 @@ char *old_func_name = NULL; unsigned int clen; int mlen, fname_len; - char *mname, *colon, *fname, *lcname; + char *mname, *colon; + zstr fname, lcname; if (EG(exception)) { return FAILURE; /* we would result in an instable executor otherwise */ @@ -748,7 +749,7 @@ } if (Z_TYPE_P(fci->function_name) == IS_UNICODE) { - if ((colon = (char*)u_strstr((UChar*)Z_UNIVAL_P(fci->function_name), (UChar*)":\0:\0")) != NULL) { + if ((colon = (char*)u_strstr(Z_USTRVAL_P(fci->function_name), (UChar*)":\0:\0")) != NULL) { mlen = u_strlen((UChar*)(colon+4)); clen = Z_UNILEN_P(fci->function_name) - mlen - 2; mname = colon + 4; @@ -762,19 +763,20 @@ } if (colon != NULL) { zend_class_entry **pce, *ce_child = NULL; - if (zend_u_lookup_class(Z_TYPE_P(fci->function_name), Z_STRVAL_P(fci->function_name), clen, &pce TSRMLS_CC) == SUCCESS) { + if (zend_u_lookup_class(Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name), clen, &pce TSRMLS_CC) == SUCCESS) { ce_child = *pce; } else { lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name), clen, 0, &clen); /* caution: lcname is not '\0' terminated */ if (calling_scope) { - if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) { + /* FIXME: Unicode support??? */ + if (clen == sizeof("self") - 1 && memcmp(lcname.s, "self", sizeof("self") - 1) == 0) { ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL; - } else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { + } else if (clen == sizeof("parent") - 1 && memcmp(lcname.s, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) { ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL; } } - efree(lcname); + efree(lcname.v); } if (!ce_child) { zend_error(E_ERROR, "Cannot call method %R() or method does not exist", Z_TYPE_P(fci->function_name), Z_UNIVAL_P(fci->function_name)); @@ -783,10 +785,10 @@ check_scope_or_static = calling_scope; fci->function_table = &ce_child->function_table; calling_scope = ce_child; - fname = colon + (Z_TYPE_P(fci->function_name) == IS_UNICODE ? 4 : 2); + fname.s = colon + (Z_TYPE_P(fci->function_name) == IS_UNICODE ? 4 : 2); fname_len = mlen; } else { - fname = Z_STRVAL_P(fci->function_name); + fname.s = Z_STRVAL_P(fci->function_name); fname_len = Z_STRLEN_P(fci->function_name); } @@ -797,20 +799,20 @@ EX(function_state).function = Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, fname, fname_len TSRMLS_CC); if (EX(function_state).function && calling_scope != EX(function_state).function->common.scope) { - void *function_name_lc = zend_u_str_tolower_dup(Z_TYPE_P(fci->function_name), fname, fname_len); + zstr function_name_lc = zend_u_str_tolower_dup(Z_TYPE_P(fci->function_name), fname, fname_len); if (zend_u_hash_find(&calling_scope->function_table, Z_TYPE_P(fci->function_name), function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) { - efree(function_name_lc); + efree(function_name_lc.v); zend_error(E_ERROR, "Cannot call method %v::%R() or method does not exist", calling_scope->name, Z_TYPE_P(fci->function_name), fname); } - efree(function_name_lc); + efree(function_name_lc.v); } } else if (calling_scope) { unsigned int lcname_len; - char *lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len); + zstr lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len); EX(function_state).function = zend_std_get_static_method(calling_scope, lcname, lcname_len TSRMLS_CC); - efree(lcname); + efree(lcname.v); if (check_scope_or_static && EX(function_state).function && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC) && !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) { @@ -819,12 +821,12 @@ } } else { unsigned int lcname_len; - char *lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len); + zstr lcname = zend_u_str_case_fold(Z_TYPE_P(fci->function_name), fname, fname_len, 1, &lcname_len); if (zend_u_hash_find(fci->function_table, Z_TYPE_P(fci->function_name), lcname, lcname_len+1, (void **) &EX(function_state).function)==FAILURE) { EX(function_state).function = NULL; } - efree(lcname); + efree(lcname.v); } if (EX(function_state).function == NULL) { @@ -833,7 +835,7 @@ EX(function_state).function = calling_scope->__call; /* prepare params */ ALLOC_INIT_ZVAL(method_name); - ZVAL_STRINGL(method_name, fname, fname_len, 0); + ZVAL_STRINGL(method_name, fname.s, fname_len, 0); ALLOC_INIT_ZVAL(params_array); array_init(params_array); @@ -867,7 +869,7 @@ } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { zend_error(E_NOTICE, "Function %s%s%s() is deprecated", - EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name.s : "", EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } @@ -1027,7 +1029,7 @@ } -ZEND_API int zend_u_lookup_class_ex(zend_uchar type, void *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_u_lookup_class_ex(zend_uchar type, zstr name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC) { zval **args[1]; zval autoload_function; @@ -1035,20 +1037,20 @@ zval *retval_ptr = NULL; int retval; unsigned int lc_name_len; - char *lc_name; + zstr lc_name; zval *exception; char dummy = 1; zend_fcall_info fcall_info; zend_fcall_info_cache fcall_cache; - if (name == NULL) { + if (name.v == NULL) { return FAILURE; } lc_name = zend_u_str_case_fold(type, name, name_length, 1, &lc_name_len); if (zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len+1, (void **) ce) == SUCCESS) { - efree(lc_name); + efree(lc_name.v); return SUCCESS; } @@ -1056,7 +1058,7 @@ * (doesn't impact fuctionality of __autoload() */ if (!use_autoload || zend_is_compiling(TSRMLS_C)) { - efree(lc_name); + efree(lc_name.v); return FAILURE; } @@ -1066,7 +1068,7 @@ } if (zend_u_hash_add(EG(in_autoload), type, lc_name, lc_name_len+1, (void**)&dummy, sizeof(char), NULL) == FAILURE) { - efree(lc_name); + efree(lc_name.v); return FAILURE; } @@ -1074,11 +1076,7 @@ ALLOC_ZVAL(class_name_ptr); INIT_PZVAL(class_name_ptr); - if (type == IS_UNICODE) { - ZVAL_UNICODEL(class_name_ptr, name, name_length, 1); - } else { - ZVAL_STRINGL(class_name_ptr, name, name_length, 1); - } + ZVAL_TEXTL(class_name_ptr, name, name_length, 1); args[0] = &class_name_ptr; @@ -1112,12 +1110,12 @@ if (retval == FAILURE) { EG(exception) = exception; - efree(lc_name); + efree(lc_name.v); return FAILURE; } if (EG(exception) && exception) { - efree(lc_name); + efree(lc_name.v); zend_error(E_ERROR, "Function %s(%R) threw an exception of type '%v'", ZEND_AUTOLOAD_FUNC_NAME, type, name, Z_OBJCE_P(EG(exception))->name); return FAILURE; } @@ -1129,21 +1127,21 @@ } retval = zend_u_hash_find(EG(class_table), type, lc_name, lc_name_len + 1, (void **) ce); - efree(lc_name); + efree(lc_name.v); return retval; } -ZEND_API int zend_u_lookup_class(zend_uchar type, void *name, int name_length, zend_class_entry ***ce TSRMLS_DC) +ZEND_API int zend_u_lookup_class(zend_uchar type, zstr name, int name_length, zend_class_entry ***ce TSRMLS_DC) { return zend_u_lookup_class_ex(type, name, name_length, 1, ce TSRMLS_CC); } ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC) { - return zend_u_lookup_class(IS_STRING, name, name_length, ce TSRMLS_CC); + return zend_u_lookup_class(IS_STRING, (zstr)name, name_length, ce TSRMLS_CC); } -ZEND_API int zend_u_eval_string(zend_uchar type, void *string, zval *retval_ptr, char *string_name TSRMLS_DC) +ZEND_API int zend_u_eval_string(zend_uchar type, zstr string, zval *retval_ptr, char *string_name TSRMLS_DC) { zval pv; zend_op_array *new_op_array; @@ -1153,7 +1151,7 @@ int retval; if (type == IS_UNICODE) { - UChar *str = (UChar*)string; + UChar *str = string.u; if (retval_ptr) { Z_USTRLEN(pv) = u_strlen(str)+sizeof("return ;")-1; @@ -1166,7 +1164,7 @@ Z_USTRVAL(pv) = eustrndup(str, Z_USTRLEN(pv)); } } else { - char *str = (char*)string; + char *str = string.s; if (retval_ptr) { Z_STRLEN(pv) = strlen(str)+sizeof("return ;")-1; @@ -1228,14 +1226,14 @@ ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC) { - return zend_u_eval_string(IS_STRING, str, retval_ptr, string_name TSRMLS_CC); + return zend_u_eval_string(IS_STRING, (zstr)str, retval_ptr, string_name TSRMLS_CC); } -ZEND_API int zend_u_eval_string_ex(zend_uchar type, void *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) +ZEND_API int zend_u_eval_string_ex(zend_uchar type, zstr str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) { int result; - result = zend_eval_string(str, retval_ptr, string_name TSRMLS_CC); + result = zend_u_eval_string(type, str, retval_ptr, string_name TSRMLS_CC); if (handle_exceptions && EG(exception)) { zend_exception_error(EG(exception) TSRMLS_CC); result = FAILURE; @@ -1245,7 +1243,7 @@ ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC) { - return zend_u_eval_string_ex(IS_STRING, str, retval_ptr, string_name, handle_exceptions TSRMLS_CC); + return zend_u_eval_string_ex(IS_STRING, (zstr)str, retval_ptr, string_name, handle_exceptions TSRMLS_CC); } @@ -1257,7 +1255,7 @@ if (!CG(interactive) || CG(active_op_array)->backpatch_count>0 - || CG(active_op_array)->function_name + || CG(active_op_array)->function_name.v || CG(active_op_array)->type!=ZEND_USER_FUNCTION) { return; } @@ -1503,7 +1501,7 @@ } -ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, void *class_name, uint class_name_len, int fetch_type TSRMLS_DC) +ZEND_API zend_class_entry *zend_u_fetch_class(zend_uchar type, zstr class_name, uint class_name_len, int fetch_type TSRMLS_DC) { zend_class_entry **pce; int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0; @@ -1549,16 +1547,16 @@ zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC) { - return zend_u_fetch_class(IS_STRING, class_name, class_name_len, fetch_type TSRMLS_CC); + return zend_u_fetch_class(IS_STRING, (zstr)class_name, class_name_len, fetch_type TSRMLS_CC); } #define MAX_ABSTRACT_INFO_CNT 3 #define MAX_ABSTRACT_INFO_FMT "%v%s%v%s" #define DISPLAY_ABSTRACT_FN(idx) \ - ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : (char*)EMPTY_STR, \ + ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : (zstr)EMPTY_STR, \ ai.afn[idx] ? "::" : "", \ - ai.afn[idx] ? ai.afn[idx]->common.function_name : (char*)EMPTY_STR, \ + ai.afn[idx] ? ai.afn[idx]->common.function_name : (zstr)EMPTY_STR, \ ai.afn[idx] && ai.afn[idx+1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") typedef struct _zend_abstract_info { @@ -1614,7 +1612,7 @@ } } -ZEND_API int zend_u_delete_global_variable(zend_uchar type, void *name, int name_len TSRMLS_DC) +ZEND_API int zend_u_delete_global_variable(zend_uchar type, zstr name, int name_len TSRMLS_DC) { zend_execute_data *ex; ulong hash_value = zend_u_inline_hash_func(type, name, name_len+1); @@ -1626,7 +1624,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == name_len && - !memcmp(ex->op_array->vars[i].name, name, type==IS_UNICODE?UBYTES(name_len):name_len)) { + !memcmp(ex->op_array->vars[i].name.v, name.v, type==IS_UNICODE?UBYTES(name_len):name_len)) { ex->CVs[i] = NULL; break; } @@ -1640,7 +1638,7 @@ ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC) { - return zend_u_delete_global_variable(IS_STRING, name, name_len TSRMLS_CC); + return zend_u_delete_global_variable(IS_STRING, (zstr)name, name_len TSRMLS_CC); } /* http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_hash.c?r1=1.132&r2=1.133&diff_format=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.132 ZendEngine2/zend_hash.c:1.133 --- ZendEngine2/zend_hash.c:1.132 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_hash.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.132 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_hash.c,v 1.133 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_operators.h" @@ -51,14 +51,14 @@ if (ht->unicode && type == IS_STRING) { \ UErrorCode status = U_ZERO_ERROR; \ UChar *u = NULL; \ - int32_t u_len; \ + int u_len; \ TSRMLS_FETCH(); \ - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)arKey, nKeyLength-1, &status); \ + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, arKey.s, nKeyLength-1, &status); \ if (U_FAILURE(status)) { \ /* UTODO: */ \ } \ type = IS_UNICODE; \ - tmp = arKey = u; \ + tmp = arKey.u = u; \ } @@ -114,14 +114,14 @@ static int zend_hash_do_resize(HashTable *ht); -ZEND_API ulong zend_u_hash_func(zend_uchar type, char *arKey, uint nKeyLength) +ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength) { return zend_u_inline_hash_func(type, arKey, nKeyLength); } ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength) { - return zend_u_hash_func(IS_STRING, arKey, nKeyLength); + return zend_u_hash_func(IS_STRING, (zstr)arKey, nKeyLength); } #define UPDATE_DATA(ht, p, pData, nDataSize) \ @@ -228,7 +228,7 @@ -ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { ulong h; uint nIndex; @@ -256,7 +256,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { if (flag & HASH_ADD) { if (tmp) efree(tmp); return FAILURE; @@ -284,13 +284,13 @@ p = p->pNext; } - p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.u)+realKeyLength, ht->persistent); + p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.arKey)+realKeyLength, ht->persistent); if (!p) { if (tmp) efree(tmp); return FAILURE; } p->key.type = type; - memcpy(&p->key.u, arKey, realKeyLength); + memcpy(p->key.arKey.s, arKey.s, realKeyLength); p->nKeyLength = nKeyLength; INIT_DATA(ht, p, pData, nDataSize); p->h = h; @@ -312,10 +312,10 @@ ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { - return _zend_u_hash_add_or_update(ht, IS_STRING, arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); + return _zend_u_hash_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } -ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) +ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { uint nIndex; Bucket *p; @@ -341,7 +341,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { if (flag & HASH_ADD) { if (tmp) efree(tmp); return FAILURE; @@ -369,14 +369,14 @@ p = p->pNext; } - p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.u)+realKeyLength, ht->persistent); + p = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(p->key.arKey)+realKeyLength, ht->persistent); if (!p) { if (tmp) efree(tmp); return FAILURE; } p->key.type = type; - memcpy(&p->key.u, arKey, realKeyLength); + memcpy(p->key.arKey.s, arKey.s, realKeyLength); p->nKeyLength = nKeyLength; INIT_DATA(ht, p, pData, nDataSize); p->h = h; @@ -400,10 +400,10 @@ ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC) { - return _zend_u_hash_quick_add_or_update(ht, IS_STRING, arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); + return _zend_u_hash_quick_add_or_update(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData, nDataSize, pDest, flag ZEND_FILE_LINE_CC); } -ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength) +ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) { void *dummy = (void *) 1; @@ -414,7 +414,7 @@ { void *dummy = (void *) 1; - return zend_u_hash_add(ht, IS_STRING, arKey, nKeyLength, &dummy, sizeof(void *), NULL); + return zend_u_hash_add(ht, IS_STRING, (zstr)arKey, nKeyLength, &dummy, sizeof(void *), NULL); } @@ -459,7 +459,7 @@ } p = p->pNext; } - p = (Bucket *) pemalloc_rel(sizeof(Bucket) - sizeof(p->key.u), ht->persistent); + p = (Bucket *) pemalloc_rel(sizeof(Bucket) - sizeof(p->key.arKey), ht->persistent); if (!p) { return FAILURE; } @@ -528,12 +528,12 @@ return SUCCESS; } -ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, int flag) +ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag) { uint nIndex; Bucket *p; void *tmp = NULL; - uint realKeyLength; + uint realKeyLength = 0; IS_CONSISTENT(ht); @@ -550,7 +550,7 @@ && (p->nKeyLength == nKeyLength) && ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp()) */ || ((p->key.type == type) - && !memcmp(&p->key.u, arKey, realKeyLength)))) { + && !memcmp(p->key.arKey.s, arKey.s, realKeyLength)))) { HANDLE_BLOCK_INTERRUPTIONS(); if (p == ht->arBuckets[nIndex]) { ht->arBuckets[nIndex] = p->pNext; @@ -594,7 +594,7 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) { - return zend_u_hash_del_key_or_index(ht, IS_STRING, arKey, nKeyLength, h, flag); + return zend_u_hash_del_key_or_index(ht, IS_STRING, (zstr)arKey, nKeyLength, h, flag); } ZEND_API void zend_hash_destroy(HashTable *ht) @@ -800,11 +800,7 @@ hash_key.nKeyLength = p->nKeyLength; hash_key.h = p->h; hash_key.type = p->key.type; - if (hash_key.type == IS_UNICODE) { - hash_key.u.unicode = p->key.u.unicode; - } else { - hash_key.u.string = p->key.u.string; - } + hash_key.arKey.s = p->key.arKey.s; if (destruct(p->pData, num_args, args, &hash_key)) { p = zend_hash_apply_deleter(ht, p); } else { @@ -834,7 +830,7 @@ if (q->nKeyLength==0) { zend_hash_index_del(ht, q->h); } else { - zend_u_hash_del(ht, q->key.type, &q->key.u.unicode, q->nKeyLength); + zend_u_hash_del(ht, q->key.type, (zstr)q->key.arKey.s, q->nKeyLength); } } if (result & ZEND_HASH_APPLY_STOP) { @@ -858,7 +854,7 @@ if (p->nKeyLength == 0) { zend_hash_index_update(target, p->h, p->pData, size, &new_entry); } else { - zend_u_hash_update(target, p->key.type, &p->key.u, p->nKeyLength, p->pData, size, &new_entry); + zend_u_hash_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &new_entry); } if (pCopyConstructor) { pCopyConstructor(new_entry); @@ -885,7 +881,7 @@ pCopyConstructor(t); } } else { - if (_zend_u_hash_add_or_update(target, p->key.type, &p->key.u, p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) { + if (_zend_u_hash_add_or_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->pData, size, &t, mode ZEND_FILE_LINE_RELAY_CC)==SUCCESS && pCopyConstructor) { pCopyConstructor(t); } } @@ -902,11 +898,7 @@ hash_key.nKeyLength = p->nKeyLength; hash_key.h = p->h; hash_key.type = p->key.type; - if (hash_key.type == IS_UNICODE) { - hash_key.u.unicode = p->key.u.unicode; - } else { - hash_key.u.string = p->key.u.string; - } + hash_key.arKey.s = p->key.arKey.s; return merge_checker_func(target, source_data, &hash_key, pParam); } @@ -922,7 +914,7 @@ p = source->pListHead; while (p) { if (zend_hash_replace_checker_wrapper(target, p->pData, p, pParam, pMergeSource)) { - if (zend_u_hash_quick_update(target, p->key.type, &p->key.u, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) { + if (zend_u_hash_quick_update(target, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, p->h, p->pData, size, &t)==SUCCESS && pCopyConstructor) { pCopyConstructor(t); } } @@ -932,14 +924,14 @@ } -ZEND_API ulong zend_u_get_hash_value(zend_uchar type, char *arKey, uint nKeyLength) +ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength) { return zend_u_inline_hash_func(type, arKey, nKeyLength); } ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength) { - return zend_u_get_hash_value(IS_STRING, arKey, nKeyLength); + return zend_u_get_hash_value(IS_STRING, (zstr)arKey, nKeyLength); } @@ -947,7 +939,7 @@ * data is returned in pData. The reason is that there's no reason * someone using the hash table might not want to have NULL data */ -ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) { ulong h; uint nIndex; @@ -968,7 +960,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { *pData = p->pData; if (tmp) efree(tmp); return SUCCESS; @@ -981,11 +973,11 @@ ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) { - return zend_u_hash_find(ht, IS_STRING, arKey, nKeyLength, pData); + return zend_u_hash_find(ht, IS_STRING, (zstr)arKey, nKeyLength, pData); } -ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void **pData) +ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData) { uint nIndex; Bucket *p; @@ -1011,7 +1003,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { *pData = p->pData; if (tmp) efree(tmp); return SUCCESS; @@ -1024,10 +1016,10 @@ ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) { - return zend_u_hash_quick_find(ht, IS_STRING, arKey, nKeyLength, h, pData); + return zend_u_hash_quick_find(ht, IS_STRING, (zstr)arKey, nKeyLength, h, pData); } -ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength) +ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) { ulong h; uint nIndex; @@ -1048,7 +1040,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { if (tmp) efree(tmp); return 1; } @@ -1060,10 +1052,10 @@ ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) { - return zend_u_hash_exists(ht, IS_STRING, arKey, nKeyLength); + return zend_u_hash_exists(ht, IS_STRING, (zstr)arKey, nKeyLength); } -ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h) +ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h) { uint nIndex; Bucket *p; @@ -1089,7 +1081,7 @@ if ((p->h == h) && (p->key.type == type) && (p->nKeyLength == nKeyLength) && - !memcmp(&p->key.u, arKey, realKeyLength)) { + !memcmp(p->key.arKey.s, arKey.s, realKeyLength)) { if (tmp) efree(tmp); return 1; } @@ -1101,7 +1093,7 @@ ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h) { - return zend_u_hash_quick_exists(ht, IS_STRING, arKey, nKeyLength, h); + return zend_u_hash_quick_exists(ht, IS_STRING, (zstr)arKey, nKeyLength, h); } ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) @@ -1206,7 +1198,7 @@ /* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos) { Bucket *p; @@ -1218,9 +1210,9 @@ if (p->nKeyLength) { if (p->key.type == IS_STRING) { if (duplicate) { - *str_index = estrndup(p->key.u.string, p->nKeyLength-1); + str_index->s = estrndup(p->key.arKey.s, p->nKeyLength-1); } else { - *str_index = p->key.u.string; + str_index->s = p->key.arKey.s; } if (str_length) { *str_length = p->nKeyLength; @@ -1228,9 +1220,9 @@ return HASH_KEY_IS_STRING; } else if (p->key.type == IS_UNICODE) { if (duplicate) { - *str_index = (char*)eustrndup(p->key.u.unicode, p->nKeyLength-1); + str_index->u = eustrndup(p->key.arKey.u, p->nKeyLength-1); } else { - *str_index = p->key.u.string; + str_index->u = p->key.arKey.u; } if (str_length) { *str_length = p->nKeyLength; @@ -1288,7 +1280,7 @@ /* This function changes key of currevt element without changing elements' * order. If element with target key already exists, it will be deleted first. */ -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos) +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos) { Bucket *p; uint real_length; @@ -1308,7 +1300,7 @@ real_length = str_length; if (p->nKeyLength == str_length && p->key.type == IS_STRING && - memcmp(p->key.u.string, str_index, str_length) == 0) { + memcmp(p->key.arKey.s, str_index.s, str_length) == 0) { return SUCCESS; } zend_u_hash_del(ht, IS_STRING, str_index, str_length); @@ -1316,7 +1308,7 @@ real_length = str_length * sizeof(UChar); if (p->nKeyLength == str_length && p->key.type == IS_UNICODE && - memcmp(p->key.u.string, str_index, real_length) == 0) { + memcmp(p->key.arKey.u, str_index.u, real_length) == 0) { return SUCCESS; } zend_u_hash_del(ht, IS_UNICODE, str_index, str_length); @@ -1370,12 +1362,12 @@ if (key_type == HASH_KEY_IS_LONG) { p->h = num_index; } else if (key_type == HASH_KEY_IS_UNICODE) { - memcpy(p->key.u.unicode, str_index, real_length); - p->key.type = IS_UNICODE; + memcpy(p->key.arKey.u, str_index.u, real_length); + p->key.type = IS_UNICODE; p->h = zend_u_inline_hash_func(IS_UNICODE, str_index, str_length); } else { - memcpy(p->key.u.string, str_index, real_length); - p->key.type = IS_STRING; + memcpy(p->key.arKey.s, str_index.s, real_length); + p->key.type = IS_STRING; p->h = zend_u_inline_hash_func(p->key.type, str_index, str_length); } @@ -1496,7 +1488,7 @@ result = p1->nKeyLength - p2->nKeyLength; } if (result==0) { - result = memcmp(&p1->key.u, &p2->key.u, REAL_KEY_SIZE(p1->key.type, p1->nKeyLength)); + result = memcmp(p1->key.arKey.s, p2->key.arKey.s, REAL_KEY_SIZE(p1->key.type, p1->nKeyLength)); } if (result!=0) { HASH_UNPROTECT_RECURSION(ht1); @@ -1513,7 +1505,7 @@ return 1; } } else { /* string, binary or unicode index */ - if (zend_u_hash_find(ht2, p1->key.type, &p1->key.u, p1->nKeyLength, &pData2)==FAILURE) { + if (zend_u_hash_find(ht2, p1->key.type, (zstr)p1->key.arKey.s, p1->nKeyLength, &pData2)==FAILURE) { HASH_UNPROTECT_RECURSION(ht1); HASH_UNPROTECT_RECURSION(ht2); return 1; @@ -1610,7 +1602,7 @@ #define HANDLE_U_NUMERIC(key, length, func) { \ register UChar *tmp=key; \ - register int32_t val; \ + register int val; \ \ if (*tmp=='-') { \ tmp++; \ @@ -1645,60 +1637,60 @@ } while (0); \ } -ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) +ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest) { if (type == IS_STRING) { - HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); + HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); } else if (type == IS_UNICODE) { - HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); + HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_update(ht, idx, pData, nDataSize, pDest)); } return zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest); } -ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) { if (type == IS_STRING) { - HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_del(ht, idx)); + HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_del(ht, idx)); } else if (type == IS_UNICODE) { - HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_del(ht, idx)); + HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_del(ht, idx)); } return zend_u_hash_del(ht, type, arKey, nKeyLength); } -ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData) +ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData) { if (type == IS_STRING) { - HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); + HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_find(ht, idx, pData)); } else if (type == IS_UNICODE) { - HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_find(ht, idx, pData)); + HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_find(ht, idx, pData)); } return zend_u_hash_find(ht, type, arKey, nKeyLength, pData); } -ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) { if (type == IS_STRING) { - HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_index_exists(ht, idx)); + HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_index_exists(ht, idx)); } else if (type == IS_UNICODE) { - HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_index_exists(ht, idx)); + HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_index_exists(ht, idx)); } return zend_u_hash_exists(ht, type, arKey, nKeyLength); } -ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength) +ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength) { zend_uchar key_type; if (type == IS_STRING) { key_type = HASH_KEY_IS_STRING; - HANDLE_NUMERIC((char*)arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx)); - } else if (type == IS_UNICODE) { + HANDLE_NUMERIC(arKey.s, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); + } else { key_type = HASH_KEY_IS_UNICODE; - HANDLE_U_NUMERIC((UChar*)arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx)); + HANDLE_U_NUMERIC(arKey.u, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); } return zend_hash_update_current_key(ht, key_type, arKey, nKeyLength, 0); } @@ -1734,8 +1726,8 @@ ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength) { - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, NULL, 0, idx)); - return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, arKey, nKeyLength, 0); + HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_update_current_key(ht, HASH_KEY_IS_LONG, (zstr)NULL, 0, idx)); + return zend_hash_update_current_key(ht, HASH_KEY_IS_STRING, (zstr)arKey, nKeyLength, 0); } ZEND_API void zend_hash_to_unicode(HashTable *ht, apply_func_t apply_func TSRMLS_DC) @@ -1755,17 +1747,17 @@ if ((*p)->key.type == IS_STRING) { UErrorCode status = U_ZERO_ERROR; UChar *u = NULL; - int32_t u_len; + int u_len; Bucket *q; - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (char*)(*p)->key.u.string, (*p)->nKeyLength-1, &status); + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &u, &u_len, (*p)->key.arKey.s, (*p)->nKeyLength-1, &status); - q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.u)+((u_len+1)*2), ht->persistent); - memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.u)); - memcpy(q->key.u.unicode, u, (u_len+1)*2); + q = (Bucket *) pemalloc(sizeof(Bucket)-sizeof(q->key.arKey)+((u_len+1)*2), ht->persistent); + memcpy(q, *p, sizeof(Bucket)-sizeof(q->key.arKey)); + memcpy(q->key.arKey.u, u, (u_len+1)*2); q->key.type = IS_UNICODE; q->nKeyLength = u_len+1; - q->h = zend_u_inline_hash_func(IS_UNICODE, (void*)q->key.u.unicode, q->nKeyLength); + q->h = zend_u_inline_hash_func(IS_UNICODE, q->key.arKey, q->nKeyLength); if ((*p)->pData == &(*p)->pDataPtr) { q->pData = &q->pDataPtr; } @@ -1796,9 +1788,9 @@ p = ht->pListTail; while (p != NULL) { if (p->key.type == IS_UNICODE) { - /* TODO: ??? */ + /* FIXME: Unicode support??? */ } else { - zend_output_debug_string(0, "pListTail has key %s\n", p->key.u.string); + zend_output_debug_string(0, "pListTail has key %s\n", p->key.arKey.s); } p = p->pListLast; } @@ -1813,9 +1805,9 @@ p = ht->arBuckets[i]; while (p != NULL) { if (p->key.type == IS_UNICODE) { - /* TODO: ??? */ + /* FIXME: Unicode support??? */ } else { - zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.u.string, p->h); + zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.arKey.s, p->h); } p = p->pNext; } @@ -1824,9 +1816,9 @@ p = ht->pListTail; while (p != NULL) { if (p->key.type == IS_UNICODE) { - /* TODO: ??? */ + /* FIXME: Unicode support??? */ } else { - zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.u.string, p->h); + zend_output_debug_string(0, "%s <==> 0x%lX\n", p->key.arKey.s, p->h); } p = p->pListLast; } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_hash.h?r1=1.84&r2=1.85&diff_format=u Index: ZendEngine2/zend_hash.h diff -u ZendEngine2/zend_hash.h:1.84 ZendEngine2/zend_hash.h:1.85 --- ZendEngine2/zend_hash.h:1.84 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_hash.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.h,v 1.84 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_hash.h,v 1.85 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_HASH_H #define ZEND_HASH_H @@ -53,9 +53,9 @@ typedef struct _key { zend_uchar type; union { - char string[1]; /* Must be last element */ - UChar unicode[1]; /* Must be last element */ - } u; + char s[1]; /* Must be last element */ + UChar u[1]; /* Must be last element */ + } arKey; } HashKey; typedef struct bucket { @@ -94,10 +94,7 @@ ulong h; uint nKeyLength; zend_uchar type; - union { - char *string; - UChar *unicode; - } u; + zstr arKey; } zend_hash_key; @@ -121,7 +118,7 @@ /* additions/updates/changes */ ZEND_API int _zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); -ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_u_hash_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_update(ht, arKey, nKeyLength, pData, nDataSize, pDest) \ _zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_u_hash_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest) \ @@ -132,7 +129,7 @@ _zend_u_hash_add_or_update(ht, type, arKey, nKeyLength, pData, nDataSize, pDest, HASH_ADD ZEND_FILE_LINE_CC) ZEND_API int _zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); -ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); +ZEND_API int _zend_u_hash_quick_add_or_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC); #define zend_hash_quick_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest) \ _zend_hash_quick_add_or_update(ht, arKey, nKeyLength, h, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC) #define zend_u_hash_quick_update(ht, type, arKey, nKeyLength, h, pData, nDataSize, pDest) \ @@ -149,7 +146,7 @@ _zend_hash_index_update_or_next_insert(ht, 0, pData, nDataSize, pDest, HASH_NEXT_INSERT ZEND_FILE_LINE_CC) ZEND_API int zend_hash_add_empty_element(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength); +ZEND_API int zend_u_hash_add_empty_element(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength); #define ZEND_HASH_APPLY_KEEP 0 @@ -179,7 +176,7 @@ /* Deletes */ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); -ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, int flag); +ZEND_API int zend_u_hash_del_key_or_index(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, int flag); #define zend_hash_del(ht, arKey, nKeyLength) \ zend_hash_del_key_or_index(ht, arKey, nKeyLength, 0, HASH_DEL_KEY) #define zend_u_hash_del(ht, type, arKey, nKeyLength) \ @@ -188,20 +185,20 @@ zend_hash_del_key_or_index(ht, NULL, 0, h, HASH_DEL_INDEX) ZEND_API ulong zend_get_hash_value(char *arKey, uint nKeyLength); -ZEND_API ulong zend_u_get_hash_value(zend_uchar type, char *arKey, uint nKeyLength); +ZEND_API ulong zend_u_get_hash_value(zend_uchar type, zstr arKey, uint nKeyLength); /* Data retreival */ ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData); +ZEND_API int zend_u_hash_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData); ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData); -ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h, void **pData); +ZEND_API int zend_u_hash_quick_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h, void **pData); ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData); /* Misc */ ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength); +ZEND_API int zend_u_hash_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength); ZEND_API int zend_hash_quick_exists(HashTable *ht, char *arKey, uint nKeyLength, ulong h); -ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, ulong h); +ZEND_API int zend_u_hash_quick_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, ulong h); ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h); ZEND_API ulong zend_hash_next_free_element(HashTable *ht); @@ -211,12 +208,12 @@ (zend_hash_get_current_key_type_ex(ht, pos) == HASH_KEY_NON_EXISTANT ? FAILURE : SUCCESS) ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, zstr *str_index, uint *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos); ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos); ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, char *str_index, uint str_length, ulong num_index, HashPosition *pos); +ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zstr str_index, uint str_length, ulong num_index, HashPosition *pos); #define zend_hash_has_more_elements(ht) \ zend_hash_has_more_elements_ex(ht, NULL) @@ -315,10 +312,10 @@ } #define zend_u_inline_hash_func(type, arKey, nKeyLength) \ - zend_inline_hash_func(arKey, REAL_KEY_SIZE(type, nKeyLength)) + zend_inline_hash_func(arKey.s, REAL_KEY_SIZE(type, nKeyLength)) ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength); -ZEND_API ulong zend_u_hash_func(zend_uchar type, char *arKey, uint nKeyLength); +ZEND_API ulong zend_u_hash_func(zend_uchar type, zstr arKey, uint nKeyLength); #if ZEND_DEBUG /* debug */ @@ -341,11 +338,11 @@ ZEND_API int zend_symtable_exists(HashTable *ht, char *arKey, uint nKeyLength); ZEND_API int zend_symtable_update_current_key(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest); -ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength); -ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength); -ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, void *arKey, uint nKeyLength); +ZEND_API int zend_u_symtable_update(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest); +ZEND_API int zend_u_symtable_del(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength); +ZEND_API int zend_u_symtable_find(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength, void **pData); +ZEND_API int zend_u_symtable_exists(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength); +ZEND_API int zend_u_symtable_update_current_key(HashTable *ht, zend_uchar type, zstr arKey, uint nKeyLength); #endif /* ZEND_HASH_H */ http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_highlight.c?r1=1.56&r2=1.57&diff_format=u Index: ZendEngine2/zend_highlight.c diff -u ZendEngine2/zend_highlight.c:1.56 ZendEngine2/zend_highlight.c:1.57 --- ZendEngine2/zend_highlight.c:1.56 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_highlight.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.56 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_highlight.c,v 1.57 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include <zend_language_parser.h> @@ -153,11 +153,11 @@ case T_DOC_COMMENT: break; default: - efree(Z_UNIVAL(token)); + efree(Z_UNIVAL(token).v); break; } } else if (token_type == T_END_HEREDOC) { - efree(Z_UNIVAL(token)); + efree(Z_UNIVAL(token).v); } Z_TYPE(token) = 0; } @@ -223,7 +223,7 @@ break; default: - efree(Z_UNIVAL(token)); + efree(Z_UNIVAL(token).v); break; } } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_ini.c?r1=1.44&r2=1.45&diff_format=u Index: ZendEngine2/zend_ini.c diff -u ZendEngine2/zend_ini.c:1.44 ZendEngine2/zend_ini.c:1.45 --- ZendEngine2/zend_ini.c:1.44 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_ini.c Tue Feb 21 20:12:41 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_ini.c,v 1.44 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_ini.c,v 1.45 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_qsort.h" @@ -135,7 +135,7 @@ return 1; } else { /* both strings */ /*FIXME: unicode hash*/ - return zend_binary_strcasecmp(f->key.u.string, f->nKeyLength, s->key.u.string, s->nKeyLength); + return zend_binary_strcasecmp(f->key.arKey.s, f->nKeyLength, s->key.arKey.s, s->nKeyLength); } } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_interfaces.c?r1=1.48&r2=1.49&diff_format=u Index: ZendEngine2/zend_interfaces.c diff -u ZendEngine2/zend_interfaces.c:1.48 ZendEngine2/zend_interfaces.c:1.49 --- ZendEngine2/zend_interfaces.c:1.48 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_interfaces.c Tue Feb 21 20:12:41 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.c,v 1.48 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_interfaces.c,v 1.49 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -76,7 +76,7 @@ if (!fn_proxy || !*fn_proxy) { if (zend_hash_find(function_table, function_name, function_name_len+1, (void **) &fcic.function_handler) == FAILURE) { /* error at c-level */ - zend_error(E_CORE_ERROR, "Couldn't find implementation for method %v%s%s", obj_ce ? (void*)obj_ce->name : EMPTY_STR, obj_ce ? "::" : "", function_name); + zend_error(E_CORE_ERROR, "Couldn't find implementation for method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name); } if (fn_proxy) { *fn_proxy = fcic.function_handler; @@ -93,7 +93,7 @@ if (!obj_ce) { obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL; } - zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? (void*)obj_ce->name : EMPTY_STR, obj_ce ? "::" : "", function_name); + zend_error(E_CORE_ERROR, "Couldn't execute method %v%s%s", obj_ce ? obj_ce->name : (zstr)EMPTY_STR, obj_ce ? "::" : "", function_name); } if (!retval_ptr_ptr) { if (retval) { @@ -176,7 +176,7 @@ /* {{{ zend_user_it_get_current_key_default */ #if 0 -static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int zend_user_it_get_current_key_default(zend_object_iterator *_iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { *int_key = _iter->index; return HASH_KEY_IS_LONG; @@ -185,7 +185,7 @@ /* }}} */ /* {{{ zend_user_it_get_current_key */ -ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { zend_user_iterator *iter = (zend_user_iterator*)_iter; zval *object = (zval*)iter->it.data; @@ -210,13 +210,13 @@ return HASH_KEY_IS_LONG; case IS_STRING: - *str_key = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + str_key->s = estrndup(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); *str_key_len = Z_STRLEN_P(retval)+1; zval_ptr_dtor(&retval); return HASH_KEY_IS_STRING; case IS_UNICODE: - *str_key = (char*)eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); + str_key->u = eustrndup(Z_USTRVAL_P(retval), Z_USTRLEN_P(retval)); *str_key_len = Z_USTRLEN_P(retval)+1; zval_ptr_dtor(&retval); return HASH_KEY_IS_UNICODE; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_interfaces.h?r1=1.19&r2=1.20&diff_format=u Index: ZendEngine2/zend_interfaces.h diff -u ZendEngine2/zend_interfaces.h:1.19 ZendEngine2/zend_interfaces.h:1.20 --- ZendEngine2/zend_interfaces.h:1.19 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_interfaces.h Tue Feb 21 20:12:41 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_interfaces.h,v 1.19 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_interfaces.h,v 1.20 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_INTERFACES_H #define ZEND_INTERFACES_H @@ -51,7 +51,7 @@ ZEND_API void zend_user_it_rewind(zend_object_iterator *_iter TSRMLS_DC); ZEND_API int zend_user_it_valid(zend_object_iterator *_iter TSRMLS_DC); -ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); +ZEND_API int zend_user_it_get_current_key(zend_object_iterator *_iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); ZEND_API void zend_user_it_get_current_data(zend_object_iterator *_iter, zval ***data TSRMLS_DC); ZEND_API void zend_user_it_move_forward(zend_object_iterator *_iter TSRMLS_DC); ZEND_API void zend_user_it_invalidate_current(zend_object_iterator *_iter TSRMLS_DC); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_iterators.c?r1=1.15&r2=1.16&diff_format=u Index: ZendEngine2/zend_iterators.c diff -u ZendEngine2/zend_iterators.c:1.15 ZendEngine2/zend_iterators.c:1.16 --- ZendEngine2/zend_iterators.c:1.15 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_iterators.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.c,v 1.15 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_iterators.c,v 1.16 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" @@ -51,8 +51,8 @@ ZEND_API void zend_register_iterator_wrapper(TSRMLS_D) { INIT_CLASS_ENTRY(zend_iterator_class_entry, "__iterator_wrapper", NULL); - free(zend_iterator_class_entry.name); - zend_iterator_class_entry.name = "__iterator_wrapper"; + free(zend_iterator_class_entry.name.s); + zend_iterator_class_entry.name.s = "__iterator_wrapper"; } static void iter_wrapper_dtor(void *object, zend_object_handle handle TSRMLS_DC) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_iterators.h?r1=1.13&r2=1.14&diff_format=u Index: ZendEngine2/zend_iterators.h diff -u ZendEngine2/zend_iterators.h:1.13 ZendEngine2/zend_iterators.h:1.14 --- ZendEngine2/zend_iterators.h:1.13 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_iterators.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_iterators.h,v 1.13 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_iterators.h,v 1.14 2006/02/21 20:12:41 dmitry Exp $ */ /* These iterators were designed to operate within the foreach() * structures provided by the engine, but could be extended for use @@ -39,7 +39,7 @@ void (*get_current_data)(zend_object_iterator *iter, zval ***data TSRMLS_DC); /* fetch the key for the current element (return HASH_KEY_IS_STRING or HASH_KEY_IS_LONG) (optional, may be NULL) */ - int (*get_current_key)(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); + int (*get_current_key)(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); /* step forwards to next element */ void (*move_forward)(zend_object_iterator *iter TSRMLS_DC); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_language_scanner.l?r1=1.146&r2=1.147&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.146 ZendEngine2/zend_language_scanner.l:1.147 --- ZendEngine2/zend_language_scanner.l:1.146 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_language_scanner.l Tue Feb 21 20:12:41 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.146 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.147 2006/02/21 20:12:41 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -370,7 +370,7 @@ } } -static inline int zend_uchar_from_uname(UChar *name, int32_t name_len, UChar32 *c) +static inline int zend_uchar_from_uname(UChar *name, int name_len, UChar32 *c) { UChar32 codepoint = 0; UErrorCode status = U_ZERO_ERROR; @@ -413,7 +413,7 @@ static inline int zend_copy_string_value(zval *zendlval, char *str, zend_uint str_len, zend_uchar type TSRMLS_DC) { UErrorCode status = U_ZERO_ERROR; - int32_t consumed = 0; + int consumed = 0; if (type == IS_UNICODE) { consumed = zend_convert_scanner_output(&Z_USTRVAL_P(zendlval), &Z_USTRLEN_P(zendlval), str, str_len, &status TSRMLS_CC); @@ -436,7 +436,7 @@ static inline int zend_check_and_normalize_identifier(zval *zendlval) { UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_is_valid_identifier(Z_USTRVAL_P(zendlval), Z_USTRLEN_P(zendlval))) { zend_error(E_COMPILE_WARNING, "Invalid identifier syntax: %r", Z_USTRVAL_P(zendlval)); @@ -621,7 +621,7 @@ return zend_set_converter_encoding(&SCNG(output_conv), encoding); } -ZEND_API int32_t zend_convert_scanner_output(UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status TSRMLS_DC) +ZEND_API int zend_convert_scanner_output(UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status TSRMLS_DC) { const char *source_consumed = NULL; @@ -1891,13 +1891,13 @@ } <ST_IN_SCRIPTING>"__CLASS__" { - char *class_name = NULL; + zstr class_name = (zstr)NULL; if (CG(active_class_entry)) { class_name = CG(active_class_entry)->name; } - if (!class_name) { + if (!class_name.v) { ZVAL_EMPTY_TEXT(zendlval); } else { ZVAL_TEXT(zendlval, class_name, 1); @@ -1906,16 +1906,13 @@ } <ST_IN_SCRIPTING>"__FUNCTION__" { - char *func_name = NULL; + zstr func_name = (zstr)NULL; if (CG(active_op_array)) { func_name = CG(active_op_array)->function_name; } - if (!func_name) { - func_name = ""; - } - if (!func_name) { + if (!func_name.v) { ZVAL_EMPTY_TEXT(zendlval); } else { ZVAL_TEXT(zendlval, func_name, 1); @@ -1924,47 +1921,47 @@ } <ST_IN_SCRIPTING>"__METHOD__" { - char *class_name = CG(active_class_entry) ? CG(active_class_entry)->name : NULL; - char *func_name = CG(active_op_array)? CG(active_op_array)->function_name : NULL; + zstr class_name = CG(active_class_entry) ? CG(active_class_entry)->name : (zstr)NULL; + zstr func_name = CG(active_op_array)? CG(active_op_array)->function_name : (zstr)NULL; size_t len = 0; if (UG(unicode)) { size_t len1; - if (class_name) { - len += len1 = u_strlen((UChar*)class_name); + if (class_name.u) { + len += len1 = u_strlen(class_name.u); len += 2; } - if (func_name) { - len += u_strlen((UChar*)func_name); + if (func_name.u) { + len += u_strlen(func_name.u); } else { - func_name = (char*)EMPTY_STR; + func_name.u = EMPTY_STR; } Z_USTRLEN_P(zendlval) = len; Z_USTRVAL_P(zendlval) = eumalloc(len+1); - if (class_name) { - u_strcpy(Z_USTRVAL_P(zendlval), (UChar*)class_name); + if (class_name.u) { + u_strcpy(Z_USTRVAL_P(zendlval), class_name.u); Z_USTRVAL_P(zendlval)[len1] = 0x3a; /* ':' */ Z_USTRVAL_P(zendlval)[len1+1] = 0x3a; /* ':' */ Z_USTRVAL_P(zendlval)[len1+2] = 0; } else { Z_USTRVAL_P(zendlval)[0] = 0; } - u_strcat(Z_USTRVAL_P(zendlval), (UChar*)func_name); + u_strcat(Z_USTRVAL_P(zendlval), func_name.u); Z_TYPE_P(zendlval) = IS_UNICODE; } else { - if (class_name) { - len += strlen(class_name) + 2; + if (class_name.s) { + len += strlen(class_name.s) + 2; } - if (func_name) { - len += strlen(func_name); + if (func_name.s) { + len += strlen(func_name.s); } Z_STRVAL_P(zendlval) = emalloc(len+1); Z_STRLEN_P(zendlval) = sprintf(Z_STRVAL_P(zendlval), "%s%s%s", - class_name ? class_name : "", - class_name && func_name ? "::" : "", - func_name ? func_name : "" + class_name.s ? class_name.s : "", + class_name.s && func_name.s ? "::" : "", + func_name.s ? func_name.s : "" ); Z_STRLEN_P(zendlval) = strlen(Z_STRVAL_P(zendlval)); Z_TYPE_P(zendlval) = IS_STRING; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_list.c?r1=1.69&r2=1.70&diff_format=u Index: ZendEngine2/zend_list.c diff -u ZendEngine2/zend_list.c:1.69 ZendEngine2/zend_list.c:1.70 --- ZendEngine2/zend_list.c:1.69 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_list.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_list.c,v 1.69 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_list.c,v 1.70 2006/02/21 20:12:41 dmitry Exp $ */ /* resource lists */ @@ -115,7 +115,7 @@ va_list resource_types; int i; char *space; - char *class_name; + zstr class_name; if (default_id==-1) { /* use id */ if (!passed_id) { http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_object_handlers.c?r1=1.159&r2=1.160&diff_format=u Index: ZendEngine2/zend_object_handlers.c diff -u ZendEngine2/zend_object_handlers.c:1.159 ZendEngine2/zend_object_handlers.c:1.160 --- ZendEngine2/zend_object_handlers.c:1.159 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_object_handlers.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.c,v 1.159 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_object_handlers.c,v 1.160 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -245,30 +245,30 @@ } -ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC) +ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name TSRMLS_DC) { zend_property_info *property_info; - char *class_name, *prop_name; + zstr class_name, prop_name; zval member; zend_u_unmangle_property_name(utype, prop_info_name, &class_name, &prop_name); if (utype == IS_UNICODE) { - ZVAL_UNICODE(&member, (UChar*)prop_name, 0); + ZVAL_UNICODE(&member, prop_name.u, 0); } else { - ZVAL_STRING(&member, prop_name, 0); + ZVAL_STRING(&member, prop_name.s, 0); } property_info = zend_get_property_info(zobj->ce, &member, 1 TSRMLS_CC); if (!property_info) { return FAILURE; } - if (class_name && class_name[0] != '*') { + if (class_name.s && class_name.s[0] != '*') { if (!(property_info->flags & ZEND_ACC_PRIVATE)) { /* we we're looking for a private prop but found a non private one of the same name */ return FAILURE; - } else if (!UG(unicode) && strcmp((char*)prop_info_name+1, property_info->name+1)) { + } else if (!UG(unicode) && strcmp(prop_info_name.s+1, property_info->name.s+1)) { /* we we're looking for a private prop but found a private one of the same name but another class */ return FAILURE; - } else if (UG(unicode) && u_strcmp(((UChar*)prop_info_name)+1, ((UChar*)property_info->name)+1)) { + } else if (UG(unicode) && u_strcmp(prop_info_name.u+1, property_info->name.u+1)) { /* we we're looking for a private prop but found a private one of the same name but another class */ return FAILURE; } @@ -285,7 +285,7 @@ property_info = &info; info.name = Z_UNIVAL_P(member); info.name_length = Z_UNILEN_P(member); - info.h = zend_u_get_hash_value(Z_TYPE_P(member), Z_STRVAL_P(member), Z_STRLEN_P(member) + 1); + info.h = zend_u_get_hash_value(Z_TYPE_P(member), Z_UNIVAL_P(member), Z_UNILEN_P(member) + 1); } if (!zobj->guards) { ALLOC_HASHTABLE(zobj->guards); @@ -661,7 +661,7 @@ * Returns the function address that should be called, or NULL * if no such function exists. */ -static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) +static inline zend_function *zend_check_private_int(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) { if (!ce) { return 0; @@ -696,7 +696,7 @@ } -ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) +ZEND_API int zend_check_private(zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) { return zend_check_private_int(fbc, ce, function_name_strval, function_name_strlen TSRMLS_CC) != NULL; } @@ -731,12 +731,12 @@ } -static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int method_len TSRMLS_DC) +static union _zend_function *zend_std_get_method(zval **object_ptr, zstr method_name, int method_len TSRMLS_DC) { zend_object *zobj; zend_function *fbc; unsigned int lc_method_name_len; - char *lc_method_name; + zstr lc_method_name; zval *object = *object_ptr; /* FIXME: type is default */ @@ -747,7 +747,7 @@ zobj = Z_OBJ_P(object); if (zend_u_hash_find(&zobj->ce->function_table, type, lc_method_name, lc_method_name_len+1, (void **)&fbc) == FAILURE) { - efree(lc_method_name); + efree(lc_method_name.v); if (zobj->ce->__call) { zend_internal_function *call_user_call = emalloc(sizeof(zend_internal_function)); call_user_call->type = ZEND_INTERNAL_FUNCTION; @@ -758,9 +758,9 @@ call_user_call->scope = zobj->ce; call_user_call->fn_flags = 0; if (UG(unicode)) { - call_user_call->function_name = (char*)eustrndup((UChar*)method_name, method_len); + call_user_call->function_name.u = eustrndup(method_name.u, method_len); } else { - call_user_call->function_name = estrndup(method_name, method_len); + call_user_call->function_name.s = estrndup(method_name.s, method_len); } call_user_call->pass_rest_by_reference = 0; call_user_call->return_reference = ZEND_RETURN_VALUE; @@ -792,34 +792,34 @@ */ updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len TSRMLS_CC); if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } fbc = updated_fbc; } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(fbc->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } - efree(lc_method_name); + efree(lc_method_name.v); return fbc; } /* This is not (yet?) in the API, but it belongs in the built-in objects callbacks */ -ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC) +ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC) { zend_function *fbc; /* FIXME: type is default */ zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING; if (zend_u_hash_find(&ce->function_table, type, function_name_strval, function_name_strlen+1, (void **) &fbc)==FAILURE) { - char *class_name = ce->name; + zstr class_name = ce->name; - if (!class_name) { - class_name = (char*)EMPTY_STR; + if (!class_name.v) { + class_name.u = EMPTY_STR; } zend_error(E_ERROR, "Call to undefined method %R::%R()", type, class_name, type, function_name_strval); } @@ -839,14 +839,14 @@ */ updated_fbc = zend_check_private_int(fbc, EG(scope), function_name_strval, function_name_strlen TSRMLS_CC); if (!updated_fbc) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } fbc = updated_fbc; } else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(EG(scope), fbc->common.scope)) { - zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to %s method %v::%v() from context '%v'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } @@ -854,7 +854,7 @@ } -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC) +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC) { zval **retval = NULL; zend_class_entry *tmp_ce = ce; @@ -865,7 +865,7 @@ std_property_info.flags = ZEND_ACC_PUBLIC; std_property_info.name = property_name; std_property_info.name_length = property_name_len; - std_property_info.h = zend_get_hash_value(std_property_info.name, std_property_info.name_length+1); + std_property_info.h = zend_u_get_hash_value(UG(unicode)?IS_UNICODE:IS_STRING, std_property_info.name, std_property_info.name_length+1); property_info = &std_property_info; } @@ -896,7 +896,7 @@ } -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len TSRMLS_DC) +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC) { zend_error(E_ERROR, "Attempt to unset static property %v::$%R", ce->name, type, property_name); return 0; @@ -915,13 +915,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC) != EG(scope)) { - zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to private %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(constructor->common.scope, EG(scope))) { - zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error(E_ERROR, "Call to protected %v::%v() from context '%v'", constructor->common.scope->name, constructor->common.function_name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -1029,7 +1029,7 @@ return zobj->ce; } -int zend_std_object_get_class_name(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) +int zend_std_object_get_class_name(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC) { zend_object *zobj; zend_class_entry *ce; @@ -1046,9 +1046,9 @@ *class_name_len = ce->name_length; if (UG(unicode)) { - *class_name = (char*)eustrndup((UChar*)ce->name, ce->name_length); + class_name->u = eustrndup(ce->name.u, ce->name_length); } else { - *class_name = estrndup(ce->name, ce->name_length); + class_name->s = estrndup(ce->name.s, ce->name_length); } return SUCCESS; } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_object_handlers.h?r1=1.55&r2=1.56&diff_format=u Index: ZendEngine2/zend_object_handlers.h diff -u ZendEngine2/zend_object_handlers.h:1.55 ZendEngine2/zend_object_handlers.h:1.56 --- ZendEngine2/zend_object_handlers.h:1.55 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_object_handlers.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_object_handlers.h,v 1.55 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_object_handlers.h,v 1.56 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_OBJECT_HANDLERS_H #define ZEND_OBJECT_HANDLERS_H @@ -84,8 +84,8 @@ /* args on stack! */ /* Andi - EX(fbc) (function being called) needs to be initialized already in the INIT fcall opcode so that the parameters can be parsed the right way. We need to add another callback for this. */ -typedef int (*zend_object_call_method_t)(char *method, INTERNAL_FUNCTION_PARAMETERS); -typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, char *method, int method_len TSRMLS_DC); +typedef int (*zend_object_call_method_t)(zstr method, INTERNAL_FUNCTION_PARAMETERS); +typedef union _zend_function *(*zend_object_get_method_t)(zval **object_ptr, zstr method, int method_len TSRMLS_DC); typedef union _zend_function *(*zend_object_get_constructor_t)(zval *object TSRMLS_DC); /* Object maintenance/destruction */ @@ -95,7 +95,7 @@ typedef zend_object_value (*zend_object_clone_obj_t)(zval *object TSRMLS_DC); typedef zend_class_entry *(*zend_object_get_class_entry_t)(zval *object TSRMLS_DC); -typedef int (*zend_object_get_class_name_t)(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC); +typedef int (*zend_object_get_class_name_t)(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC); typedef int (*zend_object_compare_t)(zval *object1, zval *object2 TSRMLS_DC); /* Cast an object to some other type @@ -137,9 +137,9 @@ extern ZEND_API zend_object_handlers std_object_handlers; BEGIN_EXTERN_C() -ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); -ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len, zend_bool silent TSRMLS_DC); -ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, void *property_name, int property_name_len TSRMLS_DC); +ZEND_API union _zend_function *zend_std_get_static_method(zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC); +ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len, zend_bool silent TSRMLS_DC); +ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_uchar type, zstr property_name, int property_name_len TSRMLS_DC); ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC); ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int type TSRMLS_DC); @@ -148,11 +148,11 @@ #define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) #define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) -ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, char *function_name_strval, int function_name_strlen TSRMLS_DC); +ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zstr function_name_strval, int function_name_strlen TSRMLS_DC); ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); -ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, void *prop_info_name TSRMLS_DC); +ZEND_API int zend_check_property_access(zend_object *zobj, zend_uchar utype, zstr prop_info_name TSRMLS_DC); ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS); END_EXTERN_C() http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_objects.c?r1=1.62&r2=1.63&diff_format=u Index: ZendEngine2/zend_objects.c diff -u ZendEngine2/zend_objects.c:1.62 ZendEngine2/zend_objects.c:1.63 --- ZendEngine2/zend_objects.c:1.62 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_objects.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects.c,v 1.62 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_objects.c,v 1.63 2006/02/21 20:12:41 dmitry Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -44,7 +44,7 @@ zend_error(EG(in_execution) ? E_ERROR : E_WARNING, "Call to private %v::__destruct() from context '%v'%s", ce->name, - EG(scope) ? EG(scope)->name : (char*)EMPTY_STR, + EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR, EG(in_execution) ? "" : " during shutdown ignored"); return; } @@ -57,7 +57,7 @@ zend_error(EG(in_execution) ? E_ERROR : E_WARNING, "Call to protected %v::__destruct() from context '%v'%s", ce->name, - EG(scope) ? EG(scope)->name : (char*)EMPTY_STR, + EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR, EG(in_execution) ? "" : " during shutdown ignored"); return; } http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_opcode.c?r1=1.117&r2=1.118&diff_format=u Index: ZendEngine2/zend_opcode.c diff -u ZendEngine2/zend_opcode.c:1.117 ZendEngine2/zend_opcode.c:1.118 --- ZendEngine2/zend_opcode.c:1.117 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_opcode.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_opcode.c,v 1.117 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_opcode.c,v 1.118 2006/02/21 20:12:41 dmitry Exp $ */ #include <stdio.h> @@ -75,7 +75,7 @@ op_array->T = 0; - op_array->function_name = NULL; + op_array->function_name.v = NULL; op_array->filename = zend_get_compiled_filename(TSRMLS_C); op_array->script_encoding = zend_get_compiled_script_encoding(TSRMLS_C); op_array->doc_comment = NULL; @@ -171,7 +171,7 @@ zend_hash_destroy(&ce->default_properties); zend_hash_destroy(&ce->properties_info); zend_hash_destroy(&ce->default_static_members); - efree(ce->name); + efree(ce->name.v); zend_hash_destroy(&ce->function_table); zend_hash_destroy(&ce->constants_table); if (ce->num_interfaces > 0 && ce->interfaces) { @@ -186,7 +186,7 @@ zend_hash_destroy(&ce->default_properties); zend_hash_destroy(&ce->properties_info); zend_hash_destroy(&ce->default_static_members); - free(ce->name); + free(ce->name.v); zend_hash_destroy(&ce->function_table); zend_hash_destroy(&ce->constants_table); if (ce->num_interfaces > 0) { @@ -226,7 +226,7 @@ i = op_array->last_var; while (i > 0) { i--; - efree(op_array->vars[i].name); + efree(op_array->vars[i].name.v); } efree(op_array->vars); } @@ -248,8 +248,8 @@ } efree(op_array->opcodes); - if (op_array->function_name) { - efree(op_array->function_name); + if (op_array->function_name.v) { + efree(op_array->function_name.v); } if (op_array->doc_comment) { efree(op_array->doc_comment); @@ -265,9 +265,9 @@ } if (op_array->arg_info) { for (i=0; i<op_array->num_args; i++) { - efree(op_array->arg_info[i].name); - if (op_array->arg_info[i].class_name) { - efree(op_array->arg_info[i].class_name); + efree(op_array->arg_info[i].name.v); + if (op_array->arg_info[i].class_name.v) { + efree(op_array->arg_info[i].class_name.v); } } efree(op_array->arg_info); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_operators.c?r1=1.233&r2=1.234&diff_format=u Index: ZendEngine2/zend_operators.c diff -u ZendEngine2/zend_operators.c:1.233 ZendEngine2/zend_operators.c:1.234 --- ZendEngine2/zend_operators.c:1.233 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_operators.c Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.c,v 1.233 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_operators.c,v 1.234 2006/02/21 20:12:41 dmitry Exp $ */ #include <ctype.h> @@ -621,7 +621,6 @@ break; case IS_RESOURCE: { long tmp = Z_LVAL_P(op); - TSRMLS_FETCH(); zend_list_delete(Z_LVAL_P(op)); Z_USTRVAL_P(op) = eumalloc_rel(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG + 1); @@ -629,20 +628,16 @@ break; } case IS_LONG: { - int32_t capacity = MAX_LENGTH_OF_LONG + 1; long lval = Z_LVAL_P(op); - Z_USTRVAL_P(op) = eumalloc_rel(capacity); + Z_USTRVAL_P(op) = eumalloc_rel(MAX_LENGTH_OF_LONG + 1); Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%ld", lval); break; } case IS_DOUBLE: { - int32_t capacity; double dval = Z_DVAL_P(op); - TSRMLS_FETCH(); - capacity = MAX_LENGTH_OF_DOUBLE + EG(precision) + 1; - Z_USTRVAL_P(op) = eumalloc_rel(capacity); + Z_USTRVAL_P(op) = eumalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); Z_USTRLEN_P(op) = u_sprintf(Z_USTRVAL_P(op), "%.*G", (int) EG(precision), dval); break; } @@ -653,8 +648,6 @@ Z_USTRLEN_P(op) = sizeof("Array")-1; break; case IS_OBJECT: { - TSRMLS_FETCH(); - convert_object_to_type(op, IS_UNICODE, convert_to_unicode); if (Z_TYPE_P(op) == IS_UNICODE) { @@ -1351,7 +1344,7 @@ assert(Z_TYPE_P(op1) == Z_TYPE_P(op2)); if (Z_TYPE_P(op1) == IS_UNICODE) { - int32_t length = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2); + int length = Z_USTRLEN_P(op1) + Z_USTRLEN_P(op2); Z_USTRVAL_P(result) = eurealloc(Z_USTRVAL_P(op1), length+1); u_memcpy(Z_USTRVAL_P(result)+Z_USTRLEN_P(op1), Z_USTRVAL_P(op2), Z_USTRLEN_P(op2)); @@ -2077,11 +2070,11 @@ return zend_str_tolower_copy((char *)emalloc(length+1), source, length); } -ZEND_API void *zend_u_str_tolower_copy(zend_uchar type, void *dest, const void *source, unsigned int length) +ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length) { if (type == IS_UNICODE) { - register UChar *str = (UChar*)source; - register UChar *result = (UChar*)dest; + register UChar *str = source.u; + register UChar *result = dest.u; register UChar *end = str + length; while (str < end) { @@ -2091,16 +2084,16 @@ return dest; } else { - return zend_str_tolower_copy(dest, source, length); + return (zstr)zend_str_tolower_copy(dest.s, source.s, length); } } -ZEND_API void *zend_u_str_tolower_dup(zend_uchar type, const void *source, unsigned int length) +ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length) { if (type == IS_UNICODE) { - return zend_u_str_tolower_copy(IS_UNICODE, emalloc(UBYTES(length+1)), source, length); + return zend_u_str_tolower_copy(IS_UNICODE, (zstr)emalloc(UBYTES(length+1)), source, length); } else { - return zend_str_tolower_copy((char*)emalloc(length+1), (char*)source, length); + return (zstr)zend_str_tolower_copy((char*)emalloc(length+1), source.s, length); } } @@ -2115,9 +2108,9 @@ } } -ZEND_API void zend_u_str_tolower(zend_uchar type, void *str, unsigned int length) { +ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length) { if (type == IS_UNICODE) { - register UChar *p = (UChar*)str; + register UChar *p = str.u; register UChar *end = p + length; while (p < end) { @@ -2125,29 +2118,29 @@ p++; } } else { - zend_str_tolower((char*)str, length); + zend_str_tolower(str.s, length); } } -ZEND_API void *zend_u_str_case_fold(zend_uchar type, const void *source, unsigned int length, zend_bool normalize, unsigned int *new_len) +ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len) { if (type == IS_UNICODE) { UChar *ret; - int32_t ret_len; + int ret_len; if (normalize) { - zend_normalize_identifier(&ret, &ret_len, (UChar*)source, length, 1); + zend_normalize_identifier(&ret, &ret_len, source.u, length, 1); } else { UErrorCode status = U_ZERO_ERROR; - zend_case_fold_string(&ret, &ret_len, (UChar*)source, length, U_FOLD_CASE_DEFAULT, &status); + zend_case_fold_string(&ret, &ret_len, source.u, length, U_FOLD_CASE_DEFAULT, &status); } *new_len = ret_len; - return ret; + return (zstr)ret; } else { *new_len = length; - return zend_str_tolower_dup(source, length); + return (zstr)zend_str_tolower_dup(source.s, length); } } @@ -2164,9 +2157,9 @@ } -ZEND_API int zend_u_binary_strcmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2) +ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2) { - int32_t result = u_strCompare(s1, len1, s2, len2, 1); + int result = u_strCompare(s1, len1, s2, len2, 1); return ZEND_NORMALIZE_BOOL(result); } @@ -2184,11 +2177,11 @@ } -ZEND_API int zend_u_binary_strncmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length) +ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length) { int32_t off1 = 0, off2 = 0; UChar32 c1, c2; - int32_t result = 0; + int result = 0; for( ; length > 0; --length) { if (off1 >= len1 || off2 >= len2) { @@ -2226,10 +2219,10 @@ } -ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2) +ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2) { UErrorCode status = U_ZERO_ERROR; - int32_t result = u_strCaseCompare(s1, len1, s2, len2, U_COMPARE_CODE_POINT_ORDER, &status); + int result = u_strCaseCompare(s1, len1, s2, len2, U_COMPARE_CODE_POINT_ORDER, &status); return ZEND_NORMALIZE_BOOL(result); } @@ -2258,11 +2251,11 @@ * codepoints to compare, we take a hit upfront by iterating over both strings * until we find them. Then we can simply use u_strCaseCompare(). */ -ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length) +ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length) { UErrorCode status = U_ZERO_ERROR; int32_t off1 = 0, off2 = 0; - int32_t result; + int result; U16_FWD_N(s1, off1, len1, length); U16_FWD_N(s2, off2, len2, length); @@ -2433,7 +2426,7 @@ { double dval = Z_DVAL_P(op); UFILE *strf; - int32_t capacity; + int capacity; TSRMLS_FETCH(); @@ -2460,7 +2453,7 @@ { long lval = Z_LVAL_P(op); UFILE *strf; - int32_t capacity; + int capacity; capacity = MAX_LENGTH_OF_LONG + 1; Z_USTRVAL_P(op) = eumalloc_rel(capacity); http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_operators.h?r1=1.108&r2=1.109&diff_format=u Index: ZendEngine2/zend_operators.h diff -u ZendEngine2/zend_operators.h:1.108 ZendEngine2/zend_operators.h:1.109 --- ZendEngine2/zend_operators.h:1.108 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_operators.h Tue Feb 21 20:12:41 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_operators.h,v 1.108 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_operators.h,v 1.109 2006/02/21 20:12:41 dmitry Exp $ */ #ifndef ZEND_OPERATORS_H #define ZEND_OPERATORS_H @@ -137,9 +137,9 @@ return 0; } -static inline zend_uchar is_numeric_unicode(UChar *str, int32_t length, long *lval, double *dval, zend_bool allow_errors) +static inline zend_uchar is_numeric_unicode(UChar *str, int length, long *lval, double *dval, zend_bool allow_errors) { - int32_t local_lval; + long local_lval; double local_dval; UChar *end_ptr_long, *end_ptr_double; int conv_base=10; @@ -203,7 +203,7 @@ } static inline UChar* -zend_u_memnstr(UChar *haystack, UChar *needle, int32_t needle_len, UChar *end) +zend_u_memnstr(UChar *haystack, UChar *needle, int needle_len, UChar *end) { return u_strFindFirst(haystack, end - haystack, needle, needle_len); } @@ -275,11 +275,11 @@ ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, unsigned int length); ZEND_API char *zend_str_tolower_dup(const char *source, unsigned int length); -ZEND_API void zend_u_str_tolower(zend_uchar type, void *str, unsigned int length); -ZEND_API void *zend_u_str_tolower_copy(zend_uchar type, void *dest, const void *source, unsigned int length); -ZEND_API void *zend_u_str_tolower_dup(zend_uchar type, const void *source, unsigned int length); +ZEND_API void zend_u_str_tolower(zend_uchar type, zstr str, unsigned int length); +ZEND_API zstr zend_u_str_tolower_copy(zend_uchar type, zstr dest, zstr source, unsigned int length); +ZEND_API zstr zend_u_str_tolower_dup(zend_uchar type, zstr source, unsigned int length); -ZEND_API void *zend_u_str_case_fold(zend_uchar type, const void *source, unsigned int length, zend_bool normalize, unsigned int *new_len); +ZEND_API zstr zend_u_str_case_fold(zend_uchar type, zstr source, unsigned int length, zend_bool normalize, unsigned int *new_len); ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2); ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3); @@ -291,10 +291,10 @@ ZEND_API int zend_binary_strncasecmp(char *s1, uint len1, char *s2, uint len2, uint length); ZEND_API int zend_u_binary_zval_strcmp(zval *s1, zval *s2); -ZEND_API int zend_u_binary_strcmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2); -ZEND_API int zend_u_binary_strncmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length); -ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2); -ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int32_t len1, UChar *s2, int32_t len2, uint length); +ZEND_API int zend_u_binary_strcmp(UChar *s1, int len1, UChar *s2, int len2); +ZEND_API int zend_u_binary_strncmp(UChar *s1, int len1, UChar *s2, int len2, uint length); +ZEND_API int zend_u_binary_strcasecmp(UChar *s1, int len1, UChar *s2, int len2); +ZEND_API int zend_u_binary_strncasecmp(UChar *s1, int len1, UChar *s2, int len2, uint length); ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); ZEND_API void zendi_u_smart_strcmp(zval *result, zval *s1, zval *s2); @@ -388,8 +388,8 @@ #define Z_OBJPROP(zval) Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC) #define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf #define Z_RESVAL(zval) (zval).value.lval -#define Z_UNIVAL(zval) (Z_TYPE(zval)==IS_UNICODE?(char*)Z_USTRVAL(zval):Z_STRVAL(zval)) -#define Z_UNILEN(zval) (Z_TYPE(zval)==IS_UNICODE?Z_USTRLEN(zval):Z_STRLEN(zval)) +#define Z_UNIVAL(zval) ((zstr)(Z_STRVAL(zval))) +#define Z_UNILEN(zval) Z_STRLEN(zval) #define Z_LVAL_P(zval_p) Z_LVAL(*zval_p) #define Z_BVAL_P(zval_p) Z_BVAL(*zval_p) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_strtol.c?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/zend_strtol.c diff -u ZendEngine2/zend_strtol.c:1.1 ZendEngine2/zend_strtol.c:1.2 --- ZendEngine2/zend_strtol.c:1.1 Thu Aug 11 23:35:00 2005 +++ ZendEngine2/zend_strtol.c Tue Feb 21 20:12:41 2006 @@ -55,7 +55,7 @@ register UChar c; register unsigned long cutoff; register int neg = 0, any, cutlim; - register int32_t val; + register int val; /* * Skip white space and pick up leading +/- sign if any. http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.c?r1=1.7&r2=1.8&diff_format=u Index: ZendEngine2/zend_unicode.c diff -u ZendEngine2/zend_unicode.c:1.7 ZendEngine2/zend_unicode.c:1.8 --- ZendEngine2/zend_unicode.c:1.7 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_unicode.c Tue Feb 21 20:12:41 2006 @@ -29,39 +29,6 @@ ZEND_API zend_unicode_globals unicode_globals; #endif -static void zend_from_unicode_substitute_cb( - const void *context, - UConverterFromUnicodeArgs *toUArgs, - const char *codeUnits, - int32_t length, - UConverterCallbackReason reason, - UErrorCode *err - ) -{ - if (context == NULL) { - if (reason > UCNV_IRREGULAR) - { - return; - } - - *err = U_ZERO_ERROR; - //ucnv_cbFromUWriteSub(fromArgs, 0, err); - return; - } else if (*((char*)context)=='i') { - if (reason != UCNV_UNASSIGNED) - { - /* the caller must have set - * the error code accordingly - */ - return; - } else { - *err = U_ZERO_ERROR; - //ucnv_cbFromUWriteSub(fromArgs, 0, err); - return; - } - } -} - /* {{{ zend_set_converter_error_mode */ void zend_set_converter_error_mode(UConverter *conv, uint8_t error_mode) { @@ -178,7 +145,7 @@ /* }}} */ /* {{{ zend_convert_to_unicode */ -ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status) +ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status) { UChar *buffer = NULL; UChar *output; @@ -530,7 +497,7 @@ /* }}} */ /* {{{ zend_case_fold_string */ -ZEND_API void zend_case_fold_string(UChar **dest, int32_t *dest_len, UChar *src, int32_t src_len, uint32_t options, UErrorCode *status) +ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status) { UChar *buffer = NULL; int32_t buffer_len; @@ -555,7 +522,7 @@ /* }}} */ /* {{{ zend_normalize_identifier */ -ZEND_API int zend_normalize_identifier(UChar **dest, int32_t *dest_len, UChar *ident, int32_t ident_len, zend_bool fold_case) +ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case) { UChar *buffer = NULL; UChar *orig_ident = ident; http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_unicode.h?r1=1.7&r2=1.8&diff_format=u Index: ZendEngine2/zend_unicode.h diff -u ZendEngine2/zend_unicode.h:1.7 ZendEngine2/zend_unicode.h:1.8 --- ZendEngine2/zend_unicode.h:1.7 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_unicode.h Tue Feb 21 20:12:41 2006 @@ -42,7 +42,7 @@ /* API functions */ -ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status); +ZEND_API void zend_convert_to_unicode(UConverter *conv, UChar **target, int *target_len, const char *source, int source_len, UErrorCode *status); ZEND_API void zend_convert_from_unicode(UConverter *conv, char **target, int32_t *target_len, const UChar *source, int32_t source_len, UErrorCode *status); ZEND_API void zend_convert_encodings(UConverter *target_conv, UConverter *source_conv, char **target, int32_t *target_len, const char *source, int32_t source_len, UErrorCode *status); ZEND_API int zval_string_to_unicode_ex(zval *string, UConverter *conv); @@ -52,10 +52,10 @@ ZEND_API int zend_cmp_unicode_and_string(UChar *ustr, char* str, uint len); ZEND_API int zend_cmp_unicode_and_literal(UChar *ustr, int32_t ulen, char* str, int32_t slen); -ZEND_API void zend_case_fold_string(UChar **dest, int32_t *dest_len, UChar *src, int32_t src_len, uint32_t options, UErrorCode *status); +ZEND_API void zend_case_fold_string(UChar **dest, int *dest_len, UChar *src, int src_len, uint32_t options, UErrorCode *status); ZEND_API int zend_is_valid_identifier(UChar *ident, int32_t ident_len); -ZEND_API int zend_normalize_identifier(UChar **dest, int32_t *dest_len, UChar *ident, int32_t ident_len, zend_bool fold_case); +ZEND_API int zend_normalize_identifier(UChar **dest, int *dest_len, UChar *ident, int ident_len, zend_bool fold_case); /* * Function to get a codepoint at position n. Iterates over codepoints starting from the @@ -94,7 +94,7 @@ #define USTR_FREE(ustr) do { if (ustr) { efree(ustr); } } while (0); #define UBYTES(len) ((len) * sizeof(UChar)) -#define USTR_LEN(str) (UG(unicode)?u_strlen((UChar*)(str)):strlen((char*)(str))) +#define USTR_LEN(str) (UG(unicode)?u_strlen((str).u):strlen((str).s)) #define USTR_MAKE(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_CC) #define USTR_MAKE_REL(cs) zend_ascii_to_unicode(cs, sizeof(cs) ZEND_FILE_LINE_RELAY_CC) http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_def.h?r1=1.97&r2=1.98&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.97 ZendEngine2/zend_vm_def.h:1.98 --- ZendEngine2/zend_vm_def.h:1.97 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_vm_def.h Tue Feb 21 20:12:41 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.97 2006/02/21 08:00:39 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.98 2006/02/21 20:12:41 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1657,7 +1657,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ @@ -1720,7 +1720,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(OP2_TYPE != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (OP2_TYPE == IS_CONST); zend_free_op free_op2; @@ -1740,7 +1740,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); FREE_OP2(); } } else { @@ -1766,7 +1766,7 @@ zend_op *opline = EX(opline); zval *function_name; zend_function *function; - void *function_name_strval, *lcname; + zstr function_name_strval, lcname; unsigned int function_name_strlen, lcname_len; zend_free_op free_op2; @@ -1784,13 +1784,13 @@ function_name_strval = Z_UNIVAL_P(function_name); function_name_strlen = Z_UNILEN_P(function_name); - lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len); + lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) { - efree(lcname); + efree(lcname.v); zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval); } - efree(lcname); + efree(lcname.v); if (OP2_TYPE != IS_CONST) { FREE_OP2(); } @@ -1820,8 +1820,8 @@ ZEND_VM_NEXT_OPCODE(); /* Never reached */ } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { - zend_error(E_NOTICE, "Function %s%s%s() is deprecated", - EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + zend_error(E_NOTICE, "Function %v%s%v() is deprecated", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR, EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } @@ -1951,7 +1951,7 @@ } if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - efree(EX(function_state).function->common.function_name); + efree(EX(function_state).function->common.function_name.v); } efree(EX(fbc)); @@ -2068,7 +2068,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { zval *ret; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -2076,13 +2076,13 @@ INIT_PZVAL_COPY(ret, retval_ptr); dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (!IS_OP1_TMP_FREE()) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || @@ -2291,7 +2291,7 @@ if (zend_ptr_stack_get_arg(arg_num, (void **) &param TSRMLS_CC)==FAILURE) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_execute_data *ptr = EX(prev_execute_data); zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); @@ -2509,13 +2509,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -2873,7 +2873,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) && - !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { + !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { ex->CVs[i] = NULL; break; } @@ -2922,20 +2922,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -2953,7 +2953,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -2962,7 +2962,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -3131,7 +3131,7 @@ if (ce) { zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; zend_uchar key_type; @@ -3168,7 +3168,7 @@ zend_free_op free_op1; zval *array = GET_OP1_ZVAL_PTR(BP_VAR_R); zval **value; - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; HashTable *fe_ht; @@ -3185,7 +3185,7 @@ ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); case ZEND_ITER_PLAIN_OBJECT: { - char *class_name, *prop_name; + zstr class_name, prop_name; zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); fe_ht = HASH_OF(array); @@ -3201,11 +3201,11 @@ if (use_key) { zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name); if (key_type == HASH_KEY_IS_UNICODE) { - str_key_len = u_strlen((UChar*)prop_name); - str_key = (char*)eustrndup((UChar*)prop_name, str_key_len); + str_key_len = u_strlen(prop_name.u); + str_key.u = eustrndup(prop_name.u, str_key_len); } else { - str_key_len = strlen(prop_name); - str_key = estrndup(prop_name, str_key_len); + str_key_len = strlen(prop_name.s); + str_key.s = estrndup(prop_name.s, str_key_len); } str_key_len++; } @@ -3289,12 +3289,12 @@ switch (key_type) { case HASH_KEY_IS_STRING: - Z_STRVAL_P(key) = str_key; + Z_STRVAL_P(key) = str_key.s; Z_STRLEN_P(key) = str_key_len-1; Z_TYPE_P(key) = IS_STRING; break; case HASH_KEY_IS_UNICODE: - Z_USTRVAL_P(key) = (UChar*)str_key; + Z_USTRVAL_P(key) = str_key.u; Z_USTRLEN_P(key) = str_key_len-1; Z_TYPE_P(key) = IS_UNICODE; break; @@ -3400,20 +3400,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -3422,7 +3421,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -3799,7 +3798,7 @@ zval var_copy; int use_copy; UChar *norm; - int32_t norm_len; + int norm_len; zend_make_unicode_zval(result, &var_copy, &use_copy); if (use_copy) { http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_vm_execute.h?r1=1.101&r2=1.102&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.101 ZendEngine2/zend_vm_execute.h:1.102 --- ZendEngine2/zend_vm_execute.h:1.101 Tue Feb 21 08:00:39 2006 +++ ZendEngine2/zend_vm_execute.h Tue Feb 21 20:12:41 2006 @@ -146,8 +146,8 @@ ZEND_VM_NEXT_OPCODE(); /* Never reached */ } if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) { - zend_error(E_NOTICE, "Function %s%s%s() is deprecated", - EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "", + zend_error(E_NOTICE, "Function %v%s%v() is deprecated", + EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : (zstr)EMPTY_STR, EX(function_state).function->common.scope ? "::" : "", EX(function_state).function->common.function_name); } @@ -277,7 +277,7 @@ } if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) { - efree(EX(function_state).function->common.function_name); + efree(EX(function_state).function->common.function_name.v); } efree(EX(fbc)); @@ -367,7 +367,7 @@ if (zend_ptr_stack_get_arg(arg_num, (void **) &param TSRMLS_CC)==FAILURE) { char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); zend_execute_data *ptr = EX(prev_execute_data); zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC); @@ -654,7 +654,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(IS_CONST != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (IS_CONST == IS_CONST); @@ -674,7 +674,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); } } else { @@ -700,7 +700,7 @@ zend_op *opline = EX(opline); zval *function_name; zend_function *function; - void *function_name_strval, *lcname; + zstr function_name_strval, lcname; unsigned int function_name_strlen, lcname_len; @@ -718,13 +718,13 @@ function_name_strval = Z_UNIVAL_P(function_name); function_name_strlen = Z_UNILEN_P(function_name); - lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len); + lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) { - efree(lcname); + efree(lcname.v); zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval); } - efree(lcname); + efree(lcname.v); if (IS_CONST != IS_CONST) { } @@ -841,7 +841,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(IS_TMP_VAR != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (IS_TMP_VAR == IS_CONST); zend_free_op free_op2; @@ -861,7 +861,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); zval_dtor(free_op2.var); } } else { @@ -887,7 +887,7 @@ zend_op *opline = EX(opline); zval *function_name; zend_function *function; - void *function_name_strval, *lcname; + zstr function_name_strval, lcname; unsigned int function_name_strlen, lcname_len; zend_free_op free_op2; @@ -905,13 +905,13 @@ function_name_strval = Z_UNIVAL_P(function_name); function_name_strlen = Z_UNILEN_P(function_name); - lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len); + lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) { - efree(lcname); + efree(lcname.v); zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval); } - efree(lcname); + efree(lcname.v); if (IS_TMP_VAR != IS_CONST) { zval_dtor(free_op2.var); } @@ -965,7 +965,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(IS_VAR != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (IS_VAR == IS_CONST); zend_free_op free_op2; @@ -985,7 +985,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } } else { @@ -1011,7 +1011,7 @@ zend_op *opline = EX(opline); zval *function_name; zend_function *function; - void *function_name_strval, *lcname; + zstr function_name_strval, lcname; unsigned int function_name_strlen, lcname_len; zend_free_op free_op2; @@ -1029,13 +1029,13 @@ function_name_strval = Z_UNIVAL_P(function_name); function_name_strlen = Z_UNILEN_P(function_name); - lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len); + lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) { - efree(lcname); + efree(lcname.v); zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval); } - efree(lcname); + efree(lcname.v); if (IS_VAR != IS_CONST) { if (free_op2.var) {zval_ptr_dtor(&free_op2.var);}; } @@ -1088,7 +1088,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(IS_UNUSED != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (IS_UNUSED == IS_CONST); @@ -1108,7 +1108,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); } } else { @@ -1169,7 +1169,7 @@ ce = EX_T(opline->op1.u.var).class_entry; if(IS_CV != IS_UNUSED) { - char *function_name_strval; + zstr function_name_strval; unsigned int function_name_strlen; zend_bool is_const = (IS_CV == IS_CONST); @@ -1189,7 +1189,7 @@ EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC); if (!is_const) { - efree(function_name_strval); + efree(function_name_strval.v); } } else { @@ -1215,7 +1215,7 @@ zend_op *opline = EX(opline); zval *function_name; zend_function *function; - void *function_name_strval, *lcname; + zstr function_name_strval, lcname; unsigned int function_name_strlen, lcname_len; @@ -1233,13 +1233,13 @@ function_name_strval = Z_UNIVAL_P(function_name); function_name_strlen = Z_UNILEN_P(function_name); - lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_STRVAL_P(function_name), function_name_strlen, 1, &lcname_len); + lcname = zend_u_str_case_fold(Z_TYPE_P(function_name), Z_UNIVAL_P(function_name), function_name_strlen, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(function_name), lcname, lcname_len+1, (void **) &function)==FAILURE) { - efree(lcname); + efree(lcname.v); zend_error_noreturn(E_ERROR, "Call to undefined function %R()", Z_TYPE_P(function_name), function_name_strval); } - efree(lcname); + efree(lcname.v); if (IS_CV != IS_CONST) { } @@ -1587,7 +1587,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { zval *ret; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -1595,13 +1595,13 @@ INIT_PZVAL_COPY(ret, retval_ptr); dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || @@ -1720,13 +1720,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -1959,7 +1959,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) && - !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { + !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { ex->CVs[i] = NULL; break; } @@ -2070,7 +2070,7 @@ if (ce) { zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; zend_uchar key_type; @@ -2216,7 +2216,7 @@ zval var_copy; int use_copy; UChar *norm; - int32_t norm_len; + int norm_len; zend_make_unicode_zval(result, &var_copy, &use_copy); if (use_copy) { @@ -4080,7 +4080,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { zval *ret; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -4088,13 +4088,13 @@ INIT_PZVAL_COPY(ret, retval_ptr); dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (!1) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || @@ -4220,13 +4220,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -4459,7 +4459,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) && - !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { + !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { ex->CVs[i] = NULL; break; } @@ -4570,7 +4570,7 @@ if (ce) { zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; zend_uchar key_type; @@ -4739,7 +4739,7 @@ zval var_copy; int use_copy; UChar *norm; - int32_t norm_len; + int norm_len; zend_make_unicode_zval(result, &var_copy, &use_copy); if (use_copy) { @@ -5043,7 +5043,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ @@ -5477,7 +5477,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ @@ -5913,7 +5913,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ @@ -6430,7 +6430,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ @@ -7080,7 +7080,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { zval *ret; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -7088,13 +7088,13 @@ INIT_PZVAL_COPY(ret, retval_ptr); dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || @@ -7317,13 +7317,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -7556,7 +7556,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) && - !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { + !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { ex->CVs[i] = NULL; break; } @@ -7667,7 +7667,7 @@ if (ce) { zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; zend_uchar key_type; @@ -7704,7 +7704,7 @@ zend_free_op free_op1; zval *array = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval **value; - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; HashTable *fe_ht; @@ -7721,7 +7721,7 @@ ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num); case ZEND_ITER_PLAIN_OBJECT: { - char *class_name, *prop_name; + zstr class_name, prop_name; zend_object *zobj = zend_objects_get_address(array TSRMLS_CC); fe_ht = HASH_OF(array); @@ -7737,11 +7737,11 @@ if (use_key) { zend_u_unmangle_property_name(key_type == HASH_KEY_IS_UNICODE?IS_UNICODE:IS_STRING, str_key, &class_name, &prop_name); if (key_type == HASH_KEY_IS_UNICODE) { - str_key_len = u_strlen((UChar*)prop_name); - str_key = (char*)eustrndup((UChar*)prop_name, str_key_len); + str_key_len = u_strlen(prop_name.u); + str_key.u = eustrndup(prop_name.u, str_key_len); } else { - str_key_len = strlen(prop_name); - str_key = estrndup(prop_name, str_key_len); + str_key_len = strlen(prop_name.s); + str_key.s = estrndup(prop_name.s, str_key_len); } str_key_len++; } @@ -7825,12 +7825,12 @@ switch (key_type) { case HASH_KEY_IS_STRING: - Z_STRVAL_P(key) = str_key; + Z_STRVAL_P(key) = str_key.s; Z_STRLEN_P(key) = str_key_len-1; Z_TYPE_P(key) = IS_STRING; break; case HASH_KEY_IS_UNICODE: - Z_USTRVAL_P(key) = (UChar*)str_key; + Z_USTRVAL_P(key) = str_key.u; Z_USTRLEN_P(key) = str_key_len-1; Z_TYPE_P(key) = IS_UNICODE; break; @@ -7966,7 +7966,7 @@ zval var_copy; int use_copy; UChar *norm; - int32_t norm_len; + int norm_len; zend_make_unicode_zval(result, &var_copy, &use_copy); if (use_copy) { @@ -8989,7 +8989,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ @@ -9185,20 +9185,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -9216,7 +9216,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -9225,7 +9225,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -9336,20 +9336,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -9358,7 +9357,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -10471,7 +10470,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ @@ -10669,20 +10668,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -10700,7 +10699,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -10709,7 +10708,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -10820,20 +10819,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -10842,7 +10840,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -11993,7 +11991,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1, free_op2; /* FIXME: type is default */ @@ -12191,20 +12189,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -12222,7 +12220,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -12231,7 +12229,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -12342,20 +12340,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -12364,7 +12361,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -13920,7 +13917,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op1; /* FIXME: type is default */ @@ -14116,20 +14113,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -14147,7 +14144,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -14156,7 +14153,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -14267,20 +14264,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -14289,7 +14285,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -14427,13 +14423,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -15122,7 +15118,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; /* FIXME: type is default */ @@ -15329,20 +15325,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -15360,7 +15356,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -15369,7 +15365,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -15478,20 +15474,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -15500,7 +15495,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -16259,7 +16254,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ @@ -16424,20 +16419,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -16455,7 +16450,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -16464,7 +16459,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -16573,20 +16568,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -16595,7 +16589,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -17354,7 +17348,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ @@ -17519,20 +17513,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -17550,7 +17544,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -17559,7 +17553,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -17668,20 +17662,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -17690,7 +17683,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -18814,7 +18807,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; /* FIXME: type is default */ @@ -18978,20 +18971,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -19009,7 +19002,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -19018,7 +19011,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -19127,20 +19120,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -19149,7 +19141,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -19730,7 +19722,7 @@ if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) { zval *ret; - char *class_name; + zstr class_name; zend_uint class_name_len; int dup; @@ -19738,13 +19730,13 @@ INIT_PZVAL_COPY(ret, retval_ptr); dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC); if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) { - zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", Z_OBJCE_P(retval_ptr)->name); + zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %v", class_name); } - zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", Z_OBJCE_P(retval_ptr)->name); + zend_error(E_STRICT, "Implicit cloning object of class '%v' because of 'zend.ze1_compatibility_mode'", class_name); Z_OBJVAL_P(ret) = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC); *EG(return_value_ptr_ptr) = ret; if (!dup) { - efree(class_name); + efree(class_name.v); } } else if (!0) { /* Not a temp var */ if (EG(active_op_array)->return_reference == ZEND_RETURN_REF || @@ -19959,13 +19951,13 @@ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (ce != EG(scope)) { - zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to private %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) { /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (!zend_check_protected(clone->common.scope, EG(scope))) { - zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (char*)EMPTY_STR); + zend_error_noreturn(E_ERROR, "Call to protected %v::__clone() from context '%v'", ce->name, EG(scope) ? EG(scope)->name : (zstr)EMPTY_STR); } } } @@ -20198,7 +20190,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == Z_UNILEN_P(varname) && - !memcmp(ex->op_array->vars[i].name, Z_UNIVAL_P(varname), Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { + !memcmp(ex->op_array->vars[i].name.v, Z_UNIVAL_P(varname).v, Z_TYPE_P(varname)==IS_UNICODE?UBYTES(Z_UNILEN_P(varname)):Z_UNILEN_P(varname))) { ex->CVs[i] = NULL; break; } @@ -20309,7 +20301,7 @@ if (ce) { zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC); while (zend_hash_has_more_elements(fe_ht) == SUCCESS) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; zend_uchar key_type; @@ -20459,7 +20451,7 @@ zval var_copy; int use_copy; UChar *norm; - int32_t norm_len; + int norm_len; zend_make_unicode_zval(result, &var_copy, &use_copy); if (use_copy) { @@ -21479,7 +21471,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; /* FIXME: type is default */ @@ -21674,20 +21666,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -21705,7 +21697,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -21714,7 +21706,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -21823,20 +21815,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -21845,7 +21836,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -22953,7 +22944,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ @@ -23150,20 +23141,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -23181,7 +23172,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -23190,7 +23181,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -23299,20 +23290,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -23321,7 +23311,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -24466,7 +24456,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; zend_free_op free_op2; /* FIXME: type is default */ @@ -24663,20 +24653,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -24694,7 +24684,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -24703,7 +24693,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -24812,20 +24802,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -24834,7 +24823,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -26383,7 +26372,7 @@ { zend_op *opline = EX(opline); zval *function_name; - char *function_name_strval; + zstr function_name_strval; int function_name_strlen; /* FIXME: type is default */ @@ -26578,20 +26567,20 @@ break; case IS_STRING: case IS_UNICODE: { - void *offset_key = Z_UNIVAL_P(offset); + zstr offset_key = Z_UNIVAL_P(offset); int offset_len = Z_UNILEN_P(offset); int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { - zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + offset_key.u, offset_len, 0)) { + zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key.u); + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -26609,7 +26598,7 @@ for (i = 0; i < ex->op_array->last_var; i++) { if (ex->op_array->vars[i].hash_value == hash_value && ex->op_array->vars[i].name_len == offset_len && - !memcmp(ex->op_array->vars[i].name, offset_key, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { + !memcmp(ex->op_array->vars[i].name.v, offset_key.v, Z_TYPE_P(offset)==IS_UNICODE?UBYTES(offset_len):offset_len)) { ex->CVs[i] = NULL; break; } @@ -26618,7 +26607,7 @@ } } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } @@ -26727,20 +26716,19 @@ break; case IS_STRING: case IS_UNICODE: { - char *offset_key = Z_UNIVAL_P(offset); - int offset_len = Z_UNILEN_P(offset); - int free_offset = 0; + zstr offset_key = Z_UNIVAL_P(offset); + int offset_len = Z_UNILEN_P(offset); + int free_offset = 0; if (UG(unicode) && ht == &EG(symbol_table) && Z_TYPE_P(offset) == IS_UNICODE) { /* Identifier normalization */ UChar *norm; - int32_t norm_len; + int norm_len; - if (!zend_normalize_identifier(&norm, &norm_len, - (UChar*)offset_key, offset_len, 0)) { + if (!zend_normalize_identifier(&norm, &norm_len, offset_key.u, offset_len, 0)) { zend_error(E_WARNING, "Could not normalize identifier: %r", offset_key); - } else if ((char*)norm != offset_key) { - offset_key = (char*)norm; + } else if (norm != offset_key.u) { + offset_key.u = norm; offset_len = norm_len; free_offset = 1; } @@ -26749,7 +26737,7 @@ isset = 1; } if (free_offset) { - efree(offset_key); + efree(offset_key.v); } break; } http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/dom_iterators.c?r1=1.15&r2=1.16&diff_format=u Index: php-src/ext/dom/dom_iterators.c diff -u php-src/ext/dom/dom_iterators.c:1.15 php-src/ext/dom/dom_iterators.c:1.16 --- php-src/ext/dom/dom_iterators.c:1.15 Mon Feb 20 10:29:35 2006 +++ php-src/ext/dom/dom_iterators.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dom_iterators.c,v 1.15 2006/02/20 10:29:35 dmitry Exp $ */ +/* $Id: dom_iterators.c,v 1.16 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -149,7 +149,7 @@ *data = &iterator->curobj; } -static int php_dom_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int php_dom_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { zval *curobj; xmlNodePtr curnode = NULL; @@ -173,7 +173,7 @@ } namelen = xmlStrlen(curnode->name); - *str_key = estrndup(curnode->name, namelen); + str_key->s = estrndup(curnode->name, namelen); *str_key_len = namelen + 1; return HASH_KEY_IS_STRING; } http://cvs.php.net/viewcvs.cgi/php-src/ext/dom/php_dom.c?r1=1.88&r2=1.89&diff_format=u Index: php-src/ext/dom/php_dom.c diff -u php-src/ext/dom/php_dom.c:1.88 php-src/ext/dom/php_dom.c:1.89 --- php-src/ext/dom/php_dom.c:1.88 Mon Feb 13 10:23:57 2006 +++ php-src/ext/dom/php_dom.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dom.c,v 1.88 2006/02/13 10:23:57 dmitry Exp $ */ +/* $Id: php_dom.c,v 1.89 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -580,19 +580,19 @@ zend_hash_init(&dom_domstringlist_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_domstringlist_prop_handlers, "length", dom_domstringlist_length_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domstringlist_prop_handlers, sizeof(dom_domstringlist_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMNameList", NULL, php_dom_namelist_class_functions, dom_namelist_class_entry); zend_hash_init(&dom_namelist_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_namelist_prop_handlers, "length", dom_namelist_length_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namelist_prop_handlers, sizeof(dom_namelist_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMImplementationList", NULL, php_dom_domimplementationlist_class_functions, dom_domimplementationlist_class_entry); zend_hash_init(&dom_domimplementationlist_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_domimplementationlist_prop_handlers, "length", dom_domimplementationlist_length_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domimplementationlist_prop_handlers, sizeof(dom_domimplementationlist_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMImplementationSource", NULL, php_dom_domimplementationsource_class_functions, dom_domimplementationsource_class_entry); REGISTER_DOM_CLASS(ce, "DOMImplementation", NULL, php_dom_domimplementation_class_functions, dom_domimplementation_class_entry); @@ -616,7 +616,7 @@ dom_register_prop_handler(&dom_node_prop_handlers, "localName", dom_node_local_name_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_node_prop_handlers, "baseURI", dom_node_base_uri_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_node_prop_handlers, "textContent", dom_node_text_content_read, dom_node_text_content_write TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_node_prop_handlers, sizeof(dom_node_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMNameSpaceNode", NULL, NULL, dom_namespace_node_class_entry); @@ -629,12 +629,12 @@ dom_register_prop_handler(&dom_namespace_node_prop_handlers, "namespaceURI", dom_node_namespace_uri_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_namespace_node_prop_handlers, "ownerDocument", dom_node_owner_document_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_namespace_node_prop_handlers, "parentNode", dom_node_parent_node_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namespace_node_prop_handlers, sizeof(dom_namespace_node_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namespace_node_prop_handlers, sizeof(dom_namespace_node_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMDocumentFragment", dom_node_class_entry, php_dom_documentfragment_class_functions, dom_documentfragment_class_entry); zend_hash_init(&dom_document_fragment_prop_handlers, 0, NULL, NULL, 1); zend_hash_copy(&dom_document_fragment_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler)); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_document_fragment_prop_handlers, sizeof(dom_node_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMDocument", dom_node_class_entry, php_dom_document_class_functions, dom_document_class_entry); zend_hash_init(&dom_document_prop_handlers, 0, NULL, NULL, 1); @@ -659,7 +659,7 @@ dom_register_prop_handler(&dom_document_prop_handlers, "substituteEntities", dom_document_substitue_entities_read, dom_document_substitue_entities_write TSRMLS_CC); zend_hash_merge(&dom_document_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_document_prop_handlers, sizeof(dom_document_prop_handlers), NULL); INIT_CLASS_ENTRY(ce, "DOMNodeList", php_dom_nodelist_class_functions); ce.create_object = dom_nnodemap_objects_new; @@ -668,7 +668,7 @@ zend_hash_init(&dom_nodelist_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_nodelist_prop_handlers, "length", dom_nodelist_length_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_nodelist_prop_handlers, sizeof(dom_nodelist_prop_handlers), NULL); INIT_CLASS_ENTRY(ce, "DOMNamedNodeMap", php_dom_namednodemap_class_functions); ce.create_object = dom_nnodemap_objects_new; @@ -677,7 +677,7 @@ zend_hash_init(&dom_namednodemap_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_namednodemap_prop_handlers, "length", dom_namednodemap_length_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_namednodemap_prop_handlers, sizeof(dom_namednodemap_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMCharacterData", dom_node_class_entry, php_dom_characterdata_class_functions, dom_characterdata_class_entry); @@ -685,7 +685,7 @@ dom_register_prop_handler(&dom_characterdata_prop_handlers, "data", dom_characterdata_data_read, dom_characterdata_data_write TSRMLS_CC); dom_register_prop_handler(&dom_characterdata_prop_handlers, "length", dom_characterdata_length_read, NULL TSRMLS_CC); zend_hash_merge(&dom_characterdata_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_characterdata_prop_handlers, sizeof(dom_characterdata_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMAttr", dom_node_class_entry, php_dom_attr_class_functions, dom_attr_class_entry); @@ -696,7 +696,7 @@ dom_register_prop_handler(&dom_attr_prop_handlers, "ownerElement", dom_attr_owner_element_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_attr_prop_handlers, "schemaTypeInfo", dom_attr_schema_type_info_read, NULL TSRMLS_CC); zend_hash_merge(&dom_attr_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_attr_prop_handlers, sizeof(dom_attr_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMElement", dom_node_class_entry, php_dom_element_class_functions, dom_element_class_entry); @@ -704,26 +704,26 @@ dom_register_prop_handler(&dom_element_prop_handlers, "tagName", dom_element_tag_name_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_element_prop_handlers, "schemaTypeInfo", dom_element_schema_type_info_read, NULL TSRMLS_CC); zend_hash_merge(&dom_element_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_element_prop_handlers, sizeof(dom_element_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMText", dom_characterdata_class_entry, php_dom_text_class_functions, dom_text_class_entry); zend_hash_init(&dom_text_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_text_prop_handlers, "wholeText", dom_text_whole_text_read, NULL TSRMLS_CC); zend_hash_merge(&dom_text_prop_handlers, &dom_characterdata_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_text_prop_handlers, sizeof(dom_text_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMComment", dom_characterdata_class_entry, php_dom_comment_class_functions, dom_comment_class_entry); zend_hash_init(&dom_comment_prop_handlers, 0, NULL, NULL, 1); zend_hash_copy(&dom_comment_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler)); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_comment_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMTypeinfo", NULL, php_dom_typeinfo_class_functions, dom_typeinfo_class_entry); zend_hash_init(&dom_typeinfo_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeName", dom_typeinfo_type_name_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_typeinfo_prop_handlers, "typeNamespace", dom_typeinfo_type_namespace_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_typeinfo_prop_handlers, sizeof(dom_typeinfo_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMUserDataHandler", NULL, php_dom_userdatahandler_class_functions, dom_userdatahandler_class_entry); REGISTER_DOM_CLASS(ce, "DOMDomError", NULL, php_dom_domerror_class_functions, dom_domerror_class_entry); @@ -735,7 +735,7 @@ dom_register_prop_handler(&dom_domerror_prop_handlers, "relatedException", dom_domerror_related_exception_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_domerror_prop_handlers, "related_data", dom_domerror_related_data_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_domerror_prop_handlers, "location", dom_domerror_location_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domerror_prop_handlers, sizeof(dom_domerror_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMErrorHandler", NULL, php_dom_domerrorhandler_class_functions, dom_domerrorhandler_class_entry); REGISTER_DOM_CLASS(ce, "DOMLocator", NULL, php_dom_domlocator_class_functions, dom_domlocator_class_entry); @@ -746,13 +746,13 @@ dom_register_prop_handler(&dom_domlocator_prop_handlers, "offset", dom_domlocator_offset_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_domlocator_prop_handlers, "relatedNode", dom_domlocator_related_node_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_domlocator_prop_handlers, "uri", dom_domlocator_uri_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_domlocator_prop_handlers, sizeof(dom_domlocator_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMConfiguration", NULL, php_dom_domconfiguration_class_functions, dom_domconfiguration_class_entry); REGISTER_DOM_CLASS(ce, "DOMCdataSection", dom_text_class_entry, php_dom_cdatasection_class_functions, dom_cdatasection_class_entry); zend_hash_init(&dom_cdata_prop_handlers, 0, NULL, NULL, 1); zend_hash_copy(&dom_cdata_prop_handlers, &dom_text_prop_handlers, NULL, NULL, sizeof(dom_prop_handler)); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_cdata_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMDocumentType", dom_node_class_entry, php_dom_documenttype_class_functions, dom_documenttype_class_entry); @@ -764,7 +764,7 @@ dom_register_prop_handler(&dom_documenttype_prop_handlers, "systemId", dom_documenttype_system_id_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_documenttype_prop_handlers, "internalSubset", dom_documenttype_internal_subset_read, NULL TSRMLS_CC); zend_hash_merge(&dom_documenttype_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_documenttype_prop_handlers, sizeof(dom_documenttype_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMNotation", NULL, php_dom_notation_class_functions, dom_notation_class_entry); @@ -775,7 +775,7 @@ dom_register_prop_handler(&dom_notation_prop_handlers, "nodeName", dom_node_node_name_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_notation_prop_handlers, "nodeValue", dom_node_node_value_read, dom_node_node_value_write TSRMLS_CC); dom_register_prop_handler(&dom_notation_prop_handlers, "attributes", dom_node_attributes_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_notation_prop_handlers, sizeof(dom_notation_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMEntity", dom_node_class_entry, php_dom_entity_class_functions, dom_entity_class_entry); @@ -788,12 +788,12 @@ dom_register_prop_handler(&dom_entity_prop_handlers, "version", dom_entity_version_read, dom_entity_version_write TSRMLS_CC); zend_hash_merge(&dom_entity_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_entity_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMEntityReference", dom_node_class_entry, php_dom_entityreference_class_functions, dom_entityreference_class_entry); zend_hash_init(&dom_entity_reference_prop_handlers, 0, NULL, NULL, 1); zend_hash_copy(&dom_entity_reference_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler)); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_entity_reference_prop_handlers, sizeof(dom_entity_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMProcessingInstruction", dom_node_class_entry, php_dom_processinginstruction_class_functions, dom_processinginstruction_class_entry); @@ -801,7 +801,7 @@ dom_register_prop_handler(&dom_processinginstruction_prop_handlers, "target", dom_processinginstruction_target_read, NULL TSRMLS_CC); dom_register_prop_handler(&dom_processinginstruction_prop_handlers, "data", dom_processinginstruction_data_read, dom_processinginstruction_data_write TSRMLS_CC); zend_hash_merge(&dom_processinginstruction_prop_handlers, &dom_node_prop_handlers, NULL, NULL, sizeof(dom_prop_handler), 0); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_processinginstruction_prop_handlers, sizeof(dom_processinginstruction_prop_handlers), NULL); REGISTER_DOM_CLASS(ce, "DOMStringExtend", NULL, php_dom_string_extend_class_functions, dom_string_extend_class_entry); @@ -812,7 +812,7 @@ zend_hash_init(&dom_xpath_prop_handlers, 0, NULL, NULL, 1); dom_register_prop_handler(&dom_xpath_prop_handlers, "document", dom_xpath_document_read, NULL TSRMLS_CC); - zend_hash_add(&classes, ce.name, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL); + zend_hash_add(&classes, ce.name.s, ce.name_length + 1, &dom_xpath_prop_handlers, sizeof(dom_xpath_prop_handlers), NULL); #endif REGISTER_LONG_CONSTANT("XML_ELEMENT_NODE", XML_ELEMENT_NODE, CONST_CS | CONST_PERSISTENT); http://cvs.php.net/viewcvs.cgi/php-src/ext/hash/hash.c?r1=1.22&r2=1.23&diff_format=u Index: php-src/ext/hash/hash.c diff -u php-src/ext/hash/hash.c:1.22 php-src/ext/hash/hash.c:1.23 --- php-src/ext/hash/hash.c:1.22 Sun Feb 19 04:29:40 2006 +++ php-src/ext/hash/hash.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: hash.c,v 1.22 2006/02/19 04:29:40 andi Exp $ */ +/* $Id: hash.c,v 1.23 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -472,7 +472,7 @@ PHP_FUNCTION(hash_algos) { HashPosition pos; - char *str; + zstr str; int str_len; long idx, type; @@ -480,7 +480,7 @@ for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos); (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, &str_len, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) { - add_next_index_stringl(return_value, str, str_len-1, 1); + add_next_index_stringl(return_value, str.s, str_len-1, 1); } } /* }}} */ @@ -577,13 +577,14 @@ { HashPosition pos; char buffer[2048]; - char *s = buffer, *e = s + sizeof(buffer), *str; + char *s = buffer, *e = s + sizeof(buffer); + zstr str; long idx, type; for(zend_hash_internal_pointer_reset_ex(&php_hash_hashtable, &pos); (type = zend_hash_get_current_key_ex(&php_hash_hashtable, &str, NULL, &idx, 0, &pos)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward_ex(&php_hash_hashtable, &pos)) { - s += snprintf(s, e - s, "%s ", str); + s += snprintf(s, e - s, "%s ", str.s); } *s = 0; http://cvs.php.net/viewcvs.cgi/php-src/ext/libxml/libxml.c?r1=1.43&r2=1.44&diff_format=u Index: php-src/ext/libxml/libxml.c diff -u php-src/ext/libxml/libxml.c:1.43 php-src/ext/libxml/libxml.c:1.44 --- php-src/ext/libxml/libxml.c:1.43 Sun Feb 19 04:29:41 2006 +++ php-src/ext/libxml/libxml.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: libxml.c,v 1.43 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: libxml.c,v 1.44 2006/02/21 20:12:42 dmitry Exp $ */ #define IS_EXT_MODULE @@ -841,17 +841,17 @@ php_libxml_initialize(); export_hnd.export_func = export_function; - if (zend_hash_add(&php_libxml_exports, ce->name, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) { + if (zend_hash_add(&php_libxml_exports, ce->name.s, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL) == SUCCESS) { int ret; UChar *uname; uname = malloc(UBYTES(ce->name_length+1)); - u_charsToUChars(ce->name, uname, ce->name_length+1); - ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, uname, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL); - free(uname); - return ret; - } - return FAILURE; + u_charsToUChars(ce->name.s, uname, ce->name_length+1); + ret = zend_u_hash_add(&php_libxml_exports, IS_UNICODE, (zstr)uname, ce->name_length + 1, &export_hnd, sizeof(export_hnd), NULL); + free(uname); + return ret; + } + return FAILURE; } PHP_LIBXML_API xmlNodePtr php_libxml_import_node(zval *object TSRMLS_DC) http://cvs.php.net/viewcvs.cgi/php-src/ext/mysql/php_mysql.c?r1=1.219&r2=1.220&diff_format=u Index: php-src/ext/mysql/php_mysql.c diff -u php-src/ext/mysql/php_mysql.c:1.219 php-src/ext/mysql/php_mysql.c:1.220 --- php-src/ext/mysql/php_mysql.c:1.219 Sun Jan 1 13:09:52 2006 +++ php-src/ext/mysql/php_mysql.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mysql.c,v 1.219 2006/01/01 13:09:52 sniper Exp $ */ +/* $Id: php_mysql.c,v 1.220 2006/02/21 20:12:42 dmitry Exp $ */ /* TODO: * @@ -1380,8 +1380,9 @@ WRONG_PARAM_COUNT; break; } - - if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C), "mysql")) { + + /* FIXME: Unicode support??? */ + if (MySG(trace_mode) || !strcasecmp(get_active_function_name(TSRMLS_C).s, "mysql")) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "This function is deprecated; use mysql_query() instead."); } http://cvs.php.net/viewcvs.cgi/php-src/ext/openssl/openssl.c?r1=1.104&r2=1.105&diff_format=u Index: php-src/ext/openssl/openssl.c diff -u php-src/ext/openssl/openssl.c:1.104 php-src/ext/openssl/openssl.c:1.105 --- php-src/ext/openssl/openssl.c:1.104 Sun Feb 19 03:07:38 2006 +++ php-src/ext/openssl/openssl.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.104 2006/02/19 03:07:38 andi Exp $ */ +/* $Id: openssl.c,v 1.105 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1244,17 +1244,18 @@ /* apply values from the dn hash */ zend_hash_internal_pointer_reset_ex(HASH_OF(dn), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(dn), (void**)&item, &hpos) == SUCCESS) { - char * strindex; int strindexlen; + zstr strindex; + int strindexlen; long intindex; zend_hash_get_current_key_ex(HASH_OF(dn), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(item); - if (strindex) { + if (strindex.s) { int nid; - nid = OBJ_txt2nid(strindex); + nid = OBJ_txt2nid(strindex.s); if (nid != NID_undef) { if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) @@ -1263,7 +1264,7 @@ return FAILURE; } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex.s); } } zend_hash_move_forward_ex(HASH_OF(dn), &hpos); @@ -1318,23 +1319,24 @@ if (attribs) { zend_hash_internal_pointer_reset_ex(HASH_OF(attribs), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(attribs), (void**)&item, &hpos) == SUCCESS) { - char * strindex; int strindexlen; + zstr strindex; + int strindexlen; long intindex; zend_hash_get_current_key_ex(HASH_OF(attribs), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(item); - if (strindex) { + if (strindex.s) { int nid; - nid = OBJ_txt2nid(strindex); + nid = OBJ_txt2nid(strindex.s); if (nid != NID_undef) { if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_PP(item)); return FAILURE; } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "dn: %s is not a recognized name", strindex.s); } } zend_hash_move_forward_ex(HASH_OF(attribs), &hpos); @@ -2264,7 +2266,7 @@ long cipherid = PHP_OPENSSL_CIPHER_DEFAULT; uint strindexlen; ulong intindex; - char * strindex; + zstr strindex; char * infilename = NULL; int infilename_len; char * outfilename = NULL; int outfilename_len; @@ -2375,8 +2377,8 @@ convert_to_string_ex(zcertval); - if (strindex) { - BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(zcertval)); + if (strindex.s) { + BIO_printf(outfile, "%s: %s\n", strindex.s, Z_STRVAL_PP(zcertval)); } else { BIO_printf(outfile, "%s\n", Z_STRVAL_PP(zcertval)); } @@ -2419,7 +2421,7 @@ ulong intindex; uint strindexlen; HashPosition hpos; - char * strindex; + zstr strindex; char * infilename; int infilename_len; char * outfilename; int outfilename_len; char * extracertsfilename = NULL; int extracertsfilename_len; @@ -2484,8 +2486,8 @@ convert_to_string_ex(hval); - if (strindex) { - BIO_printf(outfile, "%s: %s\n", strindex, Z_STRVAL_PP(hval)); + if (strindex.s) { + BIO_printf(outfile, "%s: %s\n", strindex.s, Z_STRVAL_PP(hval)); } else { BIO_printf(outfile, "%s\n", Z_STRVAL_PP(hval)); } http://cvs.php.net/viewcvs.cgi/php-src/ext/pcre/php_pcre.c?r1=1.177&r2=1.178&diff_format=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.177 php-src/ext/pcre/php_pcre.c:1.178 --- php-src/ext/pcre/php_pcre.c:1.177 Fri Feb 17 21:17:44 2006 +++ php-src/ext/pcre/php_pcre.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.177 2006/02/17 21:17:44 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.178 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1140,7 +1140,7 @@ char *result; int result_len; int limit_val = -1; - char *string_key; + zstr string_key; ulong num_key; zval callback_name; int replace_count=0; @@ -1198,7 +1198,7 @@ switch(zend_hash_get_current_key(Z_ARRVAL_PP(subject), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - add_assoc_stringl(return_value, string_key, result, result_len, 0); + add_assoc_stringl(return_value, string_key.s, result, result_len, 0); break; case HASH_KEY_IS_LONG: @@ -1530,7 +1530,7 @@ int *offsets; /* Array of subpattern offsets */ int size_offsets; /* Size of the offsets array */ int count = 0; /* Count of matched subpatterns */ - char *string_key; + zstr string_key; ulong num_key; zend_bool invert = 0; /* Whether to return non-matching entries */ @@ -1602,8 +1602,8 @@ switch(zend_hash_get_current_key(Z_ARRVAL_PP(input), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: - zend_hash_update(Z_ARRVAL_P(return_value), string_key, - strlen(string_key)+1, entry, sizeof(zval *), NULL); + zend_hash_update(Z_ARRVAL_P(return_value), string_key.s, + strlen(string_key.s)+1, entry, sizeof(zval *), NULL); break; case HASH_KEY_IS_LONG: http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.112&r2=1.113&diff_format=u Index: php-src/ext/pdo/pdo_dbh.c diff -u php-src/ext/pdo/pdo_dbh.c:1.112 php-src/ext/pdo/pdo_dbh.c:1.113 --- php-src/ext/pdo/pdo_dbh.c:1.112 Sun Feb 19 04:29:41 2006 +++ php-src/ext/pdo/pdo_dbh.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_dbh.c,v 1.112 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: pdo_dbh.c,v 1.113 2006/02/21 20:12:42 dmitry Exp $ */ /* The PDO Database Handle Class */ @@ -1115,7 +1115,7 @@ while (funcs->fname) { ifunc->type = ZEND_INTERNAL_FUNCTION; ifunc->handler = funcs->handler; - ifunc->function_name = funcs->fname; + ifunc->function_name.s = funcs->fname; ifunc->scope = dbh->ce; ifunc->prototype = NULL; if (funcs->arg_info) { @@ -1157,10 +1157,10 @@ #else zval *object, #endif - char *method_name, int method_len TSRMLS_DC) + zstr method_name, int method_len TSRMLS_DC) { zend_function *fbc = NULL; - char *lc_method_name; + zstr lc_method_name; #if PHP_API_VERSION >= 20041225 zval *object = *object_pp; #endif @@ -1191,7 +1191,7 @@ } out: - efree(lc_method_name); + efree(lc_method_name.v); return fbc; } http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.145&r2=1.146&diff_format=u Index: php-src/ext/pdo/pdo_stmt.c diff -u php-src/ext/pdo/pdo_stmt.c:1.145 php-src/ext/pdo/pdo_stmt.c:1.146 --- php-src/ext/pdo/pdo_stmt.c:1.145 Mon Feb 20 10:50:58 2006 +++ php-src/ext/pdo/pdo_stmt.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_stmt.c,v 1.145 2006/02/20 10:50:58 dmitry Exp $ */ +/* $Id: pdo_stmt.c,v 1.146 2006/02/21 20:12:42 dmitry Exp $ */ /* The PDO Statement Handle Class */ @@ -356,11 +356,14 @@ zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params)); while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) { + zstr tmp_str; + memset(&param, 0, sizeof(param)); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params), - &param.name, &str_length, &num_index, 0, NULL)) { + &tmp_str, &str_length, &num_index, 0, NULL)) { /* yes this is correct. we don't want to count the null byte. ask wez */ + param.name = tmp_str.s; param.namelen = str_length - 1; param.paramno = -1; } else { @@ -646,7 +649,7 @@ zval **object = NULL, **method; zend_class_entry * ce = NULL, **pce; zend_function *function_handler; - char *lcname; + zstr lcname; unsigned int lcname_len; if (Z_TYPE_P(callable) == IS_ARRAY) { @@ -689,11 +692,11 @@ fci->function_table = ce ? &ce->function_table : EG(function_table); if (zend_u_hash_find(fci->function_table, Z_TYPE_PP(method), lcname, lcname_len+1, (void **)&function_handler) == FAILURE) { - efree(lcname); + efree(lcname.v); pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "user-supplied function does not exist" TSRMLS_CC); return 0; } - efree(lcname); + efree(lcname.v); fci->size = sizeof(zend_fcall_info); fci->function_name = NULL; @@ -1293,7 +1296,7 @@ error = 1; break; } else { - stmt->fetch.cls.ce = zend_u_fetch_class(Z_TYPE_P(arg2), Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); + stmt->fetch.cls.ce = zend_u_fetch_class(Z_TYPE_P(arg2), Z_UNIVAL_P(arg2), Z_UNILEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); if (!stmt->fetch.cls.ce) { pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "could not find user-specified class" TSRMLS_CC); error = 1; @@ -1868,7 +1871,7 @@ zend_hash_internal_pointer_reset_ex(stmt->bound_params, &pos); while (SUCCESS == zend_hash_get_current_data_ex(stmt->bound_params, (void**)&param, &pos)) { - char *str; + zstr str; uint len; ulong num; @@ -1964,10 +1967,10 @@ #else zval *object, #endif - char *method_name, int method_len TSRMLS_DC) + zstr method_name, int method_len TSRMLS_DC) { zend_function *fbc = NULL; - char *lc_method_name; + zstr lc_method_name; #if PHP_API_VERSION >= 20041225 zval *object = *object_pp; #endif @@ -1999,7 +2002,7 @@ } out: - efree(lc_method_name); + efree(lc_method_name.v); return fbc; } @@ -2190,7 +2193,7 @@ *data = &I->fetch_ahead; } -static int pdo_stmt_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, +static int pdo_stmt_iter_get_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { struct php_pdo_iterator *I = (struct php_pdo_iterator*)iter->data; @@ -2366,24 +2369,23 @@ #else zval *object, #endif - char *method_name, int method_len TSRMLS_DC) + zstr method_name, int method_len TSRMLS_DC) { zend_function *fbc; - char *lc_method_name; + zstr lc_method_name; - lc_method_name = emalloc(method_len + 1); - zend_str_tolower_copy(lc_method_name, method_name, method_len); + lc_method_name = zend_u_str_tolower_dup(UG(unicode)?IS_UNICODE:IS_STRING, method_name, method_len); - if (zend_hash_find(&pdo_row_ce->function_table, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) { - efree(lc_method_name); + if (zend_u_hash_find(&pdo_row_ce->function_table, UG(unicode)?IS_UNICODE:IS_STRING, lc_method_name, method_len+1, (void**)&fbc) == FAILURE) { + efree(lc_method_name.v); return NULL; } - efree(lc_method_name); + efree(lc_method_name.v); return fbc; } -static int row_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) +static int row_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS) { return FAILURE; } @@ -2393,7 +2395,7 @@ static zend_internal_function ctor = {0}; ctor.type = ZEND_INTERNAL_FUNCTION; - ctor.function_name = "__construct"; + ctor.function_name.s = "__construct"; ctor.scope = pdo_row_ce; ctor.handler = ZEND_FN(dbstmt_constructor); @@ -2405,9 +2407,9 @@ return pdo_dbstmt_ce; } -static int row_get_classname(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC) +static int row_get_classname(zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC) { - *class_name = estrndup("PDORow", sizeof("PDORow")-1); + class_name->s = estrndup("PDORow", sizeof("PDORow")-1); *class_name_len = sizeof("PDORow")-1; return 0; } http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/php_reflection.c?r1=1.214&r2=1.215&diff_format=u Index: php-src/ext/reflection/php_reflection.c diff -u php-src/ext/reflection/php_reflection.c:1.214 php-src/ext/reflection/php_reflection.c:1.215 --- php-src/ext/reflection/php_reflection.c:1.214 Tue Feb 21 09:12:32 2006 +++ php-src/ext/reflection/php_reflection.c Tue Feb 21 20:12:42 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_reflection.c,v 1.214 2006/02/21 09:12:32 helly Exp $ */ +/* $Id: php_reflection.c,v 1.215 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -353,7 +353,7 @@ if (count > 0) { HashPosition pos; zval **value; - char *key; + zstr key; uint key_len; ulong num_index; @@ -362,7 +362,7 @@ while (zend_hash_get_current_data_ex(&ce->constants_table, (void **) &value, &pos) == SUCCESS) { zend_hash_get_current_key_ex(&ce->constants_table, &key, &key_len, &num_index, 0, &pos); - _const_string(str, key, *value, indent TSRMLS_CC); + _const_string(str, key.s, *value, indent TSRMLS_CC); zend_hash_move_forward_ex(&ce->constants_table, &pos); } } @@ -479,18 +479,18 @@ zend_hash_internal_pointer_reset_ex(properties, &pos); while (zend_hash_get_current_data_ex(properties, (void **) &prop, &pos) == SUCCESS) { - char *prop_name; + zstr prop_name; uint prop_name_size; ulong index; if (zend_hash_get_current_key_ex(properties, &prop_name, &prop_name_size, &index, 1, &pos) == HASH_KEY_IS_STRING) { - if (prop_name_size && prop_name[0]) { /* skip all private and protected properties */ - if (!zend_hash_quick_exists(&ce->properties_info, prop_name, prop_name_size, zend_get_hash_value(prop_name, prop_name_size))) { + if (prop_name_size && prop_name.s[0]) { /* skip all private and protected properties */ + if (!zend_hash_quick_exists(&ce->properties_info, prop_name.s, prop_name_size, zend_get_hash_value(prop_name.s, prop_name_size))) { count++; - _property_string(&dyn, NULL, prop_name, sub_indent.string TSRMLS_CC); + _property_string(&dyn, NULL, prop_name.s, sub_indent.string TSRMLS_CC); } } - efree(prop_name); + efree(prop_name.s); } zend_hash_move_forward_ex(properties, &pos); } @@ -566,7 +566,7 @@ } else { string_printf(str, "<required> "); } - if (arg_info->class_name) { + if (arg_info->class_name.v) { string_printf(str, "%v ", arg_info->class_name); if (arg_info->allow_null) { string_printf(str, "or NULL "); @@ -580,7 +580,7 @@ if (arg_info->pass_by_reference) { string_write(str, "&", sizeof("&")-1); } - if (arg_info->name) { + if (arg_info->name.v) { string_printf(str, "$%v", arg_info->name); } else { string_printf(str, "$param%d", offset); @@ -666,7 +666,7 @@ { string param_indent; zend_function *overwrites; - char *lc_name; + zstr lc_name; unsigned int lc_name_len; /* TBD: Repair indenting of doc comment (or is this to be done in the parser?) @@ -686,13 +686,14 @@ if (fptr->common.scope != scope) { string_printf(str, ", inherits %v", fptr->common.scope->name); } else if (fptr->common.scope->parent) { - lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name), 1, &lc_name_len); + /* FIXME: Unicode support??? */ + lc_name = zend_u_str_case_fold(IS_STRING, fptr->common.function_name, strlen(fptr->common.function_name.s), 1, &lc_name_len); if (zend_u_hash_find(&fptr->common.scope->parent->function_table, IS_STRING, lc_name, lc_name_len + 1, (void**) &overwrites) == SUCCESS) { if (fptr->common.scope != overwrites->common.scope) { string_printf(str, ", overwrites %v", overwrites->common.scope->name); } } - efree(lc_name); + efree(lc_name.v); } } if (fptr->common.prototype && fptr->common.prototype->common.scope) { @@ -755,7 +756,7 @@ /* {{{ _property_string */ static void _property_string(string *str, zend_property_info *prop, char *prop_name, char* indent TSRMLS_DC) { - char *class_name; + zstr class_name; string_printf(str, "%sProperty [ ", indent); if (!prop) { @@ -853,7 +854,8 @@ if (constant->module_number == module->module_number) { TSRMLS_FETCH(); - _const_string(str, constant->name, &constant->value, indent TSRMLS_CC); + /* FIXME: Unicode support??? */ + _const_string(str, constant->name.s, &constant->value, indent TSRMLS_CC); (*num_classes)++; } return ZEND_HASH_APPLY_KEEP; @@ -1040,7 +1042,7 @@ zval *name; MAKE_STD_ZVAL(name); - if (arg_info->name) { + if (arg_info->name.v) { ZVAL_TEXTL(name, arg_info->name, arg_info->name_len, 1); } else { ZVAL_NULL(name); @@ -1105,7 +1107,7 @@ zval *name; zval *classname; property_reference *reference; - char *class_name, *prop_name; + zstr class_name, prop_name; zend_uchar utype = UG(unicode) ? IS_UNICODE : IS_STRING; zend_u_unmangle_property_name(utype, prop->name, &class_name, &prop_name); @@ -1114,7 +1116,7 @@ /* we have to seach the class hierarchy for this (implicit) public or protected property */ zend_class_entry *tmp_ce = ce; zend_property_info *tmp_info; - int prop_name_len = UG(unicode) ? u_strlen((UChar*)prop_name) : strlen(prop_name); + int prop_name_len = UG(unicode) ? u_strlen(prop_name.u) : strlen(prop_name.s); while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, utype, prop_name, prop_name_len + 1, (void **) &tmp_info) != SUCCESS) { ce = tmp_ce; @@ -1338,10 +1340,10 @@ zval *name; zval *object; unsigned int lcname_len; - char *lcname; + zstr lcname; reflection_object *intern; zend_function *fptr; - char *name_str; + zstr name_str; int name_len; zend_uchar type; @@ -1356,12 +1358,12 @@ } lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); if (zend_u_hash_find(EG(function_table), type, lcname, lcname_len + 1, (void **)&fptr) == FAILURE) { - efree(lcname); + efree(lcname.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Function %R() does not exist", type, name_str); return; } - efree(lcname); + efree(lcname.v); MAKE_STD_ZVAL(name); ZVAL_TEXT(name, fptr->common.function_name, 1); zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name, sizeof(zval *), NULL); @@ -1777,17 +1779,17 @@ case IS_UNICODE: case IS_STRING: { unsigned int lcname_len; - char *lcname; + zstr lcname; convert_to_text_ex(&reference); lcname = zend_u_str_case_fold(Z_TYPE_P(reference), Z_UNIVAL_P(reference), Z_UNILEN_P(reference), 1, &lcname_len); if (zend_u_hash_find(EG(function_table), Z_TYPE_P(reference), lcname, lcname_len + 1, (void**) &fptr) == FAILURE) { - efree(lcname); + efree(lcname.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Function %R() does not exist", Z_TYPE_P(reference), Z_UNIVAL_P(reference)); return; } - efree(lcname); + efree(lcname.v); } break; @@ -1796,7 +1798,7 @@ zval **method; zend_class_entry **pce; unsigned int lcname_len; - char *lcname; + zstr lcname; if ((zend_hash_index_find(Z_ARRVAL_P(reference), 0, (void **) &classref) == FAILURE) || (zend_hash_index_find(Z_ARRVAL_P(reference), 1, (void **) &method) == FAILURE)) { @@ -1819,12 +1821,12 @@ convert_to_text_ex(method); lcname = zend_u_str_case_fold(Z_TYPE_PP(method), Z_UNIVAL_PP(method), Z_UNILEN_PP(method), 1, &lcname_len); if (zend_u_hash_find(&ce->function_table, Z_TYPE_PP(method), lcname, lcname_len + 1, (void **) &fptr) == FAILURE) { - efree(lcname); + efree(lcname.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %R::%R() does not exist", Z_TYPE_PP(classref), Z_UNIVAL_PP(classref), Z_TYPE_PP(method), Z_UNIVAL_PP(method)); return; } - efree(lcname); + efree(lcname.v); } break; @@ -1847,7 +1849,8 @@ position= -1; convert_to_string_ex(&parameter); for (i = 0; i < fptr->common.num_args; i++) { - if (arg_info[i].name && strcmp(arg_info[i].name, Z_STRVAL_P(parameter)) == 0) { + /* FIXME: Unicode support??? */ + if (arg_info[i].name.s && strcmp(arg_info[i].name.s, Z_STRVAL_P(parameter)) == 0) { position= i; break; } @@ -1859,7 +1862,7 @@ } MAKE_STD_ZVAL(name); - if (arg_info[position].name) { + if (arg_info[position].name.v) { ZVAL_TEXTL(name, arg_info[position].name, arg_info[position].name_len, 1); } else { ZVAL_NULL(name); @@ -1912,7 +1915,7 @@ METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0); GET_REFLECTION_OBJECT_PTR(param); - if (!param->arg_info->class_name) { + if (!param->arg_info->class_name.v) { RETURN_NULL(); } else { zend_class_entry **pce; @@ -2059,11 +2062,12 @@ zval *object; reflection_object *intern; unsigned int lcname_len; - char *lcname; + zstr lcname; zend_class_entry **pce; zend_class_entry *ce; zend_function *mptr; - char *name_str, *tmp; + zstr name_str; + char *tmp; int name_len, tmp_len; zval ztmp; zend_uchar type; @@ -2072,15 +2076,16 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name_str, &name_len) == FAILURE) { return; } - if ((tmp = strstr(name_str, "::")) == NULL) { + /* FIXME: Unicode support??? */ + if ((tmp = strstr(name_str.s, "::")) == NULL) { return; } type = IS_STRING; classname = &ztmp; - tmp_len = tmp - name_str; - ZVAL_STRINGL(classname, name_str, tmp_len, 1); + tmp_len = tmp - name_str.s; + ZVAL_STRINGL(classname, name_str.s, tmp_len, 1); name_len = name_len - (tmp_len + 2); - name_str = tmp + 2; + name_str.s = tmp + 2; } object = getThis(); @@ -2122,12 +2127,12 @@ lcname = zend_u_str_case_fold(type, name_str, name_len, 1, &lcname_len); if (zend_u_hash_find(&ce->function_table, type, lcname, lcname_len + 1, (void **) &mptr) == FAILURE) { - efree(lcname); + efree(lcname.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %v::%R() does not exist", ce->name, type, name_str); return; } - efree(lcname); + efree(lcname.v); MAKE_STD_ZVAL(name); ZVAL_TEXT(name, mptr->common.function_name, 1); @@ -2502,7 +2507,7 @@ zval *classname; reflection_object *intern; zend_class_entry **ce; - char *name; + zstr name; int name_len; zend_uchar name_type; @@ -2584,7 +2589,7 @@ { reflection_object *intern; zend_class_entry *ce; - char *name; + zstr name; int name_len; zval **prop, *def_value = NULL; zend_uchar name_type; @@ -2617,7 +2622,7 @@ { reflection_object *intern; zend_class_entry *ce; - char *name; + zstr name; int name_len; zval **variable_ptr, *value; int refcount; @@ -2669,15 +2674,16 @@ zend_hash_internal_pointer_reset_ex(&ce->default_properties, &pos); while (zend_hash_get_current_data_ex(&ce->default_properties, (void **) &prop, &pos) == SUCCESS) { - char *key, *class_name, *prop_name; + zstr key, class_name, prop_name; uint key_len; ulong num_index; zval *prop_copy; zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos); zend_hash_move_forward_ex(&ce->default_properties, &pos); - zend_unmangle_property_name(key, &class_name, &prop_name); - if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) { + zend_u_unmangle_property_name(UG(unicode)?IS_UNICODE:IS_STRING, key, &class_name, &prop_name); + /* FIXME: Unicode support??? */ + if (class_name.s && class_name.s[0] != '*' && strcmp(class_name.s, ce->name.s)) { /* filter privates from base classes */ continue; } @@ -2688,7 +2694,7 @@ zval_copy_ctor(prop_copy); INIT_PZVAL(prop_copy); - add_assoc_zval(return_value, prop_name, prop_copy); + add_assoc_zval(return_value, prop_name.s, prop_copy); } } } @@ -2834,7 +2840,7 @@ reflection_object *intern; zend_class_entry *ce; unsigned int lc_name_len; - char *name, *lc_name; + zstr name, lc_name; int name_len; zend_uchar type; @@ -2846,10 +2852,10 @@ GET_REFLECTION_OBJECT_PTR(ce); lc_name = zend_u_str_case_fold(type, name, name_len, 1, &lc_name_len); if (zend_u_hash_exists(&ce->function_table, type, lc_name, lc_name_len + 1)) { - efree(lc_name); + efree(lc_name.v); RETURN_TRUE; } else { - efree(lc_name); + efree(lc_name.v); RETURN_FALSE; } } @@ -2863,7 +2869,7 @@ zend_class_entry *ce; zend_function *mptr; unsigned int lc_name_len; - char *name, *lc_name; + zstr name, lc_name; int name_len; zend_uchar type; @@ -2876,9 +2882,9 @@ lc_name = zend_u_str_case_fold(type, name, name_len, 1, &lc_name_len); if (zend_u_hash_find(&ce->function_table, type, lc_name, lc_name_len + 1, (void**) &mptr) == SUCCESS) { reflection_method_factory(ce, mptr, return_value TSRMLS_CC); - efree(lc_name); + efree(lc_name.v); } else { - efree(lc_name); + efree(lc_name.v); zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Method %R does not exist", type, name); return; @@ -2971,7 +2977,8 @@ reflection_object *intern; zend_class_entry *ce, **pce; zend_property_info *property_info; - char *name, *tmp, *classname; + zstr name, classname; + char *tmp; int name_len, classname_len; zend_uchar name_type; @@ -2985,21 +2992,22 @@ reflection_property_factory(ce, property_info, return_value TSRMLS_CC); return; } - if ((tmp = strstr(name, "::")) != NULL) { - classname_len = tmp - name; - classname = zend_str_tolower_dup(name, classname_len); - classname[classname_len] = '\0'; + /* FIXME: Unicode support??? */ + if ((tmp = strstr(name.s, "::")) != NULL) { + classname_len = tmp - name.s; + classname.s = zend_str_tolower_dup(name.s, classname_len); + classname.s[classname_len] = '\0'; name_len = name_len - (classname_len + 2); - name = tmp + 2; + name.s = tmp + 2; if (zend_u_lookup_class(name_type, classname, classname_len, &pce TSRMLS_CC) == FAILURE) { if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %R does not exist", name_type, classname); } - efree(classname); + efree(classname.v); return; } - efree(classname); + efree(classname.v); if (!instanceof_function(ce, *pce TSRMLS_CC)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %v::%R does not specify a base class of %v", (*pce)->name, name_type, name, ce->name); @@ -3372,7 +3380,8 @@ zval *interface; ALLOC_ZVAL(interface); zend_reflection_class_factory(ce->interfaces[i], interface TSRMLS_CC); - add_assoc_zval_ex(return_value, ce->interfaces[i]->name, ce->interfaces[i]->name_length + 1, interface); + /* FIXME: Unicode support??? */ + add_assoc_zval_ex(return_value, ce->interfaces[i]->name.s, ce->interfaces[i]->name_length + 1, interface); } } } @@ -3571,7 +3580,7 @@ ZEND_METHOD(reflection_property, __construct) { zval *propname, *classname; - char *name_str, *class_name, *prop_name; + zstr name_str, class_name, prop_name; int name_len; zval *object; reflection_object *intern; @@ -3888,9 +3897,9 @@ GET_REFLECTION_OBJECT_PTR(ref); ce = tmp_ce = ref->ce; - while (tmp_ce && zend_hash_find(&tmp_ce->properties_info, ref->prop->name, ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) { + while (tmp_ce && zend_u_hash_find(&tmp_ce->properties_info, UG(unicode)?IS_UNICODE:IS_STRING, ref->prop->name, ref->prop->name_length + 1, (void **) &tmp_info) == SUCCESS) { ce = tmp_ce; - tmp_ce = tmp_ce->parent; + tmp_ce = tmp_ce->parent; } zend_reflection_class_factory(ce, return_value TSRMLS_CC); @@ -4045,7 +4054,8 @@ *const_val = constant->value; zval_copy_ctor(const_val); INIT_PZVAL(const_val); - add_assoc_zval_ex(retval, constant->name, constant->name_len, const_val); + /* FIXME: Unicode support???*/ + add_assoc_zval_ex(retval, constant->name.s, constant->name_len, const_val); } return 0; } @@ -4109,9 +4119,11 @@ if (add_reflection_class) { ALLOC_ZVAL(zclass); zend_reflection_class_factory(*pce, zclass TSRMLS_CC); - add_assoc_zval_ex(class_array, (*pce)->name, (*pce)->name_length + 1, zclass); + /* FIXME: Unicode support??? */ + add_assoc_zval_ex(class_array, (*pce)->name.s, (*pce)->name_length + 1, zclass); } else { - add_next_index_stringl(class_array, (*pce)->name, (*pce)->name_length, 1); + /* FIXME: Unicode support??? */ + add_next_index_stringl(class_array, (*pce)->name.s, (*pce)->name_length, 1); } } return ZEND_HASH_APPLY_KEEP; @@ -4472,7 +4484,7 @@ php_info_print_table_start(); php_info_print_table_header(2, "Reflection", "enabled"); - php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.214 2006/02/21 09:12:32 helly Exp $"); + php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.215 2006/02/21 20:12:42 dmitry Exp $"); php_info_print_table_end(); } /* }}} */ http://cvs.php.net/viewcvs.cgi/php-src/ext/session/php_session.h?r1=1.103&r2=1.104&diff_format=u Index: php-src/ext/session/php_session.h diff -u php-src/ext/session/php_session.h:1.103 php-src/ext/session/php_session.h:1.104 --- php-src/ext/session/php_session.h:1.103 Sat Jan 28 06:16:45 2006 +++ php-src/ext/session/php_session.h Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_session.h,v 1.103 2006/01/28 06:16:45 fmk Exp $ */ +/* $Id: php_session.h,v 1.104 2006/02/21 20:12:42 dmitry Exp $ */ #ifndef PHP_SESSION_H #define PHP_SESSION_H @@ -211,7 +211,7 @@ #define PS_ENCODE_VARS \ - char *key; \ + zstr key; \ uint key_length; \ ulong num_key; \ zval **struc; @@ -223,7 +223,7 @@ zend_hash_get_current_key_ex(_ht, &key, &key_length, &num_key, 0, NULL) == HASH_KEY_IS_STRING; \ zend_hash_move_forward(_ht)) { \ key_length--; \ - if (php_get_session_var(key, key_length, &struc TSRMLS_CC) == SUCCESS) { \ + if (php_get_session_var(key.s, key_length, &struc TSRMLS_CC) == SUCCESS) { \ code; \ } \ } \ http://cvs.php.net/viewcvs.cgi/php-src/ext/session/session.c?r1=1.429&r2=1.430&diff_format=u Index: php-src/ext/session/session.c diff -u php-src/ext/session/session.c:1.429 php-src/ext/session/session.c:1.430 --- php-src/ext/session/session.c:1.429 Sun Feb 19 00:55:20 2006 +++ php-src/ext/session/session.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: session.c,v 1.429 2006/02/19 00:55:20 andi Exp $ */ +/* $Id: session.c,v 1.430 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -401,13 +401,13 @@ PS_ENCODE_LOOP( if (key_length > PS_BIN_MAX) continue; smart_str_appendc(&buf, (unsigned char) key_length); - smart_str_appendl(&buf, key, key_length); + smart_str_appendl(&buf, key.s, key_length); php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); } else { if (key_length > PS_BIN_MAX) continue; smart_str_appendc(&buf, (unsigned char) (key_length & PS_BIN_UNDEF)); - smart_str_appendl(&buf, key, key_length); + smart_str_appendl(&buf, key.s, key_length); ); if (newlen) *newlen = buf.len; @@ -465,8 +465,8 @@ PHP_VAR_SERIALIZE_INIT(var_hash); PS_ENCODE_LOOP( - smart_str_appendl(&buf, key, (unsigned char) key_length); - if (memchr(key, PS_DELIMITER, key_length)) { + smart_str_appendl(&buf, key.s, (unsigned char) key_length); + if (memchr(key.s, PS_DELIMITER, key_length)) { PHP_VAR_SERIALIZE_DESTROY(var_hash); smart_str_free(&buf); return FAILURE; @@ -476,7 +476,7 @@ php_var_serialize(&buf, struc, &var_hash TSRMLS_CC); } else { smart_str_appendc(&buf, PS_UNDEF_MARKER); - smart_str_appendl(&buf, key, key_length); + smart_str_appendl(&buf, key.s, key_length); smart_str_appendc(&buf, PS_DELIMITER); ); @@ -775,7 +775,7 @@ static int migrate_global(HashTable *ht, HashPosition *pos TSRMLS_DC) { - char *str; + zstr str; uint str_len; ulong num_key; int n; @@ -786,10 +786,12 @@ switch (n) { case HASH_KEY_IS_STRING: - if (zend_hash_find(&EG(symbol_table), str, str_len, + case HASH_KEY_IS_UNICODE: + if (zend_u_hash_find(&EG(symbol_table), n, str, str_len, (void **) &val) == SUCCESS && val && Z_TYPE_PP(val) != IS_NULL) { - ZEND_SET_SYMBOL_WITH_LENGTH(ht, str, str_len, *val, + /* FIXME: Unicode support??? */ + ZEND_SET_SYMBOL_WITH_LENGTH(ht, str.s, str_len, *val, (*val)->refcount + 1 , 1); ret = 1; } @@ -1725,7 +1727,7 @@ if (PG(register_globals)) { uint str_len; - char *str; + zstr str; ulong num_key; HashPosition pos; @@ -1733,7 +1735,7 @@ while (zend_hash_get_current_key_ex(ht, &str, &str_len, &num_key, 0, &pos) == HASH_KEY_IS_STRING) { - zend_delete_global_variable(str, str_len-1 TSRMLS_CC); + zend_delete_global_variable(str.s, str_len-1 TSRMLS_CC); zend_hash_move_forward_ex(ht, &pos); } } http://cvs.php.net/viewcvs.cgi/php-src/ext/simplexml/simplexml.c?r1=1.186&r2=1.187&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.186 php-src/ext/simplexml/simplexml.c:1.187 --- php-src/ext/simplexml/simplexml.c:1.186 Mon Feb 13 10:23:57 2006 +++ php-src/ext/simplexml/simplexml.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.186 2006/02/13 10:23:57 dmitry Exp $ */ +/* $Id: simplexml.c,v 1.187 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1701,7 +1701,7 @@ static void php_sxe_iterator_dtor(zend_object_iterator *iter TSRMLS_DC); static int php_sxe_iterator_valid(zend_object_iterator *iter TSRMLS_DC); static void php_sxe_iterator_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC); -static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); +static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); static void php_sxe_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC); static void php_sxe_iterator_rewind(zend_object_iterator *iter TSRMLS_DC); @@ -1812,7 +1812,7 @@ *data = &iterator->sxe->iter.data; } -static int php_sxe_iterator_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int php_sxe_iterator_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { zval *curobj; xmlNodePtr curnode = NULL; @@ -1832,12 +1832,12 @@ int32_t u_len; namelen = xmlStrlen(curnode->name); - zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), (UChar**)str_key, &u_len, (char*)curnode->name, namelen, &status); + zend_convert_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &str_key->u, &u_len, (char*)curnode->name, namelen, &status); *str_key_len = u_len + 1; return HASH_KEY_IS_UNICODE; } else { namelen = xmlStrlen(curnode->name); - *str_key = estrndup(curnode->name, namelen); + str_key->s = estrndup(curnode->name, namelen); *str_key_len = namelen + 1; return HASH_KEY_IS_STRING; } @@ -2032,7 +2032,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.186 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.187 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/php_encoding.c?r1=1.120&r2=1.121&diff_format=u Index: php-src/ext/soap/php_encoding.c diff -u php-src/ext/soap/php_encoding.c:1.120 php-src/ext/soap/php_encoding.c:1.121 --- php-src/ext/soap/php_encoding.c:1.120 Mon Feb 6 13:17:20 2006 +++ php-src/ext/soap/php_encoding.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_encoding.c,v 1.120 2006/02/06 13:17:20 dmitry Exp $ */ +/* $Id: php_encoding.c,v 1.121 2006/02/21 20:12:42 dmitry Exp $ */ #include <time.h> @@ -321,7 +321,8 @@ zend_hash_move_forward_ex(SOAP_GLOBAL(class_map), &pos)) { if (Z_TYPE_PP(tmp) == IS_STRING && ce->name_length == Z_STRLEN_PP(tmp) && - zend_binary_strncasecmp(ce->name, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 && + /* FIXME: Unicode support??? */ + zend_binary_strncasecmp(ce->name.s, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 && zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) { /* TODO: namespace isn't stored */ @@ -1025,7 +1026,8 @@ property_info = zend_get_property_info(Z_OBJCE_P(object), &member, 1 TSRMLS_CC); EG(scope) = old_scope; - if (property_info && zend_hash_quick_exists(Z_OBJPROP_P(object), property_info->name, property_info->name_length+1, property_info->h)) { + /* FIXME: Unicode support??? */ + if (property_info && zend_hash_quick_exists(Z_OBJPROP_P(object), property_info->name.s, property_info->name_length+1, property_info->h)) { return data; } return NULL; http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/soap.c?r1=1.173&r2=1.174&diff_format=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.173 php-src/ext/soap/soap.c:1.174 --- php-src/ext/soap/soap.c:1.173 Tue Feb 7 12:49:30 2006 +++ php-src/ext/soap/soap.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ | Dmitry Stogov <dmitry@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.173 2006/02/07 12:49:30 dmitry Exp $ */ +/* $Id: soap.c,v 1.174 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -509,7 +509,7 @@ fe.type = ZEND_INTERNAL_FUNCTION; fe.handler = ZEND_FN(SoapClient___call); - fe.function_name = NULL; + fe.function_name.v = NULL; fe.scope = NULL; fe.fn_flags = 0; fe.prototype = NULL; @@ -1243,7 +1243,8 @@ zend_hash_internal_pointer_reset_ex(ft, &pos); while (zend_hash_get_current_data_ex(ft, (void **)&f, &pos) != FAILURE) { if ((service->type != SOAP_CLASS) || (f->common.fn_flags & ZEND_ACC_PUBLIC)) { - add_next_index_string(return_value, f->common.function_name, 1); + /* FIXME: Unicode support??? */ + add_next_index_string(return_value, f->common.function_name.s, 1); } zend_hash_move_forward_ex(ft, &pos); } @@ -1301,7 +1302,7 @@ } MAKE_STD_ZVAL(function_copy); - ZVAL_STRING(function_copy, f->common.function_name, 1); + ZVAL_TEXT(function_copy, f->common.function_name, 1); zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL); efree(key); @@ -1327,7 +1328,7 @@ } MAKE_STD_ZVAL(function_copy); - ZVAL_STRING(function_copy, f->common.function_name, 1); + ZVAL_TEXT(function_copy, f->common.function_name, 1); zend_hash_update(service->soap_functions.ft, key, key_len+1, &function_copy, sizeof(zval *), NULL); efree(key); } else if (function_name->type == IS_LONG) { @@ -1576,17 +1577,18 @@ #else { #endif - int class_name_len = strlen(service->soap_class.ce->name); + /* FIXME: Unicode support??? */ + int class_name_len = strlen(service->soap_class.ce->name.s); char *class_name = emalloc(class_name_len+1); - memcpy(class_name, service->soap_class.ce->name,class_name_len+1); + memcpy(class_name, service->soap_class.ce->name.s, class_name_len+1); if (zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len+1)) { zval c_ret, constructor; INIT_ZVAL(c_ret); INIT_ZVAL(constructor); - ZVAL_STRING(&constructor, service->soap_class.ce->name, 1); + ZVAL_TEXT(&constructor, service->soap_class.ce->name, 1); if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor"); } http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/php_spl.c?r1=1.86&r2=1.87&diff_format=u Index: php-src/ext/spl/php_spl.c diff -u php-src/ext/spl/php_spl.c:1.86 php-src/ext/spl/php_spl.c:1.87 --- php-src/ext/spl/php_spl.c:1.86 Mon Feb 20 22:23:27 2006 +++ php-src/ext/spl/php_spl.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_spl.c,v 1.86 2006/02/20 22:23:27 helly Exp $ */ +/* $Id: php_spl.c,v 1.87 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -59,17 +59,17 @@ } /* }}} */ -static zend_class_entry * spl_find_ce_by_name(zend_uchar ztype, void *name, int len, zend_bool autoload TSRMLS_DC) +static zend_class_entry * spl_find_ce_by_name(zend_uchar ztype, zstr name, int len, zend_bool autoload TSRMLS_DC) { zend_class_entry **ce; int found; if (!autoload) { - char *lc_name; + zstr lc_name; lc_name = zend_u_str_tolower_dup(ztype, name, len); found = zend_u_hash_find(EG(class_table), ztype, lc_name, len +1, (void **) &ce); - efree(lc_name); + efree(lc_name.v); } else { found = zend_u_lookup_class(ztype, name, len, &ce TSRMLS_CC); } @@ -342,7 +342,7 @@ { zval *class_name, *retval = NULL; int class_name_len, class_name_type; - char *func_name, *lc_name; + zstr func_name, lc_name; uint func_name_len; ulong dummy; HashPosition function_pos; @@ -361,7 +361,8 @@ while(zend_hash_has_more_elements_ex(SPL_G(autoload_functions), &function_pos) == SUCCESS && !EG(exception)) { zend_hash_get_current_key_ex(SPL_G(autoload_functions), &func_name, &func_name_len, &dummy, 0, &function_pos); zend_hash_get_current_data_ex(SPL_G(autoload_functions), (void **) &alfi, &function_pos); - zend_call_method(alfi->obj ? &alfi->obj : NULL, alfi->ce, &alfi->func_ptr, func_name, func_name_len, &retval, 1, class_name, NULL TSRMLS_CC); + /* TODO: Unicode support??? */ + zend_call_method(alfi->obj ? &alfi->obj : NULL, alfi->ce, &alfi->func_ptr, func_name.s, func_name_len, &retval, 1, class_name, NULL TSRMLS_CC); if (retval) { zval_ptr_dtor(&retval); } @@ -370,7 +371,7 @@ } zend_hash_move_forward_ex(SPL_G(autoload_functions), &function_pos); } - efree(lc_name); + efree(lc_name.v); } else { /* do not use or overwrite &EG(autoload_func) here */ zend_call_method_with_1_params(NULL, NULL, NULL, "spl_autoload", NULL, class_name); @@ -485,7 +486,7 @@ Unregister given function as __autoload() implementation */ PHP_FUNCTION(spl_autoload_unregister) { - char *func_name, *lc_name; + zstr func_name, lc_name; int func_name_len, success = FAILURE; zend_function *spl_func_ptr; zend_uchar func_name_type; @@ -520,7 +521,7 @@ } } - efree(lc_name); + efree(lc_name.v); RETURN_BOOL(success == SUCCESS); } /* }}} */ http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.98&r2=1.99&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.98 php-src/ext/spl/spl_array.c:1.99 --- php-src/ext/spl/spl_array.c:1.98 Mon Feb 13 10:23:57 2006 +++ php-src/ext/spl/spl_array.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.98 2006/02/13 10:23:57 dmitry Exp $ */ +/* $Id: spl_array.c,v 1.99 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -331,7 +331,8 @@ switch(Z_TYPE_P(offset)) { case IS_STRING: case IS_UNICODE: - if (*(char*)Z_UNIVAL_P(offset) == '\0') { + /* FIXME: Unicode support??? */ + if (Z_STRVAL_P(offset)[0] == '\0') { zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC); return; } @@ -621,7 +622,7 @@ static int spl_array_skip_protected(spl_array_object *intern TSRMLS_DC) /* {{{ */ { - char *string_key; + zstr string_key; uint string_length; ulong num_key; HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -630,8 +631,8 @@ do { if (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 0, &intern->pos) == (UG(unicode)?HASH_KEY_IS_UNICODE:HASH_KEY_IS_STRING)) { if (!string_length || - ((UG(unicode) && ((UChar*)string_key)[0]) || - (!UG(unicode) && string_key[0]))) { + ((UG(unicode) && string_key.u[0]) || + (!UG(unicode) && string_key.s[0]))) { return SUCCESS; } } else { @@ -721,7 +722,7 @@ } /* }}} */ -static int spl_array_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */ +static int spl_array_it_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */ { spl_array_it *iterator = (spl_array_it *)iter; spl_array_object *object = iterator->object; @@ -1208,7 +1209,7 @@ void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); - char *string_key; + zstr string_key; uint string_length; ulong num_key; HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); @@ -1225,10 +1226,10 @@ switch (zend_hash_get_current_key_ex(aht, &string_key, &string_length, &num_key, 1, &intern->pos)) { case HASH_KEY_IS_STRING: - RETVAL_STRINGL(string_key, string_length - 1, 0); + RETVAL_STRINGL(string_key.s, string_length - 1, 0); break; case HASH_KEY_IS_UNICODE: - RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 0); + RETVAL_UNICODEL(string_key.u, string_length - 1, 0); break; case HASH_KEY_IS_LONG: RETVAL_LONG(num_key); http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_directory.c?r1=1.76&r2=1.77&diff_format=u Index: php-src/ext/spl/spl_directory.c diff -u php-src/ext/spl/spl_directory.c:1.76 php-src/ext/spl/spl_directory.c:1.77 --- php-src/ext/spl/spl_directory.c:1.76 Sun Feb 19 04:29:41 2006 +++ php-src/ext/spl/spl_directory.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_directory.c,v 1.76 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: spl_directory.c,v 1.77 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -948,7 +948,7 @@ static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter TSRMLS_DC); static int spl_filesystem_dir_it_valid(zend_object_iterator *iter TSRMLS_DC); static void spl_filesystem_dir_it_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC); -static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); +static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC); static void spl_filesystem_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC); static void spl_filesystem_dir_it_rewind(zend_object_iterator *iter TSRMLS_DC); @@ -1017,7 +1017,7 @@ /* }}} */ /* {{{ spl_filesystem_dir_it_current_key */ -static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int spl_filesystem_dir_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter; spl_filesystem_object *object = iterator->object; @@ -1101,18 +1101,18 @@ /* }}} */ /* {{{ spl_filesystem_tree_it_current_key */ -static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int spl_filesystem_tree_it_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { spl_filesystem_dir_it *iterator = (spl_filesystem_dir_it *)iter; spl_filesystem_object *object = iterator->object; if (object->flags & SPL_FILE_DIR_KEY_AS_FILENAME) { *str_key_len = strlen(object->u.dir.entry.d_name) + 1; - *str_key = estrndup(object->u.dir.entry.d_name, *str_key_len - 1); + str_key->s = estrndup(object->u.dir.entry.d_name, *str_key_len - 1); } else { spl_filesystem_object_get_file_name(object TSRMLS_CC); *str_key_len = object->file_name_len + 1; - *str_key = estrndup(object->file_name, object->file_name_len); + str_key->s = estrndup(object->file_name, object->file_name_len); } return HASH_KEY_IS_STRING; } @@ -1634,7 +1634,7 @@ zend_get_parameters_array_ex(ZEND_NUM_ARGS(), params+(arg2 ? 2 : 1)); - ZVAL_STRING(&z_fname, func_ptr->common.function_name, 0); + ZVAL_STRING(&z_fname, func_ptr->common.function_name.s, 0); fci.size = sizeof(fci); fci.function_table = EG(function_table); http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_engine.h?r1=1.20&r2=1.21&diff_format=u Index: php-src/ext/spl/spl_engine.h diff -u php-src/ext/spl/spl_engine.h:1.20 php-src/ext/spl/spl_engine.h:1.21 --- php-src/ext/spl/spl_engine.h:1.20 Sun Jan 1 13:09:54 2006 +++ php-src/ext/spl/spl_engine.h Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_engine.h,v 1.20 2006/01/01 13:09:54 sniper Exp $ */ +/* $Id: spl_engine.h,v 1.21 2006/02/21 20:12:42 dmitry Exp $ */ #ifndef SPL_ENGINE_H #define SPL_ENGINE_H @@ -42,8 +42,9 @@ static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, int alloc, zval *arg1 TSRMLS_DC) { spl_instantiate(pce, retval, alloc TSRMLS_CC); - - zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC); + + /* FIXME: Unicode support??? */ + zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name.s, strlen(pce->constructor->common.function_name.s), NULL, 1, arg1, NULL TSRMLS_CC); return 0; } /* }}} */ @@ -53,7 +54,8 @@ { spl_instantiate(pce, retval, alloc TSRMLS_CC); - zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC); + /* FIXME: Unicode support??? */ + zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name.s, strlen(pce->constructor->common.function_name.s), NULL, 2, arg1, arg2 TSRMLS_CC); return 0; } /* }}} */ http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.c?r1=1.114&r2=1.115&diff_format=u Index: php-src/ext/spl/spl_iterators.c diff -u php-src/ext/spl/spl_iterators.c:1.114 php-src/ext/spl/spl_iterators.c:1.115 --- php-src/ext/spl/spl_iterators.c:1.114 Mon Feb 13 10:23:58 2006 +++ php-src/ext/spl/spl_iterators.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.c,v 1.114 2006/02/13 10:23:58 dmitry Exp $ */ +/* $Id: spl_iterators.c,v 1.115 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -161,7 +161,7 @@ sub_iter->funcs->get_current_data(sub_iter, data TSRMLS_CC); } -static int spl_recursive_it_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +static int spl_recursive_it_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { spl_recursive_it_object *object = (spl_recursive_it_object*)iter->data; zend_object_iterator *sub_iter = object->iterators[object->level].iterator; @@ -473,7 +473,7 @@ zend_object_iterator *iterator = object->iterators[object->level].iterator; if (iterator->funcs->get_current_key) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; @@ -482,10 +482,10 @@ RETURN_LONG(int_key); break; case HASH_KEY_IS_STRING: - RETURN_STRINGL(str_key, str_key_len-1, 0); + RETURN_STRINGL(str_key.s, str_key_len-1, 0); break; case HASH_KEY_IS_UNICODE: - RETURN_UNICODEL((void*)str_key, str_key_len-1, 0); + RETURN_UNICODEL(str_key.u, str_key_len-1, 0); break; default: RETURN_NULL(); @@ -652,7 +652,7 @@ } } /* }}} */ -static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC) +static union _zend_function *spl_recursive_it_get_method(zval **object_ptr, zstr method, int method_len TSRMLS_DC) { union _zend_function *function_handler; spl_recursive_it_object *object = (spl_recursive_it_object*)zend_object_store_get_object(*object_ptr TSRMLS_CC); @@ -661,7 +661,7 @@ function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); if (!function_handler) { - if (zend_hash_find(&Z_OBJCE_P(zobj)->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) { + if (zend_u_hash_find(&Z_OBJCE_P(zobj)->function_table, UG(unicode)?IS_UNICODE:IS_STRING, method, method_len+1, (void **) &function_handler) == FAILURE) { if (Z_OBJ_HT_P(zobj)->get_method) { *object_ptr = zobj; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC); @@ -769,7 +769,7 @@ } #endif -static union _zend_function *spl_dual_it_get_method(zval **object_ptr, char *method, int method_len TSRMLS_DC) +static union _zend_function *spl_dual_it_get_method(zval **object_ptr, zstr method, int method_len TSRMLS_DC) { union _zend_function *function_handler; spl_dual_it_object *intern; @@ -778,7 +778,7 @@ function_handler = std_object_handlers.get_method(object_ptr, method, method_len TSRMLS_CC); if (!function_handler) { - if (zend_hash_find(&intern->inner.ce->function_table, method, method_len+1, (void **) &function_handler) == FAILURE) { + if (zend_u_hash_find(&intern->inner.ce->function_table, UG(unicode)?IS_UNICODE:IS_STRING, method, method_len+1, (void **) &function_handler) == FAILURE) { if (Z_OBJ_HT_P(intern->inner.zobject)->get_method) { *object_ptr = intern->inner.zobject; function_handler = Z_OBJ_HT_P(*object_ptr)->get_method(object_ptr, method, method_len TSRMLS_CC); @@ -1007,9 +1007,9 @@ zval_ptr_dtor(&intern->current.data); intern->current.data = NULL; } - if (intern->current.str_key) { - efree(intern->current.str_key); - intern->current.str_key = NULL; + if (intern->current.str_key.v) { + efree(intern->current.str_key.v); + intern->current.str_key.v = NULL; } if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_RecursiveCachingIterator) { if (intern->u.caching.zstr) { @@ -1112,9 +1112,9 @@ if (intern->current.data) { if (intern->current.key_type == HASH_KEY_IS_STRING) { - RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len-1, 1); + RETURN_STRINGL(intern->current.str_key.s, intern->current.str_key_len-1, 1); } else if (intern->current.key_type == HASH_KEY_IS_UNICODE) { - RETURN_UNICODEL((UChar *)intern->current.str_key, intern->current.str_key_len-1, 1); + RETURN_UNICODEL(intern->current.str_key.u, intern->current.str_key_len-1, 1); } else { RETURN_LONG(intern->current.int_key); } @@ -1303,7 +1303,8 @@ subject = &tmp[0]; } else { subject_len = intern->current.str_key_len; - subject = intern->current.str_key; + /* FIXME: Unicode support??? */ + subject = intern->current.str_key.s; } } else { zend_make_printable_zval(intern->current.data, &subject_copy, &use_copy); @@ -1752,9 +1753,9 @@ } if (intern->u.caching.flags & CIT_TOSTRING_USE_KEY) { if (intern->current.key_type == HASH_KEY_IS_STRING) { - RETURN_STRINGL(intern->current.str_key, intern->current.str_key_len, 1); + RETURN_STRINGL(intern->current.str_key.s, intern->current.str_key_len, 1); } else if (intern->current.key_type == HASH_KEY_IS_UNICODE) { - RETURN_UNICODEL((void*)intern->current.str_key, intern->current.str_key_len, 1); + RETURN_UNICODEL(intern->current.str_key.u, intern->current.str_key_len, 1); } else { RETVAL_LONG(intern->current.int_key); convert_to_string(return_value); @@ -1780,7 +1781,7 @@ SPL_METHOD(CachingIterator, offsetSet) { spl_dual_it_object *intern; - void *arKey; + zstr arKey; uint nKeyLength; zend_uchar type; zval *value; @@ -1805,7 +1806,7 @@ SPL_METHOD(CachingIterator, offsetGet) { spl_dual_it_object *intern; - void *arKey; + zstr arKey; uint nKeyLength; zend_uchar type; zval **value; @@ -1834,7 +1835,7 @@ SPL_METHOD(CachingIterator, offsetUnset) { spl_dual_it_object *intern; - void *arKey; + zstr arKey; uint nKeyLength; zend_uchar type; @@ -1857,7 +1858,7 @@ SPL_METHOD(CachingIterator, offsetExists) { spl_dual_it_object *intern; - void *arKey; + zstr arKey; uint nKeyLength; zend_uchar type; @@ -2060,7 +2061,7 @@ intern = (spl_dual_it_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (intern->inner.iterator->funcs->get_current_key) { - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; switch (intern->inner.iterator->funcs->get_current_key(intern->inner.iterator, &str_key, &str_key_len, &int_key TSRMLS_CC)) { @@ -2068,10 +2069,10 @@ RETURN_LONG(int_key); break; case HASH_KEY_IS_STRING: - RETURN_STRINGL(str_key, str_key_len-1, 0); + RETURN_STRINGL(str_key.s, str_key_len-1, 0); break; case HASH_KEY_IS_UNICODE: - RETURN_UNICODEL((void*)str_key, str_key_len-1, 0); + RETURN_UNICODEL(str_key.u, str_key_len-1, 0); break; default: RETURN_NULL(); @@ -2357,7 +2358,7 @@ { zval *obj, **data; zend_object_iterator *iter; - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; int key_type; @@ -2380,12 +2381,12 @@ key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); switch(key_type) { case HASH_KEY_IS_STRING: - add_assoc_zval_ex(return_value, str_key, str_key_len, *data); - efree(str_key); + add_assoc_zval_ex(return_value, str_key.s, str_key_len, *data); + efree(str_key.s); break; case HASH_KEY_IS_UNICODE: add_u_assoc_zval_ex(return_value, IS_UNICODE, str_key, str_key_len, *data); - efree(str_key); + efree(str_key.u); break; case HASH_KEY_IS_LONG: add_index_zval(return_value, int_key, *data); http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.h?r1=1.28&r2=1.29&diff_format=u Index: php-src/ext/spl/spl_iterators.h diff -u php-src/ext/spl/spl_iterators.h:1.28 php-src/ext/spl/spl_iterators.h:1.29 --- php-src/ext/spl/spl_iterators.h:1.28 Sun Jan 1 13:09:54 2006 +++ php-src/ext/spl/spl_iterators.h Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_iterators.h,v 1.28 2006/01/01 13:09:54 sniper Exp $ */ +/* $Id: spl_iterators.h,v 1.29 2006/02/21 20:12:42 dmitry Exp $ */ #ifndef SPL_ITERATORS_H #define SPL_ITERATORS_H @@ -100,7 +100,7 @@ } inner; struct { zval *data; - char *str_key; + zstr str_key; uint str_key_len; ulong int_key; int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */ http://cvs.php.net/viewcvs.cgi/php-src/ext/sqlite/sqlite.c?r1=1.186&r2=1.187&diff_format=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.186 php-src/ext/sqlite/sqlite.c:1.187 --- php-src/ext/sqlite/sqlite.c:1.186 Sun Feb 19 00:55:20 2006 +++ php-src/ext/sqlite/sqlite.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ | Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ - $Id: sqlite.c,v 1.186 2006/02/19 00:55:20 andi Exp $ + $Id: sqlite.c,v 1.187 2006/02/21 20:12:42 dmitry Exp $ */ #ifdef HAVE_CONFIG_H @@ -946,11 +946,11 @@ } -int sqlite_iterator_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) +int sqlite_iterator_get_current_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) { struct php_sqlite_result *res = ((sqlite_object_iterator*)iter)->res; - *str_key = NULL; + str_key->v = NULL; *str_key_len = 0; *int_key = res ? res->curr_row : 0; return HASH_KEY_IS_LONG; @@ -1127,7 +1127,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "SQLite support", "enabled"); - php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.186 2006/02/19 00:55:20 andi Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.187 2006/02/21 20:12:42 dmitry Exp $"); php_info_print_table_row(2, "SQLite Library", sqlite_libversion()); php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding()); php_info_print_table_end(); @@ -2043,7 +2043,7 @@ zend_bool decode_binary = 1; struct php_sqlite_result *res; zval *object = getThis(); - char *class_name; + zstr class_name; int class_name_len; zend_class_entry *ce; zval dataset; http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.340&r2=1.341&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.340 php-src/ext/standard/array.c:1.341 --- php-src/ext/standard/array.c:1.340 Mon Feb 13 10:23:58 2006 +++ php-src/ext/standard/array.c Tue Feb 21 20:12:42 2006 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.340 2006/02/13 10:23:58 dmitry Exp $ */ +/* $Id: array.c,v 1.341 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -177,11 +177,11 @@ Z_LVAL(first) = f->h; } else if (f->key.type == IS_UNICODE) { Z_TYPE(first) = IS_UNICODE; - Z_USTRVAL(first) = f->key.u.unicode; + Z_USTRVAL(first) = f->key.arKey.u; Z_USTRLEN(first) = f->nKeyLength-1; } else { Z_TYPE(first) = f->key.type; - Z_STRVAL(first) = f->key.u.string; + Z_STRVAL(first) = f->key.arKey.s; Z_STRLEN(first) = f->nKeyLength-1; } @@ -190,11 +190,11 @@ Z_LVAL(second) = s->h; } else if (s->key.type == IS_UNICODE) { Z_TYPE(second) = IS_UNICODE; - Z_USTRVAL(second) = s->key.u.unicode; + Z_USTRVAL(second) = s->key.arKey.u; Z_USTRLEN(second) = s->nKeyLength-1; } else { Z_TYPE(second) = s->key.type; - Z_STRVAL(second) = s->key.u.string; + Z_STRVAL(second) = s->key.arKey.s; Z_STRLEN(second) = s->nKeyLength-1; } @@ -721,11 +721,11 @@ Z_LVAL(key1) = f->h; Z_TYPE(key1) = IS_LONG; } else if (f->key.type == IS_UNICODE) { - Z_USTRVAL(key1) = eustrndup(f->key.u.unicode, f->nKeyLength-1); + Z_USTRVAL(key1) = eustrndup(f->key.arKey.u, f->nKeyLength-1); Z_USTRLEN(key1) = f->nKeyLength-1; Z_TYPE(key1) = IS_UNICODE; } else { - Z_STRVAL(key1) = estrndup(f->key.u.string, f->nKeyLength-1); + Z_STRVAL(key1) = estrndup(f->key.arKey.s, f->nKeyLength-1); Z_STRLEN(key1) = f->nKeyLength-1; Z_TYPE(key1) = f->key.type; } @@ -733,11 +733,11 @@ Z_LVAL(key2) = s->h; Z_TYPE(key2) = IS_LONG; } else if (s->key.type == IS_UNICODE) { - Z_USTRVAL(key2) = eustrndup(s->key.u.unicode, s->nKeyLength-1); + Z_USTRVAL(key2) = eustrndup(s->key.arKey.u, s->nKeyLength-1); Z_USTRLEN(key2) = s->nKeyLength-1; Z_TYPE(key2) = IS_UNICODE; } else { - Z_STRVAL(key2) = estrndup(s->key.u.string, s->nKeyLength-1); + Z_STRVAL(key2) = estrndup(s->key.arKey.s, s->nKeyLength-1); Z_STRLEN(key2) = s->nKeyLength-1; Z_TYPE(key2) = s->key.type; } @@ -926,7 +926,7 @@ PHP_FUNCTION(key) { zval **array; - char *string_key; + zstr string_key; uint string_length; ulong num_key; HashTable *target_hash; @@ -941,10 +941,10 @@ } switch (zend_hash_get_current_key_ex(target_hash, &string_key, &string_length, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - RETVAL_STRINGL(string_key, string_length - 1, 1); + RETVAL_STRINGL(string_key.s, string_length - 1, 1); break; case HASH_KEY_IS_UNICODE: - RETVAL_UNICODEL((UChar*)string_key, string_length - 1, 1); + RETVAL_UNICODEL(string_key.u, string_length - 1, 1); break; case HASH_KEY_IS_LONG: RETVAL_LONG(num_key); @@ -1059,7 +1059,7 @@ zval **args[3], /* Arguments to userland function */ *retval_ptr, /* Return value - unused */ *key=NULL; /* Entry key */ - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition pos; @@ -1096,10 +1096,10 @@ Z_LVAL_P(key) = num_key; break; case HASH_KEY_IS_STRING: - ZVAL_STRINGL(key, string_key, string_key_len-1, 1); + ZVAL_STRINGL(key, string_key.s, string_key_len-1, 1); break; case HASH_KEY_IS_UNICODE: - ZVAL_UNICODEL(key, (UChar*)string_key, string_key_len-1, 1); + ZVAL_UNICODEL(key, string_key.u, string_key_len-1, 1); break; } @@ -1234,7 +1234,7 @@ HashPosition pos; /* hash iterator */ ulong num_key; uint str_key_len; - char *string_key; + zstr string_key; int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 3 || @@ -1266,10 +1266,10 @@ /* Return current key */ switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 0, &pos)) { case HASH_KEY_IS_STRING: - RETURN_STRINGL(string_key, str_key_len-1, 1); + RETURN_STRINGL(string_key.s, str_key_len-1, 1); break; case HASH_KEY_IS_UNICODE: - RETURN_UNICODEL((UChar*)string_key, str_key_len-1, 1); + RETURN_UNICODEL(string_key.u, str_key_len-1, 1); break; case HASH_KEY_IS_LONG: RETURN_LONG(num_key); @@ -1332,7 +1332,7 @@ { zval **var_array, **z_extract_type, **prefix; zval **entry, *data; - void *var_name; + zstr var_name; ulong num_key; uint var_name_len; int var_exists, extract_type, key_type, count = 0; @@ -1393,7 +1393,7 @@ ZVAL_NULL(&final_name); - key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), (char **)&var_name, &var_name_len, &num_key, 0, &pos); + key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(var_array), &var_name, &var_name_len, &num_key, 0, &pos); var_exists = 0; if (key_type == HASH_KEY_IS_STRING || @@ -1438,7 +1438,8 @@ /* break omitted intentionally */ case EXTR_OVERWRITE: - if (var_exists && !strcmp(var_name, "GLOBALS")) { + /* FIXME: Unicode support??? */ + if (var_exists && !strcmp(var_name.s, "GLOBALS")) { break; } @@ -1453,13 +1454,13 @@ Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1); memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix))); Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_'; - memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1)); + memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1)); } else { Z_TYPE(final_name) = IS_STRING; Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1); memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix)); Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_'; - memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1); + memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1); } } break; @@ -1478,33 +1479,34 @@ Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1); memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix))); Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_'; - memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1)); + memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1)); } else { Z_TYPE(final_name) = IS_STRING; Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1); memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix)); Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_'; - memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1); + memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1); } } break; case EXTR_PREFIX_INVALID: if (Z_TYPE(final_name) == IS_NULL) { - if (!php_valid_var_name(var_name)) { + /* FIXME: Unicode support??? */ + if (!php_valid_var_name(var_name.s)) { Z_STRLEN(final_name) = Z_UNILEN_PP(prefix) + 1 + var_name_len; if (UG(unicode)) { Z_TYPE(final_name) = IS_UNICODE; Z_USTRVAL(final_name) = eumalloc(Z_USTRLEN(final_name)+1); memcpy(Z_USTRVAL(final_name), Z_USTRVAL_PP(prefix), UBYTES(Z_USTRLEN_PP(prefix))); Z_USTRVAL(final_name)[Z_USTRLEN_PP(prefix)] = '_'; - memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name, UBYTES(var_name_len+1)); + memcpy(Z_USTRVAL(final_name)+Z_USTRLEN_PP(prefix)+1, var_name.u, UBYTES(var_name_len+1)); } else { Z_TYPE(final_name) = IS_STRING; Z_STRVAL(final_name) = emalloc(Z_STRLEN(final_name)+1); memcpy(Z_STRVAL(final_name), Z_STRVAL_PP(prefix), Z_STRLEN_PP(prefix)); Z_STRVAL(final_name)[Z_STRLEN_PP(prefix)] = '_'; - memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name, var_name_len+1); + memcpy(Z_STRVAL(final_name)+Z_STRLEN_PP(prefix)+1, var_name.s, var_name_len+1); } } else { ZVAL_TEXTL(&final_name, var_name, var_name_len, 1); @@ -1520,7 +1522,8 @@ } if (Z_TYPE(final_name) != IS_NULL) { - if (php_valid_var_name(Z_UNIVAL(final_name))) { + /* FIXME: Unicode support??? */ + if (php_valid_var_name(Z_STRVAL(final_name))) { if (extract_refs) { zval **orig_var; @@ -1984,7 +1987,7 @@ if (p->nKeyLength == 0) { zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } else { - zend_u_hash_update(out_hash, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); } } @@ -1996,7 +1999,7 @@ if (p->nKeyLength == 0) { zend_hash_next_index_insert(*removed, &entry, sizeof(zval *), NULL); } else { - zend_u_hash_update(*removed, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_u_hash_update(*removed, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); } } } else /* otherwise just skip those entries */ @@ -2029,7 +2032,7 @@ if (p->nKeyLength == 0) { zend_hash_next_index_insert(out_hash, &entry, sizeof(zval *), NULL); } else { - zend_u_hash_update(out_hash, p->key.type, &p->key.u, p->nKeyLength, &entry, sizeof(zval *), NULL); + zend_u_hash_update(out_hash, p->key.type, (zstr)p->key.arKey.s, p->nKeyLength, &entry, sizeof(zval *), NULL); } } @@ -2090,7 +2093,7 @@ { zval **stack, /* Input stack */ **val; /* Value to be popped */ - char *key = NULL; + zstr key = (zstr)NULL; int key_len = 0; ulong index; zend_uchar key_type; @@ -2119,12 +2122,12 @@ /* Delete the first or last value */ key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(stack), &key, &key_len, &index, 0, NULL); - if (key && Z_ARRVAL_PP(stack) == &EG(symbol_table)) { + if (key.v && Z_ARRVAL_PP(stack) == &EG(symbol_table)) { if (key_type == HASH_KEY_IS_UNICODE) key_type = IS_UNICODE; else key_type = IS_STRING; zend_u_delete_global_variable(key_type, key, key_len-1 TSRMLS_CC); } else { - zend_hash_del_key_or_index(Z_ARRVAL_PP(stack), key, key_len, index, (key) ? HASH_DEL_KEY : HASH_DEL_INDEX); + zend_u_hash_del_key_or_index(Z_ARRVAL_PP(stack), key_type, key, key_len, index, (key.v) ? HASH_DEL_KEY : HASH_DEL_INDEX); } /* If we did a shift... re-index like it did before */ @@ -2317,7 +2320,7 @@ pos, /* Current position in the array */ argc; /* Number of function arguments */ - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition hpos; @@ -2417,7 +2420,7 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS_DC) { zval **src_entry, **dest_entry; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition pos; @@ -2537,7 +2540,7 @@ **strict, /* be strict */ *new_val; /* New value */ int add_key; /* Flag to indicate whether a key should be added */ - char *string_key; /* String key */ + zstr string_key; /* String key */ uint string_key_len; ulong num_key; /* Numeric key */ HashPosition pos; @@ -2580,10 +2583,10 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 1, &pos)) { case HASH_KEY_IS_STRING: - ZVAL_STRINGL(new_val, string_key, string_key_len-1, 0); + ZVAL_STRINGL(new_val, string_key.s, string_key_len-1, 0); goto ukey; case HASH_KEY_IS_UNICODE: - ZVAL_UNICODEL(new_val, (UChar*)string_key, string_key_len-1, 0); + ZVAL_UNICODEL(new_val, string_key.u, string_key_len-1, 0); ukey: zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &new_val, sizeof(zval *), NULL); @@ -2734,7 +2737,7 @@ zval **input, /* Input array */ **z_preserve_keys, /* Flag: whether to preserve keys */ **entry; /* An entry in the input array */ - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; zend_bool preserve_keys = 0; @@ -2866,7 +2869,7 @@ { zval **array, **entry, *data; HashTable *target_hash; - char *string_key; + zstr string_key; uint str_key_len; ulong num_key; HashPosition pos; @@ -2888,10 +2891,10 @@ MAKE_STD_ZVAL(data); switch (zend_hash_get_current_key_ex(target_hash, &string_key, &str_key_len, &num_key, 1, &pos)) { case HASH_KEY_IS_STRING: - ZVAL_STRINGL(data, string_key, str_key_len-1, 0); + ZVAL_STRINGL(data, string_key.s, str_key_len-1, 0); break; case HASH_KEY_IS_UNICODE: - ZVAL_UNICODEL(data, (UChar *)string_key, str_key_len-1, 0); + ZVAL_UNICODEL(data, string_key.u, str_key_len-1, 0); break; case HASH_KEY_IS_LONG: Z_TYPE_P(data) = IS_LONG; @@ -2920,8 +2923,8 @@ PHP_FUNCTION(array_change_key_case) { zval **array, **entry, **to_upper; - char *string_key; - char *new_key; + zstr string_key; + zstr new_key; uint str_key_len; ulong num_key; ulong change_to_upper=0; @@ -2954,28 +2957,24 @@ zend_hash_index_update(Z_ARRVAL_P(return_value), num_key, entry, sizeof(entry), NULL); break; case HASH_KEY_IS_STRING: - new_key = estrndup(string_key,str_key_len - 1); + new_key.s = estrndup(string_key.s, str_key_len - 1); if (change_to_upper) - php_strtoupper(new_key, str_key_len - 1); + php_strtoupper(new_key.s, str_key_len - 1); else - php_strtolower(new_key, str_key_len - 1); + php_strtolower(new_key.s, str_key_len - 1); zend_u_hash_update(Z_ARRVAL_P(return_value), IS_STRING, new_key, str_key_len, entry, sizeof(entry), NULL); - efree(new_key); + efree(new_key.s); break; case HASH_KEY_IS_UNICODE: - { - UChar *new_key_u; - - new_key_u = eustrndup((UChar *)string_key,str_key_len - 1); - str_key_len--; - if (change_to_upper) - new_key_u = php_u_strtoupper(&new_key_u, &str_key_len, UG(default_locale)); - else - new_key_u = php_u_strtolower(&new_key_u, &str_key_len, UG(default_locale)); - str_key_len++; - zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key_u, str_key_len, entry, sizeof(entry), NULL); - efree(new_key_u); - } + new_key.u = eustrndup(string_key.u, str_key_len - 1); + str_key_len--; + if (change_to_upper) + new_key.u = php_u_strtoupper(&new_key.u, &str_key_len, UG(default_locale)); + else + new_key.u = php_u_strtolower(&new_key.u, &str_key_len, UG(default_locale)); + str_key_len++; + zend_u_hash_update(Z_ARRVAL_P(return_value), IS_UNICODE, new_key, str_key_len, entry, sizeof(entry), NULL); + efree(new_key.u); break; } @@ -3043,9 +3042,9 @@ zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { - zend_u_delete_global_variable(p->key.type, &p->key.u, p->nKeyLength-1 TSRMLS_CC); + zend_u_delete_global_variable(p->key.type, (zstr)p->key.arKey.s, p->nKeyLength-1 TSRMLS_CC); } else { - zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength); + zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); } } } @@ -3303,7 +3302,7 @@ if (p->nKeyLength == 0) { zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { - zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength); + zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); } } } @@ -3319,7 +3318,7 @@ if (p->nKeyLength == 0) { zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { - zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength); + zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); } if (!*++ptrs[0]) { goto out; @@ -3702,7 +3701,7 @@ if (p->nKeyLength == 0) { zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { - zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, &p->key.u, p->nKeyLength); + zend_u_hash_del(Z_ARRVAL_P(return_value), p->key.type, (zstr)p->key.arKey.s, p->nKeyLength); } if (!*++ptrs[0]) { goto out; @@ -4050,7 +4049,7 @@ zval **input, **num_req; long randval; int num_req_val, num_avail, key_type; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition pos; @@ -4092,18 +4091,18 @@ /* If we are returning a single result, just do it. */ if (Z_TYPE_P(return_value) != IS_ARRAY) { if (key_type == HASH_KEY_IS_STRING) { - RETURN_STRINGL(string_key, string_key_len-1, 1); + RETURN_STRINGL(string_key.s, string_key_len-1, 1); } else if (key_type == HASH_KEY_IS_UNICODE) { - RETURN_UNICODEL((UChar *)string_key, string_key_len-1, 1); + RETURN_UNICODEL(string_key.u, string_key_len-1, 1); } else { RETURN_LONG(num_key); } } else { /* Append the result to the return value. */ if (key_type == HASH_KEY_IS_STRING) - add_next_index_stringl(return_value, string_key, string_key_len-1, 1); + add_next_index_stringl(return_value, string_key.s, string_key_len-1, 1); else if (key_type == HASH_KEY_IS_UNICODE) - add_next_index_unicodel(return_value, (UChar *)string_key, string_key_len-1, 1); + add_next_index_unicodel(return_value, string_key.u, string_key_len-1, 1); else add_next_index_long(return_value, num_key); } @@ -4320,7 +4319,7 @@ zval **args[1]; zval *retval = NULL; zval callback_name; - char *string_key; + zstr string_key; zend_fcall_info_cache fci_cache = empty_fcall_info_cache; uint string_key_len; ulong num_key; @@ -4490,7 +4489,7 @@ for (k = 0; k < maxlen; k++) { uint str_key_len; ulong num_key; - char *str_key; + zstr str_key; int key_type = 0; /* @@ -4631,7 +4630,7 @@ { int argc = ZEND_NUM_ARGS(), key_type; long size, current = 0; - char *str_key; + zstr str_key; uint str_key_len; ulong num_key; zend_bool preserve_keys = 0; http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/basic_functions.c?r1=1.755&r2=1.756&diff_format=u Index: php-src/ext/standard/basic_functions.c diff -u php-src/ext/standard/basic_functions.c:1.755 php-src/ext/standard/basic_functions.c:1.756 --- php-src/ext/standard/basic_functions.c:1.755 Tue Feb 21 15:32:34 2006 +++ php-src/ext/standard/basic_functions.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.755 2006/02/21 15:32:34 iliaa Exp $ */ +/* $Id: basic_functions.c,v 1.756 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_streams.h" @@ -1236,7 +1236,7 @@ } convert_to_string_ex(const_name); - if (!zend_u_get_constant(Z_TYPE_PP(const_name), Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) { + if (!zend_u_get_constant(Z_TYPE_PP(const_name), Z_UNIVAL_PP(const_name), Z_UNILEN_PP(const_name), return_value TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", Z_STRVAL_PP(const_name)); RETURN_NULL(); } @@ -2516,8 +2516,8 @@ } if (hash_key->nKeyLength == 0 || - hash_key->type != IS_STRING || - hash_key->u.string[0] != 0) { + hash_key->type != IS_STRING || + hash_key->arKey.s[0] != 0) { MAKE_STD_ZVAL(option); array_init(option); @@ -3179,7 +3179,8 @@ if (!hash_key->nKeyLength) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard."); return 0; - } else if (!strcmp(hash_key->u.string, "GLOBALS")) { + /* FIXME: Unicode support??? */ + } else if (!strcmp(hash_key->arKey.s, "GLOBALS")) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempted GLOBALS variable overwrite."); return 0; } @@ -3190,7 +3191,8 @@ new_key = (char *) emalloc(new_key_len); memcpy(new_key, prefix, prefix_len); - memcpy(new_key+prefix_len, hash_key->u.string, hash_key->nKeyLength); + /* FIXME: Unicode support??? */ + memcpy(new_key+prefix_len, hash_key->arKey.s, hash_key->nKeyLength); } else { new_key_len = spprintf(&new_key, 0, "%s%ld", prefix, hash_key->h); } http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/http.c?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/standard/http.c diff -u php-src/ext/standard/http.c:1.17 php-src/ext/standard/http.c:1.18 --- php-src/ext/standard/http.c:1.17 Sun Jan 1 13:09:55 2006 +++ php-src/ext/standard/http.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: http.c,v 1.17 2006/01/01 13:09:55 sniper Exp $ */ +/* $Id: http.c,v 1.18 2006/02/21 20:12:42 dmitry Exp $ */ #include "php_http.h" #include "php_ini.h" @@ -31,7 +31,8 @@ const char *key_suffix, int key_suffix_len, zval *type, char *arg_sep TSRMLS_DC) { - char *key = NULL, *ekey, *newprefix, *p; + zstr key; + char *ekey, *newprefix, *p; int arg_sep_len, key_len, ekey_len, key_type, newprefix_len; ulong idx; zval **zdata = NULL, *copyzval; @@ -57,22 +58,23 @@ (key_type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(ht) ) { - if (key_type == HASH_KEY_IS_STRING && key_len && key[key_len-1] == '\0') { + if (key_type == HASH_KEY_IS_STRING && key_len && key.s[key_len-1] == '\0') { /* We don't want that trailing NULL */ key_len -= 1; } /* handling for private & protected object properties */ - if (key && *key == '\0' && type != NULL) { - char *tmp; + /* FIXME: Unicode support??? */ + if (key.s && key.s[0] == '\0' && type != NULL) { + zstr tmp; zend_object *zobj = zend_objects_get_address(type TSRMLS_CC); if (zend_check_property_access(zobj, IS_STRING, key TSRMLS_CC) != SUCCESS) { /* private or protected property access outside of the class */ continue; } - zend_unmangle_property_name(key, &tmp, &key); - key_len = strlen(key); + zend_u_unmangle_property_name(key_type, key, &tmp, &key); + key_len = strlen(key.s); } if (zend_hash_get_current_data_ex(ht, (void **)&zdata, NULL) == FAILURE || !zdata || !(*zdata)) { @@ -81,7 +83,7 @@ } if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == IS_OBJECT) { if (key_type == HASH_KEY_IS_STRING) { - ekey = php_url_encode(key, key_len, &ekey_len); + ekey = php_url_encode(key.s, key_len, &ekey_len); newprefix_len = key_suffix_len + ekey_len + key_prefix_len + 1; newprefix = emalloc(newprefix_len + 1); p = newprefix; @@ -142,7 +144,7 @@ /* Simple key=value */ smart_str_appendl(formstr, key_prefix, key_prefix_len); if (key_type == HASH_KEY_IS_STRING) { - ekey = php_url_encode(key, key_len, &ekey_len); + ekey = php_url_encode(key.s, key_len, &ekey_len); smart_str_appendl(formstr, ekey, ekey_len); efree(ekey); } else { http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/incomplete_class.c?r1=1.30&r2=1.31&diff_format=u Index: php-src/ext/standard/incomplete_class.c diff -u php-src/ext/standard/incomplete_class.c:1.30 php-src/ext/standard/incomplete_class.c:1.31 --- php-src/ext/standard/incomplete_class.c:1.30 Sat Jan 28 06:16:32 2006 +++ php-src/ext/standard/incomplete_class.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ */ -/* $Id: incomplete_class.c,v 1.30 2006/01/28 06:16:32 fmk Exp $ */ +/* $Id: incomplete_class.c,v 1.31 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "basic_functions.h" @@ -38,12 +38,13 @@ */ static void incomplete_class_message(zval *object, int error_type TSRMLS_DC) { - char *class_name; + zstr class_name; class_name = php_lookup_class_name(object, NULL); - if (!class_name) { - class_name = "unknown"; + /* FIXME: Unicode support??? */ + if (!class_name.s) { + class_name.s = "unknown"; } php_error_docref(NULL TSRMLS_CC, error_type, INCOMPLETE_CLASS_MSG, class_name); @@ -82,7 +83,7 @@ return 0; } -static union _zend_function *incomplete_class_get_method(zval **object, char *method, int method_len TSRMLS_DC) { +static union _zend_function *incomplete_class_get_method(zval **object, zstr method, int method_len TSRMLS_DC) { incomplete_class_message(*object, E_ERROR TSRMLS_CC); return NULL; } @@ -122,23 +123,23 @@ /* {{{ php_lookup_class_name */ -PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen) +PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen) { zval **val; - char *retval = NULL; + zstr retval = (zstr)NULL; HashTable *object_properties; TSRMLS_FETCH(); object_properties = Z_OBJPROP_P(object); if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) { - retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); + retval.s = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); if (nlen) *nlen = Z_STRLEN_PP(val); } - return (retval); + return retval; } /* }}} */ http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/info.c?r1=1.258&r2=1.259&diff_format=u Index: php-src/ext/standard/info.c diff -u php-src/ext/standard/info.c:1.258 php-src/ext/standard/info.c:1.259 --- php-src/ext/standard/info.c:1.258 Sun Jan 1 13:09:55 2006 +++ php-src/ext/standard/info.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: info.c,v 1.258 2006/01/01 13:09:55 sniper Exp $ */ +/* $Id: info.c,v 1.259 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -96,7 +96,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC) { zval **data, **tmp, tmp2; - char *string_key; + zstr string_key; uint string_len; ulong num_key; char *elem_esc = NULL; @@ -119,11 +119,11 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(data), &string_key, &string_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: if (!sapi_module.phpinfo_as_text) { - elem_esc = php_info_html_esc(string_key TSRMLS_CC); + elem_esc = php_info_html_esc(string_key.s TSRMLS_CC); PUTS(elem_esc); efree(elem_esc); } else { - PUTS(string_key); + PUTS(string_key.s); } break; case HASH_KEY_IS_LONG: @@ -506,7 +506,8 @@ #endif { HashTable *url_stream_wrappers_hash; - char *stream_protocol, *stream_protocols_buf = NULL; + zstr stream_protocol; + char *stream_protocols_buf = NULL; int stream_protocol_len, stream_protocols_buf_len = 0; ulong num_key; @@ -515,7 +516,7 @@ zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(url_stream_wrappers_hash)) { stream_protocols_buf = erealloc(stream_protocols_buf, stream_protocols_buf_len + stream_protocol_len + 2 + 1); - memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol, stream_protocol_len); + memcpy(stream_protocols_buf + stream_protocols_buf_len, stream_protocol.s, stream_protocol_len); stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len] = ','; stream_protocols_buf[stream_protocols_buf_len + stream_protocol_len + 1] = ' '; stream_protocols_buf_len += stream_protocol_len + 2; @@ -537,7 +538,8 @@ { HashTable *stream_xport_hash; - char *xport_name, *xport_buf = NULL; + zstr xport_name; + char *xport_buf = NULL; int xport_name_len, xport_buf_len = 0, xport_buf_size = 0; ulong num_key; @@ -559,7 +561,7 @@ xport_buf[xport_buf_len++] = ','; xport_buf[xport_buf_len++] = ' '; } - memcpy(xport_buf + xport_buf_len, xport_name, xport_name_len); + memcpy(xport_buf + xport_buf_len, xport_name.s, xport_name_len); xport_buf_len += xport_name_len; xport_buf[xport_buf_len] = '\0'; } @@ -578,7 +580,8 @@ { HashTable *stream_filter_hash; - char *filter_name, *filter_buf = NULL; + zstr filter_name; + char *filter_buf = NULL; int filter_name_len, filter_buf_len = 0, filter_buf_size = 0; ulong num_key; @@ -600,7 +603,7 @@ filter_buf[filter_buf_len++] = ','; filter_buf[filter_buf_len++] = ' '; } - memcpy(filter_buf + filter_buf_len, filter_name, filter_name_len); + memcpy(filter_buf + filter_buf_len, filter_name.s, filter_name_len); filter_buf_len += filter_name_len; filter_buf[filter_buf_len] = '\0'; } http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/php_incomplete_class.h?r1=1.19&r2=1.20&diff_format=u Index: php-src/ext/standard/php_incomplete_class.h diff -u php-src/ext/standard/php_incomplete_class.h:1.19 php-src/ext/standard/php_incomplete_class.h:1.20 --- php-src/ext/standard/php_incomplete_class.h:1.19 Sat Jan 28 06:16:32 2006 +++ php-src/ext/standard/php_incomplete_class.h Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_incomplete_class.h,v 1.19 2006/01/28 06:16:32 fmk Exp $ */ +/* $Id: php_incomplete_class.h,v 1.20 2006/02/21 20:12:42 dmitry Exp $ */ #ifndef PHP_INCOMPLETE_CLASS_H #define PHP_INCOMPLETE_CLASS_H @@ -38,10 +38,10 @@ } #define PHP_CLEANUP_CLASS_ATTRIBUTES() \ - if (free_class_name) efree(class_name) + if (free_class_name) efree(class_name.v) #define PHP_CLASS_ATTRIBUTES \ - char *class_name; \ + zstr class_name; \ zend_uint name_len; \ zend_bool free_class_name = 0; \ zend_bool incomplete_class = 0 @@ -55,7 +55,7 @@ zend_class_entry *php_create_incomplete_class(TSRMLS_D); -PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen); +PHPAPI zstr php_lookup_class_name(zval *object, zend_uint *nlen); PHPAPI void php_store_class_name(zval *object, const char *name, zend_uint len); #ifdef __cplusplus http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/proc_open.c?r1=1.40&r2=1.41&diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.40 php-src/ext/standard/proc_open.c:1.41 --- php-src/ext/standard/proc_open.c:1.40 Mon Feb 20 09:38:47 2006 +++ php-src/ext/standard/proc_open.c Tue Feb 21 20:12:42 2006 @@ -15,7 +15,7 @@ | Author: Wez Furlong <wez@thebrainroom.com> | +----------------------------------------------------------------------+ */ -/* $Id: proc_open.c,v 1.40 2006/02/20 09:38:47 dmitry Exp $ */ +/* $Id: proc_open.c,v 1.41 2006/02/21 20:12:42 dmitry Exp $ */ #if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -75,7 +75,8 @@ { zval **element; php_process_env_t env; - char *string_key, *data; + zstr string_key; + char *data; #ifndef PHP_WIN32 char **ep; #endif @@ -148,7 +149,7 @@ continue; } l = string_length + el_len + 1; - memcpy(p, string_key, string_length); + memcpy(p, string_key.s, string_length); strcat(p, "="); strcat(p, data); @@ -478,14 +479,14 @@ /* walk the descriptor spec and set up files/pipes */ zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(descriptorspec), &pos); while (zend_hash_get_current_data_ex(Z_ARRVAL_P(descriptorspec), (void **)&descitem, &pos) == SUCCESS) { - char *str_index; + zstr str_index; ulong nindex; zval **ztype; - str_index = NULL; + str_index.v = NULL; zend_hash_get_current_key_ex(Z_ARRVAL_P(descriptorspec), &str_index, NULL, &nindex, 0, &pos); - if (str_index) { + if (str_index.v) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "descriptor spec must be an integer indexed array"); goto exit_fail; } http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.62&r2=1.63&diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.62 php-src/ext/standard/streamsfuncs.c:1.63 --- php-src/ext/standard/streamsfuncs.c:1.62 Sun Feb 19 04:29:41 2006 +++ php-src/ext/standard/streamsfuncs.c Tue Feb 21 20:12:42 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streamsfuncs.c,v 1.62 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: streamsfuncs.c,v 1.63 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -523,7 +523,7 @@ PHP_FUNCTION(stream_get_transports) { HashTable *stream_xport_hash; - char *stream_xport; + zstr stream_xport; int stream_xport_len; ulong num_key; @@ -537,7 +537,7 @@ while (zend_hash_get_current_key_ex(stream_xport_hash, &stream_xport, &stream_xport_len, &num_key, 0, NULL) == HASH_KEY_IS_STRING) { - add_next_index_stringl(return_value, stream_xport, stream_xport_len, 1); + add_next_index_stringl(return_value, stream_xport.s, stream_xport_len, 1); zend_hash_move_forward(stream_xport_hash); } } else { @@ -551,7 +551,7 @@ PHP_FUNCTION(stream_get_wrappers) { HashTable *url_stream_wrappers_hash; - char *stream_protocol; + zstr stream_protocol; int key_flags, stream_protocol_len = 0; ulong num_key; @@ -565,7 +565,7 @@ (key_flags = zend_hash_get_current_key_ex(url_stream_wrappers_hash, &stream_protocol, &stream_protocol_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(url_stream_wrappers_hash)) { if (key_flags == HASH_KEY_IS_STRING) { - add_next_index_stringl(return_value, stream_protocol, stream_protocol_len, 1); + add_next_index_stringl(return_value, stream_protocol.s, stream_protocol_len, 1); } } } else { @@ -850,7 +850,7 @@ { HashPosition pos, opos; zval **wval, **oval; - char *wkey, *okey; + zstr wkey, okey; int wkey_len, okey_len; int ret = SUCCESS; ulong num_key; @@ -864,7 +864,7 @@ /* fold to string */ UErrorCode errCode = 0; - zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &wkey, &wkey_len, (UChar*)wkey, wkey_len, &errCode); + zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &wkey.s, &wkey_len, wkey.u, wkey_len, &errCode); } zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(wval), &opos); @@ -874,17 +874,17 @@ /* fold to string */ UErrorCode errCode = 0; - zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &okey, &okey_len, (UChar*)okey, okey_len, &errCode); - php_stream_context_set_option(context, wkey, okey, *oval); - efree(okey); + zend_convert_from_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &okey.s, &okey_len, okey.u, okey_len, &errCode); + php_stream_context_set_option(context, wkey.s, okey.s, *oval); + efree(okey.v); } if (HASH_KEY_IS_STRING == otype) { - php_stream_context_set_option(context, wkey, okey, *oval); + php_stream_context_set_option(context, wkey.s, okey.s, *oval); } zend_hash_move_forward_ex(Z_ARRVAL_PP(wval), &opos); } if (wtype == HASH_KEY_IS_UNICODE) { - efree(wkey); + efree(wkey.v); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "options should have the form [\"wrappername\"][\"optionname\"] = $value"); @@ -912,7 +912,7 @@ U_STRING_INIT(u_default_mode, "default_mode", 12); if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp) || - SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_notification, sizeof("notification"), (void**)&tmp)) { + SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_notification, sizeof("notification"), (void**)&tmp)) { if (context->notifier) { php_stream_notification_free(context->notifier); @@ -926,11 +926,11 @@ context->notifier->dtor = user_space_stream_notifier_dtor; } if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp) || - SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_options, sizeof("options"), (void**)&tmp)) { + SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_options, sizeof("options"), (void**)&tmp)) { parse_context_options(context, *tmp TSRMLS_CC); } if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "input_encoding", sizeof("input_encoding"), (void**)&tmp) || - SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_input_encoding, sizeof("input_encoding"), (void**)&tmp)) { + SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_input_encoding, sizeof("input_encoding"), (void**)&tmp)) { zval strval = **tmp; if (context->input_encoding) { @@ -942,7 +942,7 @@ context->input_encoding = Z_STRVAL(strval); } if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "output_encoding", sizeof("output_encoding"), (void**)&tmp) || - SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_output_encoding, sizeof("output_encoding"), (void**)&tmp)) { + SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_output_encoding, sizeof("output_encoding"), (void**)&tmp)) { zval strval = **tmp; if (context->output_encoding) { @@ -954,7 +954,7 @@ context->output_encoding = Z_STRVAL(strval); } if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "default_mode", sizeof("default_mode"), (void**)&tmp) || - SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, u_default_mode, sizeof("default_mode"), (void**)&tmp)) { + SUCCESS == zend_u_hash_find(Z_ARRVAL_P(params), IS_UNICODE, (zstr)u_default_mode, sizeof("default_mode"), (void**)&tmp)) { zval longval = **tmp; zval_copy_ctor(&longval); http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.517&r2=1.518&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.517 php-src/ext/standard/string.c:1.518 --- php-src/ext/standard/string.c:1.517 Sat Jan 28 00:13:13 2006 +++ php-src/ext/standard/string.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.517 2006/01/28 00:13:13 pajoye Exp $ */ +/* $Id: string.c,v 1.518 2006/02/21 20:12:42 dmitry Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2023,7 +2023,7 @@ UChar u_needle_char[3]; int32_t needle_len; char *haystack_copy; - void *target; + zstr target; void *found = NULL; int found_offset; void *start, *end; @@ -2067,11 +2067,11 @@ u_needle_char[needle_len++] = (UChar)U16_TRAIL(Z_LVAL_P(needle)); u_needle_char[needle_len] = 0; } - target = u_needle_char; + target.u = u_needle_char; } else { needle_char[needle_len++] = (char)Z_LVAL_P(needle); needle_char[needle_len] = 0; - target = needle_char; + target.s = needle_char; } } @@ -2080,11 +2080,11 @@ } if (Z_TYPE_P(haystack) == IS_UNICODE) { - found = php_u_stristr(Z_USTRVAL_P(haystack), (UChar *)target, + found = php_u_stristr(Z_USTRVAL_P(haystack), target.u, Z_USTRLEN_P(haystack), needle_len); } else { haystack_copy = estrndup(Z_STRVAL_P(haystack), Z_STRLEN_P(haystack)); - found = php_stristr(Z_STRVAL_P(haystack), (char *)target, + found = php_stristr(Z_STRVAL_P(haystack), target.s, Z_STRLEN_P(haystack), needle_len); } @@ -2356,7 +2356,7 @@ if (Z_TYPE_P(haystack) == IS_UNICODE) { haystack_dup = eustrndup(Z_USTRVAL_P(haystack), haystack_len); php_u_strtolower((UChar **)&haystack_dup, &haystack_len, UG(default_locale)); - needle_dup = eustrndup(Z_STRVAL_P(needle), needle_len); + needle_dup = eustrndup(Z_USTRVAL_P(needle), needle_len); php_u_strtolower((UChar **)&needle_dup, &needle_len, UG(default_locale)); found = zend_u_memnstr((UChar *)haystack_dup + offset, (UChar *)needle_dup, needle_len, @@ -2441,7 +2441,7 @@ PHP_FUNCTION(strrpos) { zval *zhaystack, *zneedle; - void *haystack, *needle; + zstr haystack, needle; int32_t haystack_len, needle_len = 0; zend_uchar str_type; long offset = 0; @@ -2481,12 +2481,12 @@ u_ord_needle[needle_len++] = (UChar)U16_TRAIL(Z_LVAL_P(zneedle)); u_ord_needle[needle_len] = 0; } - needle = u_ord_needle; + needle.u = u_ord_needle; } else { convert_to_long(zneedle); ord_needle[0] = (char)(Z_LVAL_P(zneedle) & 0xFF); ord_needle[1] = '\0'; - needle = ord_needle; + needle.s = ord_needle; needle_len = 1; } } @@ -2499,44 +2499,44 @@ if (Z_TYPE_P(zhaystack) == IS_UNICODE) { if (offset >= 0) { - u_p = (UChar *)haystack + offset; - u_e = (UChar *)haystack + haystack_len - needle_len; + u_p = haystack.u + offset; + u_e = haystack.u + haystack_len - needle_len; } else { - u_p = haystack; + u_p = haystack.u; if (-offset > haystack_len) { - u_e = (UChar *)haystack - needle_len; + u_e = haystack.u - needle_len; } else if (needle_len > -offset) { - u_e = (UChar *)haystack + haystack_len - needle_len; + u_e = haystack.u + haystack_len - needle_len; } else { - u_e = (UChar *)haystack + haystack_len + offset; + u_e = haystack.u + haystack_len + offset; } } - pos = u_strFindLast(u_p, u_e-u_p+needle_len, (UChar *)needle, needle_len); + pos = u_strFindLast(u_p, u_e-u_p+needle_len, needle.u, needle_len); if (pos) { - RETURN_LONG(pos - (UChar *)haystack); + RETURN_LONG(pos - haystack.u); } else { RETURN_FALSE; } } else { if (offset >= 0) { - p = (char *)haystack + offset; - e = (char *)haystack + haystack_len - needle_len; + p = haystack.s + offset; + e = haystack.s + haystack_len - needle_len; } else { - p = haystack; + p = haystack.s; if (-offset > haystack_len) { - e = (char *)haystack - needle_len; + e = haystack.s - needle_len; } else if (needle_len > -offset) { - e = (char *)haystack + haystack_len - needle_len; + e = haystack.s + haystack_len - needle_len; } else { - e = (char *)haystack + haystack_len + offset; + e = haystack.s + haystack_len + offset; } } if (needle_len == 1) { /* Single character search can shortcut memcmps */ while (e >= p) { - if (*e == *(char *)needle) { + if (*e == *needle.s) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; @@ -2545,7 +2545,7 @@ } while (e >= p) { - if (memcmp(e, needle, needle_len) == 0) { + if (memcmp(e, needle.s, needle_len) == 0) { RETURN_LONG(e - p + (offset > 0 ? offset : 0)); } e--; @@ -3429,7 +3429,7 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *hash) { zval **entry; - char *string_key; + zstr string_key; uint string_key_len; zval **trans; zval ctmp; @@ -3451,7 +3451,7 @@ zend_hash_destroy(&tmp_hash); RETURN_FALSE; } - zend_hash_add(&tmp_hash, string_key, string_key_len, entry, sizeof(zval*), NULL); + zend_u_hash_add(&tmp_hash, IS_STRING, string_key, string_key_len, entry, sizeof(zval*), NULL); if (len > maxlen) { maxlen = len; } @@ -4650,7 +4650,7 @@ { zval **subject, **search, **replace, **subject_entry, **zcount; zval *result; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; int count = 0; @@ -4694,7 +4694,7 @@ switch (zend_hash_get_current_key_ex(Z_ARRVAL_PP(subject), &string_key, &string_key_len, &num_key, 0, NULL)) { case HASH_KEY_IS_STRING: - add_assoc_zval_ex(return_value, string_key, string_key_len, result); + add_assoc_zval_ex(return_value, string_key.s, string_key_len, result); break; case HASH_KEY_IS_LONG: http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/type.c?r1=1.39&r2=1.40&diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.39 php-src/ext/standard/type.c:1.40 --- php-src/ext/standard/type.c:1.39 Tue Jan 17 12:18:53 2006 +++ php-src/ext/standard/type.c Tue Feb 21 20:12:42 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: type.c,v 1.39 2006/01/17 12:18:53 dmitry Exp $ */ +/* $Id: type.c,v 1.40 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_incomplete_class.h" @@ -226,7 +226,8 @@ RETURN_TRUE; } ce = Z_OBJCE_PP(arg); - if (!strcmp(ce->name, INCOMPLETE_CLASS)) { + /* FIXME: Unicode support??? */ + if (!strcmp(ce->name.s, INCOMPLETE_CLASS)) { RETURN_FALSE; } } http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/user_filters.c?r1=1.34&r2=1.35&diff_format=u Index: php-src/ext/standard/user_filters.c diff -u php-src/ext/standard/user_filters.c:1.34 php-src/ext/standard/user_filters.c:1.35 --- php-src/ext/standard/user_filters.c:1.34 Tue Jan 17 12:18:53 2006 +++ php-src/ext/standard/user_filters.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: user_filters.c,v 1.34 2006/01/17 12:18:53 dmitry Exp $ */ +/* $Id: user_filters.c,v 1.35 2006/02/21 20:12:42 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -509,7 +509,7 @@ Returns a list of registered filters */ PHP_FUNCTION(stream_get_filters) { - char *filter_name; + zstr filter_name; int key_flags, filter_name_len = 0; HashTable *filters_hash; ulong num_key; @@ -527,7 +527,7 @@ (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &filter_name_len, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTANT; zend_hash_move_forward(filters_hash)) if (key_flags == HASH_KEY_IS_STRING) - add_next_index_stringl(return_value, filter_name, filter_name_len, 1); + add_next_index_stringl(return_value, filter_name.s, filter_name_len, 1); } /* It's okay to return an empty array if no filters are registered */ } http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/var.c?r1=1.218&r2=1.219&diff_format=u Index: php-src/ext/standard/var.c diff -u php-src/ext/standard/var.c:1.218 php-src/ext/standard/var.c:1.219 --- php-src/ext/standard/var.c:1.218 Tue Jan 17 12:18:53 2006 +++ php-src/ext/standard/var.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var.c,v 1.218 2006/01/17 12:18:53 dmitry Exp $ */ +/* $Id: var.c,v 1.219 2006/02/21 20:12:42 dmitry Exp $ */ @@ -120,8 +120,8 @@ php_printf("%*c[%ld]=>\n", level + 1, ' ', hash_key->h); } else { /* string key */ if (va_arg(args, int) && - ((hash_key->type == IS_STRING && hash_key->u.string[0] == 0) || - (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == '\0'))) { + ((hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0) || + (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0))) { /* XXX: perhaps when we are inside the class we should permit access to * private & protected values */ @@ -130,11 +130,11 @@ php_printf("%*c[", level + 1, ' '); if (hash_key->type == IS_STRING) { php_printf("\""); - PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1); + PHPWRITE(hash_key->arKey.s, hash_key->nKeyLength - 1); php_printf("\""); } else if (hash_key->type == IS_UNICODE) { php_printf("u"); - php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, verbose, "\"", 0 TSRMLS_CC); + php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, verbose, "\"", 0 TSRMLS_CC); } php_printf("]=>\n"); } @@ -145,7 +145,7 @@ static int php_object_property_dump(zval **zv, int num_args, va_list args, zend_hash_key *hash_key) { int level; - char *prop_name, *class_name; + zstr prop_name, class_name; int verbose; TSRMLS_FETCH(); @@ -157,11 +157,11 @@ } else { /* string key */ int is_unicode = hash_key->type == IS_UNICODE; - zend_u_unmangle_property_name(hash_key->type, hash_key->u.string, &class_name, &prop_name); + zend_u_unmangle_property_name(hash_key->type, hash_key->arKey, &class_name, &prop_name); php_printf("%*c[", level + 1, ' '); - if (class_name) { - if (class_name[0]=='*') { + if (class_name.s) { + if (class_name.s[0]=='*') { php_printf("%s\"%R\":protected", is_unicode ? "u" : "", hash_key->type, prop_name); } else { php_printf("%s\"%R\":%s\"%R\":private", is_unicode ? "u" : "", hash_key->type, prop_name, is_unicode ? "u" : "", hash_key->type, class_name); @@ -179,7 +179,7 @@ PHPAPI void php_var_dump(zval **struc, int level, int verbose TSRMLS_DC) { HashTable *myht = NULL; - char *class_name; + zstr class_name; zend_uint class_name_len; int (*php_element_dump_func)(zval**, int, va_list, zend_hash_key*); @@ -228,7 +228,7 @@ Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); php_printf("%sobject(%v)#%d (%d) {\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0); - efree(class_name); + efree(class_name.v); php_element_dump_func = php_object_property_dump; head_done: if (myht) { @@ -319,18 +319,18 @@ * private & protected values */ if (va_arg(args, int) && - ((hash_key->type == IS_STRING && hash_key->u.string[0] == 0) || - (hash_key->type == IS_UNICODE && hash_key->u.unicode[0] == '\0'))) { + ((hash_key->type == IS_STRING && hash_key->arKey.s[0] == 0) || + (hash_key->type == IS_UNICODE && hash_key->arKey.u[0] == 0))) { return 0; } php_printf("%*c[", level + 1, ' '); if (hash_key->type == IS_STRING) { php_printf("\""); - PHPWRITE(hash_key->u.string, hash_key->nKeyLength - 1); + PHPWRITE(hash_key->arKey.s, hash_key->nKeyLength - 1); php_printf("\""); } else if (hash_key->type == IS_UNICODE) { php_printf("u"); - php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, 1, "\"", 0 TSRMLS_CC); + php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, 1, "\"", 0 TSRMLS_CC); } php_printf("]=>\n"); } @@ -341,7 +341,7 @@ PHPAPI void php_debug_zval_dump(zval **struc, int level, int verbose TSRMLS_DC) { HashTable *myht = NULL; - char *class_name; + zstr class_name; zend_uint class_name_len; zend_class_entry *ce; @@ -389,7 +389,7 @@ ce = Z_OBJCE(**struc); Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); php_printf("%sobject(%v)#%d (%d) refcount(%u){\n", COMMON, class_name, Z_OBJ_HANDLE_PP(struc), myht ? zend_hash_num_elements(myht) : 0, Z_REFCOUNT_PP(struc)); - efree(class_name); + efree(class_name.v); head_done: if (myht) { zend_hash_apply_with_arguments(myht, (apply_func_args_t) zval_array_element_dump, 1, level, (Z_TYPE_PP(struc) == IS_ARRAY ? 0 : 1)); @@ -452,12 +452,12 @@ } else { /* string key */ php_printf("%*c'", level + 1, ' '); if (hash_key->type == IS_UNICODE) { - php_var_dump_unicode(hash_key->u.unicode, hash_key->nKeyLength-1, 0, "", 1 TSRMLS_CC); + php_var_dump_unicode(hash_key->arKey.u, hash_key->nKeyLength-1, 0, "", 1 TSRMLS_CC); } else { char *key; int key_len; - key = php_addcslashes(hash_key->u.string, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + key = php_addcslashes(hash_key->arKey.s, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); PHPWRITE(key, key_len); efree(key); } @@ -471,14 +471,14 @@ static int php_object_element_export(zval **zv, int num_args, va_list args, zend_hash_key *hash_key) { int level; - char *prop_name, *class_name; + zstr prop_name, class_name; TSRMLS_FETCH(); level = va_arg(args, int); if (hash_key->nKeyLength != 0) { php_printf("%*c", level + 1, ' '); - zend_u_unmangle_property_name(hash_key->type, hash_key->u.string, &class_name, &prop_name); + zend_u_unmangle_property_name(hash_key->type, hash_key->arKey, &class_name, &prop_name); php_printf(" '%R' => ", hash_key->type, prop_name); php_var_export(zv, level + 2 TSRMLS_CC); PUTS (",\n"); @@ -491,7 +491,7 @@ HashTable *myht; char* tmp_str; int tmp_len; - char *class_name; + zstr class_name; zend_uint class_name_len; switch (Z_TYPE_PP(struc)) { @@ -536,7 +536,7 @@ } Z_OBJ_HANDLER(**struc, get_class_name)(*struc, &class_name, &class_name_len, 0 TSRMLS_CC); php_printf ("%v::__set_state(array(\n", class_name); - efree(class_name); + efree(class_name.v); if (myht) { zend_hash_apply_with_arguments(myht, (apply_func_args_t) php_object_element_export, 1, level); } @@ -671,9 +671,9 @@ smart_str_append_long(buf, name_len); smart_str_appendl(buf, ":\"", 2); if (UG(unicode)) { - php_var_serialize_ustr(buf, (UChar*)class_name, name_len); + php_var_serialize_ustr(buf, class_name.u, name_len); } else { - smart_str_appendl(buf, class_name, name_len); + smart_str_appendl(buf, class_name.s, name_len); } smart_str_appendl(buf, "\":", 2); PHP_CLEANUP_CLASS_ATTRIBUTES(); @@ -696,7 +696,7 @@ smart_str_appendl(buf, ":{", 2); if (count > 0) { - char *key; + zstr key; zval **d, **name; ulong index; HashPosition pos; @@ -715,7 +715,8 @@ if (i == HASH_KEY_NON_EXISTANT) break; - if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) { + /* FIXME: Unicode support??? */ + if (incomplete_class && strcmp(key.s, MAGIC_MEMBER) == 0) { continue; } zend_hash_get_current_data_ex(HASH_OF(retval_ptr), @@ -742,36 +743,36 @@ zend_class_entry *ce; ce = zend_get_class_entry(*struc TSRMLS_CC); if (ce) { - char *prot_name, *priv_name; + zstr prot_name, priv_name; int prop_name_length; do { zend_u_mangle_property_name(&priv_name, &prop_name_length, Z_TYPE_PP(name), ce->name, ce->name_length, - Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), priv_name, prop_name_length+1, (void *) &d) == SUCCESS) { if (Z_TYPE_PP(name) == IS_UNICODE) { - php_var_serialize_unicode(buf, (UChar *)priv_name, prop_name_length); + php_var_serialize_unicode(buf, priv_name.u, prop_name_length); } else { - php_var_serialize_string(buf, priv_name, prop_name_length); + php_var_serialize_string(buf, priv_name.s, prop_name_length); } - efree(priv_name); + efree(priv_name.v); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); break; } - efree(priv_name); - zend_u_mangle_property_name(&prot_name, &prop_name_length, Z_TYPE_PP(name), "*", 1, - Z_STRVAL_PP(name), Z_STRLEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); + efree(priv_name.v); + zend_u_mangle_property_name(&prot_name, &prop_name_length, Z_TYPE_PP(name), (zstr)"*", 1, + Z_UNIVAL_PP(name), Z_UNILEN_PP(name), ce->type & ZEND_INTERNAL_CLASS); if (zend_u_hash_find(Z_OBJPROP_PP(struc), Z_TYPE_PP(name), prot_name, prop_name_length+1, (void *) &d) == SUCCESS) { if (Z_TYPE_PP(name) == IS_UNICODE) { - php_var_serialize_unicode(buf, (UChar *)prot_name, prop_name_length); + php_var_serialize_unicode(buf, prot_name.u, prop_name_length); } else { - php_var_serialize_string(buf, prot_name, prop_name_length); + php_var_serialize_string(buf, prot_name.s, prop_name_length); } - efree(prot_name); + efree(prot_name.v); php_var_serialize_intern(buf, d, var_hash TSRMLS_CC); break; } - efree(prot_name); + efree(prot_name.v); php_error_docref(NULL TSRMLS_CC, E_NOTICE, "\"%R\" returned as member variable from __sleep() but does not exist", Z_TYPE_PP(name), Z_UNIVAL_PP(name)); if (Z_TYPE_PP(name) == IS_UNICODE) { php_var_serialize_unicode(buf, Z_USTRVAL_PP(name), Z_USTRLEN_PP(name)); @@ -868,7 +869,8 @@ smart_str_appendl(buf, "C:", 2); smart_str_append_long(buf, Z_OBJCE_PP(struc)->name_length); smart_str_appendl(buf, ":\"", 2); - smart_str_appendl(buf, Z_OBJCE_PP(struc)->name, Z_OBJCE_PP(struc)->name_length); + /* FIXME: Unicode support??? */ + smart_str_appendl(buf, Z_OBJCE_PP(struc)->name.s, Z_OBJCE_PP(struc)->name_length); smart_str_appendl(buf, "\":", 2); smart_str_append_long(buf, serialized_length); @@ -933,7 +935,7 @@ smart_str_append_long(buf, i); smart_str_appendl(buf, ":{", 2); if (i > 0) { - char *key; + zstr key; zval **data; ulong index; uint key_len; @@ -946,7 +948,8 @@ if (i == HASH_KEY_NON_EXISTANT) break; - if (incomplete_class && strcmp(key, MAGIC_MEMBER) == 0) { + /* FIXME: Unicode support??? */ + if (incomplete_class && strcmp(key.s, MAGIC_MEMBER) == 0) { continue; } @@ -955,10 +958,10 @@ php_var_serialize_long(buf, index); break; case HASH_KEY_IS_STRING: - php_var_serialize_string(buf, key, key_len - 1); + php_var_serialize_string(buf, key.s, key_len - 1); break; case HASH_KEY_IS_UNICODE: - php_var_serialize_unicode(buf, (UChar*)key, key_len - 1); + php_var_serialize_unicode(buf, key.u, key_len - 1); break; } http://cvs.php.net/viewcvs.cgi/php-src/main/main.c?r1=1.664&r2=1.665&diff_format=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.664 php-src/main/main.c:1.665 --- php-src/main/main.c:1.664 Sun Feb 19 04:29:41 2006 +++ php-src/main/main.c Tue Feb 21 20:12:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.664 2006/02/19 04:29:41 andi Exp $ */ +/* $Id: main.c,v 1.665 2006/02/21 20:12:42 dmitry Exp $ */ /* {{{ includes */ @@ -548,9 +548,9 @@ char *p; int buffer_len = 0; char *space; - char *class_name = get_active_class_name(&space TSRMLS_CC); + zstr class_name = get_active_class_name(&space TSRMLS_CC); int origin_len; - char *function = NULL; + zstr function = (zstr)NULL; char *origin; char *message; char *stage; @@ -576,19 +576,19 @@ EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL) { switch (EG(current_execute_data)->opline->op2.u.constant.value.lval) { case ZEND_EVAL: - function = "eval"; + function.s = "eval"; break; case ZEND_INCLUDE: - function = "include"; + function.s = "include"; break; case ZEND_INCLUDE_ONCE: - function = "include_once"; + function.s = "include_once"; break; case ZEND_REQUIRE: - function = "require"; + function.s = "require"; break; case ZEND_REQUIRE_ONCE: - function = "require_once"; + function.s = "require_once"; break; default: stage = "Unknown"; @@ -596,16 +596,16 @@ } else { function_name_is_string = 0; function = get_active_function_name(TSRMLS_C); - if (!function || !USTR_LEN(function)) { + if (!function.v || !USTR_LEN(function)) { stage = "Unknown"; - function = NULL; + function.v = NULL; } } /* if we still have memory then format the origin */ - if (function) { + if (function.v) { if (function_name_is_string) { - origin_len = spprintf(&origin, 0, "%v%s%s(%s)", class_name, space, function, params); + origin_len = spprintf(&origin, 0, "%v%s%s(%s)", class_name, space, function.s, params); } else { origin_len = spprintf(&origin, 0, "%v%s%v(%s)", class_name, space, function, params); } @@ -627,9 +627,9 @@ } /* no docref given but function is known (the default) */ - if (!docref && function) { + if (!docref && function.v) { if (function_name_is_string) { - spprintf(&docref_buf, 0, "function.%s", function); + spprintf(&docref_buf, 0, "function.%s", function.s); } else { spprintf(&docref_buf, 0, "function.%v", function); } @@ -643,7 +643,7 @@ * - we show erroes in html mode OR * - the user wants to see the links anyway */ - if (docref && function && (PG(html_errors) || strlen(PG(docref_root)))) { + if (docref && function.v && (PG(html_errors) || strlen(PG(docref_root)))) { if (strncmp(docref, "http://", 7)) { /* We don't have 'http://' so we use docref_root */ http://cvs.php.net/viewcvs.cgi/php-src/main/output.c?r1=1.173&r2=1.174&diff_format=u Index: php-src/main/output.c diff -u php-src/main/output.c:1.173 php-src/main/output.c:1.174 --- php-src/main/output.c:1.173 Tue Jan 17 12:18:53 2006 +++ php-src/main/output.c Tue Feb 21 20:12:43 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.173 2006/01/17 12:18:53 dmitry Exp $ */ +/* $Id: output.c,v 1.174 2006/02/21 20:12:43 dmitry Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -414,7 +414,7 @@ /* {{{ php_ob_init_named */ -static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type, char *handler_name, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC) +static int php_ob_init_named(uint initial_size, uint block_size, zend_uchar type, zstr handler_name, zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC) { int handler_len; @@ -422,9 +422,9 @@ return FAILURE; } if (type == IS_UNICODE) { - handler_len = u_strlen(handler_name); + handler_len = u_strlen(handler_name.u); } else { - handler_len = strlen(handler_name); + handler_len = strlen(handler_name.s); } if (OG(ob_nesting_level)>0) { #if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) @@ -449,9 +449,10 @@ OG(active_ob_buffer).status = 0; OG(active_ob_buffer).internal_output_handler = NULL; if (type == IS_UNICODE) { - OG(active_ob_buffer).handler_name = eustrdup(handler_name&&handler_name[0]?handler_name:OB_DEFAULT_HANDLER_NAME); + /* FIXME: Unicode support??? */ + OG(active_ob_buffer).handler_name = eustrdup((handler_name.u && handler_name.u[0])?handler_name.u:(UChar*)OB_DEFAULT_HANDLER_NAME); } else { - OG(active_ob_buffer).handler_name = estrdup(handler_name&&handler_name[0]?handler_name:OB_DEFAULT_HANDLER_NAME); + OG(active_ob_buffer).handler_name = estrdup((handler_name.s && handler_name.s[0])?handler_name.s:OB_DEFAULT_HANDLER_NAME); } OG(active_ob_buffer).erase = erase; OG(php_body_write) = php_b_body_write; @@ -509,7 +510,7 @@ len = next_handler_name-handler_name; next_handler_name = estrndup(handler_name, len); handler_zval = php_ob_handler_from_string(next_handler_name, len TSRMLS_CC); - result = php_ob_init_named(initial_size, block_size, IS_STRING, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); + result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); if (result != SUCCESS) { zval_dtor(handler_zval); FREE_ZVAL(handler_zval); @@ -521,7 +522,7 @@ } if (result == SUCCESS) { handler_zval = php_ob_handler_from_string(handler_name, handler_len TSRMLS_CC); - result = php_ob_init_named(initial_size, block_size, IS_STRING, handler_name, handler_zval, chunk_size, erase TSRMLS_CC); + result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC); if (result != SUCCESS) { zval_dtor(handler_zval); FREE_ZVAL(handler_zval); @@ -538,7 +539,7 @@ len = next_handler_name-handler_name; next_handler_name = eustrndup(handler_name, len); handler_zval = php_ob_handler_from_unicode(next_handler_name, len TSRMLS_CC); - result = php_ob_init_named(initial_size, block_size, IS_UNICODE, next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); + result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)next_handler_name, handler_zval, chunk_size, erase TSRMLS_CC); if (result != SUCCESS) { zval_dtor(handler_zval); FREE_ZVAL(handler_zval); @@ -550,7 +551,7 @@ } if (result == SUCCESS) { handler_zval = php_ob_handler_from_unicode(handler_name, handler_len TSRMLS_CC); - result = php_ob_init_named(initial_size, block_size, IS_UNICODE, handler_name, handler_zval, chunk_size, erase TSRMLS_CC); + result = php_ob_init_named(initial_size, block_size, IS_UNICODE, (zstr)handler_name, handler_zval, chunk_size, erase TSRMLS_CC); if (result != SUCCESS) { zval_dtor(handler_zval); FREE_ZVAL(handler_zval); @@ -581,7 +582,7 @@ php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use ob_start(array($object,'method')) to specify instance $object and the name of a method of class %v to use as output handler", Z_OBJCE_P(output_handler)->name); result = FAILURE; } else { - result = php_ob_init_named(initial_size, block_size, IS_STRING, OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC); + result = php_ob_init_named(initial_size, block_size, IS_STRING, (zstr)OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC); } return result; } http://cvs.php.net/viewcvs.cgi/php-src/main/php_variables.c?r1=1.114&r2=1.115&diff_format=u Index: php-src/main/php_variables.c diff -u php-src/main/php_variables.c:1.114 php-src/main/php_variables.c:1.115 --- php-src/main/php_variables.c:1.114 Mon Feb 13 16:35:36 2006 +++ php-src/main/php_variables.c Tue Feb 21 20:12:43 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.114 2006/02/13 16:35:36 dmitry Exp $ */ +/* $Id: php_variables.c,v 1.115 2006/02/21 20:12:43 dmitry Exp $ */ #include <stdio.h> #include "php.h" @@ -336,11 +336,11 @@ } else { escaped_index = index; } - if (zend_u_symtable_find(symtable1, IS_UNICODE, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE + if (zend_u_symtable_find(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { MAKE_STD_ZVAL(gpc_element); array_init(gpc_element); - zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } if (index!=escaped_index) { efree(escaped_index); @@ -369,7 +369,7 @@ /* UTODO fix for php_addslashes case */ //char *escaped_index = php_addslashes(index, index_len, &index_len, 0 TSRMLS_CC); UChar *escaped_index = index; - zend_u_symtable_update(symtable1, IS_UNICODE, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_u_symtable_update(symtable1, IS_UNICODE, (zstr)escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); //efree(escaped_index); } break; @@ -804,7 +804,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { zval **src_entry, **dest_entry; - char *string_key; + zstr string_key; uint string_key_len; ulong num_key; HashPosition pos; @@ -814,16 +814,17 @@ zend_hash_internal_pointer_reset_ex(src, &pos); while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) { key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos); + /* FIXME: Unicode support??? */ if (Z_TYPE_PP(src_entry) != IS_ARRAY - || (key_type == HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) + || (key_type == HASH_KEY_IS_STRING && zend_u_hash_find(dest, key_type, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) || (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) || Z_TYPE_PP(dest_entry) != IS_ARRAY ) { (*src_entry)->refcount++; if (key_type == HASH_KEY_IS_STRING) { /* if register_globals is on and working with main symbol table, prevent overwriting of GLOBALS */ - if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key, "GLOBALS", sizeof("GLOBALS") - 1)) { - zend_hash_update(dest, string_key, string_key_len, src_entry, sizeof(zval *), NULL); + if (!globals_check || string_key_len != sizeof("GLOBALS") || memcmp(string_key.s, "GLOBALS", sizeof("GLOBALS") - 1)) { + zend_u_hash_update(dest, key_type, string_key, string_key_len, src_entry, sizeof(zval *), NULL); } else { (*src_entry)->refcount--; } http://cvs.php.net/viewcvs.cgi/php-src/main/rfc1867.c?r1=1.180&r2=1.181&diff_format=u Index: php-src/main/rfc1867.c diff -u php-src/main/rfc1867.c:1.180 php-src/main/rfc1867.c:1.181 --- php-src/main/rfc1867.c:1.180 Sun Jan 1 13:09:57 2006 +++ php-src/main/rfc1867.c Tue Feb 21 20:12:43 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: rfc1867.c,v 1.180 2006/01/01 13:09:57 sniper Exp $ */ +/* $Id: rfc1867.c,v 1.181 2006/02/21 20:12:43 dmitry Exp $ */ /* * This product includes software developed by the Apache Group @@ -264,7 +264,7 @@ int dummy=1; normalize_u_protected_variable(varname TSRMLS_CC); - zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, varname, u_strlen(varname)+1, &dummy, sizeof(int), NULL); + zend_u_hash_add(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1, &dummy, sizeof(int), NULL); } @@ -278,7 +278,7 @@ static zend_bool is_u_protected_variable(UChar *varname TSRMLS_DC) { normalize_u_protected_variable(varname TSRMLS_CC); - return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, varname, u_strlen(varname)+1); + return zend_u_hash_exists(&PG(rfc1867_protected_variables), IS_UNICODE, (zstr)varname, u_strlen(varname)+1); } @@ -1316,7 +1316,7 @@ } temp_filename = EMPTY_STR; } else { - zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, temp_filename, u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL); + zend_u_hash_add(SG(rfc1867_uploaded_files), IS_UNICODE, (zstr)temp_filename, u_strlen(temp_filename) + 1, &temp_filename, sizeof(UChar *), NULL); } /* is_arr_upload is true when name of file upload field http://cvs.php.net/viewcvs.cgi/php-src/main/streams/streams.c?r1=1.95&r2=1.96&diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.95 php-src/main/streams/streams.c:1.96 --- php-src/main/streams/streams.c:1.95 Sun Feb 19 04:29:42 2006 +++ php-src/main/streams/streams.c Tue Feb 21 20:12:43 2006 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.95 2006/02/19 04:29:42 andi Exp $ */ +/* $Id: streams.c,v 1.96 2006/02/21 20:12:43 dmitry Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -2636,7 +2636,9 @@ php_stream *stream) { php_stream **pstream; - char *hostent; + zend_uchar type; + zstr hostent; + unsigned int hostent_len; int ret = SUCCESS; if (!context || !context->links || !stream) { @@ -2647,8 +2649,9 @@ SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(context->links), (void**)&pstream); zend_hash_move_forward(Z_ARRVAL_P(context->links))) { if (*pstream == stream) { - if (SUCCESS == zend_hash_get_current_key(Z_ARRVAL_P(context->links), &hostent, NULL, 0)) { - if (FAILURE == zend_hash_del(Z_ARRVAL_P(context->links), (char*)hostent, strlen(hostent)+1)) { + type = zend_hash_get_current_key_ex(Z_ARRVAL_P(context->links), &hostent, &hostent_len, NULL, 0, NULL); + if (type == HASH_KEY_IS_STRING || type == HASH_KEY_IS_UNICODE) { + if (FAILURE == zend_u_hash_del(Z_ARRVAL_P(context->links), type, hostent, hostent_len)) { ret = FAILURE; } } else { http://cvs.php.net/viewcvs.cgi/php-src/sapi/cli/php_cli.c?r1=1.145&r2=1.146&diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.145 php-src/sapi/cli/php_cli.c:1.146 --- php-src/sapi/cli/php_cli.c:1.145 Mon Feb 13 10:23:59 2006 +++ php-src/sapi/cli/php_cli.c Tue Feb 21 20:12:43 2006 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c,v 1.145 2006/02/13 10:23:59 dmitry Exp $ */ +/* $Id: php_cli.c,v 1.146 2006/02/21 20:12:43 dmitry Exp $ */ #include "php.h" #include "php_globals.h" @@ -490,21 +490,21 @@ ic.value = *zin; ic.flags = CONST_CS; - ic.name = zend_strndup(ZEND_STRL("STDIN")); + ic.name.s = zend_strndup(ZEND_STRL("STDIN")); ic.name_len = sizeof("STDIN"); ic.module_number = 0; zend_register_constant(&ic TSRMLS_CC); oc.value = *zout; oc.flags = CONST_CS; - oc.name = zend_strndup(ZEND_STRL("STDOUT")); + oc.name.s = zend_strndup(ZEND_STRL("STDOUT")); oc.name_len = sizeof("STDOUT"); oc.module_number = 0; zend_register_constant(&oc TSRMLS_CC); ec.value = *zerr; ec.flags = CONST_CS; - ec.name = zend_strndup(ZEND_STRL("STDERR")); + ec.name.s = zend_strndup(ZEND_STRL("STDERR")); ec.name_len = sizeof("STDERR"); ec.module_number = 0; zend_register_constant(&ec TSRMLS_CC);
« previous php.cvs (#36964) next »