pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1013:       /* Destructed objects are considered equal to each other, and    * greater than others. That makes them sort close to real zeroes,    * which are sorted after objects without compare functions. */    if (!a->u.object->prog)    return !b->u.object->prog ? 0 : 1;    else if (!b->u.object->prog)    return -1;       if (a->type == T_FUNCTION) { +  /* Sort pike functions before builtins. */ +  if (a->subtype == FUNCTION_BUILTIN) { +  if (b->subtype == FUNCTION_BUILTIN) +  return a->u.efun < b->u.efun ? -1 : (a->u.efun == b->u.efun ? 0 : 1); +  else +  return 1; +  } +  else +  if (b->subtype == FUNCTION_BUILTIN) +  return -1; +     if (a->u.object->prog != b->u.object->prog)    return a->u.object->prog < b->u.object->prog ? -1 : 1;    if (a->subtype != b->subtype)    return a->subtype - b->subtype;       /* We have the same function but in different objects. Compare the    * objects themselves. */    /* FIXME: Should we try to convert the subtypes to the ones for    * the closest inherits? That'd make some sense if the functions    * are private, but otherwise it's doubtful. */