pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:7603:      unsigned int rec_size_svalue( struct svalue *s, struct mapping **m )   {    unsigned int res = 0;    int i;    ptrdiff_t node_ref;    INT32 e;    struct svalue *x;    struct keypair *k;    -  switch( s->type ) +  switch( TYPEOF(*s) )    {    case PIKE_T_STRING:    /* FIXME: This makes assumptions about the threshold for short strings. */    if( s->u.string->flags & STRING_IS_SHORT )    return (16+sizeof(struct string_header)) / s->u.string->refs;    return ((s->u.string->len << s->u.string->size_shift) +    sizeof(struct string_header)) / s->u.string->refs;    case PIKE_T_INT:    case PIKE_T_OBJECT:    case PIKE_T_FLOAT:
pike.git/src/builtin_functions.c:7629:       if( !*m )    *m = allocate_mapping( 10 );    else if( (x = low_mapping_lookup( *m, s )) )    {    /* Already counted. Use the old size. */    return x->u.integer;    }       low_mapping_insert( *m, s, &svalue_int_one, 0 ); -  switch( s->type ) +  switch( TYPEOF(*s) )    {    case PIKE_T_ARRAY:    res = sizeof( struct array );    for( i=0; i<s->u.array->size; i++ )    res += sizeof(struct svalue) + rec_size_svalue( s->u.array->item+i, m );    break;       case PIKE_T_MULTISET:    res = sizeof(struct multiset) + sizeof(struct multiset_data);    node_ref = multiset_last( s->u.multiset );
pike.git/src/builtin_functions.c:7706:    *! @[lfun::_size_object()], @[sizeof()]    */   static void f__size_object( INT32 UNUSED(args) )   {    size_t sum;    unsigned int i;    ptrdiff_t fun;    struct object *o;    struct program *p;    struct mapping *map = NULL; -  if( Pike_sp[-1].type != PIKE_T_OBJECT ) +  if( TYPEOF(Pike_sp[-1]) != PIKE_T_OBJECT )    Pike_error("Expected an object as argument\n");    o = Pike_sp[-1].u.object;       if( !(p=o->prog) )    {    pop_stack();    push_int(0);    return;    }    sum = sizeof(struct object);    sum += p->storage_needed;       if( (fun = low_find_lfun( p, LFUN__SIZE_OBJECT)) != -1 )    {    apply_low( o, fun, 0 ); -  if( Pike_sp[-1].type == PIKE_T_INT ) +  if( TYPEOF(Pike_sp[-1]) == PIKE_T_INT )    sum += Pike_sp[-1].u.integer;    pop_stack();    }       Pike_sp++;    for (i = 0; i < p->num_identifier_references; i++)    {    struct reference *ref = PTR_FROM_INT(p, i);    struct identifier *id = ID_FROM_PTR(p, ref);    struct inherit *inh = p->inherits;
pike.git/src/builtin_functions.c:9450:    struct pike_string *ident;    struct program *id_prog, *p2;    struct identifier *id;    INT_TYPE line;    INT_TYPE offset;    struct pike_string *file = NULL;       if( !(p = program_from_svalue(Pike_sp-args)) )    Pike_error("Illegal argument 1 to defined(program,string)\n");    -  if( Pike_sp[-args+1].type != PIKE_T_STRING ) +  if( TYPEOF(Pike_sp[1-args]) != PIKE_T_STRING )    Pike_error("Illegal argument 2 to defined(program,string)\n");    else    ident = Pike_sp[-args+1].u.string;       if( (offset = find_shared_string_identifier( ident, p )) == -1 )    {    INT_TYPE line;    struct pike_string *tmp = low_get_program_line(p, &line);       pop_n_elems(args);