Branch: Tag:

2000-02-04

2000-02-04 20:16:18 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

another mapping bug bites the dust

Rev: src/mapping.c:1.61
Rev: src/testsuite.in:1.267

5:   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.60 2000/02/04 19:25:10 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.61 2000/02/04 20:16:16 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"
29:      struct mapping *first_mapping;    + #define unlink_mapping_data(M) do{ \ +  struct mapping_data *md_=(M); \ +  if(md_->hardlinks) { md_->hardlinks--; md_->valrefs--; } \ +  free_mapping_data(M); \ + }while(0) +  +    #define MD_KEYPAIRS(MD, HSIZE) \    ( (struct keypair *)DO_ALIGN( (long) (((struct mapping_data *)(MD))->hash + HSIZE), ALIGNOF(struct keypair)) )   
47:    \    FREE_PROT(m); \    \ -  if(m->data->hardlinks) \ -  { \ -  m->data->hardlinks--; \ -  m->data->valrefs--; \ -  } \ -  free_mapping_data(m->data); \ +  unlink_mapping_data(m->data); \    \    if(m->prev) \    m->prev->next = m->next; \
305:    for(e=0;e<md->hashsize;e++)    mapping_rehash_backwards_good(new_md, md->hash[e]);    -  if(md->hardlinks) -  { -  md->hardlinks--; -  md->valrefs--; -  } -  free_mapping_data(md); +  unlink_mapping_data(md);    }else{    /* evil */    for(e=0;e<md->hashsize;e++)
1851:    if(gc_do_free(m))    {    add_ref(m); -  md=m->data; -  -  /* no locking required -  * -  * FIXME: is it possible that md->refs might not be zero here? -  * for now I will assume it is not possible... -  */ -  for(e=0;e<md->hashsize;e++) -  { -  k=md->hash[e]; -  while(k) -  { -  free_svalue(&k->ind); -  free_svalue(&k->val); -  -  if(k->next) -  { -  k = k->next; -  } else { -  k->next=md->free_list; -  md->free_list=md->hash[e]; -  md->hash[e]=0; -  break; -  } -  } -  } -  md->size=0; -  +  unlink_mapping_data(m->data); +  m->data=&empty_data; +  m->data->refs++;    next=m->next;       free_mapping(m);