summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>1999-12-04 16:50:18 +0000
committerAndrei Zmievski <andrei@php.net>1999-12-04 16:50:18 +0000
commitf962a35df75d343f5f4503864c067cf36dac9e11 (patch)
tree8a38b63edcb96ff7f79dbf2aba980e753d00dc61
parent0a276c2ff384fa19398c1e8022869ef90b7dd529 (diff)
downloadphp-git-f962a35df75d343f5f4503864c067cf36dac9e11.tar.gz
Added zend_set_hash_symbol() function.
-rw-r--r--Zend/zend_API.c21
-rw-r--r--Zend/zend_API.h5
-rw-r--r--Zend/zend_hash.h1
3 files changed, 25 insertions, 2 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 0427d252cb..8d5c7219e5 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -836,3 +836,24 @@ ZEND_API zend_module_entry *zend_get_module(int module_number)
return NULL;
}
}
+
+ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
+ int is_ref, int num_symbol_tables, ...)
+{
+ HashTable *symbol_table;
+ va_list symbol_table_list;
+
+ if (num_symbol_tables <= 0) return FAILURE;
+
+ symbol->is_ref = is_ref;
+ symbol->refcount = 0;
+
+ va_start(symbol_table_list, num_symbol_tables);
+ while(num_symbol_tables-- > 0) {
+ symbol_table = va_arg(symbol_table_list, HashTable *);
+ zend_hash_update_ptr(symbol_table, name, name_length + 1, symbol, sizeof(zval *), NULL);
+ zval_add_ref(&symbol);
+ }
+ va_end(symbol_table_list);
+ return SUCCESS;
+}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index 82e4a1cd56..c5d7460600 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -132,6 +132,9 @@ ZEND_API int add_property_double(zval *arg, char *key, double d);
ZEND_API int add_property_string(zval *arg, char *key, char *str, int duplicate);
ZEND_API int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate);
+ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length,
+ int is_ref, int num_symbol_tables, ...);
+
#define add_method(arg,key,method) add_assoc_function((arg),(key),(method))
#define RETVAL_RESOURCE(l) { \
@@ -279,7 +282,7 @@ ZEND_API int add_property_stringl(zval *arg, char *key, char *str, uint length,
#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? (p)->value.obj.properties : NULL)))
-#endif /* _ZEND_API_H */
+#endif /* _ZEND_API_H */
/*
* Local variables:
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 4c6d740883..dc2a469a54 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -100,7 +100,6 @@ ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void
ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData);
-
typedef struct _zend_hash_key {
char *arKey;
uint nKeyLength;