pike.git / src / operators.c

version» Context lines:

pike.git/src/operators.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h"   #include <math.h> - RCSID("$Id: operators.c,v 1.94 2000/08/03 17:20:28 grubba Exp $"); + RCSID("$Id: operators.c,v 1.95 2000/08/03 17:52:55 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:2321:    if(from<0) from = 0;    to = sp[-1].u.integer;    if(to<from-1) to = from-1;    sp-=2;       switch(sp[-1].type)    {    case T_STRING:    {    struct pike_string *s; -  if(to+1>=sp[-1].u.string->len) +  if(to >= sp[-1].u.string->len-1)    {    if(from==0) return;    to = sp[-1].u.string->len-1;       if(from>to+1) from=to+1;    }   #ifdef PIKE_DEBUG    if(from < 0 || (to-from+1) < 0)    fatal("Error in o_range.\n");   #endif       s=string_slice(sp[-1].u.string, from, to-from+1);    free_string(sp[-1].u.string);    sp[-1].u.string=s;    break;    }       case T_ARRAY:    {    struct array *a; -  if(to+1 >= sp[-1].u.array->size) +  if(to >= sp[-1].u.array->size-1)    {    to = sp[-1].u.array->size-1;       if(from>to+1) from=to+1;    }       a=slice_array(sp[-1].u.array,from,to+1);    free_array(sp[-1].u.array);    sp[-1].u.array=a;    break;