Branch: Tag:

2014-12-04

2014-12-04 19:23:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Mappings: Removed some duplicated code.

323:    }    k->next = prev;    -  from = k; +  prev = k;       /* Rehash and reverse the hash chain. */ -  while (from) { +  while ((from = prev)) { +  /* Reverse */ +  prev = from->next; +  from->next = next; +  next = from; +     if (md->flags & MAPPING_WEAK) {       switch(md->flags & MAPPING_WEAK) {
360:    free_svalue(&from->ind);    free_svalue(&from->val);    -  /* Reverse */ -  prev = from->next; -  from->next = next; -  next = from; -  from = prev; -  +     continue;    }    keep_keypair:
394:    md->ind_types |= 1<< (TYPEOF(k->ind));    md->val_types |= 1<< (TYPEOF(k->val));    md->size++; -  -  /* Reverse */ -  prev = from->next; -  from->next = next; -  next = from; -  from = prev; +     }   }   
420:    }    k->next = prev;    -  from = k; +  prev = k;       /* Rehash and reverse the hash chain. */ -  while (from) { +  while ((from = prev)) { +  /* Reverse */ +  prev = from->next; +  from->next = next; +  next = from; +     if (md->flags & MAPPING_WEAK) {       switch(md->flags & MAPPING_WEAK) {
458:    * or similar.    */    -  /* Reverse */ -  prev = from->next; -  from->next = next; -  next = from; -  from = prev; -  +     continue;    }    keep_keypair:
494:    md->ind_types |= 1<< (TYPEOF(k->ind));    md->val_types |= 1<< (TYPEOF(k->val));    md->size++; -  -  /* Reverse */ -  prev = from->next; -  from->next = next; -  next = from; -  from = prev; +     }   }