Branch: Tag:

2016-09-03

2016-09-03 09:54:12 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [cpp]: Replace the struct hash_entry with a string.

The struct hash_entry is only used to hold a string, so get rid
of it and store the string directly instead.

104:      PIKECLASS define   { -  CVAR struct hash_entry link; /* must be first */ +  PIKEVAR string name flags ID_PRIVATE|ID_PROTECTED;    CVAR magic_define_fun magic;    CVAR int args;    CVAR ptrdiff_t num_parts;
125:    def->parts = NULL;    def->num_parts=0;    def->first=0; -  def->link.s = NULL; +     }       EXIT
136:    free_string(d->parts[e].postfix);    if (d->parts)    free(d->parts); -  if (d->link.s) -  free_string(d->link.s); +     if(d->first)    free_string(d->first);    }
1593:       push_object(o = clone_object(define_program, 0));    def = (struct define_struct *)get_storage(o, define_program); -  def->link.s=name; +  def->name = name;    debug_malloc_touch(name);    if (parts) {    def->parts = xalloc(sizeof(struct define_part) * parts);
1687:    } else    def = alloc_empty_define(make_shared_string(name),0);    def->magic=fun; -  mapping_string_insert(this->defines, def->link.s, Pike_sp-1); +  mapping_string_insert(this->defines, def->name, Pike_sp-1);    pop_stack();       return def;
1701:    add_ref (name);    def=alloc_empty_define(name,0);    add_ref (def->first = what); -  mapping_string_insert(this->defines, def->link.s, Pike_sp-1); +  mapping_string_insert(this->defines, def->name, Pike_sp-1);    pop_stack();   }   
1725:    def = alloc_empty_define(make_shared_string(name),0);       def->first=make_shared_string(what); -  mapping_string_insert(this->defines, def->link.s, Pike_sp-1); +  mapping_string_insert(this->defines, def->name, Pike_sp-1);    pop_stack();   }   
3073:    struct pike_string *arg,    struct string_builder *tmp)   { -  ref_push_string( def->link.s ); +  ref_push_string( def->name );    ref_push_string( arg );    if (safe_apply_handler( "evaluate_define",    this->handler, this->compat_handler, 2, 0 ) &&
3099:    struct string_builder *tmp)   {    struct svalue *save_sp = Pike_sp; -  ref_push_string( def->link.s ); +  ref_push_string( def->name );    if (safe_apply_handler( "evaluate_define",    this->handler, this->compat_handler, 1, 0 ) &&    TYPEOF(sp[-1]) == T_STRING )
3483:    REF_MAKE_CONST_STRING(def->first, "__attribute__(\"deprecated\", ");    def->parts[0].argument = 0;    REF_MAKE_CONST_STRING(def->parts[0].postfix, ")"); -  mapping_string_insert(this.defines, def->link.s, Pike_sp-1); +  mapping_string_insert(this.defines, def->name, Pike_sp-1);    pop_stack();   #endif /* 0 */   
3542:    k->ind.u.string->refs++;    def->magic = insert_callback_define_no_args;    } -  mapping_string_insert(this.defines, def->link.s, Pike_sp-1); +  mapping_string_insert(this.defines, def->name, Pike_sp-1);    pop_stack();    }    else