Branch: Tag:

2004-05-13

2004-05-13 23:32:52 by Martin Nilsson <mani@lysator.liu.se>

Simplified type_field use

Rev: src/builtin.cmod:1.159
Rev: src/builtin_functions.c:1.554
Rev: src/docode.c:1.175
Rev: src/modules/Image/polyfill.c:1.48
Rev: src/modules/files/efuns.c:1.143
Rev: src/modules/files/file.c:1.320
Rev: src/signal_handler.c:1.297

2:   || 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.553 2004/05/13 16:31:06 nilsson Exp $ + || $Id: builtin_functions.c,v 1.554 2004/05/13 23:31:04 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.553 2004/05/13 16:31:06 nilsson Exp $"); + RCSID("$Id: builtin_functions.c,v 1.554 2004/05/13 23:31:04 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
635:   {    struct pike_string *ret;    INT_TYPE len, e; -  get_all_args("random_string",args,"%i",&len); +  get_all_args("random_string",args,"%+",&len);    ret = begin_shared_string(len);    for(e=0;e<len;e++) ret->str[e] = DO_NOT_WARN((char)my_rand());    pop_n_elems(args);
3055:    return str;    }    -  if(from->type_field & ~BIT_STRING) { -  array_fix_type_field(from); -  if(from->type_field & ~BIT_STRING) +  if( (from->type_field & ~BIT_STRING) && +  (array_fix_type_field(from) & ~BIT_STRING) )    Pike_error("replace: from array not array(string).\n"); -  } +     -  if(to->type_field & ~BIT_STRING) { -  array_fix_type_field(to); -  if(to->type_field & ~BIT_STRING) +  if( (to->type_field & ~BIT_STRING) && +  (array_fix_type_field(to) & ~BIT_STRING) )    Pike_error("replace: to array not array(string).\n"); -  } +        ctx.v=(struct tupel *)xalloc(sizeof(struct tupel)*from->size);    init_string_builder(&ctx.ret,str->size_shift);
4782:    case T_ARRAY:    a=Pike_sp[1-args].u.array;    -  if(a->type_field & ~BIT_STRING) { -  array_fix_type_field(a); -  if(a->type_field & ~BIT_STRING) +  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);
4835:    /* We're not interrested in any other arguments. */    pop_n_elems(args-1);    -  if(arr->type_field & ~BIT_MAPPING) { -  array_fix_type_field(arr); -  if(arr->type_field & ~BIT_MAPPING) +  if( (arr->type_field & ~BIT_MAPPING) && +  (array_fix_type_field(arr) & ~BIT_MAPPING) )    SIMPLE_BAD_ARG_ERROR("interleave_array", 1, "array(mapping(int:mixed))"); -  } +        /* The order array */    ref_push_array(arr);
6715:    return;    }    -  if(in->type_field != BIT_ARRAY) -  { -  array_fix_type_field(in); -  if(in->type_field != BIT_ARRAY) +  if( (in->type_field != BIT_ARRAY) && +  (array_fix_type_field(in) != BIT_ARRAY) )    SIMPLE_BAD_ARG_ERROR("transpose", 1, "array(array)"); -  } +        sizeininner=in->item->u.array->size;