pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:3979:   {    struct svalue key, *val;       if (!remap || !remap->markers || !marker) return NULL;       SET_SVAL(key, T_INT, NUMBER_NUMBER, integer, marker);       val = low_mapping_lookup(remap->markers, &key);    if (!val) return NULL;    -  if (TYPEOF(*val) == PIKE_T_TYPE) { +  if ((TYPEOF(*val) == PIKE_T_TYPE) && val->u.type) { +  add_ref(val->u.type);    return val->u.type;    }    return NULL;   }   #define lookup_marker(REMAP, M) ((struct pike_type *)debug_malloc_pass(lookup_marker(REMAP, M)))      static void store_marker(struct remap_state *remap, int marker,    struct pike_type *value)   {    struct svalue key, val;       if (!remap || !marker) return;       if (!remap->markers) {    remap->markers = allocate_mapping(10);    }       SET_SVAL(key, T_INT, NUMBER_NUMBER, integer, marker); -  +  if (value) {    SET_SVAL(val, T_TYPE, 0, type, value); -  +  } else { +  SET_SVAL(val, T_INT, NUMBER_NUMBER, integer, 0); +  }    mapping_insert(remap->markers, &key, &val);   }   #define store_marker(REMAP, M, T) store_marker(REMAP, M, debug_malloc_pass(T))      static void push_remap_markers(struct pike_type *t,    struct remap_state *remap,    enum pt_remap_flags flags)   {    if (!t || (flags & PT_FLAG_REMAP_INHIBIT) ||    (!remap && !(flags & PT_FLAG_REMAP_EVAL_MARKERS))) {
pike.git/src/pike_types.cmod:4035:    } else {    struct pike_type *old = lookup_marker(remap, marker);    struct pike_type *new = t->cdr;    if (new) {    if (old) {    new = or_pike_types(old, new, 0);    } else {    add_ref(new);    }    store_marker(remap, marker, new); -  free_pike_type(new); +  free_type(new);    } -  +  free_type(old);    push_remap_markers(t->cdr, remap, flags);    }       if (flags & PT_FLAG_REMAP_BOTH_MARKERS) {    marker = alloc_remap_marker(remap, CAR_TO_INT(t),    flags ^ PT_FLAG_REMAP_SWAP_MARKERS);       if (!(flags & PT_FLAG_REMAP_EVAL_MARKERS)) {    push_assign_type(marker);    } else {    struct pike_type *old = lookup_marker(remap, marker);    struct pike_type *new = t->cdr;    if (old) {    new = or_pike_types(old, new, 0);    } else {    add_ref(new);    }    store_marker(remap, marker, new); -  free_pike_type(new); +  free_type(new); +  free_type(old);    push_remap_markers(t->cdr, remap, flags);       switch(flags & PT_FLAG_REMAP_BOTH_MARKERS_MASK) {    case PT_FLAG_REMAP_BOTH_MARKERS_AND:    push_type(T_AND);    break;    case PT_FLAG_REMAP_BOTH_MARKERS_OR:    push_type(T_OR);    break;    default:
pike.git/src/pike_types.cmod:4082:    }       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int marker = remap_marker(remap, t->type, flags);    struct pike_type *value = lookup_marker(remap, marker);       if (value) {    push_remap_markers(value, remap, flags); +  free_type(value);    } else if (flags & PT_FLAG_REMAP_EVAL_MARKERS) {    /* Marker without matching assign. */    /* FIXME: Report error? */    push_type(T_MIXED);    } else {       /* Remap the marker. */       if (!marker) {    /* FIXME: Improve error handling here. */
pike.git/src/pike_types.cmod:4105:    }    }       if (flags & PT_FLAG_REMAP_BOTH_MARKERS) {    marker = remap_marker(remap, t->type,    flags ^ PT_FLAG_REMAP_SWAP_MARKERS);    value = lookup_marker(remap, marker);       if (value) {    push_remap_markers(value, remap, flags); +  free_type(value);    } else if (flags & PT_FLAG_REMAP_EVAL_MARKERS) {    /* Marker without matching assign. */    /* FIXME: Report error? */    push_type(T_MIXED);    } else {       /* Remap the marker. */       if (!marker) {    /* FIXME: Improve error handling here. */