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

Legend:

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