From 3b547450e5ee6d7bd93f28b44e751ee43936c909 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 3 Jan 2018 13:36:52 +0100 Subject: Remove some dead code --- src/sp_harden_rand.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'src/sp_harden_rand.c') diff --git a/src/sp_harden_rand.c b/src/sp_harden_rand.c index b84fbe3..3727bef 100644 --- a/src/sp_harden_rand.c +++ b/src/sp_harden_rand.c @@ -54,34 +54,26 @@ static void random_int_wrapper(INTERNAL_FUNCTION_PARAMETERS) { PHP_FUNCTION(sp_rand) { void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS); - if ((orig_handler = - zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook), - "rand", strlen("rand")))) { - /* call the original `rand` function, - * since we might no be the only ones to hook it*/ - orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - } else { - sp_log_err("harden_rand", - "Unable to find the pointer to the original function 'rand' in " - "the hashtable.\n"); - } + /* call the original `rand` function, + * since we might no be the only ones to hook it*/ + orig_handler = + zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook), + "rand", strlen("rand")); + orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU); } PHP_FUNCTION(sp_mt_rand) { void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS); - if ((orig_handler = + /* call the original `mt_rand` function, + * since we might no be the only ones to hook it*/ + orig_handler = zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook), - "mt_rand", strlen("mt_rand")))) { - /* call the original `mt_rand` function, - * since we might no be the only ones to hook it*/ - orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); - } else { - sp_log_err("harden_rand", - "Unable to find the pointer to the original function 'mt_rand' " - "in the hashtable.\n"); - } + "mt_rand", strlen("mt_rand")); + orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); + random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU); } -- cgit v1.3