pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.99 2000/12/14 07:29:20 mast Exp $"); + RCSID("$Id: array.c,v 1.100 2001/01/03 16:36:45 grubba Exp $");      PMOD_EXPORT struct array empty_array=   {    1, /* Never free */   #ifdef PIKE_SECURITY    0,   #endif    &empty_array, /* Next */    &empty_array, /* previous (circular) */    0, /* Size = 0 */
pike.git/src/array.c:675:       default:    if(a->u.refs < b->u.refs) return -1;    if(a->u.refs > b->u.refs) return 1;    return 0;       case T_OBJECT:    if(a->u.object == b->u.object) return 0;    if(a->u.refs < b->u.refs) { def=-1; break; }    if(a->u.refs > b->u.refs) { def=1; break; } -  def=0; +  def = (a<b)?-1:1;    break;    }    }else{    def=a->type - b->type;    }    -  if(a->type == T_OBJECT && a->u.object->prog && -  FIND_LFUN(a->u.object->prog,LFUN_LT) != -1) -  { +  if (a->type == T_OBJECT && a->u.object->prog) { +  if (FIND_LFUN(a->u.object->prog,LFUN_LT) != -1) {    push_svalue(b);    apply_lfun(a->u.object,LFUN_LT,1);    if(!IS_ZERO(sp-1))    {    pop_stack();    return -1; -  }else{ +  }    pop_stack();    } -  +  if (FIND_LFUN(a->u.object->prog,LFUN_GT) != -1) {    push_svalue(b);    apply_lfun(a->u.object,LFUN_GT,1);    if(!IS_ZERO(sp-1))    {    pop_stack();    return 1; -  }else{ +  }    pop_stack();    } -  +  if (FIND_LFUN(a->u.object->prog,LFUN_EQ) != -1) { +  push_svalue(b); +  apply_lfun(a->u.object,LFUN_EQ,1); +  if (!IS_ZERO(sp-1)) { +  pop_stack();    return 0;    } -  -  if(b->type == T_OBJECT && b->u.object->prog && -  FIND_LFUN(b->u.object->prog,LFUN_LT) != -1) -  { +  pop_stack(); +  } +  } +  if(b->type == T_OBJECT && b->u.object->prog) { +  if (FIND_LFUN(b->u.object->prog,LFUN_LT) != -1) {    push_svalue(a);    apply_lfun(b->u.object,LFUN_LT,1);    if(!IS_ZERO(sp-1))    {    pop_stack();    return 1; -  }else{ +  }    pop_stack();    } -  +  if (FIND_LFUN(b->u.object->prog,LFUN_GT) != -1) {    push_svalue(a);    apply_lfun(b->u.object,LFUN_GT,1);    if(!IS_ZERO(sp-1))    {    pop_stack();    return -1; -  }else{ +  }    pop_stack();    } -  +  if (FIND_LFUN(b->u.object->prog,LFUN_EQ) != -1) { +  push_svalue(a); +  apply_lfun(b->u.object,LFUN_EQ,1); +  if (!IS_ZERO(sp-1)) { +  pop_stack();    return 0;    } -  +  pop_stack(); +  } +  }       return def;   }      static int switch_svalue_cmpfun(struct svalue *a, struct svalue *b)   {    if(a->type == b->type)    {    switch(a->type)    {
pike.git/src/array.c:1244:    return ordera[*a] - ordera[*b];    }    }   }      /*    * merge two arrays and retain their order, this is done by arranging them    * into ordered sets, merging them as sets and then rearranging the zipper    * before zipping the sets together.    */ - PMOD_EXPORT struct array *merge_array_with_order(struct array *a, struct array *b,INT32 op) + PMOD_EXPORT struct array *merge_array_with_order(struct array *a, +  struct array *b, INT32 op)   {    ONERROR r1,r2,r3,r4,r5;    INT32 *zipper;    struct array *tmpa,*tmpb,*ret;    INT32 *ordera, *orderb;       ordera=get_set_order(a);    SET_ONERROR(r4,free,ordera);       orderb=get_set_order(b);