Changeset 129


Ignore:
Timestamp:
Mar 22, 2008, 10:39:25 AM (11 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.
Location:
abuse/trunk/src
Files:
2 deleted
89 edited

Legend:

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

    r124 r129  
    127127    delete files[i];
    128128  if (total_files)
    129     jfree(files);
     129    free(files);
    130130  total_files=0;
    131131  files=NULL;
     
    134134CrcedFile::~CrcedFile()
    135135{
    136   jfree(filename);
     136  free(filename);
    137137}
    138138
    139139CrcedFile::CrcedFile(char const *name)
    140140{
    141   filename=strcpy((char *)jmalloc(strlen(name)+1,"crc_file"),name);
     141  filename=strcpy((char *)malloc(strlen(name)+1),name);
    142142  crc_calculated=0;
    143143}
     
    154154    if (!strcmp(filename,files[i]->filename)) return i;
    155155  total_files++;
    156   files=(CrcedFile **)jrealloc(files,total_files*sizeof(CrcedFile *),"crc_file_list");
     156  files=(CrcedFile **)realloc(files,total_files*sizeof(CrcedFile *));
    157157  files[total_files-1]=new CrcedFile(filename);
    158158  return total_files-1;
     
    195195    case SPEC_EXTERN_SFX : delete ((sound_effect *)i->data); break;
    196196    case SPEC_PARTICLE : delete ((part_frame *)i->data); break;
    197     case SPEC_EXTERNAL_LCACHE : if (i->data) jfree(i->data); break;
     197    case SPEC_EXTERNAL_LCACHE : if (i->data) free(i->data); break;
    198198    case SPEC_PALETTE : delete ((char_tint *)i->data); break;
    199199    default :
     
    209209{
    210210  if (prof_data)
    211     jfree(prof_data);
    212 
    213   prof_data=(int *)jmalloc(sizeof(int)*total,"cache profile");
     211    free(prof_data);
     212
     213  prof_data=(int *)malloc(sizeof(int)*total);
    214214  memset(prof_data,0,sizeof(int)*total);
    215215}
     
    252252  if (prof_data)
    253253  {
    254     int *ordered_ids=(int *)jmalloc(sizeof(int)*total,"profile order");
     254    int *ordered_ids=(int *)malloc(sizeof(int)*total);
    255255    int i;
    256256    for (i=0;i<total;i++) ordered_ids[i]=i;
     
    285285    }
    286286
    287     jfree(ordered_ids);
     287    free(ordered_ids);
    288288
    289289  } else dprintf("Cache profiling was not initialized\n");
     
    294294  if (prof_data)
    295295  {
    296     jfree(prof_data);
     296    free(prof_data);
    297297    prof_data=NULL;
    298298  }
     
    495495      if (tnames)                     /// make sure there isn't bad info in the file
    496496      {
    497     fnum_remap=(int *)jmalloc(sizeof(int)*tnames,"pfname remap");
     497    fnum_remap=(int *)malloc(sizeof(int)*tnames);
    498498
    499499    int i;
     
    512512
    513513
    514     int *priority=(int *)jmalloc(tsaved*sizeof(int),"priorities");
     514    int *priority=(int *)malloc(tsaved*sizeof(int));
    515515    memset(priority,0xff,tsaved*sizeof(int));   // initialize to -1
    516516    int tmatches=0;
    517517
    518     sorted_id_list=(int *)jmalloc(sizeof(int)*total,"sorted ids");
     518    sorted_id_list=(int *)malloc(sizeof(int)*total);
    519519    for (j=0;j<total;j++) sorted_id_list[j]=j;
    520520    qsort(sorted_id_list,total,sizeof(int),s_offset_compare);
     
    542542    }
    543543
    544     jfree(sorted_id_list);            // was used for searching, no longer needed
     544    free(sorted_id_list);            // was used for searching, no longer needed
    545545
    546546    for (j=0;j<total;j++)
     
    592592    }
    593593
    594     jfree(priority);
    595     jfree(fnum_remap);
     594    free(priority);
     595    free(fnum_remap);
    596596
    597597
     
    745745      unmalloc(&list[i]);
    746746  }
    747   jfree(list);
     747  free(list);
    748748  if (fp) delete fp;
    749749  if (last_dir) delete last_dir;
     
    837837    {
    838838      int add_size=20;
    839       list=(CacheItem *)jrealloc(list,(sizeof(CacheItem)*(total+add_size)),"Cache list");
     839      list=(CacheItem *)realloc(list,(sizeof(CacheItem)*(total+add_size)));
    840840      for (i=0;i<add_size;i++)
    841841      {
     
    846846      id=total;
    847847      if (prof_data)                          // new id's have been added old prof_data size won't work
    848       { jfree(prof_data); prof_data=NULL; }
     848      { free(prof_data); prof_data=NULL; }
    849849      total+=add_size;
    850850    }
     
    10311031    touch(me);
    10321032    locate(me);
    1033     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    10341033    me->data=(void *)new backtile(fp);
    1035     alloc_space=sp;
    10361034    last_offset=fp->tell();
    10371035    return (backtile *)me->data;
     
    10541052    touch(me);
    10551053    locate(me);
    1056     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    10571054    me->data=(void *)new foretile(fp);
    1058     alloc_space=sp;
    10591055    last_offset=fp->tell();
    10601056    return (foretile *)me->data;
     
    10751071    touch(me);
    10761072    locate(me);
    1077     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    10781073    me->data=(void *)new figure(fp,me->type);
    1079     alloc_space=sp;
    10801074    last_offset=fp->tell();
    10811075    return (figure *)me->data;
     
    10961090    touch(me);                                           // hold me, feel me, be me!
    10971091    locate(me);
    1098     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    10991092    image *im=new image(fp);
    1100     alloc_space=sp;
    11011093    me->data=(void *)im;
    11021094    last_offset=fp->tell();
     
    11191111    touch(me);                                           // hold me, feel me, be me!
    11201112    char *fn=crc_manager.get_filename(me->file_number);
    1121     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    11221113    me->data=(void *)new sound_effect(fn);
    1123     alloc_space=sp;
    11241114    return (sound_effect *)me->data;
    11251115  }
     
    11401130    touch(me);
    11411131    locate(me);
    1142     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    11431132    me->data=(void *)new part_frame(fp);
    1144     alloc_space=sp;
    11451133    last_offset=fp->tell();
    11461134    return (part_frame *)me->data;
     
    11801168    cache_read_file->seek(me->offset,0);
    11811169
    1182     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    1183 
    11841170    uint32_t size=cache_read_file->read_uint32();
    11851171    void *space;
    11861172
    11871173    if (size)
    1188       space=jmalloc(size,"cached lisp block");
     1174      space=malloc(size);
    11891175    else space=NULL;
    11901176
     
    11941180    current_space=cs;
    11951181
    1196     alloc_space=sp;
    11971182    if (size)
    11981183      me->data=(Cell *)space;
     
    12041189CacheList cache;
    12051190
    1206 void free_up_memory()
    1207 {
    1208   cache.free_oldest();
    1209 }
    1210 
    12111191void CacheList::free_oldest()
    12121192{
     
    12321212    close_graphics();
    12331213    printf("Out of memory, please remove any TSR's device drivers you can\n");
    1234     mem_report("out_of_mem");
    12351214    exit(0);
    12361215  }
     
    12921271    touch(me);
    12931272    locate(me);
    1294     int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    12951273    me->data=(void *)new char_tint(fp);
    1296     alloc_space=sp;
    12971274    last_offset=fp->tell();
    12981275    return (char_tint *)me->data;
  • abuse/trunk/src/chars.cpp

    r124 r129  
    123123  } else if (num>=ts)
    124124  {
    125     seq=(sequence **)jrealloc(seq,sizeof(sequence *)*(num+1),"state list");
    126     seq_syms=(void **)jrealloc(seq_syms,sizeof(void *)*(num+1),"state sym list");
     125    seq=(sequence **)realloc(seq,sizeof(sequence *)*(num+1));
     126    seq_syms=(void **)realloc(seq_syms,sizeof(void *)*(num+1));
    127127
    128128    memset(&seq[ts],0,sizeof(sequence *)*((num+1)-ts));
     
    236236    {
    237237      int new_total=index+1;
    238       vars=(void **)jrealloc(vars,sizeof(void *)*new_total,"variable name list");
    239       var_index=(short *)jrealloc(var_index,sizeof(short)*new_total,"variable index");
     238      vars=(void **)realloc(vars,sizeof(void *)*new_total);
     239      var_index=(short *)realloc(var_index,sizeof(short)*new_total);
    240240      memset(&vars[tiv],0,(new_total-tiv)*sizeof(void *));
    241241      memset(&var_index[tiv],0,(new_total-tiv)*sizeof(short));
     
    255255    {
    256256      int new_total=free_index+1;
    257       vars=(void **)jrealloc(vars,sizeof(void *)*new_total,"variable name list");
    258       var_index=(short *)jrealloc(var_index,sizeof(short)*new_total,"variable index");
     257      vars=(void **)realloc(vars,sizeof(void *)*new_total);
     258      var_index=(short *)realloc(var_index,sizeof(short)*new_total);
    259259      memset(&vars[tiv],0,(new_total-tiv)*sizeof(void *));
    260260      memset(&var_index[tiv],0,(new_total-tiv)*sizeof(short));
     
    367367      {
    368368    total_weapons++;
    369     weapon_types=(int *)jrealloc(weapon_types,sizeof(int)*total_weapons,"weapon map");
     369    weapon_types=(int *)realloc(weapon_types,sizeof(int)*total_weapons);
    370370    weapon_types[total_weapons-1]=total_objects;
    371371      }
     
    411411    total_fields++;
    412412
    413     fields=(named_field **)jrealloc(fields,sizeof(named_field *)*total_fields,"named_fields");
     413    fields=(named_field **)realloc(fields,sizeof(named_field *)*total_fields);
    414414    fields[total_fields-1]=new named_field(real,fake);
    415415    mf=lcdr(mf);
     
    517517      total_fields++;
    518518
    519       fields=(named_field **)jrealloc(fields,sizeof(named_field *)*total_fields,"named_fields");
     519      fields=(named_field **)realloc(fields,sizeof(named_field *)*total_fields);
    520520      fields[total_fields-1]=new named_field(find,new_name);
    521521      mf=lcdr(mf);
     
    554554    if (seq[i])
    555555      delete seq[i];
    556   if (ts) jfree(seq);
     556  if (ts) free(seq);
    557557
    558558  if (total_fields)
     
    560560    for (int i=0;i<total_fields;i++)
    561561      delete fields[i];
    562     jfree(fields);
     562    free(fields);
    563563  }
    564564
    565565  if (ts)
    566     jfree(seq_syms);
     566    free(seq_syms);
    567567
    568568  if (tiv)
    569569  {
    570     jfree(vars);
    571     jfree(var_index);
    572   }
    573 
    574 
    575 }
    576 
    577 extern long small_ptr_size(void *ptr);
    578 
    579 
    580 void chk_sizes()
    581 {
    582   for (int i=0;i<total_objects;i++)
    583   {
    584     figures[i]->check_sizes();
    585   }
    586 }
    587 
    588 
    589 void character_type::check_sizes()
    590 {
    591   for (int i=0;i<ts;i++)
    592     if (seq[i] && small_ptr_size(seq[i])!=8)
    593       printf("bad size for state %d\n",i);
    594 }
    595 
    596 
    597 
    598 
     570    free(vars);
     571    free(var_index);
     572  }
     573
     574
     575}
     576
  • abuse/trunk/src/chars.hpp

    r124 r129  
    4141  char *descript_name;
    4242  named_field(char *real, char *fake)
    43   { real_name=strcpy((char *)jmalloc(strlen(real)+1,"var_name"),real);
    44     descript_name=strcpy((char *)jmalloc(strlen(fake)+1,"var_name"),fake);
     43  { real_name=strcpy((char *)malloc(strlen(real) + 1),real);
     44    descript_name=strcpy((char *)malloc(strlen(fake) + 1),fake);
    4545  }
    46   ~named_field() { jfree(real_name); jfree(descript_name); }
     46  ~named_field() { free(real_name); free(descript_name); }
    4747} ;
    4848
  • abuse/trunk/src/clisp.cpp

    r126 r129  
    770770      if (!total_objects)
    771771      {
    772         object_names=(char **)jmalloc(sizeof(char *)*(total_objects+1),"object name list");
    773     figures=(character_type **)jmalloc(sizeof(character_type *)*(total_objects+1),"character types");
     772        object_names=(char **)malloc(sizeof(char *)*(total_objects+1));
     773    figures=(character_type **)malloc(sizeof(character_type *)*(total_objects+1));
    774774      }
    775775      else
    776776      {
    777         object_names=(char **)jrealloc(object_names,sizeof(char *)*(total_objects+1),
    778                        "object name list");
    779     figures=(character_type **)jrealloc(figures,sizeof(character_type *)*(total_objects+1),
    780                         "character types");
     777        object_names=(char **)realloc(object_names,sizeof(char *)*(total_objects+1));
     778    figures=(character_type **)realloc(figures,sizeof(character_type *)*(total_objects+1));
    781779      }
    782780
    783781      object_names[total_objects]=strcpy(
    784       (char *)jmalloc(strlen(lstring_value(symbol_name(sym)))+1,"object name"),
     782      (char *)malloc(strlen(lstring_value(symbol_name(sym)))+1),
    785783                     lstring_value(symbol_name(sym)));
    786784      figures[total_objects]=new character_type(CDR(args),sym);
     
    992990    p_ref r1(fl),r2(dl);
    993991   
    994     for (i=tfiles-1;i>=0;i--) { push_onto_list(new_lisp_string(files[i]),fl); jfree(files[i]); }
    995     jfree(files);
    996 
    997     for (i=tdirs-1;i>=0;i--) { push_onto_list(new_lisp_string(dirs[i]),dl); jfree(dirs[i]); }
    998     jfree(dirs);
     992    for (i=tfiles-1;i>=0;i--) { push_onto_list(new_lisp_string(files[i]),fl); free(files[i]); }
     993    free(files);
     994
     995    for (i=tdirs-1;i>=0;i--) { push_onto_list(new_lisp_string(dirs[i]),dl); free(dirs[i]); }
     996    free(dirs);
    999997   
    1000998    push_onto_list(dl,rl);
     
    21402138    case 264 :
    21412139    {
    2142       mem_report("mem.rep");
     2140      printf("mem_report is deprecated\n");
    21432141    } break;
    21442142    case 265 :
  • abuse/trunk/src/collide.cpp

    r124 r129  
    2828  void add_collide(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, game_object *who);
    2929  collide_patch *copy(collide_patch *Next);
    30   ~collide_patch() { if (total) jfree(touch); }
     30  ~collide_patch() { if (total) free(touch); }
    3131} ;
    3232
     
    3838  if (total)
    3939  {
    40     p->touch=(game_object **)jmalloc(total*sizeof(game_object *),"collide patches");
     40    p->touch=(game_object **)malloc(total*sizeof(game_object *));
    4141    memcpy(p->touch,touch,total*(sizeof(game_object *)));
    4242  }
     
    8484
    8585      p->total++;
    86       p->touch=(game_object **)jrealloc(p->touch,sizeof(game_object *)*p->total,"object_patch_list");
     86      p->touch=(game_object **)realloc(p->touch,sizeof(game_object *)*p->total);
    8787      p->touch[p->total-1]=who;
    8888      return ;
     
    101101        add_collide(first,p->x1,p->y2+1,p->x2,y2,who);
    102102      p->total++;
    103       p->touch=(game_object **)jrealloc(p->touch,sizeof(game_object *)*p->total,"object_patch_list");
     103      p->touch=(game_object **)realloc(p->touch,sizeof(game_object *)*p->total);
    104104      p->touch[p->total-1]=who;
    105105      return ;
     
    149149  first=new collide_patch(x1,y1,x2,y2,first);
    150150  first->total=1;
    151   first->touch=(game_object **)jmalloc(sizeof(game_object *)*1,"object_patch_list");
     151  first->touch=(game_object **)malloc(sizeof(game_object *)*1);
    152152  first->touch[0]=who;
    153153}
  • abuse/trunk/src/compiled.cpp

    r124 r129  
    1414#include "lisp.hpp"
    1515#include "macs.hpp"
    16 #include "jmalloc.hpp"
    1716
    1817extern int total_objects;
     
    126125  {
    127126    b=symbol_value(b);
    128     bad_guy_array=(uint8_t *)jmalloc(total_objects,"bad_guy_array");
     127    bad_guy_array=(uint8_t *)malloc(total_objects);
    129128    memset(bad_guy_array,0,total_objects);
    130129    while (b)
     
    150149{
    151150  if (bad_guy_array)
    152     jfree(bad_guy_array);
     151    free(bad_guy_array);
    153152}
  • abuse/trunk/src/config.cpp

    r124 r129  
    9393    if( key_map )
    9494    {
    95         jfree( key_map );
     95        free( key_map );
    9696    }
    9797    key_map = NULL;
     
    100100    if( key_players )
    101101    {
    102         key_map = ( player_keys *)jmalloc(sizeof(player_keys)*key_players,"key bindings");
     102        key_map = ( player_keys *)malloc(sizeof(player_keys)*key_players);
    103103        for( int i = 0; i < key_players; i++ )
    104104        {
     
    128128    if( key_map )
    129129    {
    130         jfree( key_map );
     130        free( key_map );
    131131    }
    132132    key_map = NULL;
    133133
    134134    key_players = 1;
    135     key_map = (player_keys *)jmalloc( sizeof( player_keys ) * key_players, "key bindings" );
     135    key_map = (player_keys *)malloc( sizeof( player_keys ) * key_players );
    136136    for( int i = 0; i < key_players; i++ )
    137137    {
     
    224224    if(key_map)
    225225    {
    226         jfree(key_map);
     226        free(key_map);
    227227        key_map = NULL;
    228228    }
  • abuse/trunk/src/console.cpp

    r124 r129  
    1717#include "linked.hpp"
    1818#include "console.hpp"
    19 #include "jmalloc.hpp"
    2019
    2120void console::put_string(char const *st)
     
    7170{
    7271  hide();
    73   jfree(screen);
    74   jfree(name);
     72  free(screen);
     73  free(name);
    7574}
    7675
     
    8079  w=width;
    8180  h=height;
    82   screen=(char *)jmalloc(w*h,"console screen");
     81  screen=(char *)malloc(w*h);
    8382  memset(screen,' ',w*h);
    8483  cx=cy=0;
     
    8685  lastx=xres/2-screen_w()/2;
    8786  lasty=yres/2-screen_h()/2;
    88   name=(char *)strcpy((char *)jmalloc(strlen(Name)+1,"console name"),Name);
     87  name=(char *)strcpy((char *)malloc(strlen(Name)+1),Name);
    8988}
    9089
  • abuse/trunk/src/crc.cpp

    r124 r129  
    3232
    3333  int size=0x1000;
    34   uint8_t *buffer=(uint8_t *)jmalloc(size,"crc_buffer"),*c;
     34  uint8_t *buffer=(uint8_t *)malloc(size),*c;
    3535  long l=fp->file_size();
    3636  long cur_pos=fp->tell();
     
    5353  }
    5454  fp->seek(cur_pos,0);
    55   jfree(buffer);
     55  free(buffer);
    5656  return (crc1|(crc2<<8)|(crc3<<16)|(crc4<<24));
    5757}
  • abuse/trunk/src/demo.cpp

    r124 r129  
    1616#include "macs.hpp"
    1717#include "jwindow.hpp"
    18 #include "jmalloc.hpp"
    1918#include "dprint.hpp"
    2019#include "dev.hpp"
  • abuse/trunk/src/dev.cpp

    r123 r129  
    556556
    557557  }
    558 
    559   update_memprof();
    560558}
    561559
     
    572570}
    573571
    574 
    575 extern void small_static_allocation_summary(int &total, int *&static_list, int *&cache_list);
    576 
    577 void dev_controll::update_memprof()
    578 {
    579     if(!memprof)
    580         return;
    581 
    582     int i;
    583     int total, *st, *ch;
    584     small_static_allocation_summary(total, st, ch);
    585 
    586     int h, x = 0, y = 0;
    587     memprof->clear();
    588 
    589     for(i = 0; i < total; i++)
    590     {
    591         x++;
    592         h = st[i] * 100 / 3000;
    593         memprof->screen->bar(x, y, x, y + h, wm->bright_color());
    594         h = ch[i] * 100 / 3000;
    595         memprof->screen->bar(x, y, x, y + h, wm->medium_color());
    596         x++;
    597     }
    598     jfree(st);
    599     jfree(ch);
    600     char buf[100];
    601     sprintf(buf, "%8ld %8ld", (long int)j_allocated(), (long int)j_available());
    602     wm->font()->put_string(memprof->screen, memprof->x1(),
    603                            memprof->y2() - wm->font()->height(), buf);
    604 }
    605 
    606 void dev_controll::toggle_memprof()
    607 {
    608   if (memprof)
    609   {
    610     prop->setd("memprof x",memprof->x);
    611     prop->setd("memprof y",memprof->y);
    612     wm->close_window(memprof);
    613     memprof=NULL;
    614   } else
    615   {
    616     int total,*st,*ch;
    617     small_static_allocation_summary(total,st,ch);
    618     jfree(st);
    619     jfree(ch);
    620     memprof=wm->new_window(0,0,total*2+20,100,NULL);
    621     update_memprof();
    622   }
    623 }
    624572
    625573void dev_controll::toggle_toolbar()
     
    705653        wm->close_window(omenu);
    706654        omenu = NULL;
    707         jfree(listable_objs);
     655        free(listable_objs);
    708656        listable_objs = NULL;
    709657        return;
     
    718666        if(!figures[i]->get_cflag(CFLAG_UNLISTABLE))
    719667            total_listable++;
    720     listable_objs = (char **)jmalloc(sizeof(char *) * total_listable, "omenu list");
     668    listable_objs = (char **)malloc(sizeof(char *) * total_listable);
    721669
    722670    for(i = 0, c = 0; i < total_objects; i++)
     
    752700        wm->close_window(pmenu);
    753701        pmenu = NULL;
    754         jfree(pwin_list);
     702        free(pwin_list);
    755703        return;
    756704    }
     
    764712    pmenu_on = 1;
    765713
    766     pwin_list = (char **)jmalloc(total_pals * sizeof(char *), "pal pick list");
     714    pwin_list = (char **)malloc(total_pals * sizeof(char *));
    767715    for(int i = 0; i < total_pals; i++)
    768716        pwin_list[i] = pal_wins[i]->name;
     
    968916  ai_object=NULL;
    969917  search_object = NULL;
    970   memprof=NULL;
    971918  oedit=NULL;
    972919  forew=NULL;
     
    999946  if (get_option("-nolight"))
    1000947    dev=dev^DRAW_LIGHTS;
    1001   if (start_mem)
    1002     toggle_memprof();
    1003948}
    1004949
     
    10801025
    10811026      // save the old weapon array
    1082       int32_t *w=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"tmp weapon array");
     1027      int32_t *w=(int32_t *)malloc(total_weapons*sizeof(int32_t));
    10831028      memcpy(w,player_list->weapons,total_weapons*sizeof(int32_t));
    10841029
     
    10951040
    10961041      memcpy(player_list->weapons,w,total_weapons*sizeof(int32_t));
    1097       jfree(w);
     1042      free(w);
    10981043
    10991044      the_game->need_refresh();
     
    13041249    }
    13051250  }
    1306 
    1307   if (!strcmp(fword,"mem_report"))
    1308     mem_report("memory.report");
    13091251
    13101252  if (!strcmp(fword,"restart"))
     
    27392681    else if (ev.window==tbw) toggle_toolbar();
    27402682    else if (ev.window==omenu) toggle_omenu();
    2741     else if (ev.window==memprof) toggle_memprof();
    27422683    else if (ev.window==search_window) toggle_search_window();
    27432684    else if (profile_handle_event(ev))  profile_on=!profile_on;
     
    28292770      case 'p' : toggle_pmenu(); break;
    28302771      case 'P' : profile_toggle(); break;
    2831       case '|' : toggle_memprof(); break;
    28322772      case '.' :
    28332773      {
     
    29762916{
    29772917  total_pals++;
    2978   pal_wins=(pal_win **)jrealloc(pal_wins,sizeof(pal_win *)*total_pals,"edit pal array");
     2918  pal_wins=(pal_win **)realloc(pal_wins,sizeof(pal_win *)*total_pals);
    29792919  pal_wins[total_pals-1]=new pal_win(args);
    29802920}
     
    29862926  Cell *ao=(Cell *)args;
    29872927
    2988   name=strcpy((char *)jmalloc(strlen(lstring_value(CAR(args)))+1,
    2989                   "pal name"),lstring_value(CAR(args)));
     2928  name=strcpy((char *)malloc(strlen(lstring_value(CAR(args)))+1),lstring_value(CAR(args)));
    29902929  ao=CDR(ao);
    29912930  scale=w=h=1;
     
    30142953  if (h<=0) h=0;
    30152954
    3016   pat=(unsigned short *)jmalloc(w*h*sizeof(unsigned short),"palwin::pat");
     2955  pat=(unsigned short *)malloc(w*h*sizeof(unsigned short));
    30172956  memset(pat,0,sizeof(unsigned short)*w*h);   // set the palette to black if no parameters are given
    30182957  while (!NILP(ao))   // loop until we run out of parameters
     
    32173156  if (w+xa<1 || y+ya<1) return ;
    32183157
    3219   npat=(unsigned short *)jmalloc(sizeof(unsigned short)*(w+xa)*(h+ya),"resized pal_win");
     3158  npat=(unsigned short *)malloc(sizeof(unsigned short)*(w+xa)*(h+ya));
    32203159  memset(npat,0,sizeof(unsigned short)*(w+xa)*(h+ya));
    32213160  for (i=0;i<(w+xa);i++)
     
    32233162      if (i+j*w<w*h)
    32243163        npat[i+j*(w+xa)]=pat[i+j*w];
    3225   jfree(pat);
     3164  free(pat);
    32263165  w+=xa;
    32273166  h+=ya;
     
    34633402  if (listable_objs)
    34643403  {
    3465     jfree(listable_objs);
     3404    free(listable_objs);
    34663405    listable_objs=NULL;
    34673406  }
     
    36723611    delete pal_wins[i];
    36733612  if (total_pals)
    3674     jfree(pal_wins);
     3613    free(pal_wins);
    36753614}
    36763615
     
    36793618pal_win::~pal_win()
    36803619{
    3681   jfree(pat);
    3682   jfree(name);
    3683 }
     3620  free(pat);
     3621  free(name);
     3622}
  • abuse/trunk/src/dev.hpp

    r124 r129  
    7979  Jwindow *backw,*forew,*commandw,*modew,*omenu,*oedit,*ledit,
    8080          *music_window,*pmenu,*show_menu,*lightw,*aiw,*ambw,*tbw,*area_win,
    81           *search_window,*memprof;
     81          *search_window;
    8282
    8383  int fg_w,bg_w,fg_scale,bg_scale,yellow;
     
    8585  void fg_fill(int color, int x, int y, pal_win *p);
    8686  void add_palette(void *args);
    87   void toggle_memprof();
    8887  void search_forward();
    8988  void search_backward();
     
    121120  void notify_deleted_light(light_source *l);
    122121  void set_state(int new_state);
    123   void update_memprof();
    124122  ~dev_controll();
    125123} ;
  • abuse/trunk/src/endgame.cpp

    r124 r129  
    4242static mask_line *make_mask_lines(image *mask, int map_width)
    4343{
    44   mask_line *p=(mask_line *)jmalloc(mask->height()*sizeof(mask_line),"mask_line");
     44  mask_line *p=(mask_line *)malloc(mask->height()*sizeof(mask_line));
    4545  for (int y=0;y<mask->height();y++)
    4646  {
     
    5959
    6060    // now calculate remap for line
    61     p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap");
    62     p[y].light=(uint8_t *)jmalloc(size,"mask light");
     61    p[y].remap=(uint16_t *)malloc(size * 2);
     62    p[y].light=(uint8_t *)malloc(size);
    6363    uint16_t *rem=p[y].remap;
    6464    uint8_t *lrem=p[y].light;
     
    398398  for (i=0;i<cache.img(mask)->height();i++)
    399399  {
    400     jfree(p[i].remap);
    401     jfree(p[i].light);
    402   }
    403 
    404   jfree(p);
     400    free(p[i].remap);
     401    free(p[i].light);
     402  }
     403
     404  free(p);
    405405
    406406
  • abuse/trunk/src/extend.cpp

    r126 r129  
    5454  for (int i=0;i<tlights;i++) if (lights[i]==ls) return;
    5555  tlights++;
    56   lights=(light_source **)jrealloc(lights,sizeof(light_source *)*tlights,"Light list");
     56  lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights);
    5757  lights[tlights-1]=ls;
    5858}
     
    6868    o->set_tint(_tint);
    6969  tobjs++;
    70   objs=(game_object **)jrealloc(objs,sizeof(game_object *)*tobjs,"Object list");
     70  objs=(game_object **)realloc(objs,sizeof(game_object *)*tobjs);
    7171  objs[tobjs-1]=o;
    7272}
     
    8282      for (int j=i;j<tlights;j++)     // don't even think about it :)
    8383        lights[j]=lights[j+1];
    84       lights=(light_source **)jrealloc(lights,sizeof(light_source *)*tlights,"object's lights");
     84      lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights);
    8585      return ;
    8686    }
     
    9797      for (int j=i;j<tobjs;j++)     // don't even think about it :)
    9898        objs[j]=objs[j+1];
    99       objs=(game_object **)jrealloc(objs,sizeof(game_object *)*tobjs,"object's lights");
     99      objs=(game_object **)realloc(objs,sizeof(game_object *)*tobjs);
    100100      return ;
    101101    }
     
    145145void simple_object::clean_up()
    146146{
    147   if (tlights) jfree(lights);
    148   if (tobjs)   jfree(objs);
     147  if (tlights) free(lights);
     148  if (tobjs)   free(objs);
    149149  if (Controller)
    150150    Controller->focus=NULL;
  • abuse/trunk/src/extend.hpp

    r126 r129  
    2020#include "lisp/lisp.hpp"
    2121
    22 #include "jmalloc.hpp"
    2322#include "macs.hpp"
    2423#include "morpher.hpp"
  • abuse/trunk/src/fakelib.hpp

    r124 r129  
    1111#define __FAKELIB_HPP_
    1212
    13 #define jmalloc(x,y) malloc(x)
    14 #define jrealloc(x,y,z) realloc(x,y)
    15 #define jfree(x) free(x)
    16 
    17 #ifdef __sgi
    18 #include <sys/bsd_types.h>
    19 #else
    2013#include <stdint.h>
    21 #endif
    2214
    2315class bFILE
  • abuse/trunk/src/game.cpp

    r127 r129  
    13881388//    ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof
    13891389    char *fastpath;
    1390     fastpath = (char *)jmalloc(strlen(get_save_filename_prefix()) + 12 + 1, "fastpath");
     1390    fastpath = (char *)malloc(strlen(get_save_filename_prefix()) + 12 + 1);
    13911391    sprintf(fastpath, "%sfastload.dat", get_save_filename_prefix());
    13921392    fast_load_start_recording(fastpath);
    13931393    load_data(argc, argv);
    13941394    fast_load_stop_recording();
    1395     jfree(fastpath);
     1395    free(fastpath);
    13961396//    ProfilerDump("\pabuse.prof");  //prof
    13971397//    ProfilerTerm();
     
    21142114  for(; i < total_objects; i++)
    21152115  {
    2116     jfree(object_names[i]);
     2116    free(object_names[i]);
    21172117    delete figures[i];
    21182118  }
     
    21202120  if(fps_mark_start) delete fps_mark_start; fps_mark_start = NULL;
    21212121  delete pal;
    2122   jfree(object_names);
    2123   jfree(figures);
    2124 
    2125   jfree(backtiles);
    2126   jfree(foretiles);
     2122  free(object_names);
     2123  free(figures);
     2124
     2125  free(backtiles);
     2126  free(foretiles);
    21272127  if(total_weapons)
    2128     jfree(weapon_types);
     2128    free(weapon_types);
    21292129
    21302130  config_cleanup();
     
    21352135  delete console_font;
    21362136  if(total_help_screens)
    2137     jfree(help_screens);
     2137    free(help_screens);
    21382138
    21392139  close_graphics();
     
    22692269char *get_line(int open_braces)
    22702270{
    2271   char *line=(char *)jmalloc(1000, "lstring");
     2271  char *line=(char *)malloc(1000);
    22722272  fgets(line, 1000, stdin);
    22732273
     
    22842284  {
    22852285    char *s2 = get_line(open_braces);
    2286     line=(char *)jrealloc(line, strlen(line)+strlen(s2)+1, "lstring");
     2286    line=(char *)realloc(line, strlen(line)+strlen(s2)+1);
    22872287    strcat(line, s2);
    2288     jfree(s2);
     2288    free(s2);
    22892289  }
    22902290  return line;
     
    23322332                    l_user_stack.pop(1);
    23332333                }
    2334                 jfree(l);
     2334                free(l);
    23352335            }
    23362336            fprintf(stderr, "End of input : bye\n");
     
    23762376extern pmenu *dev_menu;
    23772377
    2378 
    2379 extern int jmalloc_max_size;
    2380 extern int jmalloc_min_low_size;
    2381 
    23822378void game_net_init(int argc, char **argv)
    23832379{
     
    24202416            external_print = 1;
    24212417        }
    2422 
    2423         if(!strcmp(argv[i], "-min_low"))
    2424         {
    2425             i++;
    2426             jmalloc_min_low_size = atoi(argv[i]);
    2427         }
    2428     }
    2429 
    2430 //  jmalloc_max_size = 0x150000;
    2431     jmalloc_init(0x150000);
    2432 //  jmalloc_init(100000);
     2418    }
    24332419
    24342420#if(defined(__APPLE__) && !defined(__MACH__))
     
    26502636    compiled_uninit();
    26512637    delete_all_lights();
    2652     jfree(white_light_initial);
    2653 
    2654     for(int i = 0; i < TTINTS; i++) jfree(tints[i]);
     2638    free(white_light_initial);
     2639
     2640    for(int i = 0; i < TTINTS; i++) free(tints[i]);
    26552641
    26562642
     
    26742660
    26752661    base->packet.packet_reset();
    2676 //    mem_report("end.mem");
    26772662  } while(main_net_cfg && main_net_cfg->restart_state());
    26782663
     
    26922677    }
    26932678
    2694 // AK -> Commented this out to stop a crash as the file prefix has already
    2695 //       been released.  Need to fix this.
    2696 //    mem_report("end.mem");
    2697 
    2698 //    jmalloc_uninit();
    26992679    l_user_stack.clean_up();
    27002680    l_ptr_stack.clean_up();
  • abuse/trunk/src/gamma.cpp

    r123 r129  
    167167            FILE *fp;
    168168
    169             gammapath = (char *)jmalloc(strlen(get_save_filename_prefix()) + 10, "gammapath");
     169            gammapath = (char *)malloc(strlen(get_save_filename_prefix()) + 10);
    170170            sprintf(gammapath, "%sgamma.lsp", get_save_filename_prefix());
    171171            fp = open_FILE(gammapath, "wb");
     
    184184                dprintf("Unable to write to file gamma.lsp\n");
    185185            }
    186             jfree(gammapath);
     186            free(gammapath);
    187187        }
    188188    }
  • abuse/trunk/src/imlib/Makefile.am

    r104 r129  
    2424    pcxread.cpp pcxread.hpp \
    2525    timage.cpp timage.hpp \
    26     jmalloc.cpp jmalloc.hpp \
    2726    jrand.cpp jrand.hpp \
    2827    lbmread.cpp lbmread.hpp \
  • abuse/trunk/src/imlib/filesel.cpp

    r124 r129  
    3535  int i=0;
    3636  for (;i<tf;i++)
    37     jfree(f[i]);
     37    free(f[i]);
    3838  for (i=0;i<td;i++)
    39     jfree(d[i]);
    40   if (tf) jfree(f);
    41   if (td) jfree(d);
     39    free(d[i]);
     40  if (tf) free(f);
     41  if (td) free(d);
    4242}
    4343
  • abuse/trunk/src/imlib/filter.cpp

    r128 r129  
    1919{
    2020  nc=from->pal_size() > to->pal_size() ? from->pal_size() : to->pal_size();
    21   unsigned char *p=fdat=(unsigned char *)jmalloc(nc,"conversion filter");
     21  unsigned char *p=fdat=(unsigned char *)malloc(nc);
    2222  unsigned char *r,*g,*b;
    2323  r=g=b=(unsigned char *)from->addr();
     
    7373  nc=colors;
    7474  make_block(nc);
    75   fdat=(unsigned char *)jmalloc(nc,"filter");
     75  fdat=(unsigned char *)malloc(nc);
    7676  clear();
    7777}
     
    121121  long dist_sqr,best;
    122122  int colors=1<<color_bits;
    123   color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter");
     123  color_table=(unsigned char *)malloc(colors*colors*colors);
    124124  for (r=0;r<colors;r++)
    125125  {
     
    156156  fp->read_uint16();
    157157  int colors=32;
    158   color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded");
     158  color_table=(unsigned char *)malloc(colors*colors*colors);
    159159  fp->read(color_table,colors*colors*colors);
    160160}
  • abuse/trunk/src/imlib/filter.hpp

    r124 r129  
    1010#ifndef _FILTER_HPP
    1111#define _FILTER_HPP
     12
    1213#include "image.hpp"
    1314#include "palette.hpp"
    1415#include "specs.hpp"
    15 #include "jmalloc.hpp"
    1616
    1717class filter
     
    2929  void put_image(image *screen, image *im, short x, short y, char transparent=0);
    3030  void clear();
    31   ~filter() { jfree(fdat); }
     31  ~filter() { free(fdat); }
    3232} ;
    3333
     
    4545  int total_colors() { return 32; }
    4646  unsigned char *get_table() { return color_table; }
    47   ~color_filter() { jfree(color_table); }
     47  ~color_filter() { free(color_table); }
    4848} ;
    4949
  • abuse/trunk/src/imlib/glview.cpp

    r124 r129  
    3333  screen->clear();
    3434  i=argc;
    35   im=(image **)jmalloc(sizeof(image *)*80,"gl_view image");
     35  im=(image **)malloc(sizeof(image *)*80);
    3636  i=1; t=1;
    3737  while (i<argc)
  • abuse/trunk/src/imlib/guistat.cpp

    r124 r129  
    2525  time_marker last_time;
    2626  gui_status_node(char const *Name, visual_object *Show, gui_status_node *Next)
    27   { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
     27  { name=strcpy((char *)malloc(strlen(Name)+1),Name);
    2828    show=Show;
    2929    next=Next;
     
    3737gui_status_node::~gui_status_node()
    3838{
    39   jfree(name);
     39  free(name);
    4040  if (show)
    4141    delete show;
  • abuse/trunk/src/imlib/image.cpp

    r124 r129  
    112112void make_block(size_t size)
    113113{
    114   void *dat=jmalloc(size, "make_block : tmp");
     114  void *dat=malloc(size);
    115115  CONDITION(dat, "Memory error : could not make block\n");
    116   if (dat) jfree((char *)dat);
     116  if (dat) free((char *)dat);
    117117}
    118118
     
    274274
    275275    lock();
    276     dat = (uint8_t *)jmalloc(width(), "image copy");
     276    dat = (uint8_t *)malloc(width());
    277277    im = new image(width(), height());
    278278    im->lock();
     
    286286    im->unlock();
    287287    unlock();
    288     jfree((char *)dat);
     288    free((char *)dat);
    289289    return im;
    290290}
     
    11051105  int16_t x;
    11061106  uint8_t *sl, *ex, mask, bt, sh;
    1107   ex=(uint8_t *)jmalloc(width(), "image::unpacked scanline");
     1107  ex=(uint8_t *)malloc(width());
    11081108
    11091109  lock();
     
    11211121  }
    11221122
    1123   jfree((char *)ex);
     1123  free((char *)ex);
    11241124}
    11251125
     
    11621162{
    11631163  int old_width=width(), old_height=height();
    1164   uint8_t *im=(uint8_t *)jmalloc(width()*height(), "image::resized");
     1164  uint8_t *im=(uint8_t *)malloc(width()*height());
    11651165  lock();
    11661166  memcpy(im, scan_line(0), width()*height());
     
    11871187    { sl2[x2]=sl1[(int)xd]; }
    11881188  }
    1189   jfree(im);
     1189  free(im);
    11901190  if (special) special->resize(new_width, new_height);
    11911191  unlock();
     
    14241424void image::flip_x()
    14251425{
    1426   uint8_t *rev=(uint8_t *)jmalloc(width(), "image tmp::flipped_x"), *sl;
     1426  uint8_t *rev=(uint8_t *)malloc(width()), *sl;
    14271427  CONDITION(rev, "memory allocation");
    14281428  int y, x, i;
     
    14371437  }
    14381438  unlock();
    1439   jfree(rev);
     1439  free(rev);
    14401440}
    14411441
    14421442void image::flip_y()
    14431443{
    1444   uint8_t *rev=(uint8_t *)jmalloc(width(), "image::flipped_y"), *sl;
     1444  uint8_t *rev=(uint8_t *)malloc(width()), *sl;
    14451445  CONDITION(rev, "memory allocation");
    14461446  int y;
     
    14551455  }
    14561456  unlock();
    1457   jfree(rev);
     1457  free(rev);
    14581458}
    14591459
  • abuse/trunk/src/imlib/image24.cpp

    r124 r129  
    1919  h=height;
    2020
    21   data=(unsigned char *)jmalloc(width*height*3,"image24");
     21  data=(unsigned char *)malloc(width*height*3);
    2222  CONDITION(data,"unable to alloc enough memory for 24 bit image");
    2323}
  • abuse/trunk/src/imlib/image24.hpp

    r124 r129  
    3939                                unsigned char b=0);
    4040  void add_error(int x, int y, int r_error, int g_error, int b_error, int error_mult);
    41   ~image24() { jfree(data); }
     41  ~image24() { free(data); }
    4242} ;
    4343
  • abuse/trunk/src/imlib/input.cpp

    r124 r129  
    221221  x=X; y=Y; id=ID;
    222222  act_id=-1;
    223   text=strcpy((char *)jmalloc(strlen(Text)+1,"input button"),Text);
     223  text=strcpy((char *)malloc(strlen(Text)+1),Text);
    224224  up=1; next=Next; act=0;
    225225  visual=NULL;
     
    248248{
    249249  if (strlen(format)<strlen(new_data))
    250     data=(char *)jrealloc(data,strlen(new_data),"text field input");
     250    data=(char *)realloc(data,strlen(new_data));
    251251
    252252  strcpy(data,new_data);
     
    334334
    335335  x=X; y=Y; id=ID;
    336   prompt=strcpy((char *)jmalloc(strlen(Prompt)+1,"text_field::prompt"),Prompt);
    337   format=strcpy((char *)jmalloc(slen+1,"text_field::format"),Format);
    338   data=strcpy((char *)jmalloc(slen+1,"text_field::data"),Data);
     336  prompt=strcpy((char *)malloc(strlen(Prompt)+1),Prompt);
     337  format=strcpy((char *)malloc(slen+1),Format);
     338  data=strcpy((char *)malloc(slen+1),Data);
    339339  cur=strlen(data);
    340340  while (cur && data[cur-1]==' ') cur--;
     
    349349  int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num));
    350350  x=X; y=Y; id=ID;
    351   prompt=strcpy((char *)jmalloc(strlen(Prompt)+1,"text_field::prompt"),Prompt);
    352   format=strcpy((char *)jmalloc(slen+1,"text_field::format"),Format);
    353   data=strcpy((char *)jmalloc(slen+1,"text_field::data"),num);
     351  prompt=strcpy((char *)malloc(strlen(Prompt)+1),Prompt);
     352  format=strcpy((char *)malloc(slen+1),Format);
     353  data=strcpy((char *)malloc(slen+1),num);
    354354  cur=strlen(num);
    355355  while (cur && data[cur-1]==' ') cur--;
     
    460460{
    461461  x = X; y = Y; id = ID; next = Next;
    462   text = strcpy((char *)jmalloc(strlen(info)+1,"info_field"), info);
     462  text = strcpy((char *)malloc(strlen(info)+1), info);
    463463  w = -1;
    464464}
  • abuse/trunk/src/imlib/input.hpp

    r124 r129  
    3232  void change_visual(image *new_visual);
    3333  virtual void remap(filter *f);
    34   virtual ~button() { if (text) jfree(text); }
     34  virtual ~button() { if (text) free(text); }
    3535  void push();
    3636  virtual char *read() { return (char *)&up; }
     
    8585  virtual void handle_event(event &ev, image *screen, InputManager *im);
    8686
    87   virtual ~text_field() { jfree(prompt); jfree(format); jfree(data); }
     87  virtual ~text_field() { free(prompt); free(format); free(data); }
    8888  virtual char *read();
    8989  void change_data(char const *new_data, int new_cursor,       // cursor==-1, does not change it.
     
    106106  virtual char *read() { return text; }
    107107  virtual int selectable() { return 0; }
    108   virtual ~info_field() { jfree(text); }
     108  virtual ~info_field() { free(text); }
    109109} ;
    110110
  • abuse/trunk/src/imlib/jwindow.cpp

    r128 r129  
    394394    _name = NULL;
    395395    if(name)
    396         _name = strcpy((char *)jmalloc(strlen(name) + 1,
    397                                        "Jwindow::window name"), name);
     396        _name = strcpy((char *)malloc(strlen(name) + 1), name);
    398397    wm->add_window(this);
    399398}
     
    441440    _name = NULL;
    442441    if(name)
    443         _name = strcpy((char *)jmalloc(strlen(name) + 1,
    444                                        "Jwindow::window name"), name);
     442        _name = strcpy((char *)malloc(strlen(name) + 1), name);
    445443
    446444    wm->add_window(this);
     
    457455    delete inm;
    458456    if(_name)
    459         jfree(_name);
     457        free(_name);
    460458}
    461459
  • abuse/trunk/src/imlib/loader.cpp

    r124 r129  
    5353      break;
    5454    case LOADER_xwd :
    55       images=(image **)jmalloc(sizeof(image *),"loader::xwd image * array");
     55      images=(image **)malloc(sizeof(image *));
    5656      total_read=1;
    5757      images[0]=readxwd(filename,pal);
    5858      break;
    5959    case LOADER_ppm :
    60       images=(image **)jmalloc(sizeof(image *),"loader::ppm image * array");
     60      images=(image **)malloc(sizeof(image *));
    6161      total_read=1;
    6262      pal=new palette;
     
    6464      break;
    6565    case LOADER_pic :
    66       images=(image **)jmalloc(sizeof(image *),"loader::pic image * array");
     66      images=(image **)malloc(sizeof(image *));
    6767      total_read=1;
    6868      pal=NULL;
     
    7070      break;
    7171    case LOADER_bmp8 :
    72       images=(image **)jmalloc(sizeof(image *),"loader::bmp image * array");
     72      images=(image **)malloc(sizeof(image *));
    7373      total_read=1;
    7474      pal=NULL;
     
    7676      break;
    7777    case LOADER_pcx8 :
    78       images=(image **)jmalloc(sizeof(image *),"loader::pcx image * array");
     78      images=(image **)malloc(sizeof(image *));
    7979      total_read=1;
    8080      pal=NULL;
     
    8282      break;
    8383    case LOADER_lbm :
    84       images=(image **)jmalloc(sizeof(image *),"loader::pcx image * array");
     84      images=(image **)malloc(sizeof(image *));
    8585      total_read=1;
    8686      pal=NULL;
     
    9191      if (ref_pal)
    9292      {
    93         images=(image **)jmalloc(sizeof(image *),"loader::targa image * array");
     93        images=(image **)malloc(sizeof(image *));
    9494        total_read=1;
    9595        images[0]=load_targa(filename,ref_pal);
  • abuse/trunk/src/imlib/mdlread.cpp

    r124 r129  
    164164      }
    165165      if (!current_error())
    166     im=(image **)jmalloc(sizeof(image *)*endn,"mdl_read::image * array");
     166    im=(image **)malloc(sizeof(image *)*endn);
    167167
    168168      while ((startn<endn || endn==-1) && !feof(fp) && !current_error())
  • abuse/trunk/src/imlib/morph.cpp

    r124 r129  
    119119
    120120  patches=frames;
    121   pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"morph::patch array");
     121  pats=(morph_patch *)malloc(sizeof(morph_patch)*patches);
    122122  w=max(bound_x2(0),bound_x2(1));
    123123  h=max(bound_y2(0),bound_y2(1));
     
    261261
    262262
    263   middle_map=(morph_point8 **)jmalloc(w*h*sizeof(morph_point8 *),
    264                       "morph::middle_map");  // create an image of pointers
    265   end_map=(unsigned char *)jmalloc(w*h,
    266                   "morph::end_map");      // maps all the ending pixels
     263  // create an image of pointers
     264  middle_map=(morph_point8 **)malloc(w*h*sizeof(morph_point8 *));
     265  // maps all the ending pixels
     266  end_map=(unsigned char *)malloc(w*h);
    267267
    268268  for (frame_on=2;frame_on<frames-1;frame_on++)
     
    349349  }
    350350
    351   jfree(middle_map);
    352   jfree(end_map);
     351  free(middle_map);
     352  free(end_map);
    353353
    354354}
     
    364364  if (e->type==SPEC_MORPH_POINTS_8 || e->type==SPEC_PATCHED_MORPH)
    365365  {
    366     p=(void *)jmalloc(sizeof(morph_point8)*total,"morph8::point array");
     366    p=(void *)malloc(sizeof(morph_point8)*total);
    367367    fp->read(p,sizeof(morph_point8)*total);
    368368    small=1;
     
    370370  else
    371371  {
    372     p=(void *)jmalloc(sizeof(morph_point16)*total,"morph16::point array");
     372    p=(void *)malloc(sizeof(morph_point16)*total);
    373373
    374374    for (i=0;i<total;i++)
     
    544544  }
    545545  if (small)
    546     plist=(void *)jmalloc(sizeof(morph_point8)*total,"morph8::point array");
     546    plist=(void *)malloc(sizeof(morph_point8)*total);
    547547  else
    548     plist=(void *)jmalloc(sizeof(morph_point16)*total,"morph16::point array");
     548    plist=(void *)malloc(sizeof(morph_point16)*total);
    549549  CHECK(plist);
    550550  for (i=0,color=0;i<total_hints;i++)
     
    734734
    735735  total=mor->total_points();
    736   points=(step_struct *)jmalloc(sizeof(step_struct)*total,"step_morph::points");
     736  points=(step_struct *)malloc(sizeof(step_struct)*total);
    737737
    738738  dir=frame_direction;
     
    897897
    898898  patches=fp->read_uint16();
    899   pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points");
     899  pats=(morph_patch *)malloc(sizeof(morph_patch)*patches);
    900900
    901901  for (i=0;i<patches;i++)
     
    904904    if (pats[i].patches)
    905905    {
    906       pats[i].patch_data=(unsigned char *)jmalloc(3*pats[i].patches,"patched_morph::patch_data");
     906      pats[i].patch_data=(unsigned char *)malloc(3*pats[i].patches);
    907907      fp->read(pats[i].patch_data,3*pats[i].patches);
    908908    }
  • abuse/trunk/src/imlib/morph.hpp

    r124 r129  
    2020#include "specs.hpp"
    2121#include "filter.hpp"
    22 #include "jmalloc.hpp"
    2322
    2423
     
    6665  void add_filler(int frames);
    6766  int small_morph() { return small; }
    68   ~jmorph() { jfree(p); }
     67  ~jmorph() { free(p); }
    6968} ;
    7069
     
    8180  void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
    8281  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
    83   ~patched_morph() { jfree(pats); }
     82  ~patched_morph() { free(pats); }
    8483
    8584} ;
     
    101100  void show_frame(image *screen, int x, int y,  color_filter *fli);
    102101  void reverse_direction();
    103   ~step_morph() { jfree(points); }
     102  ~step_morph() { free(points); }
    104103} ;
    105104
  • abuse/trunk/src/imlib/packet.cpp

    r124 r129  
    1414
    1515#include "packet.hpp"
    16 #include "jmalloc.hpp"
    1716
    1817int packet::advance(int32_t offset)
     
    4039
    4140packet::~packet()
    42 { jfree(buf); }
     41{ free(buf); }
    4342
    4443packet::packet(int prefix_size)
     
    4645  pre_size=prefix_size;
    4746
    48 #ifdef MANAGE_MEM
    49   int sp=alloc_space;
    50   alloc_space=ALLOC_SPACE_STATIC;
    51 #endif
    52 
    5347  buf_size=1000;
    54   buf=(uint8_t *)jmalloc(buf_size,"packet buffer");
     48  buf=(uint8_t *)malloc(buf_size);
    5549  reset();
    56 
    57 #ifdef MANAGE_MEM
    58   alloc_space=sp;
    59 #endif
    6050}
    6151
     
    8373  {
    8474    buf_size=max;
    85     buf=(uint8_t *)jrealloc(buf,max,"packet buffer");
     75    buf=(uint8_t *)realloc(buf,max);
    8676  }
    8777}
  • abuse/trunk/src/imlib/palette.cpp

    r124 r129  
    1818#include "video.hpp"
    1919#include "filter.hpp"
    20 #include "jmalloc.hpp"
    2120
    2221palette *lastl=NULL;
     
    2524{
    2625  ncolors=fp->read_uint16();
    27   pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
    28   usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
     26  pal=(color *)malloc(sizeof(color)*ncolors);
     27  usd=(unsigned char *)malloc(ncolors/8+1);
    2928  set_all_unused();
    3029  fp->read(pal,sizeof(color)*ncolors);
     
    3635  fp->seek(e->offset,0);
    3736  ncolors=fp->read_uint16();
    38   pal=(color *)jmalloc(sizeof(color)*ncolors,"palette");
    39   usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
     37  pal=(color *)malloc(sizeof(color)*ncolors);
     38  usd=(unsigned char *)malloc(ncolors/8+1);
    4039  set_all_unused();
    4140  fp->read(pal,sizeof(color)*ncolors);
     
    302301}
    303302palette::~palette()
    304 { if (pal) jfree(pal);
    305   if (usd) jfree(usd);
     303{ if (pal) free(pal);
     304  if (usd) free(usd);
    306305}
    307306
     
    311310  ncolors=number_colors;
    312311  bg=0;
    313   pal=(color *)jmalloc(ncolors*3,"palette");
    314   usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array");
     312  pal=(color *)malloc(ncolors*3);
     313  usd=(unsigned char *)malloc(ncolors/8+1);
    315314  defaults();
    316315}
  • abuse/trunk/src/imlib/pmenu.cpp

    r124 r129  
    6060  on_off=on_off_flag;
    6161  if (Name)
    62     n=strcpy((char *)jmalloc(strlen(Name)+1,"pmenu_item::name"),Name);
     62    n=strcpy((char *)malloc(strlen(Name)+1),Name);
    6363  else n=NULL;
    6464  next=Next;
     
    7373  on_off=NULL;
    7474  CONDITION(Name,"Sub menu cannot have a NULL name");
    75   n=strcpy((char *)jmalloc(strlen(Name)+1,"pmenu_item::name"),Name);
     75  n=strcpy((char *)malloc(strlen(Name)+1),Name);
    7676  sub=Sub;
    7777}
     
    400400
    401401pmenu_item::~pmenu_item()
    402 { if (n) jfree(n); if (sub) delete sub;
     402{ if (n) free(n); if (sub) delete sub;
    403403}
    404404
  • abuse/trunk/src/imlib/pmenu.hpp

    r124 r129  
    1111#define __PMENU_HPP_
    1212
    13 #include "jmalloc.hpp"
    1413#include "input.hpp"
    1514
  • abuse/trunk/src/imlib/readwav.cpp

    r124 r129  
    159159
    160160  data_size=tag.size;
    161   data=(unsigned char *)jmalloc(tag.size,"WAV data");
     161  data=(unsigned char *)malloc(tag.size);
    162162  ERROR(data,"Malloc error");
    163163
  • abuse/trunk/src/imlib/scroller.cpp

    r124 r129  
    394394  wid=0;
    395395  key_hist_total=0;
    396   lis=(pick_list_item *)jmalloc(sizeof(pick_list_item)*num_entries,"pick list");
     396  lis=(pick_list_item *)malloc(sizeof(pick_list_item)*num_entries);
    397397  int i=0;
    398398  for (;i<num_entries;i++)
     
    557557{
    558558  if (select)
    559     jfree(select);
     559    free(select);
    560560  select=NULL;
    561561
     
    566566  if (m)
    567567  {
    568     select=(uint8_t *)jmalloc((t+7)/8,"selection bit array");
     568    select=(uint8_t *)malloc((t+7)/8);
    569569    memset(select,0,(t+7)/8);
    570570  } else cur_sel=0;
  • abuse/trunk/src/imlib/scroller.hpp

    r124 r129  
    8686  virtual void set_x(int x, image *screen);
    8787  void reconfigure();   // should be called by constructor after class is ready to take virtual calls
    88   ~spicker() { if (select) jfree(select); }
     88  ~spicker() { if (select) free(select); }
    8989} ;
    9090
     
    111111  virtual void handle_down(image *screen, InputManager *inm);
    112112  int get_selection() { return lis[cur_sel].number; }
    113   ~pick_list() { jfree(lis); }
     113  ~pick_list() { free(lis); }
    114114} ;
    115115
  • abuse/trunk/src/imlib/specs.cpp

    r124 r129  
    2525#include "specs.hpp"
    2626#include "system.h"
    27 #include "jmalloc.hpp"
    2827#include "dprint.hpp"
    2928
     
    7574    if( spec_prefix )
    7675    {
    77         jfree( spec_prefix );
     76        free( spec_prefix );
    7877    }
    7978   
    8079    if( prefix )
    8180    {
    82         spec_prefix = strcpy( (char *)jmalloc( strlen( prefix ) + 2, "prefix_name" ), prefix );
     81        spec_prefix = strcpy( (char *)malloc( strlen( prefix ) + 2 ), prefix );
    8382        int len = strlen( prefix );
    8483        if( prefix[len - 1] != '\\' && prefix[len - 1] != '/')
     
    104103    if( save_spec_prefix )
    105104    {
    106         jfree( save_spec_prefix );
     105        free( save_spec_prefix );
    107106    }
    108107
     
    110109    {
    111110        int len = strlen( save_prefix );
    112         save_spec_prefix = (char *)jmalloc( len + 1, "prefix_name" );
     111        save_spec_prefix = (char *)malloc( len + 1 );
    113112        strcpy( save_spec_prefix, save_prefix );
    114113/* AK - Commented this out as it may cause problems
     
    143142{
    144143  rbuf_size=8192;
    145   rbuf=(unsigned char *)jmalloc(rbuf_size,"File read buffer");
     144  rbuf=(unsigned char *)malloc(rbuf_size);
    146145  rbuf_start=rbuf_end=0;
    147146
    148147  wbuf_size=8192;
    149   wbuf=(unsigned char *)jmalloc(wbuf_size,"File write buffer");
     148  wbuf=(unsigned char *)malloc(wbuf_size);
    150149  wbuf_end=0;
    151150}
     
    153152bFILE::~bFILE()
    154153{
    155   if (rbuf) jfree(rbuf);
     154  if (rbuf) free(rbuf);
    156155  flush_writes();
    157   if (wbuf) jfree(wbuf);
     156  if (wbuf) free(wbuf);
    158157}
    159158
     
    268267  rbuf_start=rbuf_end=0;
    269268  if (rbuf)
    270     jfree(rbuf);
     269    free(rbuf);
    271270  rbuf_size=size;
    272   rbuf=(unsigned char *)jmalloc(rbuf_size,"File buffer");
     271  rbuf=(unsigned char *)malloc(rbuf_size);
    273272}
    274273
     
    645644  if (total)
    646645  {
    647     jfree(data);
    648     jfree(entries);
     646    free(data);
     647    free(entries);
    649648  }
    650649}
     
    754753  {
    755754    total=fp->read_uint16();
    756     entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries");
     755    entries=(spec_entry **)malloc(sizeof(spec_entry *)*total);
    757756    long start=fp->tell();
    758757
     
    768767      size+=entry_size;
    769768    }
    770     data=jmalloc(size,"spec_directory::data");
     769    data=malloc(size);
    771770    char *dp=(char *)data;
    772771    fp->seek(start,SEEK_SET);
     
    972971    for (;i<total;i++)                               // compact the pointer array
    973972      entries[i]=entries[i+1];
    974     entries=(spec_entry **)jrealloc(entries,sizeof(spec_entry *)*total,"spec_directory::entries");
     973    entries=(spec_entry **)realloc(entries,sizeof(spec_entry *)*total);
    975974  }
    976975  else
     
    983982{
    984983  total++;
    985   entries=(spec_entry **)jrealloc(entries,sizeof(spec_entry *)*total,"spec_directory::entries");
     984  entries=(spec_entry **)realloc(entries,sizeof(spec_entry *)*total);
    986985  entries[total-1]=e;
    987986}
     
    994993
    995994  if (total)
    996     jfree(entries);
     995    free(entries);
    997996}
    998997
  • abuse/trunk/src/imlib/specs.hpp

    r124 r129  
    1010#ifndef __SPECS_HPP_
    1111#define __SPECS_HPP_
    12 #include "linked.hpp"
    1312#include <stdio.h>
    14 #include "jmalloc.hpp"
    15 #include "system.h"
    1613#include <fcntl.h>
    1714#include <stdlib.h>
    1815#include <stdint.h>
     16
     17#include "linked.hpp"
     18#include "system.h"
    1919
    2020extern char const *spec_types[];
     
    157157             unsigned long data_offset)
    158158  { type=spec_type;
    159     name=strcpy((char *)jmalloc(strlen(object_name)+1,"spec_entry::name"),object_name);
     159    name=strcpy((char *)malloc(strlen(object_name) + 1),object_name);
    160160    size=data_size; offset=data_offset;
    161161  }
    162162  void print();
    163   ~spec_entry() { if (name) jfree(name); }
     163  ~spec_entry() { if (name) free(name); }
    164164} ;
    165165
  • abuse/trunk/src/imlib/status.cpp

    r124 r129  
    2424  int last_update;
    2525  text_status_node(char const *Name, visual_object *Show, text_status_node *Next)
    26   { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
     26  { name=strcpy((char *)malloc(strlen(Name)+1),Name);
    2727    show=Show;
    2828    next=Next;
    2929    last_update=0;
    3030  }
    31   ~text_status_node() { jfree(name); if (show) delete show; }
     31  ~text_status_node() { free(name); if (show) delete show; }
    3232} ;
    3333
  • abuse/trunk/src/imlib/supmorph.cpp

    r124 r129  
    9595
    9696  t=start;
    97   movers=(unsigned char *)jmalloc(t*4,"morph movers");
     97  movers=(unsigned char *)malloc(t*4);
    9898
    9999
     
    204204  unsigned char *d=m->movers,*paddr=(unsigned char *)pal->addr(),*pa;
    205205  stepper *p;
    206   p=steps=(stepper *)jmalloc(sizeof(stepper)*m->t,"smorph steps");
     206  p=steps=(stepper *)malloc(sizeof(stepper)*m->t);
    207207  f_left=frames;
    208208  frames--;
     
    247247  }
    248248
    249   hole=(unsigned char *)jmalloc(w*h,"hole image");
     249  hole=(unsigned char *)malloc(w*h);
    250250}
    251251
  • abuse/trunk/src/imlib/supmorph.hpp

    r124 r129  
    1010#ifndef __SUPER_MORPH_HPP__
    1111#define __SUPER_MORPH_HPP__
    12 #include "jmalloc.hpp"
     12
    1313#include "timage.hpp"
    1414
     
    2020  int w,h;
    2121  super_morph(trans_image *h1, trans_image *h2, int aneal_steps, void (*stat_fun)(int));
    22   ~super_morph() { if (t) jfree(movers); }
     22  ~super_morph() { if (t) free(movers); }
    2323} ;
    2424
     
    3737  smorph_player(super_morph *m, palette *pal, image *i1, image *i2, int frames, int dir);
    3838  int show(image *screen, int x, int y, color_filter *fil, palette *pal, int blur_threshold);
    39   ~smorph_player() { jfree(hole); jfree(steps);  }
     39  ~smorph_player() { free(hole); free(steps);  }
    4040} ;
    4141
  • abuse/trunk/src/imlib/timage.cpp

    r115 r129  
    100100  char st[80];
    101101  sprintf(st,"trans_image::data (%s)",name);
    102   data=(uint8_t *)jmalloc(size,st);
     102  data=(uint8_t *)malloc(size);
    103103#else
    104   data=(uint8_t *)jmalloc(size,"");
     104  data=(uint8_t *)malloc(size);
    105105#endif
    106106  int ww=im->width(),hh=im->height();
  • abuse/trunk/src/imlib/timage.hpp

    r124 r129  
    1515#include "palette.hpp"
    1616#include "filter.hpp"
    17 #include "jmalloc.hpp"
    1817
    1918/* data is stored in the following format
     
    6160  int size();
    6261  image *make_image();
    63   ~trans_image() { jfree(data); }
     62  ~trans_image() { free(data); }
    6463} ;
    6564
  • abuse/trunk/src/imlib/unpackgl.cpp

    r124 r129  
    1414
    1515#include "system.h"
    16 #include "jmalloc.hpp"
    1716#include "macs.hpp"
    1817
     
    5958      bufsize=0xf000;
    6059      do {
    61     buf=(char *)jmalloc(bufsize,"unpack_gl::buffer");
     60    buf=(char *)malloc(bufsize);
    6261    if (!buf) bufsize-=100;
    6362      } while (!buf);
     
    7271    length-=amread;
    7372      }
    74       jfree(buf);
     73      free(buf);
    7574      if (ot) fclose(ot);
    7675    }
  • abuse/trunk/src/imlib/visobj.cpp

    r124 r129  
    2525string_visual::string_visual(char *string, int Color)
    2626{
    27   st=strcpy((char *)jmalloc(strlen(string)+1,"string visual"),string);
     27  st=strcpy((char *)malloc(strlen(string)+1),string);
    2828  color=Color;
    2929  w=-1;
  • abuse/trunk/src/imlib/xwdread.cpp

    r124 r129  
    522522  bytes=(im->width()+3)/4;
    523523  bytes*=4;
    524   scrap=(char *)jmalloc(bytes,"xwd_read scrap");
     524  scrap=(char *)malloc(bytes);
    525525  for (i=im->height();i;i--)
    526526  {
     
    528528    memcpy(im->scan_line(i-1),scrap,im->width());
    529529  }
    530   jfree(scrap);
     530  free(scrap);
    531531  fclose(fp);
    532532  return im;
  • abuse/trunk/src/innet.cpp

    r126 r129  
    159159    fman=new file_manager(argc,argv,prot);                                       // manages remote file access
    160160    game_face=new game_handler;
    161     join_array=(join_struct *)jmalloc(sizeof(join_struct)*MAX_JOINERS,"join array");
     161    join_array=(join_struct *)malloc(sizeof(join_struct)*MAX_JOINERS);
    162162    base->join_list=NULL;
    163163    base->mem_lock=0;
     
    184184{
    185185  if (game_face) delete game_face;  game_face=NULL;
    186   if (join_array) jfree(join_array);  join_array=NULL;
     186  if (join_array) free(join_array);  join_array=NULL;
    187187  if (game_sock) { delete game_sock; game_sock=NULL; }
    188188  if (comm_sock) { delete comm_sock; comm_sock=NULL; }
  • abuse/trunk/src/items.cpp

    r124 r129  
    2929    }
    3030
    31     inside=(uint8_t *)jmalloc(tot,"Boundary point list");
     31    inside=(uint8_t *)malloc(tot);
    3232  }
    3333
     
    115115  if (tot)
    116116  {
    117     inside=(uint8_t *)jmalloc(tot,"Boundary point list");
     117    inside=(uint8_t *)malloc(tot);
    118118  } else inside=NULL;
    119119  for (i=0,point_on=data;i<tot-1;i++)
  • abuse/trunk/src/items.hpp

    r124 r129  
    2626  uint8_t *inside;     // tells which side of the line is on the inside
    2727  boundary(boundary *p);      // flips the *inside list
    28   ~boundary() { if (tot) jfree(inside); }
     28  ~boundary() { if (tot) free(inside); }
    2929} ;
    3030
  • abuse/trunk/src/level.cpp

    r124 r129  
    7676void level::load_fail()
    7777{
    78   if (map_fg)    jfree(map_fg);   map_fg=NULL;
    79   if (map_bg)    jfree(map_bg);   map_bg=NULL;
    80   if (Name)      jfree(Name);     Name=NULL;
     78  if (map_fg)    free(map_fg);   map_fg=NULL;
     79  if (map_bg)    free(map_bg);   map_bg=NULL;
     80  if (Name)      free(Name);     Name=NULL;
    8181
    8282  first_active=NULL;
     
    111111{
    112112  load_fail();
    113   if (attack_list) jfree(attack_list);
    114   if (target_list) jfree(target_list);
    115   if (block_list) jfree(block_list);
    116   if (all_block_list) jfree(all_block_list);
    117   if (first_name) jfree(first_name);
     113  if (attack_list) free(attack_list);
     114  if (target_list) free(target_list);
     115  if (block_list) free(block_list);
     116  if (all_block_list) free(all_block_list);
     117  if (first_name) free(first_name);
    118118}
    119119
     
    835835
    836836  uint16_t *new_fg,*new_bg;
    837   new_fg=(uint16_t *)jmalloc(w*h*sizeof(int16_t),"Map fg : resized");
     837  new_fg=(uint16_t *)malloc(w*h*sizeof(int16_t));
    838838  memset(new_fg,0,w*h*sizeof(int16_t));
    839839
     
    843843  calc_bgsize(w,h,nbw,nbh);
    844844
    845   new_bg=(uint16_t *)jmalloc((int)nbw*(int)nbh*sizeof(int16_t),"map bg : resized");
     845  new_bg=(uint16_t *)malloc((int)nbw*(int)nbh*sizeof(int16_t));
    846846  memset(new_bg,0,(int)nbw*(int)nbh*sizeof(int16_t));
    847847
     
    857857      new_bg[x+y*nbw]=get_bg(x,y);
    858858
    859   jfree(map_fg);
    860   jfree(map_bg);
     859  free(map_fg);
     860  free(map_bg);
    861861  map_fg=new_fg;
    862862  map_bg=new_bg;
     
    898898    /******************************* Read debug info ******************************/
    899899    int16_t old_tot=fp->read_uint16();
    900     uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");
     900    uint16_t *o_remap=(uint16_t *)malloc(old_tot * 2);
    901901    char old_name[150];
    902902    for (i=0;i<old_tot;i++)
     
    913913    /***************************** Read state names *********************************/
    914914    int old_stot=fp->read_uint16();
    915     unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array");
     915    unsigned char *s_remap=(unsigned char *)malloc(old_stot);
    916916    for (i=0;i<old_stot;i++)
    917917    {
     
    10051005    }
    10061006
    1007 
    1008 
    1009     jfree(o_remap);
    1010     jfree(s_remap);
     1007    free(o_remap);
     1008    free(s_remap);
    10111009  }
    10121010
     
    10341032      return ;
    10351033
    1036     uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");
    1037     uint16_t *o_backmap=(uint16_t *)jmalloc(total_objects*2,"obj remap array");
     1034    uint16_t *o_remap=(uint16_t *)malloc(old_tot * 2);
     1035    uint16_t *o_backmap=(uint16_t *)malloc(total_objects * 2);
    10381036    memset(o_backmap,0xff,total_objects*2);
    10391037    char old_name[150];
     
    10521050
    10531051    se=sd->find("describe_states");
    1054     if (!se) { jfree(o_remap); jfree(o_backmap); return ; }
    1055     int16_t **s_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big state remap array");
    1056     int16_t *s_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big state rmp totals");
     1052    if (!se) { free(o_remap); free(o_backmap); return ; }
     1053    int16_t **s_remap=(int16_t **)malloc(old_tot*sizeof(int16_t *));
     1054    int16_t *s_remap_totals=(int16_t *)malloc(old_tot*sizeof(int16_t));
    10571055    fp->seek(se->offset,0);
    10581056    int i=0;
     
    10631061      if (t)
    10641062      {
    1065         s_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"state remap");
     1063        s_remap[i]=(int16_t *)malloc(t*sizeof(int16_t));
    10661064    int j=0;
    10671065    for (;j<t;j++)
     
    10941092    if (se)
    10951093    {
    1096       v_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big var remap array");
    1097       v_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big var rmp totals");
     1094      v_remap=(int16_t **)malloc(old_tot*sizeof(int16_t *));
     1095      v_remap_totals=(int16_t *)malloc(old_tot*sizeof(int16_t));
    10981096
    10991097      fp->seek(se->offset,0);
     
    11051103    if (t)
    11061104    {
    1107       v_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"var remap");
     1105      v_remap[i]=(int16_t *)malloc(t*sizeof(int16_t));
    11081106      memset(v_remap[i],0xff,t*sizeof(int16_t));
    11091107    } else { v_remap[i]=NULL; }
     
    12561254    {
    12571255      if (s_remap_totals[k])
    1258         jfree(s_remap[k]);
     1256        free(s_remap[k]);
    12591257    }
    12601258
     
    12631261    {
    12641262      if (v_remap_totals[l])
    1265         jfree(v_remap[l]);
    1266     }
    1267     jfree(v_remap_totals);
    1268     jfree(s_remap_totals);
    1269     jfree(o_remap);
    1270     jfree(o_backmap);
    1271     jfree(s_remap);
    1272     jfree(v_remap);
     1263        free(v_remap[l]);
     1264    }
     1265    free(v_remap_totals);
     1266    free(s_remap_totals);
     1267    free(o_remap);
     1268    free(o_backmap);
     1269    free(s_remap);
     1270    free(v_remap);
    12731271  }
    12741272
     
    12981296  sprintf(cmd,symbol_str("loading"),lev_name);
    12991297  stack_stat stat(cmd);
    1300   Name=strcpy((char *)jmalloc(strlen(lev_name)+1,"lev name"),lev_name);
     1298  Name=strcpy((char *)malloc(strlen(lev_name)+1),lev_name);
    13011299
    13021300  e=sd->find("first name");
     
    13051303    fp->seek(e->offset,0);
    13061304    int len=fp->read_uint8();   // read the length of the string
    1307     first_name=(char *)jmalloc(len,"level first name");
     1305    first_name=(char *)malloc(len);
    13081306    fp->read(first_name,len);    // read the string
    13091307  } else
    13101308  {
    1311     first_name=(char *)jmalloc(strlen(Name)+1,"level first name");
     1309    first_name=(char *)malloc(strlen(Name)+1);
    13121310    strcpy(first_name,Name);
    13131311  }
     
    13211319    fg_width=fp->read_uint32();
    13221320    fg_height=fp->read_uint32();
    1323     map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
     1321    map_fg=(uint16_t *)malloc(2*fg_width*fg_height);
    13241322    fp->read((char *)map_fg,2*fg_width*fg_height);
    13251323    int t=fg_width*fg_height;
     
    13391337    bg_width=fp->read_uint32();
    13401338    bg_height=fp->read_uint32();
    1341     map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
     1339    map_bg=(uint16_t *)malloc(2*bg_width*bg_height);
    13421340    fp->read((char *)map_bg,2*bg_width*bg_height);
    13431341    int t=bg_width*bg_height;
     
    13541352    fg_width=bg_width;
    13551353    fg_height=bg_height;
    1356     map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
     1354    map_fg=(uint16_t *)malloc(2*fg_width*fg_height);
    13571355    memset(map_fg,0,2*fg_width*fg_height);
    13581356  }
     
    13621360    bg_width=fg_width/8+8;
    13631361    bg_height=fg_height/8+8;
    1364     map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
     1362    map_bg=(uint16_t *)malloc(2*bg_width*bg_height);
    13651363    memset(map_bg,0,2*bg_width*bg_height);
    13661364  }
     
    22172215            else
    22182216            {
     2217                uint8_t buf[0x1000];
    22192218                int32_t size = fp->file_size();
    2220                 uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf");
    22212219                int tr = 1;
    22222220                while( size && tr )
     
    22272225                    size -= tr;
    22282226                }
    2229                 jfree(buf);
    22302227            }
    22312228            delete bk;
     
    22412238    {
    22422239        if( first_name )
    2243             jfree(first_name);
    2244         first_name = (char *)jmalloc( strlen( name ) + 1, "level first name" );
     2240            free(first_name);
     2241        first_name = (char *)malloc( strlen( name ) + 1 );
    22452242        strcpy( first_name, name );
    22462243    }
     
    23812378  calc_bgsize(fg_width,fg_height,bg_width,bg_height);
    23822379
    2383   map_bg=(uint16_t *)jmalloc(sizeof(int16_t)*bg_width*bg_height,"map bg");
    2384   map_fg=(uint16_t *)jmalloc(sizeof(int16_t)*fg_width*fg_height,"map fg");
     2380  map_bg=(uint16_t *)malloc(sizeof(int16_t)*bg_width*bg_height);
     2381  map_fg=(uint16_t *)malloc(sizeof(int16_t)*fg_width*fg_height);
    23852382
    23862383
     
    31173114  {
    31183115    attack_list_size++;
    3119     attack_list=(game_object **)jrealloc(attack_list,sizeof(game_object *)*attack_list_size,
    3120                               "attack_list");
     3116    attack_list=(game_object **)realloc(attack_list,sizeof(game_object *)*attack_list_size);
    31213117  }
    31223118  attack_list[attack_total]=who;
     
    31313127  {
    31323128    target_list_size++;
    3133     target_list=(game_object **)jrealloc(target_list,sizeof(game_object *)*target_list_size,
    3134                               "target_list");
     3129    target_list=(game_object **)realloc(target_list,sizeof(game_object *)*target_list_size);
    31353130  }
    31363131  target_list[target_total]=who;
     
    31453140  {
    31463141    block_list_size++;
    3147     block_list=(game_object **)jrealloc(block_list,sizeof(game_object *)*block_list_size,
    3148                               "block_list");
     3142    block_list=(game_object **)realloc(block_list,sizeof(game_object *)*block_list_size);
    31493143  }
    31503144  block_list[block_total]=who;
     
    31583152  {
    31593153    all_block_list_size++;
    3160     all_block_list=(game_object **)jrealloc(all_block_list,sizeof(game_object *)*all_block_list_size,
    3161                               "all_block_list");
     3154    all_block_list=(game_object **)realloc(all_block_list,sizeof(game_object *)*all_block_list_size);
    31623155  }
    31633156  all_block_list[all_block_total]=who;
  • abuse/trunk/src/level.hpp

    r124 r129  
    9898  level(int width, int height, char const *name);
    9999  int save(char const *filename, int save_all);  // save_all includes player and view information (1 = success)
    100   void set_name(char const *name) { Name=strcpy((char *)jrealloc(Name,strlen(name)+1,"map name"),name); }
     100  void set_name(char const *name) { Name=strcpy((char *)realloc(Name,strlen(name)+1),name); }
    101101  void set_size(int w, int h);
    102102  void remove_light(light_source *which);
  • 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
  • abuse/trunk/src/light.hpp

    r124 r129  
    5656  void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who);
    5757  light_patch *copy(light_patch *Next);
    58   ~light_patch() { if (total) jfree(lights); }
     58  ~light_patch() { if (total) free(lights); }
    5959} ;
    6060
  • abuse/trunk/src/lisp/lisp.cpp

    r125 r129  
    2525#else
    2626#include "status.hpp"
    27 #include "jmalloc.hpp"
    2827#include "macs.hpp"
    2928#include "specs.hpp"
     
    862861     current_space=PERM_SPACE;       // make sure all symbols get defined in permanant space
    863862
    864   p=(lisp_symbol *)jmalloc(sizeof(lisp_symbol),"lsymbol");
     863  p=(lisp_symbol *)malloc(sizeof(lisp_symbol));
    865864  p->type=L_SYMBOL;
    866865  p->name=new_lisp_string(name);
     
    889888    ldelete_syms(root->left);
    890889    ldelete_syms(root->right);
    891     jfree(root);
     890    free(root);
    892891  }
    893892}
     
    16461645  if (!num_args) return 0;
    16471646
    1648   void **arg_on=(void **)jmalloc(sizeof(void *)*num_args,"mapcar tmp array");
     1647  void **arg_on=(void **)malloc(sizeof(void *)*num_args);
    16491648  cons_cell *list_on=(cons_cell *)CDR(arg_list);
    16501649  long old_ptr_son=l_ptr_stack.son;
     
    16611660  if (stop)
    16621661  {
    1663     jfree(arg_on);
     1662    free(arg_on);
    16641663    return NULL;
    16651664  }
     
    17041703  l_ptr_stack.son=old_ptr_son;
    17051704
    1706   jfree(arg_on);
     1705  free(arg_on);
    17071706  return return_list;
    17081707}
     
    17221721    else
    17231722    {
    1724       void **str_eval=(void **)jmalloc(elements*sizeof(void *),"tmp eval array");
     1723      void **str_eval=(void **)malloc(elements*sizeof(void *));
    17251724      int i,old_ptr_stack_start=l_ptr_stack.son;
    17261725
     
    17841783    }
    17851784      }
    1786       jfree(str_eval);
     1785      free(str_eval);
    17871786      l_ptr_stack.son=old_ptr_stack_start;   // restore pointer GC stack
    17881787      *s=0;
     
    24092408                {
    24102409                    char *gammapath;
    2411                     gammapath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9 + 1, "gammapath" );
     2410                    gammapath = (char *)malloc( strlen( get_save_filename_prefix() ) + 9 + 1 );
    24122411                    sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() );
    24132412                    fp = new jFILE( gammapath, "rb" );
    2414                     jfree( gammapath );
     2413                    free( gammapath );
    24152414                }
    24162415                else
     
    24342433            {
    24352434                long l=fp->file_size();
    2436                 char *s=(char *)jmalloc(l+1,"loaded script");
     2435                char *s=(char *)malloc(l + 1);
    24372436                if (!s)
    24382437                {
     
    24682467                if (stat_man) stat_man->pop();
    24692468            #endif
    2470                 jfree(s);
     2469                free(s);
    24712470                ret=fn;
    24722471      }
     
    32003199  } else if (free_space[TMP_SPACE]==space[TMP_SPACE])
    32013200  {
    3202     free_space[TMP_SPACE]=space[TMP_SPACE]=(char *)jrealloc(space[TMP_SPACE],new_size,"lisp tmp space");
     3201    free_space[TMP_SPACE]=space[TMP_SPACE]=(char *)realloc(space[TMP_SPACE],new_size);
    32033202    space_size[TMP_SPACE]=new_size;
    32043203    dprintf("Lisp : tmp space resized to %d\n",new_size);
     
    32123211  lsym_root=NULL;
    32133212  total_user_functions=0;
    3214   free_space[0]=space[0]=(char *)jmalloc(perm_size,"lisp perm space");
     3213  free_space[0]=space[0]=(char *)malloc(perm_size);
    32153214  space_size[0]=perm_size;
    32163215
    32173216
    3218   free_space[1]=space[1]=(char *)jmalloc(tmp_size,"lisp tmp space");
     3217  free_space[1]=space[1]=(char *)malloc(tmp_size);
    32193218  space_size[1]=tmp_size;
    32203219
     
    32343233void lisp_uninit()
    32353234{
    3236   jfree(space[0]);
    3237   jfree(space[1]);
     3235  free(space[0]);
     3236  free(space[1]);
    32383237  ldelete_syms(lsym_root);
    32393238  lsym_root=NULL;
  • abuse/trunk/src/lisp/lisp_gc.cpp

    r124 r129  
    1717#include "fakelib.hpp"
    1818#else
    19 #include "jmalloc.hpp"
    2019#include "macs.hpp"
    2120#endif
     
    4645  {
    4746    reg_ptr_list_size+=0x100;
    48     reg_ptr_list=(void ***)jrealloc(reg_ptr_list,sizeof(void **)*reg_ptr_list_size,"registered ptr list");
     47    reg_ptr_list=(void ***)realloc(reg_ptr_list,sizeof(void **)*reg_ptr_list_size);
    4948  }
    5049  reg_ptr_list[reg_ptr_total++]=addr;
     
    257256
    258257  space_size[GC_SPACE]=space_size[which_space];
    259   void *new_space=jmalloc(space_size[GC_SPACE],"collect lisp space");
     258  void *new_space=malloc(space_size[GC_SPACE]);
    260259  current_space=GC_SPACE;
    261260  free_space[GC_SPACE]=space[GC_SPACE]=(char *)new_space;
     
    268267
    269268  memset(space[which_space],0,space_size[which_space]);  // for debuging clear it out
    270   jfree(space[which_space]);
     269  free(space[which_space]);
    271270
    272271  space[which_space]=(char *)new_space;
  • abuse/trunk/src/lisp/stack.hpp

    r124 r129  
    1212
    1313#include <stdio.h>
    14 
    15 #ifndef NO_LIBS
    16 #   include "jmalloc.hpp"
    17 #else
    18 #   include "fakelib.hpp"
    19 #endif
     14#include <stdlib.h>
    2015
    2116// A fixed-size stack class
     
    3429        smax = max_size;
    3530        son = 0;
    36         sdata = (T **)jmalloc(sizeof(T *) * smax, "pointer stack");
     31        sdata = (T **)malloc(sizeof(T *) * smax);
    3732    }
    3833
     
    6358        if(son != 0)
    6459            fprintf(stderr, "warning: cleaning up stack and not empty\n");
    65         jfree(sdata);
     60        free(sdata);
    6661        sdata = NULL;
    6762        son = 0;
  • abuse/trunk/src/loader2.cpp

    r124 r129  
    141141      int fon=nforetiles,bon=nbacktiles;
    142142      if (ft)
    143         foretiles=(int *)jrealloc(foretiles,sizeof(int)*(nforetiles+ft),"foretile id array ptrs");
     143        foretiles=(int *)realloc(foretiles,sizeof(int)*(nforetiles+ft));
    144144      if (bt)
    145         backtiles=(int *)jrealloc(backtiles,sizeof(int)*(nbacktiles+bt),"foretile id array ptrs");
     145        backtiles=(int *)realloc(backtiles,sizeof(int)*(nbacktiles+bt));
    146146
    147147      for (i=0;i<sd.total;i++)
     
    218218  if (nbacktiles>old_bsize)
    219219  {
    220     backtiles=(int *)jrealloc(backtiles,sizeof(int)*nbacktiles,"backtile id array ptrs");
     220    backtiles=(int *)realloc(backtiles,sizeof(int)*nbacktiles);
    221221    memset(backtiles+old_bsize,-1,(nbacktiles-old_bsize)*sizeof(int));
    222222  }
     
    224224  if (nforetiles>old_fsize)
    225225  {
    226     foretiles=(int *)jrealloc(foretiles,sizeof(int)*nforetiles,"foretile id array ptrs");
     226    foretiles=(int *)realloc(foretiles,sizeof(int)*nforetiles);
    227227    memset(foretiles+old_fsize,-1,(nforetiles-old_fsize)*sizeof(int));
    228228  }
     
    296296
    297297    char *cachepath;
    298     cachepath = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 12 + 1, "cachepath" );
     298    cachepath = (char *)malloc( strlen( get_save_filename_prefix() ) + 12 + 1 );
    299299    sprintf( cachepath, "%ssd_cache.tmp", get_save_filename_prefix() );
    300300
     
    401401    if (total_help_screens)
    402402    {
    403       help_screens=(int *)jmalloc(sizeof(int)*total_help_screens,"help image ids");
     403      help_screens=(int *)malloc(sizeof(int)*total_help_screens);
    404404      v=CDR(symbol_value(l_help_screens));
    405405      int i=0;
     
    472472    past_startup = 1;
    473473#if 0
    474     jfree( cachepath );
     474    free( cachepath );
    475475#endif
    476476}
     
    494494
    495495  long l=fp->file_size();
    496   s=(char *)jmalloc(l+1,"loaded script");
     496  s=(char *)malloc(l+1);
    497497  ERROR(s,"Malloc error in load_script");
    498498
  • abuse/trunk/src/ltree.cpp

    r124 r129  
    4545  }
    4646
    47   p=jmalloc(sizeof(lisp_symbol),"lsymbol");
     47  p=malloc(sizeof(lisp_symbol));
    4848  p->type=L_SYMBOL;
    4949  p->name=new_lisp_string(name);
  • abuse/trunk/src/newlight.cpp

    r124 r129  
    185185void calc_light_table(palette *pal)
    186186{
    187   white_light=(unsigned char *)jmalloc(256*64,"light table");
    188   green_light=(unsigned char *)jmalloc(256*64,"green light");
     187  white_light=(unsigned char *)malloc(256*64);
     188  green_light=(unsigned char *)malloc(256*64);
    189189  for (int i=0;i<TTINTS;i++)
    190       tints[i]=(uchar *)jmalloc(256,"color tint");
     190      tints[i]=(uchar *)malloc(256);
    191191
    192192  jFILE fp("light.tbl","rb");
     
    300300  if (total)
    301301  {
    302     p->lights=(light_source **)jmalloc(total*sizeof(light_source *),"light patches");
     302    p->lights=(light_source **)malloc(total*sizeof(light_source *));
    303303    memcpy(p->lights,lights,total*(sizeof(light_source *)));
    304304  }
     
    348348      p->x1=x1; p->y1=y1; p->x2=x2; p->y2=y2;
    349349      p->total++;
    350       p->lights=(light_source **)jrealloc(p->lights,sizeof(light_source *)*p->total,"patch_list");
     350      p->lights=(light_source **)realloc(p->lights,sizeof(light_source *)*p->total);
    351351      p->lights[p->total-1]=who;
    352352      return ;
     
    366366      if (p->total==MAX_LP)  return ;
    367367      p->total++;
    368       p->lights=(light_source **)jrealloc(p->lights,sizeof(light_source *)*p->total,"patch_list");
     368      p->lights=(light_source **)realloc(p->lights,sizeof(light_source *)*p->total);
    369369      p->lights[p->total-1]=who;
    370370      return ;
  • abuse/trunk/src/objects.cpp

    r126 r129  
    341341game_object::~game_object()
    342342{
    343   if (lvars) jfree(lvars);
     343  if (lvars) free(lvars);
    344344  clean_up();
    345345}
     
    15631563    if (t)
    15641564    {
    1565       lvars=(int32_t *)jmalloc(t*4,"object vars");
     1565      lvars=(int32_t *)malloc(t * 4);
    15661566      memset(lvars,0,t*4);
    15671567    }
     
    16201620void game_object::change_type(int new_type)
    16211621{
    1622   if (lvars) jfree(lvars);     // free old variable
     1622  if (lvars) free(lvars);     // free old variable
    16231623
    16241624  if (otype<0xffff)
     
    16271627    if (t)
    16281628    {
    1629       lvars=(int32_t *)jmalloc(t*4,"object vars");
     1629      lvars=(int32_t *)malloc(t*4);
    16301630      memset(lvars,0,t*4);
    16311631    }
  • abuse/trunk/src/old.nfclient.cpp

    r124 r129  
    145145  {
    146146    int ret=new_read(buf,count);
    147     void *comp=jmalloc(count,"compare");
     147    void *comp=malloc(count);
    148148/*    ::read(check_fd,comp,count);
    149149    if (memcmp(comp,buf,count))
     
    151151      printf("bad read!\n");
    152152    }
    153     jfree(comp);*/
     153    free(comp);*/
    154154    return ret;
    155155  }
  • abuse/trunk/src/old.nfserver.cpp

    r124 r129  
    4949     delete file_list[i];
    5050  if (file_list)
    51     jfree(file_list);
     51    free(file_list);
    5252}
    5353
     
    6464  // we need to enlarge the file_list
    6565  file_list_size++;
    66   file_list=(bFILE **)jrealloc(file_list,sizeof(bFILE *)*file_list_size,"client file list");
     66  file_list=(bFILE **)realloc(file_list,sizeof(bFILE *)*file_list_size);
    6767  file_list[file_list_size-1]=fp;
    6868  return file_list_size-1;
  • abuse/trunk/src/old_server.cpp

    r124 r129  
    623623  { fputs(re,stderr); exit(0); }
    624624  rand_on=lstl(rand_on);
    625   uint16_t *rtab=(uint16_t *)jmalloc(1024*2,"tmp rtab");
     625  uint16_t rtab[1024];
    626626  if (!pk.read((uint8_t *)rtab,1024*2)) { fputs(re,stderr); exit(0); }  // read the rand table
    627627
     
    629629    if (((uint8_t *)rtab)[j]!=((uint8_t *)rtable)[j])
    630630    { printf("rtables differ on byte %d\n",j); exit(0); }
    631 
    632   jfree(rtab);
    633 
    634 
    635631
    636632  if (last)
  • abuse/trunk/src/oldhelp.cpp

    r124 r129  
    2323  FILE *fp=fopen("help.txt","r");
    2424  if (!fp)
    25     return strcpy((char *)jmalloc(40,"Help missing error string"),"help.txt missing");
     25    return strcpy((char *)malloc(40),"help.txt missing");
    2626  else
    2727  {
     
    3535      {   
    3636    fclose(fp);   
    37     return strcpy((char *)jmalloc(30,"help : page missing string"),"missing page");
     37    return strcpy((char *)malloc(30),"missing page");
    3838      }
    3939
     
    4545      {   
    4646    fclose(fp);   
    47         return strcpy((char *)jmalloc(strlen(tmp)+1,"help page"),tmp);
     47        return strcpy((char *)malloc(strlen(tmp)+1),tmp);
    4848      }
    4949      else strcat(tmp,line);
     
    124124        wm->font()->put_string(s,0,yres-10,"Missing image!");
    125125        delete fp;
    126         jfree(ho);   
     126        free(ho);   
    127127        return ;   
    128128      }
     
    169169    if (*h) h++;
    170170  }
    171   jfree(ho);
     171  free(ho);
    172172  delete fp;
    173173}
  • abuse/trunk/src/particle.cpp

    r123 r129  
    2727    delete pseqs[i];
    2828  if (total_pseqs)
    29     jfree(pseqs);
     29    free(pseqs);
    3030}
    3131
    3232part_frame::~part_frame()
    3333{
    34   jfree(data);
     34  free(data);
    3535}
    3636
     
    7272  set_symbol_number(sym,total_pseqs);   // set the symbol value to the object number
    7373  current_space=sp;
    74   pseqs=(part_sequence **)jrealloc(pseqs,sizeof(part_sequence *)*(total_pseqs+1),"particle seq array");
     74  pseqs=(part_sequence **)realloc(pseqs,sizeof(part_sequence *)*(total_pseqs+1));
    7575
    7676  args=lcdr(args);
     
    105105  for (;i<sd.total;i++)
    106106    if (sd.entries[i]->type==SPEC_PARTICLE) tframes++;
    107   frames=(int *)jmalloc(sizeof(int)*tframes,"part_frame id list\n");
     107  frames=(int *)malloc(sizeof(int)*tframes);
    108108
    109109  int on=0;
     
    117117{
    118118  t=fp->read_uint32();
    119   data=(part *)jmalloc(sizeof(part)*t,"particle frame");
     119  data=(part *)malloc(sizeof(part)*t);
    120120  x1=y1=100000; x2=y2=-100000;
    121121  for (int i=0;i<t;i++)
  • abuse/trunk/src/particle.hpp

    r57 r129  
    4545  int *frames;  // array of id's
    4646  part_sequence(void *args);
    47   ~part_sequence() { if (tframes) jfree(frames); }
     47  ~part_sequence() { if (tframes) free(frames); }
    4848} ;
    4949
  • abuse/trunk/src/points.cpp

    r124 r129  
    2020  if (tot)
    2121  {
    22     data=(unsigned char *)jmalloc((int)how_many*2,"point list");
     22    data=(unsigned char *)malloc((int)how_many*2);
    2323    memcpy(data,Data,(int)tot*2);
    2424  } else data=NULL;
     
    3030  if (tot)
    3131  {
    32     data=(unsigned char *)jmalloc((int)tot*2,"point list : loaded");
     32    data=(unsigned char *)malloc((int)tot*2);
    3333    fp->read(data,(int)tot*2);
    3434
  • abuse/trunk/src/points.hpp

    r57 r129  
    1010#ifndef __POINTS_HPP_
    1111#define __POINTS_HPP_
     12
    1213#include <stdio.h>
    1314#include <stdlib.h>
    14 #include "jmalloc.hpp"
     15
    1516#include "specs.hpp"
    1617
     
    2627  long size() { return 1+2*tot; }
    2728  point_list *copy() { return new point_list(tot,data); }
    28   ~point_list() { if (tot) { jfree(data); } }
     29  ~point_list() { if (tot) { free(data); } }
    2930} ;
    3031
  • abuse/trunk/src/profile.cpp

    r124 r129  
    5252{
    5353  if (prof_list) { profile_uninit(); }
    54   prof_list=(prof_info *)jmalloc(sizeof(prof_info)*total_objects,"prof info");
     54  prof_list=(prof_info *)malloc(sizeof(prof_info)*total_objects);
    5555  profile_reset();
    5656
     
    7979void profile_uninit()
    8080{
    81   if (prof_list) jfree(prof_list);
     81  if (prof_list) free(prof_list);
    8282  prof_list=NULL;
    8383  if (prof_win) { wm->close_window(prof_win); prof_win=NULL; }
  • abuse/trunk/src/property.cpp

    r124 r129  
    1414
    1515#include "property.hpp"
    16 #include "jmalloc.hpp"
    1716#include "dprint.hpp"
    1817#include "game.hpp"
     
    2524  int def_num;
    2625  property(char const *Name, int Def)
    27   { name=strcpy((char *)jmalloc(strlen(Name)+1,"Property Name"),Name);
     26  { name=strcpy((char *)malloc(strlen(Name)+1),Name);
    2827    def_num=Def;
    2928    def_str=NULL;
     
    3231
    3332  property(char const *Name, char const *Def)
    34   { name=strcpy((char *)jmalloc(strlen(Name)+1,"Property Name"),Name);
    35     def_str=strcpy((char *)jmalloc(strlen(Def)+1,"Property text"),Def);
     33  { name=strcpy((char *)malloc(strlen(Name)+1),Name);
     34    def_str=strcpy((char *)malloc(strlen(Def)+1),Def);
    3635    next=NULL;
    3736  }
     
    4039  { if (def_str)
    4140    {
    42       jfree(def_str);
     41      free(def_str);
    4342      def_str=NULL;
    4443    }
     
    5049    if (def_str)
    5150    {
    52       jfree(def_str);
     51      free(def_str);
    5352      def_str=NULL;
    5453    }
    55     def_str=strcpy((char *)jmalloc(strlen(x)+1,"Property text"),x);
     54    def_str=strcpy((char *)malloc(strlen(x)+1),x);
    5655  }
    5756
     
    5958  {
    6059    if (def_str)
    61       jfree(def_str);
    62     jfree(name);
     60      free(def_str);
     61    free(name);
    6362  }
    6463  property *next;
  • abuse/trunk/src/ramfile.cpp

    r56 r129  
    1313{
    1414  buf_size=2048;
    15   buf=(uchar *)jmalloc(buf_size,"ram file buffer");
     15  buf=(uchar *)malloc(buf_size);
    1616  buf_end=0;
    1717}
  • abuse/trunk/src/scene.cpp

    r124 r129  
    3434  { l=Left;
    3535    r=Right;
    36     n=strcpy((char *)jmalloc(strlen(Name)+1,"string node"),Name);
    37   }
    38   ~string_node() { jfree(n); }
     36    n=strcpy((char *)malloc(strlen(Name)+1),Name);
     37  }
     38  ~string_node() { free(n); }
    3939  char *name() { return n; }
    4040  string_node *left() { return l; }
     
    115115
    116116scene_sequence::~scene_sequence()
    117 { jfree(n);
     117{ free(n);
    118118  while (first)
    119119  { scene_frame *p=first;
     
    132132
    133133  expect(get_token(s,tmp_name),sWORD,s);
    134   n=strcpy((char *)jmalloc(strlen(tmp_name)+1,"sequence name"),tmp_name);
     134  n=strcpy((char *)malloc(strlen(tmp_name)+1),tmp_name);
    135135  cur=first=new scene_frame(s);
    136136
     
    216216  int y() { return the_game->screeny(me->y)-cache.fig(current_frame->picture)->forward->height(); }
    217217  int next_frame();  // true if sequence is done
    218   ~scene_character() { jfree(n); delete seq_list; if (last_frame) delete last_frame; }
     218  ~scene_character() { free(n); delete seq_list; if (last_frame) delete last_frame; }
    219219} ;
    220220
     
    271271  expect(get_token(s,tmp),sLEFT_PAREN,s);
    272272  expect(get_token(s,tmp),sWORD,s);
    273   n=strcpy((char *)jmalloc(strlen(tmp)+1,"scene character name"),tmp);
     273  n=strcpy((char *)malloc(strlen(tmp)+1),tmp);
    274274  expect(get_token(s,tmp),sNUMBER,s);
    275275
     
    487487  text_blocker *text_blockers=NULL;
    488488
    489   char *strng=(char *)jmalloc(MAX_SCROLL_DATA,"tmp token space");
     489  char *strng=(char *)malloc(MAX_SCROLL_DATA);
    490490  strcpy(scene_filename,filename);
    491491
     
    706706    next_token(s);
    707707
    708   jfree(strng);
     708  free(strng);
    709709  screen->set_clip(cx1,cy1,cx2,cy2);
    710710
  • abuse/trunk/src/sdlport/jdir.cpp

    r124 r129  
    2727#include <unistd.h>
    2828
    29 #include "jmalloc.hpp"
    30 
    3129void get_directory(char *path, char **&files, int &tfiles, char **&dirs, int &tdirs)
    3230{
     
    5351        {
    5452            t++;
    55             tlist = (char **)jrealloc(tlist,sizeof(char *)*t,"tmp file list");
    56             tlist[t-1] = strcpy((char *)jmalloc(strlen(de->d_name)+1,"tmp file name"),de->d_name);
     53            tlist = (char **)realloc(tlist,sizeof(char *)*t);
     54            tlist[t-1] = strcpy((char *)malloc(strlen(de->d_name)+1),de->d_name);
    5755        }
    5856    } while( de );
     
    6563        {
    6664            tdirs++;
    67             dirs = (char **)jrealloc(dirs,sizeof(char *)*tdirs,"dir list");
    68             dirs[tdirs-1] = strcpy((char *)jmalloc(strlen(tlist[i])+1,"tmp file name"),tlist[i]);
     65            dirs = (char **)realloc(dirs,sizeof(char *)*tdirs);
     66            dirs[tdirs-1] = strcpy((char *)malloc(strlen(tlist[i])+1),tlist[i]);
    6967            closedir( d );
    7068        }
     
    7270        {
    7371            tfiles++;
    74             files = (char **)jrealloc(files,sizeof(char *)*tfiles,"dir list");
    75             files[tfiles-1] = strcpy((char *)jmalloc(strlen(tlist[i])+1,"tmp file name"),tlist[i]);
     72            files = (char **)realloc(files,sizeof(char *)*tfiles);
     73            files[tfiles-1] = strcpy((char *)malloc(strlen(tlist[i])+1),tlist[i]);
    7674        }
    77         jfree( tlist[i] );
     75        free( tlist[i] );
    7876    }
    7977    if( t )
    80         jfree( tlist );
     78        free( tlist );
    8179    chdir( curdir );
    8280}
  • abuse/trunk/src/sdlport/jnet.cpp

    r124 r129  
    3838#include "jnet.hpp"
    3939#include "macs.hpp"
    40 #include "jmalloc.hpp"
    4140
    4241int current_sock_err;
  • abuse/trunk/src/sdlport/jnet.hpp

    r124 r129  
    5757                                                        // 4 (net number) 6 node number for IPX
    5858
    59 uchar *get_local_address();                             // same format as above (be sure to jfree this)
     59uchar *get_local_address();                             // same format as above (be sure to free this)
    6060
    6161
  • abuse/trunk/src/sdlport/setup.cpp

    r124 r129  
    128128    char *result;
    129129
    130     rcfile = (char *)jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile" );
     130    rcfile = (char *)malloc( strlen( get_save_filename_prefix() ) + 9 );
    131131    sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() );
    132132    if( (fd = fopen( rcfile, "r" )) != NULL )
     
    247247        createRCFile( rcfile );
    248248    }
    249     jfree( rcfile );
     249    free( rcfile );
    250250}
    251251
     
    387387    if( (homedir = getenv( "HOME" )) != NULL )
    388388    {
    389         savedir = (char *)jmalloc( strlen( homedir ) + 9, "savedir" );
     389        savedir = (char *)malloc( strlen( homedir ) + 9 );
    390390        sprintf( savedir, "%s/.abuse/", homedir );
    391391        // Check if we already have a savegame directory
     
    400400        }
    401401        set_save_filename_prefix( savedir );
    402         jfree( savedir );
     402        free( savedir );
    403403    }
    404404    else
  • abuse/trunk/src/sdlport/sound.cpp

    r124 r129  
    2323
    2424#include "sound.hpp"
    25 #include "jmalloc.hpp"
    2625#include "readwav.hpp"
    2726#include "specs.hpp"
     
    127126    // Check for the sfx directory, disable sound if we can't find it.
    128127    datadir = get_filename_prefix();
    129     sfxdir = (char *)jmalloc( strlen( datadir ) + 5 + 1, "sfxdir" );
     128    sfxdir = (char *)malloc( strlen( datadir ) + 5 + 1 );
    130129    sprintf( sfxdir, "%s/sfx/", datadir );
    131130    if( (fd = fopen( sfxdir,"r" )) == NULL )
     
    135134        return 0;
    136135    }
    137     jfree( sfxdir );
     136    free( sfxdir );
    138137
    139138    audioWanted.freq = 11025;
     
    174173            effect_handle *last = fx_list;
    175174            fx_list = fx_list->next;
    176             jfree( last );
     175            free( last );
    177176        }
    178177        SDL_CloseAudio();
     
    205204        if( data )
    206205        {
    207             jfree( data );
     206            free( data );
    208207        }
    209208    }
     
    296295{
    297296    data = NULL;
    298     Name = strcpy((char *)jmalloc( strlen( filename ) + 1, "song name" ), filename );
     297    Name = strcpy((char *)malloc( strlen( filename ) + 1 ), filename );
    299298    song_id = 0;
    300299}
     
    308307    if( data )
    309308    {
    310         jfree( data );
    311     }
    312     jfree( Name );
     309        free( data );
     310    }
     311    free( Name );
    313312}
    314313
  • abuse/trunk/src/sdlport/video-overlay.cpp

    r124 r129  
    2828#include "macs.hpp"
    2929#include "image.hpp"
    30 #include "jmalloc.hpp"
    3130#include "setup.h"
    3231
     
    346345    else
    347346    {
    348         data = (unsigned char *)jmalloc( width * height, "image::data" );
     347        data = (unsigned char *)malloc(width * height);
    349348    }
    350349}
     
    357356    if( !special || !special->static_mem )
    358357    {
    359         jfree( data );
     358        free( data );
    360359    }
    361360}
  • abuse/trunk/src/sdlport/video.cpp

    r124 r129  
    3535#include "macs.hpp"
    3636#include "image.hpp"
    37 #include "jmalloc.hpp"
    3837#include "setup.h"
    3938
     
    411410{
    412411    if( page_buffer )
    413     {
    414412        data = page_buffer;
    415     }
    416413    else
    417     {
    418         data = (unsigned char *)jmalloc( width * height, "image::data" );
    419     }
     414        data = (unsigned char *)malloc( width * height );
    420415}
    421416
     
    426421{
    427422    if( !special || !special->static_mem )
    428     {
    429         jfree( data );
    430     }
     423        free( data );
    431424}
    432425
  • abuse/trunk/src/seq.cpp

    r124 r129  
    4242    total=list_length(pict_list);
    4343
    44   seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array");
     44  seq=(int *) malloc(sizeof(int)*total);
    4545  if (item_type(pict_list)==L_STRING)
    4646    seq[0]=cache.reg_object(filename,pict_list,SPEC_CHARACTER2,1);
     
    5858sequence::~sequence()
    5959{
    60   jfree(seq);
     60  free(seq);
    6161}
    6262
     
    8787
    8888  s=picts;
    89   seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array");
     89  seq=(int *) malloc(sizeof(int)*total);
    9090
    9191  for (i=0;i<total;)
  • abuse/trunk/src/smoosh.cpp

    r124 r129  
    1010#include "config.h"
    1111
    12 #include "jmalloc.hpp"
    1312#define PARTICLE_SIZE 2            // 2x2 block of pixels
    1413
     
    2019  particle *left,*right,*up,*down;
    2120  particle(int X, int Y, int size);
    22   ~particle() { jfree(pict); }
     21  ~particle() { free(pict); }
    2322} ;
    2423
     
    2726  x=X; y=Y;
    2827  left=right=up=down=NULL;
    29   pict=(unsigned char *)jmalloc(size*size,"Particle");
     28  pict=(unsigned char *)malloc(size*size);
    3029}
    3130
  • abuse/trunk/src/specache.hpp

    r124 r129  
    2525    filename_node(char const *filename, spec_directory *dir)
    2626    {
    27       fn=(char *)memcpy(jmalloc(strlen(filename)+1,"spec_dir cache"),filename,strlen(filename)+1);
     27      fn=(char *)memcpy(malloc(strlen(filename) + 1),filename,strlen(filename)+1);
    2828      sd=dir;
    2929      next=left=right=0;
  • abuse/trunk/src/status.cpp

    r124 r129  
    3939  time_marker last_update;
    4040  status_node(char *Name, visual_object *Show, status_node *Next)
    41   { name=strcpy((char *)jmalloc(strlen(Name)+1,"status name"),Name);
     41  { name=strcpy((char *)malloc(strlen(Name)+1),Name);
    4242    show=Show;
    4343    next=Next;
    4444  }
    45   ~status_node() { jfree(name); if (show) delete show; }
     45  ~status_node() { free(name); if (show) delete show; }
    4646}
    4747
  • abuse/trunk/src/view.cpp

    r126 r129  
    4444  if (total_weapons)
    4545  {
    46     jfree(weapons);
    47     jfree(last_weapons);
     46    free(weapons);
     47    free(last_weapons);
    4848  }
    4949}
     
    254254  if (total_weapons)
    255255  {
    256     weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"weapon array");
    257     last_weapons=(int32_t *)jmalloc(total_weapons*sizeof(int32_t),"last weapon array");
     256    weapons=(int32_t *)malloc(total_weapons*sizeof(int32_t));
     257    last_weapons=(int32_t *)malloc(total_weapons*sizeof(int32_t));
    258258    memset(weapons,0xff,total_weapons*sizeof(int32_t));   // set all to -1
    259259    memset(last_weapons,0xff,total_weapons*sizeof(int32_t));   // set all to -1
Note: See TracChangeset for help on using the changeset viewer.