diff options
author | Andi Gutmans <andi@php.net> | 2000-06-09 14:40:14 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-06-09 14:40:14 +0000 |
commit | eb0e69466571093c6f6cb70c05efea1489b8f571 (patch) | |
tree | 4e06066a2567489aacb96e5d6577282dc3da7b89 /Zend/zend_API.c | |
parent | ef1d6987fde2d1793f606345b6b1f5633d523583 (diff) | |
download | php-git-eb0e69466571093c6f6cb70c05efea1489b8f571.tar.gz |
- Andrei, this is for you!
- Add zend_register_internal_class_ex() which allows you to specify a
- parent to inherit from. You can either specify the parent directly or via
- its name.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 8e28c9ddb1..1fe7a46279 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -867,6 +867,29 @@ int zend_next_free_module(void) return ++module_count; } +/* If parent_ce is not NULL then it inherits from parent_ce + * If parent_ce is NULL and parent_name isn't then it looks for the parent and inherits from it + * If both parent_ce and parent_name are NULL it does a regular class registration + * If parent_name is specified but not found NULL is returned + */ +ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name) +{ + zend_class_entry *register_class; + CLS_FETCH(); + + if (!parent_ce && parent_name) { + if (zend_hash_find(CG(class_table), parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) { + return NULL; + } + } + + register_class = zend_register_internal_class(class_entry); + + if (parent_ce) { + do_inheritance(register_class, parent_ce); + } + return register_class; +} ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry) { |