pike.git / src / object.c

version» Context lines:

pike.git/src/object.c:1456:    sp--;    dmalloc_touch_svalue(sp);    } else {    object_index_no_free2(to, o, inherit_number, index);    }   }      static void object_lower_set_index(struct object *o, union idptr func, int rtt,    struct svalue *from)   { -  int is_zero = UNSAFE_IS_ZERO(from); +     do {    void *ptr = PIKE_OBJ_STORAGE(o) + func.offset;    union anything *u = (union anything *)ptr;    struct svalue *to = (struct svalue *)ptr;    switch(rtt) {    case T_SVALUE_PTR: case T_OBJ_INDEX:    Pike_error("Cannot assign functions or constants.\n");    continue;    case PIKE_T_FREE:    Pike_error("Attempt to store data in extern variable.\n");
pike.git/src/object.c:1540:    if (TYPEOF(*from) != T_INT) break;    u->integer=from->u.integer;    continue;    case T_FLOAT:    case PIKE_T_NO_REF_FLOAT:    if (TYPEOF(*from) != T_FLOAT) break;    u->float_number=from->u.float_number;    continue;       case PIKE_T_NO_REF_OBJECT: +  { +  int is_zero = UNSAFE_IS_ZERO(from);    /* Don't count references to ourselves to help the gc. */    if ((TYPEOF(*from) != T_OBJECT) && !is_zero) break;    debug_malloc_touch(u->object);    if ((u->object != o) && u->refs && !sub_ref(u->dummy)) {    debug_malloc_touch(o);    really_free_short_svalue(u,rtt);   #ifdef DEBUG_MALLOC    } else {    debug_malloc_touch(o);   #endif /* DEBUG_MALLOC */    }    if (is_zero) {    debug_malloc_touch(u->ptr);    u->refs = NULL;    continue;    } -  +  }    u->refs = from->u.refs;    debug_malloc_touch(u->refs);    if (u->object != o) {    debug_malloc_touch(o);    add_ref(u->dummy);   #ifdef DEBUG_MALLOC    } else {    debug_malloc_touch(o);   #endif /* DEBUG_MALLOC */    }    continue;       default: -  +  { +  int is_zero = UNSAFE_IS_ZERO(from);    rtt &= ~PIKE_T_NO_REF_FLAG;    if ((rtt != TYPEOF(*from)) && !is_zero) break; /* Error. */    debug_malloc_touch(u->refs);    if(u->refs && !sub_ref(u->dummy))    really_free_short_svalue(u, rtt);    if (is_zero) {    debug_malloc_touch(u->ptr);    u->refs = NULL;    continue;    }    u->refs = from->u.refs;    add_ref(u->dummy);    continue;    } -  +  }    Pike_error("Wrong type in assignment, expected %s, got %s.\n",    get_name_of_type(rtt & ~PIKE_T_NO_REF_FLAG),    get_name_of_type(TYPEOF(*from)));    } while(0);   }      /* Assign a variable through internal indexing, i.e. directly by    * identifier index without going through `->= or `[]= lfuns. */   PMOD_EXPORT void object_low_set_index(struct object *o,    int f,