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.539 2004/04/13 06:43:24 jonasw Exp $ + || $Id: builtin_functions.c,v 1.540 2004/04/15 00:12:21 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.539 2004/04/13 06:43:24 jonasw Exp $"); + RCSID("$Id: builtin_functions.c,v 1.540 2004/04/15 00:12:21 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:4816:    /* The order array */    ref_push_array(arr);    f_indices(1);    order = Pike_sp[-1].u.array;       /* The min array */    push_array(min = allocate_array(arr->size));       /* Initialize the min array */    for (i = 0; i < arr->size; i++) { -  struct mapping *m; -  /* e and k are used by MAPPING_LOOP() */ +  struct mapping_data *md; +  /* e and k are used by NEW_MAPPING_LOOP() */    INT32 e;    struct keypair *k;    INT_TYPE low = MAX_INT_TYPE;   #ifdef PIKE_DEBUG    if (ITEM(arr)[i].type != T_MAPPING) {    Pike_error("interleave_array(): Element %d is not a mapping!\n", i);    }   #endif /* PIKE_DEBUG */ -  m = ITEM(arr)[i].u.mapping; -  MAPPING_LOOP(m) { +  md = ITEM(arr)[i].u.mapping->data; +  NEW_MAPPING_LOOP(md) {    if (k->ind.type != T_INT) {    Pike_error("interleave_array(): Index not an integer in mapping %d!\n", i);    }    if (low > k->ind.u.integer) {    low = k->ind.u.integer;    if (low < 0) {    Pike_error("interleave_array(): Index %"PRINTPIKEINT"d in mapping %d is negative!\n",    low, i);    }    }
pike.git/src/builtin_functions.c:4878:    if (!(tab = malloc(size + max))) {    SIMPLE_OUT_OF_MEMORY_ERROR("interleave_array", size+max);    }    MEMSET(tab, 0, size + max);       for (i = 0; i < order->size; i++) {    int low = ITEM(min)[i].u.integer;    int j = ITEM(order)[i].u.integer;    int offset = 0;    struct mapping *m; +  struct mapping_data *md;    INT32 e;    struct keypair *k;       if (! m_sizeof(m = ITEM(arr)[j].u.mapping)) {    /* Not available */    ITEM(min)[i].u.integer = -1;    continue;    }       if (low < minfree) {    offset = minfree - low;    } else {    minfree = offset;    }    -  +  md = m->data;    ok = 0;    while (!ok) {    ok = 1; -  MAPPING_LOOP(m) { +  NEW_MAPPING_LOOP(md) {    int ind = k->ind.u.integer;    if (tab[offset + ind]) {    ok = 0;    while (tab[++offset + ind])    ;    }    }    } -  MAPPING_LOOP(m) { +  NEW_MAPPING_LOOP(md) {    tab[offset + k->ind.u.integer] = 1;    }    while(tab[minfree]) {    minfree++;    }    ITEM(min)[i].u.integer = offset;       /* Check need for realloc */    if (offset >= size) {    char *newtab = realloc(tab, size*2 + max);