PennMUSH Community
Show
Ignore:
Timestamp:
07/08/07 20:50:12 (1 year ago)
Author:
shawnw
Message:

Merged 1.8.3p4 into trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/trunk/src/comp_h.c

    r919 r1032  
    5454static CType ctable[TABLE_SIZE]; 
    5555static char ltable[TABLE_SIZE]; 
     56 
     57slab *huffman_slab = NULL; 
    5658 
    5759static int fix_tree_depth(CNode *node, int height, int zeros); 
     
    260262      add_ones(node->right); 
    261263    if ((count >= 7) || ((count >= 3) && !node->left && !node->right)) { 
    262       ctop = (CNode *) malloc((unsigned) sizeof(CNode)); 
     264      ctop = slab_malloc(huffman_slab, node); 
    263265      if (!ctop) { 
    264266        do_rawlog(LT_ERR, 
     
    337339#endif 
    338340 
     341  huffman_slab = slab_create("huffman attribute compression", sizeof(CNode)); 
     342  slab_set_opt(huffman_slab, SLAB_ALLOC_BEST_FIT, 1); 
     343 
    339344  /* Part 1: initialize */ 
    340345  for (total = 0; total < TABLE_SIZE; total++) { 
    341346    table[total].freq = 0; 
    342     table[total].node = (CNode *) malloc((unsigned) sizeof(CNode)); 
     347    table[total].node = slab_malloc(huffman_slab, NULL); 
    343348    if (!table[total].node) { 
    344349      do_rawlog(LT_ERR, 
     
    435440    printf("\n"); 
    436441#endif 
    437     node = (CNode *) malloc((unsigned) sizeof(CNode)); 
     442    node = slab_malloc(huffman_slab, table[indx].node); 
    438443    if (!node) { 
    439444      do_rawlog(LT_ERR, 
     
    485490  for (count = 0; node->left && (count < 4); count++) 
    486491    node = node->left; 
    487   ctop = (CNode *) malloc((unsigned) sizeof(CNode)); 
     492  ctop = slab_malloc(huffman_slab, node); 
    488493  if (!ctop) { 
    489494    do_rawlog(LT_ERR, "Cannot allocate memory for compression tree. Aborting."); 
     
    509514  for (count = 0; count < 8; count++) { 
    510515    if (!node->left) { 
    511       ctop = (CNode *) malloc((unsigned) sizeof(CNode)); 
     516      ctop = slab_malloc(huffman_slab, node); 
    512517      if (!ctop) { 
    513518        do_rawlog(LT_ERR,