Ignore:
Timestamp:
Mar 22, 2008, 10:39:25 AM (15 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/imlib
Files:
2 deleted
33 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.