pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.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: operators.c,v 1.171 2003/01/26 17:04:03 nilsson Exp $ + || $Id: operators.c,v 1.172 2003/03/14 15:50:46 grubba Exp $   */      #include "global.h"   #include <math.h> - RCSID("$Id: operators.c,v 1.171 2003/01/26 17:04:03 nilsson Exp $"); + RCSID("$Id: operators.c,v 1.172 2003/03/14 15:50:46 grubba Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"   #include "mapping.h"   #include "array.h"   #include "stralloc.h"   #include "opcodes.h"   #include "operators.h"   #include "language.h"   #include "pike_memory.h"
pike.git/src/operators.c:350:    int max_shift=0;       if ((sp[-args].type != T_STRING) && (sp[1-args].type != T_STRING)) {    struct svalue *save_sp = sp;    /* We need to perform a normal addition first.    */    for (e=-args; e < 0; e++) {    if (save_sp[e].type == T_STRING)    break;    *(sp++) = save_sp[e]; +  dmalloc_touch_svalue(Pike_sp-1);    }    /* Perform the addition. */    f_add(args+e); -  +  dmalloc_touch_svalue(Pike_sp-1);    save_sp[--e] = *(--sp);   #ifdef PIKE_DEBUG    if (sp != save_sp) {    Pike_fatal("f_add(): Lost track of stack %p != %p\n", sp, save_sp);    }   #endif /* PIKE_DEBUG */    /* Perform the rest of the addition. */    f_add(-e);   #ifdef PIKE_DEBUG    if (sp != save_sp + 1 + e) {
pike.git/src/operators.c:1372:    ONERROR err;       switch(args)    {    case 3: func();    case 2: func();    case 1: return;       default:    r_speedup((args+1)>>1,func); +  dmalloc_touch_svalue(Pike_sp-1);    tmp=*--sp;    SET_ONERROR(err,do_free_svalue,&tmp);    r_speedup(args>>1,func);    UNSET_ONERROR(err);    sp++[0]=tmp;    func();    }   }   static void speedup(INT32 args, void (*func)(void))   {
pike.git/src/operators.c:3107:    if(sp[-2].type != T_INT)    PIKE_ERROR("`[]", "Bad argument 2 to [ .. ]\n", sp, 3);       if(sp[-1].type != T_INT)    PIKE_ERROR("`[]", "Bad argument 3 to [ .. ]\n", sp, 3);       from = sp[-2].u.integer;    if(from<0) from = 0;    to = sp[-1].u.integer;    if(to<from-1) to = from-1; +  dmalloc_touch_svalue(Pike_sp-1); +  dmalloc_touch_svalue(Pike_sp-2);    sp-=2;       switch(sp[-1].type)    {    case T_STRING:    {    struct pike_string *s;    if(to >= sp[-1].u.string->len-1)    {    if(from==0) return;
pike.git/src/operators.c:3551:    {    free_string(THIS->s);    if(i<0) i+=u->string->len;    if(i<0 || i>=u->string->len)    Pike_error("String index out of range %ld\n",(long)i);    u->string=modify_shared_string(u->string,i,j);    copy_shared_string(THIS->s, u->string);    }else{    lvalue_to_svalue_no_free(sp,THIS->lval);    sp++; +  dmalloc_touch_svalue(Pike_sp-1);    if(sp[-1].type != T_STRING) Pike_error("string[]= failed.\n");    if(i<0) i+=sp[-1].u.string->len;    if(i<0 || i>=sp[-1].u.string->len)    Pike_error("String index out of range %ld\n",(long)i);    sp[-1].u.string=modify_shared_string(sp[-1].u.string,i,j);    assign_lvalue(THIS->lval, sp-1);    pop_stack();    }    pop_n_elems(args);    push_int(j);