Ignore:
Timestamp:
Mar 22, 2008, 10:39:25 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Get rid of jmalloc and replace it with standard malloc. Modern operating systems certainly perform a lot better than this custom implementation, and we have superior tools (eg. valgrind) to debug and profile memory usage without interfering with the code itself.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/light.cpp

    r125 r129  
    204204void calc_light_table(palette *pal)
    205205{
    206     white_light_initial=(uint8_t *)jmalloc(256*64,"light table");
     206    white_light_initial=(uint8_t *)malloc(256*64);
    207207    white_light=white_light_initial;
    208208
    209 //    green_light=(uint8_t *)jmalloc(256*64,"green light");
     209//    green_light=(uint8_t *)malloc(256*64);
    210210    int i = 0;
    211211    for( ; i < TTINTS; i++ )
    212212    {
    213         tints[i] = (uint8_t *)jmalloc( 256, "color tint" );
     213        tints[i] = (uint8_t *)malloc( 256 );
    214214    }
    215215
    216216    char *lightpath;
    217     lightpath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "lightpath" );
     217    lightpath = (char *)malloc( strlen( get_save_filename_prefix() ) + 9 + 1 );
    218218    sprintf( lightpath, "%slight.tbl", get_save_filename_prefix() );
    219219
     
    235235                fp->read(tints[i],256);
    236236            fp->read(bright_tint,256);
    237 //            trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
     237//            trans_table=(uint8_t *)malloc(256*256);
    238238//            fp.read(trans_table,256*256);
    239239        }
     
    329329    stat_man->pop();
    330330/*    fprintf(stderr,"calculating transparency tables (256 total)\n");
    331     trans_table=(uint8_t *)jmalloc(256*256,"transparency table");
     331    trans_table=(uint8_t *)malloc(256*256);
    332332
    333333    uint8_t *tp=trans_table;
     
    366366        delete f;
    367367    }
    368     jfree( lightpath );
     368    free( lightpath );
    369369}
    370370
     
    376376  if (total)
    377377  {
    378     p->lights=(light_source **)jmalloc(total*sizeof(light_source *),"light patches");
     378    p->lights=(light_source **)malloc(total*sizeof(light_source *));
    379379    memcpy(p->lights,lights,total*(sizeof(light_source *)));
    380380  }
     
    460460
    461461      p->total++;
    462       p->lights=(light_source **)jrealloc(p->lights,sizeof(light_source *)*p->total,"patch_list");
     462      p->lights=(light_source **)realloc(p->lights,sizeof(light_source *)*p->total);
    463463      p->lights[p->total-1]=who;
    464464      return ;
     
    478478      if (p->total==MAX_LP)  return ;
    479479      p->total++;
    480       p->lights=(light_source **)jrealloc(p->lights,sizeof(light_source *)*p->total,"patch_list");
     480      p->lights=(light_source **)realloc(p->lights,sizeof(light_source *)*p->total);
    481481      p->lights[p->total-1]=who;
    482482      return ;
     
    786786  int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
    787787
    788   uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
     788  uint8_t *remap_line=(uint8_t *)malloc(remap_size);
    789789
    790790  light_patch *f=first;
     
    891891    delete p;
    892892  }
    893   jfree(remap_line);
     893  free(remap_line);
    894894}
    895895
     
    963963  int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run);
    964964
    965   uint8_t *remap_line=(uint8_t *)jmalloc(remap_size,"light remap line");
     965  uint8_t *remap_line=(uint8_t *)malloc(remap_size);
    966966
    967967  light_patch *f=first;
     
    11021102    delete p;
    11031103  }
    1104   jfree(remap_line);
     1104  free(remap_line);
    11051105}
    11061106
Note: See TracChangeset for help on using the changeset viewer.