]> granicus.if.org Git - php/commitdiff
Added zend_set_hash_symbol() function.
authorAndrei Zmievski <andrei@php.net>
Sat, 4 Dec 1999 16:50:18 +0000 (16:50 +0000)
committerAndrei Zmievski <andrei@php.net>
Sat, 4 Dec 1999 16:50:18 +0000 (16:50 +0000)
Zend/zend_API.c
Zend/zend_API.h
Zend/zend_hash.h

index 0427d252cb953c1fefb03e78e552b2d0c056de31..8d5c7219e5fb8c41bace45e008cd376cfea1fe79 100644 (file)
@@ -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;
+}
index 82e4a1cd5631256033a91d05e728d203ecdc7c64..c5d7460600ad19fc988c7e7eb48b5be333276cb3 100644 (file)
@@ -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:
index 4c6d7408830a41fea48925de1376c4c3f7218971..dc2a469a54fee500a1ca5a0f22d98943150b98e2 100644 (file)
@@ -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;