diff options
author | Harald Radi <phanto@php.net> | 2002-03-19 18:46:28 +0000 |
---|---|---|
committer | Harald Radi <phanto@php.net> | 2002-03-19 18:46:28 +0000 |
commit | cb2368c90553c0ecad48a2241d865a548d26445d (patch) | |
tree | 5cbcc8378c65576f23601e4fa629365d2ba50284 /ext/rpc/rpc.h | |
parent | 5280936895b578107038a668b9654a92558f8bed (diff) | |
download | php-git-cb2368c90553c0ecad48a2241d865a548d26445d.tar.gz |
fixed memleaks
added method lookup caching
pass function signature to hash function callback
Diffstat (limited to 'ext/rpc/rpc.h')
-rw-r--r-- | ext/rpc/rpc.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/ext/rpc/rpc.h b/ext/rpc/rpc.h index 15f9bea5bf..81f8af314a 100644 --- a/ext/rpc/rpc.h +++ b/ext/rpc/rpc.h @@ -6,12 +6,48 @@ #define HANDLER_COUNT (sizeof(handler_entries) / sizeof(rpc_handler_entry)) #define GET_INTERNAL(intern) rpc_internal **intern; \ - if (GET_INTERNAL_EX(intern, object) == FAILURE) { \ + if (GET_INTERNAL_EX(intern, object) != SUCCESS) { \ /* TODO: exception */ \ } #define GET_INTERNAL_EX(intern, object) zend_worm_hash_index_find(instance, object->value.obj.handle, (void **) &intern) +#define GET_CLASS(ce) char *key; \ + int key_len; \ + zend_class_entry **ce; \ + \ + /* the name of the rpc layer is prepended to '_load' so lets strip everything after \ + * the first '_' away from the function name \ + */ \ + key = estrdup(get_active_function_name(TSRMLS_C)); \ + key_len = strchr(key, '_') - key; \ + key[key_len] = '\0'; \ + \ + /* get the class entry for the requested rpc layer */ \ + if (zend_hash_find(CG(class_table), key, key_len + 1, (void **) &ce) != SUCCESS) { \ + efree(key); \ + /* TODO: exception here */ \ + } else { \ + efree(key); \ + } + +#define GET_ARGS_EX(num_args, args, args_free, strip) \ + GET_ARGS(num_args, args) \ + \ + args_free = args; \ + \ + /* strip away the first parameters */ \ + num_args -= strip; \ + args = (num_args > 0) ? &args[strip] : NULL; + +#define GET_ARGS(num_args, args) \ + args = (zval ***) emalloc(sizeof(zval **) * num_args); \ + \ + if (zend_get_parameters_array_ex(num_args, args) != SUCCESS) { \ + efree(args); \ + /* TODO: exception */ \ + } + #define RPC_REFCOUNT(intern) ((*intern)->refcount) #define RPC_ADDREF(intern) (++RPC_REFCOUNT(intern)) #define RPC_DELREF(intern) (--RPC_REFCOUNT(intern)) |