]> granicus.if.org Git - php/commitdiff
Add add_property_zstr(l)(_ex)()
authorSara Golemon <pollita@php.net>
Sun, 7 Jan 2007 06:16:57 +0000 (06:16 +0000)
committerSara Golemon <pollita@php.net>
Sun, 7 Jan 2007 06:16:57 +0000 (06:16 +0000)
Zend/zend_API.c
Zend/zend_API.h

index 920c21c8793209bc2f852cb3d0c8d0a03b40f072..504d358befe269afab6e3dcd2d89565e2d81c7bc 100644 (file)
@@ -1727,6 +1727,50 @@ ZEND_API int add_utf8_property_zval_ex(zval *arg, char *key, uint key_len, zval
        return SUCCESS;
 }
 
+ZEND_API int add_property_zstr_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, int duplicate TSRMLS_DC)
+{
+       zval *tmp;
+       zval *z_key;
+
+       if (type == IS_UNICODE) {
+               MAKE_STD_ZVAL(tmp);
+               ZVAL_UNICODE(tmp, str.u, duplicate);
+       } else {
+               MAKE_STD_ZVAL(tmp);
+               ZVAL_STRING(tmp, str.s, duplicate);
+       }
+
+       MAKE_STD_ZVAL(z_key);
+       ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1);
+
+       Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
+       zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+       zval_ptr_dtor(&z_key);
+       return SUCCESS;
+}
+
+ZEND_API int add_property_zstrl_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, uint length, int duplicate TSRMLS_DC)
+{
+       zval *tmp;
+       zval *z_key;
+
+       if (type == IS_UNICODE) {
+               MAKE_STD_ZVAL(tmp);
+               ZVAL_UNICODEL(tmp, str.u, length, duplicate);
+       } else {
+               MAKE_STD_ZVAL(tmp);
+               ZVAL_STRINGL(tmp, str.s, length, duplicate);
+       }
+
+       MAKE_STD_ZVAL(z_key);
+       ZVAL_ASCII_STRINGL(z_key, key, key_len-1, 1);
+
+       Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
+       zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
+       zval_ptr_dtor(&z_key);
+       return SUCCESS;
+}
+
 ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC)
 {
        int name_len;
index c8c73a25a7bfd90dd899f27f7fb8ce890a4e261f..2b09f93d527f02e804e344a99f97bf802fc3d345 100644 (file)
@@ -1467,6 +1467,8 @@ ZEND_API int add_property_unicode_ex(zval *arg, char *key, uint key_len, UChar *
 ZEND_API int add_property_unicodel_ex(zval *arg, char *key, uint key_len,  UChar *str, uint length, int duplicate TSRMLS_DC);
 ZEND_API int add_property_utf8_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC);
 ZEND_API int add_property_utf8_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC);
+ZEND_API int add_property_zstr_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, int duplicate TSRMLS_DC);
+ZEND_API int add_property_zstrl_ex(zval *arg, char *key, uint key_len, zend_uchar type, zstr str, uint length, int duplicate TSRMLS_DC);
 
 #define add_property_long(__arg, __key, __n) add_property_long_ex(__arg, __key, strlen(__key)+1, __n TSRMLS_CC)
 #define add_property_null(__arg, __key) add_property_null_ex(__arg, __key, strlen(__key) + 1 TSRMLS_CC)
@@ -1484,7 +1486,8 @@ ZEND_API int add_property_utf8_stringl_ex(zval *arg, char *key, uint key_len, ch
 #define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key)+1, __value TSRMLS_CC)
 #define add_property_unicode(__arg, __key, __str, __duplicate) add_property_unicode_ex(__arg, __key, strlen(__key)+1, __str, __duplicate TSRMLS_CC)
 #define add_property_unicodel(__arg, __key, __str, __length, __duplicate) add_property_unicodel_ex(__arg, __key, strlen(__key)+1, __str, __length, __duplicate TSRMLS_CC)
-
+#define add_property_zstr(__arg, __key, __type, __str, __duplicate) add_property_zstr_ex(__arg, __key, strlen(__key)+1, __type, __str, __duplicate TSRMLS_CC)
+#define add_property_zstrl(__arg, __key, __type, __str, __length, __duplicate) add_property_zstrl_ex(__arg, __key, strlen(__key)+1, __type, __str, __length, __duplicate TSRMLS_CC)
 
 ZEND_API int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC);
 ZEND_API int call_user_function_ex(HashTable *function_table, zval **object_pp, zval *function_name, zval **retval_ptr_ptr, zend_uint param_count, zval **params[], int no_separation, HashTable *symbol_table TSRMLS_DC);