Branch: Tag:

2017-03-03

2017-03-03 11:54:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Mapping: Added macro MD_FULLP().

This is a predicate that indicates whether all keypairs in a
struct mapping_data are in use or not.

Some related code clean up.

542:    hashsize = find_next_power(hashsize);    if ((md->hashsize == hashsize) && (md->refs == 1)    /* FIXME: Paranoia check below; is this needed? */ - #ifndef PIKE_MAPPING_KEYPAIR_LOOP -  && md->free_list - #else -  && (md->size < md->num_keypairs) - #endif -  ) return m; +  && !MD_FULLP(md)) +  return m;       init_mapping(m, hashsize, md->flags);    debug_malloc_touch(m);
969:   #endif    free_mapping_data(md);    -  grow_md = - #ifndef PIKE_MAPPING_KEYPAIR_LOOP -  (!md->free_list) - #else /* PIKE_MAPPING_KEYPAIR_LOOP */ -  (md->size >= md->num_keypairs) - #endif /* !PIKE_MAPPING_KEYPAIR_LOOP */ -  ; +  grow_md = MD_FULLP(md);       /* We do a re-hash here instead of copying the mapping. */    if(grow_md || md->refs>1)
1096:       if(t != T_INT) return 0;    -  grow_md = - #ifndef PIKE_MAPPING_KEYPAIR_LOOP -  (!md->free_list) - #else /* PIKE_MAPPING_KEYPAIR_LOOP */ -  (md->size >= md->num_keypairs) - #endif /* !PIKE_MAPPING_KEYPAIR_LOOP */ -  ; +  grow_md = MD_FULLP(md);       /* no need to call PREPARE_* because we re-hash instead */    if(grow_md || md->refs>1)