From e1783feb7b59a6f2ac61c57c36e194cf07946892 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Thu, 24 Aug 2000 21:17:32 +0200 Subject: [PATCH] Fixed bug in f_map and f_filter where they returned unsorted multisets when fed multisets as first argument. Fixed prototype for map() when the second argument is a string. Rev: src/builtin_functions.c:1.302 --- src/builtin_functions.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 9784f09e61..f502aa1af1 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.301 2000/08/24 17:11:16 grubba Exp $"); +RCSID("$Id: builtin_functions.c,v 1.302 2000/08/24 19:17:32 mast Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -4890,6 +4890,7 @@ PMOD_EXPORT void f_map(INT32 args) Pike_sp--; /* allocate_multiset is destructive */ dmalloc_touch_svalue(Pike_sp); push_multiset(allocate_multiset(Pike_sp->u.array)); + order_multiset(sp[-1].u.multiset); return; case T_STRING: @@ -5263,6 +5264,7 @@ PMOD_EXPORT void f_filter(INT32 args) Pike_sp--; /* allocate_multiset is destructive */ dmalloc_touch_svalue(Pike_sp); push_multiset(allocate_multiset(Pike_sp->u.array)); + order_multiset(sp[-1].u.multiset); return; case T_STRING: @@ -6114,8 +6116,12 @@ void init_builtin_efuns(void) tFuncV(tString tFuncV(tInt,tMix,tInt),tMix,tString), tFuncV(tString tSet(tMix),tMix,tString), tFuncV(tString tMap(tMix,tInt), tMix, tString) ), - - tFuncV(tArr(tStringIndicable) tString,tMix,tMix), + + tOr4 (tFuncV(tArr(tStringIndicable) tString,tMix,tArray), + tFuncV(tMap(tSetvar(3,tMix),tStringIndicable) tString,tMix, + tMap(tVar(3),tMix)), + tFuncV(tSet(tStringIndicable) tString,tMix,tSet(tMix)), + tFuncV(tOr(tProgram,tFunction) tString,tMix,tMapping)), tFuncV(tObj,tMix,tMix) ), OPT_TRY_OPTIMIZE, fix_map_node_info, 0); -- GitLab