pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.681 2008/06/29 20:42:59 grubba Exp $ + || $Id: builtin_functions.c,v 1.682 2008/07/04 15:52:08 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin_functions.c:3565:    * a is the lower bound.    * b is the upper bound + 1.    */   int find_longest_prefix(char *str,    ptrdiff_t len,    int size_shift,    struct replace_many_tupel *v,    INT32 a,    INT32 b)   { -  INT32 c, match=-1, match_len=-1, d; +  INT32 c, match=-1, match_len=-1;    ptrdiff_t tmp;       check_c_stack(2048);       while(a<b)    {    c=(a+b)/2;       if (v[c].ind->len <= match_len) {    /* Can't be a suffix of (or is equal to) the current match. */
pike.git/src/builtin_functions.c:5799:    *! All strings in the array @[str] are matched against @[glob],    *! and those that match are returned in an array (in the same    *! order).    *! @endmixed    *!    *! @seealso    *! @[sscanf()], @[Regexp]    */   PMOD_EXPORT void f_glob(INT32 args)   { -  INT32 i,matches; +  INT32 i;    struct array *a;    struct pike_string *glob;       if(args < 2)    SIMPLE_TOO_FEW_ARGS_ERROR("glob", 2);       if(args > 2)    pop_n_elems(args-2);    args=2;   
pike.git/src/builtin_functions.c:5830:    push_int(i);    break;       case T_ARRAY:    a=Pike_sp[1-args].u.array;       if( (a->type_field & ~BIT_STRING) &&    (array_fix_type_field(a) & ~BIT_STRING) )    SIMPLE_BAD_ARG_ERROR("glob", 2, "string|array(string)");    -  matches=0; +     check_stack(120);    BEGIN_AGGREGATE_ARRAY (MINIMUM (a->size, 120)) {    for(i=0;i<a->size;i++)    if(does_match(ITEM(a)[i].u.string,0,glob,0))    {    ref_push_string(ITEM(a)[i].u.string); -  matches++; +     DO_AGGREGATE_ARRAY (120);    } -  } END_AGGREGATE_ARRAY; +  +  /* We know what this array contains - avoid array_fix_type_field +  * in END_AGGREGATE_ARRAY. */ +  if (Pike_sp[-1].u.array->size)    Pike_sp[-1].u.array->type_field = BIT_STRING; -  +  else +  Pike_sp[-1].u.array->type_field = 0; +  } END_AGGREGATE_ARRAY; +     stack_pop_n_elems_keep_top (2);    break;       default:    SIMPLE_BAD_ARG_ERROR("glob", 2, "string|array(string)");    }   }      /* comb_merge */