CVS update: php3/functions

From: Date: Tue, 18 Aug 1998 21:08:58 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-303@lists.php.net to get a copy of this message
Date: Tuesday August 18, 1998 @ 17:08 Author: rasmus Update of /repository/php3/functions In directory asf:/export/home/rasmus/php3/functions Modified Files: basic_functions.c basic_functions.h Log Message: Add uasort() Index: php3/functions/basic_functions.c diff -c php3/functions/basic_functions.c:1.207 php3/functions/basic_functions.c:1.208 *** php3/functions/basic_functions.c:1.207 Sat Aug 8 07:18:12 1998 --- php3/functions/basic_functions.c Tue Aug 18 17:08:58 1998 *************** *** 101,106 **** --- 101,107 ---- {"sort", php3_sort, first_arg_force_ref}, {"rsort", php3_rsort, first_arg_force_ref}, {"usort", php3_user_sort, first_arg_force_ref}, + {"uasort", php3_auser_sort, first_arg_force_ref}, {"array_walk", php3_array_walk, first_arg_force_ref}, {"sizeof", php3_count, first_arg_allow_ref}, {"count", php3_count, first_arg_allow_ref}, *************** *** 804,809 **** --- 805,835 ---- } convert_to_string(user_compare_func_name); if (_php3_hash_sort(array->value.ht, array_user_compare, 1) == FAILURE) { + user_compare_func_name = old_compare_func; + return; + } + user_compare_func_name = old_compare_func; + RETURN_TRUE; + } + + void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS) + { + pval *array; + pval *old_compare_func; + TLS_VARS; + + old_compare_func = user_compare_func_name; + if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) { + user_compare_func_name = old_compare_func; + WRONG_PARAM_COUNT; + } + if (!(array->type & IS_HASH)) { + php3_error(E_WARNING, "Wrong datatype in uasort() call"); + user_compare_func_name = old_compare_func; + return; + } + convert_to_string(user_compare_func_name); + if (_php3_hash_sort(array->value.ht, array_user_compare, 0) == FAILURE) { user_compare_func_name = old_compare_func; return; } Index: php3/functions/basic_functions.h diff -c php3/functions/basic_functions.h:1.28 php3/functions/basic_functions.h:1.29 *** php3/functions/basic_functions.h:1.28 Sat Aug 8 07:18:13 1998 --- php3/functions/basic_functions.h Tue Aug 18 17:08:58 1998 *************** *** 29,35 **** */ ! /* $Id: basic_functions.h,v 1.28 1998/08/08 11:18:13 zeev Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H --- 29,35 ---- */ ! /* $Id: basic_functions.h,v 1.29 1998/08/18 21:08:58 rasmus Exp $ */ #ifndef _BASIC_FUNCTIONS_H #define _BASIC_FUNCTIONS_H *************** *** 51,56 **** --- 51,57 ---- extern void php3_sort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_rsort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS); extern void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS); extern void php3_count(INTERNAL_FUNCTION_PARAMETERS); extern void php3_flush(INTERNAL_FUNCTION_PARAMETERS); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#303) next »