Changeset 129
- Timestamp:
- Mar 22, 2008, 10:39:25 AM (15 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 2 deleted
- 89 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/cache.cpp
r124 r129 127 127 delete files[i]; 128 128 if (total_files) 129 jfree(files);129 free(files); 130 130 total_files=0; 131 131 files=NULL; … … 134 134 CrcedFile::~CrcedFile() 135 135 { 136 jfree(filename);136 free(filename); 137 137 } 138 138 139 139 CrcedFile::CrcedFile(char const *name) 140 140 { 141 filename=strcpy((char *) jmalloc(strlen(name)+1,"crc_file"),name);141 filename=strcpy((char *)malloc(strlen(name)+1),name); 142 142 crc_calculated=0; 143 143 } … … 154 154 if (!strcmp(filename,files[i]->filename)) return i; 155 155 total_files++; 156 files=(CrcedFile **) jrealloc(files,total_files*sizeof(CrcedFile *),"crc_file_list");156 files=(CrcedFile **)realloc(files,total_files*sizeof(CrcedFile *)); 157 157 files[total_files-1]=new CrcedFile(filename); 158 158 return total_files-1; … … 195 195 case SPEC_EXTERN_SFX : delete ((sound_effect *)i->data); break; 196 196 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; 198 198 case SPEC_PALETTE : delete ((char_tint *)i->data); break; 199 199 default : … … 209 209 { 210 210 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); 214 214 memset(prof_data,0,sizeof(int)*total); 215 215 } … … 252 252 if (prof_data) 253 253 { 254 int *ordered_ids=(int *) jmalloc(sizeof(int)*total,"profile order");254 int *ordered_ids=(int *)malloc(sizeof(int)*total); 255 255 int i; 256 256 for (i=0;i<total;i++) ordered_ids[i]=i; … … 285 285 } 286 286 287 jfree(ordered_ids);287 free(ordered_ids); 288 288 289 289 } else dprintf("Cache profiling was not initialized\n"); … … 294 294 if (prof_data) 295 295 { 296 jfree(prof_data);296 free(prof_data); 297 297 prof_data=NULL; 298 298 } … … 495 495 if (tnames) /// make sure there isn't bad info in the file 496 496 { 497 fnum_remap=(int *) jmalloc(sizeof(int)*tnames,"pfname remap");497 fnum_remap=(int *)malloc(sizeof(int)*tnames); 498 498 499 499 int i; … … 512 512 513 513 514 int *priority=(int *) jmalloc(tsaved*sizeof(int),"priorities");514 int *priority=(int *)malloc(tsaved*sizeof(int)); 515 515 memset(priority,0xff,tsaved*sizeof(int)); // initialize to -1 516 516 int tmatches=0; 517 517 518 sorted_id_list=(int *) jmalloc(sizeof(int)*total,"sorted ids");518 sorted_id_list=(int *)malloc(sizeof(int)*total); 519 519 for (j=0;j<total;j++) sorted_id_list[j]=j; 520 520 qsort(sorted_id_list,total,sizeof(int),s_offset_compare); … … 542 542 } 543 543 544 jfree(sorted_id_list); // was used for searching, no longer needed544 free(sorted_id_list); // was used for searching, no longer needed 545 545 546 546 for (j=0;j<total;j++) … … 592 592 } 593 593 594 jfree(priority);595 jfree(fnum_remap);594 free(priority); 595 free(fnum_remap); 596 596 597 597 … … 745 745 unmalloc(&list[i]); 746 746 } 747 jfree(list);747 free(list); 748 748 if (fp) delete fp; 749 749 if (last_dir) delete last_dir; … … 837 837 { 838 838 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))); 840 840 for (i=0;i<add_size;i++) 841 841 { … … 846 846 id=total; 847 847 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; } 849 849 total+=add_size; 850 850 } … … 1031 1031 touch(me); 1032 1032 locate(me); 1033 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1034 1033 me->data=(void *)new backtile(fp); 1035 alloc_space=sp;1036 1034 last_offset=fp->tell(); 1037 1035 return (backtile *)me->data; … … 1054 1052 touch(me); 1055 1053 locate(me); 1056 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1057 1054 me->data=(void *)new foretile(fp); 1058 alloc_space=sp;1059 1055 last_offset=fp->tell(); 1060 1056 return (foretile *)me->data; … … 1075 1071 touch(me); 1076 1072 locate(me); 1077 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1078 1073 me->data=(void *)new figure(fp,me->type); 1079 alloc_space=sp;1080 1074 last_offset=fp->tell(); 1081 1075 return (figure *)me->data; … … 1096 1090 touch(me); // hold me, feel me, be me! 1097 1091 locate(me); 1098 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1099 1092 image *im=new image(fp); 1100 alloc_space=sp;1101 1093 me->data=(void *)im; 1102 1094 last_offset=fp->tell(); … … 1119 1111 touch(me); // hold me, feel me, be me! 1120 1112 char *fn=crc_manager.get_filename(me->file_number); 1121 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1122 1113 me->data=(void *)new sound_effect(fn); 1123 alloc_space=sp;1124 1114 return (sound_effect *)me->data; 1125 1115 } … … 1140 1130 touch(me); 1141 1131 locate(me); 1142 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1143 1132 me->data=(void *)new part_frame(fp); 1144 alloc_space=sp;1145 1133 last_offset=fp->tell(); 1146 1134 return (part_frame *)me->data; … … 1180 1168 cache_read_file->seek(me->offset,0); 1181 1169 1182 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1183 1184 1170 uint32_t size=cache_read_file->read_uint32(); 1185 1171 void *space; 1186 1172 1187 1173 if (size) 1188 space= jmalloc(size,"cached lisp block");1174 space=malloc(size); 1189 1175 else space=NULL; 1190 1176 … … 1194 1180 current_space=cs; 1195 1181 1196 alloc_space=sp;1197 1182 if (size) 1198 1183 me->data=(Cell *)space; … … 1204 1189 CacheList cache; 1205 1190 1206 void free_up_memory()1207 {1208 cache.free_oldest();1209 }1210 1211 1191 void CacheList::free_oldest() 1212 1192 { … … 1232 1212 close_graphics(); 1233 1213 printf("Out of memory, please remove any TSR's device drivers you can\n"); 1234 mem_report("out_of_mem");1235 1214 exit(0); 1236 1215 } … … 1292 1271 touch(me); 1293 1272 locate(me); 1294 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;1295 1273 me->data=(void *)new char_tint(fp); 1296 alloc_space=sp;1297 1274 last_offset=fp->tell(); 1298 1275 return (char_tint *)me->data; -
abuse/trunk/src/chars.cpp
r124 r129 123 123 } else if (num>=ts) 124 124 { 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)); 127 127 128 128 memset(&seq[ts],0,sizeof(sequence *)*((num+1)-ts)); … … 236 236 { 237 237 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); 240 240 memset(&vars[tiv],0,(new_total-tiv)*sizeof(void *)); 241 241 memset(&var_index[tiv],0,(new_total-tiv)*sizeof(short)); … … 255 255 { 256 256 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); 259 259 memset(&vars[tiv],0,(new_total-tiv)*sizeof(void *)); 260 260 memset(&var_index[tiv],0,(new_total-tiv)*sizeof(short)); … … 367 367 { 368 368 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); 370 370 weapon_types[total_weapons-1]=total_objects; 371 371 } … … 411 411 total_fields++; 412 412 413 fields=(named_field **) jrealloc(fields,sizeof(named_field *)*total_fields,"named_fields");413 fields=(named_field **)realloc(fields,sizeof(named_field *)*total_fields); 414 414 fields[total_fields-1]=new named_field(real,fake); 415 415 mf=lcdr(mf); … … 517 517 total_fields++; 518 518 519 fields=(named_field **) jrealloc(fields,sizeof(named_field *)*total_fields,"named_fields");519 fields=(named_field **)realloc(fields,sizeof(named_field *)*total_fields); 520 520 fields[total_fields-1]=new named_field(find,new_name); 521 521 mf=lcdr(mf); … … 554 554 if (seq[i]) 555 555 delete seq[i]; 556 if (ts) jfree(seq);556 if (ts) free(seq); 557 557 558 558 if (total_fields) … … 560 560 for (int i=0;i<total_fields;i++) 561 561 delete fields[i]; 562 jfree(fields);562 free(fields); 563 563 } 564 564 565 565 if (ts) 566 jfree(seq_syms);566 free(seq_syms); 567 567 568 568 if (tiv) 569 569 { 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 41 41 char *descript_name; 42 42 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); 45 45 } 46 ~named_field() { jfree(real_name); jfree(descript_name); }46 ~named_field() { free(real_name); free(descript_name); } 47 47 } ; 48 48 -
abuse/trunk/src/clisp.cpp
r126 r129 770 770 if (!total_objects) 771 771 { 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)); 774 774 } 775 775 else 776 776 { 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)); 781 779 } 782 780 783 781 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), 785 783 lstring_value(symbol_name(sym))); 786 784 figures[total_objects]=new character_type(CDR(args),sym); … … 992 990 p_ref r1(fl),r2(dl); 993 991 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); 999 997 1000 998 push_onto_list(dl,rl); … … 2140 2138 case 264 : 2141 2139 { 2142 mem_report("mem.rep");2140 printf("mem_report is deprecated\n"); 2143 2141 } break; 2144 2142 case 265 : -
abuse/trunk/src/collide.cpp
r124 r129 28 28 void add_collide(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, game_object *who); 29 29 collide_patch *copy(collide_patch *Next); 30 ~collide_patch() { if (total) jfree(touch); }30 ~collide_patch() { if (total) free(touch); } 31 31 } ; 32 32 … … 38 38 if (total) 39 39 { 40 p->touch=(game_object **) jmalloc(total*sizeof(game_object *),"collide patches");40 p->touch=(game_object **)malloc(total*sizeof(game_object *)); 41 41 memcpy(p->touch,touch,total*(sizeof(game_object *))); 42 42 } … … 84 84 85 85 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); 87 87 p->touch[p->total-1]=who; 88 88 return ; … … 101 101 add_collide(first,p->x1,p->y2+1,p->x2,y2,who); 102 102 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); 104 104 p->touch[p->total-1]=who; 105 105 return ; … … 149 149 first=new collide_patch(x1,y1,x2,y2,first); 150 150 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); 152 152 first->touch[0]=who; 153 153 } -
abuse/trunk/src/compiled.cpp
r124 r129 14 14 #include "lisp.hpp" 15 15 #include "macs.hpp" 16 #include "jmalloc.hpp"17 16 18 17 extern int total_objects; … … 126 125 { 127 126 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); 129 128 memset(bad_guy_array,0,total_objects); 130 129 while (b) … … 150 149 { 151 150 if (bad_guy_array) 152 jfree(bad_guy_array);151 free(bad_guy_array); 153 152 } -
abuse/trunk/src/config.cpp
r124 r129 93 93 if( key_map ) 94 94 { 95 jfree( key_map );95 free( key_map ); 96 96 } 97 97 key_map = NULL; … … 100 100 if( key_players ) 101 101 { 102 key_map = ( player_keys *) jmalloc(sizeof(player_keys)*key_players,"key bindings");102 key_map = ( player_keys *)malloc(sizeof(player_keys)*key_players); 103 103 for( int i = 0; i < key_players; i++ ) 104 104 { … … 128 128 if( key_map ) 129 129 { 130 jfree( key_map );130 free( key_map ); 131 131 } 132 132 key_map = NULL; 133 133 134 134 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 ); 136 136 for( int i = 0; i < key_players; i++ ) 137 137 { … … 224 224 if(key_map) 225 225 { 226 jfree(key_map);226 free(key_map); 227 227 key_map = NULL; 228 228 } -
abuse/trunk/src/console.cpp
r124 r129 17 17 #include "linked.hpp" 18 18 #include "console.hpp" 19 #include "jmalloc.hpp"20 19 21 20 void console::put_string(char const *st) … … 71 70 { 72 71 hide(); 73 jfree(screen);74 jfree(name);72 free(screen); 73 free(name); 75 74 } 76 75 … … 80 79 w=width; 81 80 h=height; 82 screen=(char *) jmalloc(w*h,"console screen");81 screen=(char *)malloc(w*h); 83 82 memset(screen,' ',w*h); 84 83 cx=cy=0; … … 86 85 lastx=xres/2-screen_w()/2; 87 86 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); 89 88 } 90 89 -
abuse/trunk/src/crc.cpp
r124 r129 32 32 33 33 int size=0x1000; 34 uint8_t *buffer=(uint8_t *) jmalloc(size,"crc_buffer"),*c;34 uint8_t *buffer=(uint8_t *)malloc(size),*c; 35 35 long l=fp->file_size(); 36 36 long cur_pos=fp->tell(); … … 53 53 } 54 54 fp->seek(cur_pos,0); 55 jfree(buffer);55 free(buffer); 56 56 return (crc1|(crc2<<8)|(crc3<<16)|(crc4<<24)); 57 57 } -
abuse/trunk/src/demo.cpp
r124 r129 16 16 #include "macs.hpp" 17 17 #include "jwindow.hpp" 18 #include "jmalloc.hpp"19 18 #include "dprint.hpp" 20 19 #include "dev.hpp" -
abuse/trunk/src/dev.cpp
r123 r129 556 556 557 557 } 558 559 update_memprof();560 558 } 561 559 … … 572 570 } 573 571 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 } else615 {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 }624 572 625 573 void dev_controll::toggle_toolbar() … … 705 653 wm->close_window(omenu); 706 654 omenu = NULL; 707 jfree(listable_objs);655 free(listable_objs); 708 656 listable_objs = NULL; 709 657 return; … … 718 666 if(!figures[i]->get_cflag(CFLAG_UNLISTABLE)) 719 667 total_listable++; 720 listable_objs = (char **) jmalloc(sizeof(char *) * total_listable, "omenu list");668 listable_objs = (char **)malloc(sizeof(char *) * total_listable); 721 669 722 670 for(i = 0, c = 0; i < total_objects; i++) … … 752 700 wm->close_window(pmenu); 753 701 pmenu = NULL; 754 jfree(pwin_list);702 free(pwin_list); 755 703 return; 756 704 } … … 764 712 pmenu_on = 1; 765 713 766 pwin_list = (char **) jmalloc(total_pals * sizeof(char *), "pal pick list");714 pwin_list = (char **)malloc(total_pals * sizeof(char *)); 767 715 for(int i = 0; i < total_pals; i++) 768 716 pwin_list[i] = pal_wins[i]->name; … … 968 916 ai_object=NULL; 969 917 search_object = NULL; 970 memprof=NULL;971 918 oedit=NULL; 972 919 forew=NULL; … … 999 946 if (get_option("-nolight")) 1000 947 dev=dev^DRAW_LIGHTS; 1001 if (start_mem)1002 toggle_memprof();1003 948 } 1004 949 … … 1080 1025 1081 1026 // 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)); 1083 1028 memcpy(w,player_list->weapons,total_weapons*sizeof(int32_t)); 1084 1029 … … 1095 1040 1096 1041 memcpy(player_list->weapons,w,total_weapons*sizeof(int32_t)); 1097 jfree(w);1042 free(w); 1098 1043 1099 1044 the_game->need_refresh(); … … 1304 1249 } 1305 1250 } 1306 1307 if (!strcmp(fword,"mem_report"))1308 mem_report("memory.report");1309 1251 1310 1252 if (!strcmp(fword,"restart")) … … 2739 2681 else if (ev.window==tbw) toggle_toolbar(); 2740 2682 else if (ev.window==omenu) toggle_omenu(); 2741 else if (ev.window==memprof) toggle_memprof();2742 2683 else if (ev.window==search_window) toggle_search_window(); 2743 2684 else if (profile_handle_event(ev)) profile_on=!profile_on; … … 2829 2770 case 'p' : toggle_pmenu(); break; 2830 2771 case 'P' : profile_toggle(); break; 2831 case '|' : toggle_memprof(); break;2832 2772 case '.' : 2833 2773 { … … 2976 2916 { 2977 2917 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); 2979 2919 pal_wins[total_pals-1]=new pal_win(args); 2980 2920 } … … 2986 2926 Cell *ao=(Cell *)args; 2987 2927 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))); 2990 2929 ao=CDR(ao); 2991 2930 scale=w=h=1; … … 3014 2953 if (h<=0) h=0; 3015 2954 3016 pat=(unsigned short *) jmalloc(w*h*sizeof(unsigned short),"palwin::pat");2955 pat=(unsigned short *)malloc(w*h*sizeof(unsigned short)); 3017 2956 memset(pat,0,sizeof(unsigned short)*w*h); // set the palette to black if no parameters are given 3018 2957 while (!NILP(ao)) // loop until we run out of parameters … … 3217 3156 if (w+xa<1 || y+ya<1) return ; 3218 3157 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)); 3220 3159 memset(npat,0,sizeof(unsigned short)*(w+xa)*(h+ya)); 3221 3160 for (i=0;i<(w+xa);i++) … … 3223 3162 if (i+j*w<w*h) 3224 3163 npat[i+j*(w+xa)]=pat[i+j*w]; 3225 jfree(pat);3164 free(pat); 3226 3165 w+=xa; 3227 3166 h+=ya; … … 3463 3402 if (listable_objs) 3464 3403 { 3465 jfree(listable_objs);3404 free(listable_objs); 3466 3405 listable_objs=NULL; 3467 3406 } … … 3672 3611 delete pal_wins[i]; 3673 3612 if (total_pals) 3674 jfree(pal_wins);3613 free(pal_wins); 3675 3614 } 3676 3615 … … 3679 3618 pal_win::~pal_win() 3680 3619 { 3681 jfree(pat);3682 jfree(name);3683 } 3620 free(pat); 3621 free(name); 3622 } -
abuse/trunk/src/dev.hpp
r124 r129 79 79 Jwindow *backw,*forew,*commandw,*modew,*omenu,*oedit,*ledit, 80 80 *music_window,*pmenu,*show_menu,*lightw,*aiw,*ambw,*tbw,*area_win, 81 *search_window ,*memprof;81 *search_window; 82 82 83 83 int fg_w,bg_w,fg_scale,bg_scale,yellow; … … 85 85 void fg_fill(int color, int x, int y, pal_win *p); 86 86 void add_palette(void *args); 87 void toggle_memprof();88 87 void search_forward(); 89 88 void search_backward(); … … 121 120 void notify_deleted_light(light_source *l); 122 121 void set_state(int new_state); 123 void update_memprof();124 122 ~dev_controll(); 125 123 } ; -
abuse/trunk/src/endgame.cpp
r124 r129 42 42 static mask_line *make_mask_lines(image *mask, int map_width) 43 43 { 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)); 45 45 for (int y=0;y<mask->height();y++) 46 46 { … … 59 59 60 60 // 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); 63 63 uint16_t *rem=p[y].remap; 64 64 uint8_t *lrem=p[y].light; … … 398 398 for (i=0;i<cache.img(mask)->height();i++) 399 399 { 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); 405 405 406 406 -
abuse/trunk/src/extend.cpp
r126 r129 54 54 for (int i=0;i<tlights;i++) if (lights[i]==ls) return; 55 55 tlights++; 56 lights=(light_source **) jrealloc(lights,sizeof(light_source *)*tlights,"Light list");56 lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights); 57 57 lights[tlights-1]=ls; 58 58 } … … 68 68 o->set_tint(_tint); 69 69 tobjs++; 70 objs=(game_object **) jrealloc(objs,sizeof(game_object *)*tobjs,"Object list");70 objs=(game_object **)realloc(objs,sizeof(game_object *)*tobjs); 71 71 objs[tobjs-1]=o; 72 72 } … … 82 82 for (int j=i;j<tlights;j++) // don't even think about it :) 83 83 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); 85 85 return ; 86 86 } … … 97 97 for (int j=i;j<tobjs;j++) // don't even think about it :) 98 98 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); 100 100 return ; 101 101 } … … 145 145 void simple_object::clean_up() 146 146 { 147 if (tlights) jfree(lights);148 if (tobjs) jfree(objs);147 if (tlights) free(lights); 148 if (tobjs) free(objs); 149 149 if (Controller) 150 150 Controller->focus=NULL; -
abuse/trunk/src/extend.hpp
r126 r129 20 20 #include "lisp/lisp.hpp" 21 21 22 #include "jmalloc.hpp"23 22 #include "macs.hpp" 24 23 #include "morpher.hpp" -
abuse/trunk/src/fakelib.hpp
r124 r129 11 11 #define __FAKELIB_HPP_ 12 12 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 __sgi18 #include <sys/bsd_types.h>19 #else20 13 #include <stdint.h> 21 #endif22 14 23 15 class bFILE -
abuse/trunk/src/game.cpp
r127 r129 1388 1388 // ProfilerInit(collectDetailed, bestTimeBase, 2000, 200); //prof 1389 1389 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); 1391 1391 sprintf(fastpath, "%sfastload.dat", get_save_filename_prefix()); 1392 1392 fast_load_start_recording(fastpath); 1393 1393 load_data(argc, argv); 1394 1394 fast_load_stop_recording(); 1395 jfree(fastpath);1395 free(fastpath); 1396 1396 // ProfilerDump("\pabuse.prof"); //prof 1397 1397 // ProfilerTerm(); … … 2114 2114 for(; i < total_objects; i++) 2115 2115 { 2116 jfree(object_names[i]);2116 free(object_names[i]); 2117 2117 delete figures[i]; 2118 2118 } … … 2120 2120 if(fps_mark_start) delete fps_mark_start; fps_mark_start = NULL; 2121 2121 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); 2127 2127 if(total_weapons) 2128 jfree(weapon_types);2128 free(weapon_types); 2129 2129 2130 2130 config_cleanup(); … … 2135 2135 delete console_font; 2136 2136 if(total_help_screens) 2137 jfree(help_screens);2137 free(help_screens); 2138 2138 2139 2139 close_graphics(); … … 2269 2269 char *get_line(int open_braces) 2270 2270 { 2271 char *line=(char *) jmalloc(1000, "lstring");2271 char *line=(char *)malloc(1000); 2272 2272 fgets(line, 1000, stdin); 2273 2273 … … 2284 2284 { 2285 2285 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); 2287 2287 strcat(line, s2); 2288 jfree(s2);2288 free(s2); 2289 2289 } 2290 2290 return line; … … 2332 2332 l_user_stack.pop(1); 2333 2333 } 2334 jfree(l);2334 free(l); 2335 2335 } 2336 2336 fprintf(stderr, "End of input : bye\n"); … … 2376 2376 extern pmenu *dev_menu; 2377 2377 2378 2379 extern int jmalloc_max_size;2380 extern int jmalloc_min_low_size;2381 2382 2378 void game_net_init(int argc, char **argv) 2383 2379 { … … 2420 2416 external_print = 1; 2421 2417 } 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 } 2433 2419 2434 2420 #if(defined(__APPLE__) && !defined(__MACH__)) … … 2650 2636 compiled_uninit(); 2651 2637 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]); 2655 2641 2656 2642 … … 2674 2660 2675 2661 base->packet.packet_reset(); 2676 // mem_report("end.mem");2677 2662 } while(main_net_cfg && main_net_cfg->restart_state()); 2678 2663 … … 2692 2677 } 2693 2678 2694 // AK -> Commented this out to stop a crash as the file prefix has already2695 // been released. Need to fix this.2696 // mem_report("end.mem");2697 2698 // jmalloc_uninit();2699 2679 l_user_stack.clean_up(); 2700 2680 l_ptr_stack.clean_up(); -
abuse/trunk/src/gamma.cpp
r123 r129 167 167 FILE *fp; 168 168 169 gammapath = (char *) jmalloc(strlen(get_save_filename_prefix()) + 10, "gammapath");169 gammapath = (char *)malloc(strlen(get_save_filename_prefix()) + 10); 170 170 sprintf(gammapath, "%sgamma.lsp", get_save_filename_prefix()); 171 171 fp = open_FILE(gammapath, "wb"); … … 184 184 dprintf("Unable to write to file gamma.lsp\n"); 185 185 } 186 jfree(gammapath);186 free(gammapath); 187 187 } 188 188 } -
abuse/trunk/src/imlib/Makefile.am
r104 r129 24 24 pcxread.cpp pcxread.hpp \ 25 25 timage.cpp timage.hpp \ 26 jmalloc.cpp jmalloc.hpp \27 26 jrand.cpp jrand.hpp \ 28 27 lbmread.cpp lbmread.hpp \ -
abuse/trunk/src/imlib/filesel.cpp
r124 r129 35 35 int i=0; 36 36 for (;i<tf;i++) 37 jfree(f[i]);37 free(f[i]); 38 38 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); 42 42 } 43 43 -
abuse/trunk/src/imlib/filter.cpp
r128 r129 19 19 { 20 20 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); 22 22 unsigned char *r,*g,*b; 23 23 r=g=b=(unsigned char *)from->addr(); … … 73 73 nc=colors; 74 74 make_block(nc); 75 fdat=(unsigned char *) jmalloc(nc,"filter");75 fdat=(unsigned char *)malloc(nc); 76 76 clear(); 77 77 } … … 121 121 long dist_sqr,best; 122 122 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); 124 124 for (r=0;r<colors;r++) 125 125 { … … 156 156 fp->read_uint16(); 157 157 int colors=32; 158 color_table=(unsigned char *) jmalloc(colors*colors*colors,"color_filter : loaded");158 color_table=(unsigned char *)malloc(colors*colors*colors); 159 159 fp->read(color_table,colors*colors*colors); 160 160 } -
abuse/trunk/src/imlib/filter.hpp
r124 r129 10 10 #ifndef _FILTER_HPP 11 11 #define _FILTER_HPP 12 12 13 #include "image.hpp" 13 14 #include "palette.hpp" 14 15 #include "specs.hpp" 15 #include "jmalloc.hpp"16 16 17 17 class filter … … 29 29 void put_image(image *screen, image *im, short x, short y, char transparent=0); 30 30 void clear(); 31 ~filter() { jfree(fdat); }31 ~filter() { free(fdat); } 32 32 } ; 33 33 … … 45 45 int total_colors() { return 32; } 46 46 unsigned char *get_table() { return color_table; } 47 ~color_filter() { jfree(color_table); }47 ~color_filter() { free(color_table); } 48 48 } ; 49 49 -
abuse/trunk/src/imlib/glview.cpp
r124 r129 33 33 screen->clear(); 34 34 i=argc; 35 im=(image **) jmalloc(sizeof(image *)*80,"gl_view image");35 im=(image **)malloc(sizeof(image *)*80); 36 36 i=1; t=1; 37 37 while (i<argc) -
abuse/trunk/src/imlib/guistat.cpp
r124 r129 25 25 time_marker last_time; 26 26 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); 28 28 show=Show; 29 29 next=Next; … … 37 37 gui_status_node::~gui_status_node() 38 38 { 39 jfree(name);39 free(name); 40 40 if (show) 41 41 delete show; -
abuse/trunk/src/imlib/image.cpp
r124 r129 112 112 void make_block(size_t size) 113 113 { 114 void *dat= jmalloc(size, "make_block : tmp");114 void *dat=malloc(size); 115 115 CONDITION(dat, "Memory error : could not make block\n"); 116 if (dat) jfree((char *)dat);116 if (dat) free((char *)dat); 117 117 } 118 118 … … 274 274 275 275 lock(); 276 dat = (uint8_t *) jmalloc(width(), "image copy");276 dat = (uint8_t *)malloc(width()); 277 277 im = new image(width(), height()); 278 278 im->lock(); … … 286 286 im->unlock(); 287 287 unlock(); 288 jfree((char *)dat);288 free((char *)dat); 289 289 return im; 290 290 } … … 1105 1105 int16_t x; 1106 1106 uint8_t *sl, *ex, mask, bt, sh; 1107 ex=(uint8_t *) jmalloc(width(), "image::unpacked scanline");1107 ex=(uint8_t *)malloc(width()); 1108 1108 1109 1109 lock(); … … 1121 1121 } 1122 1122 1123 jfree((char *)ex);1123 free((char *)ex); 1124 1124 } 1125 1125 … … 1162 1162 { 1163 1163 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()); 1165 1165 lock(); 1166 1166 memcpy(im, scan_line(0), width()*height()); … … 1187 1187 { sl2[x2]=sl1[(int)xd]; } 1188 1188 } 1189 jfree(im);1189 free(im); 1190 1190 if (special) special->resize(new_width, new_height); 1191 1191 unlock(); … … 1424 1424 void image::flip_x() 1425 1425 { 1426 uint8_t *rev=(uint8_t *) jmalloc(width(), "image tmp::flipped_x"), *sl;1426 uint8_t *rev=(uint8_t *)malloc(width()), *sl; 1427 1427 CONDITION(rev, "memory allocation"); 1428 1428 int y, x, i; … … 1437 1437 } 1438 1438 unlock(); 1439 jfree(rev);1439 free(rev); 1440 1440 } 1441 1441 1442 1442 void image::flip_y() 1443 1443 { 1444 uint8_t *rev=(uint8_t *) jmalloc(width(), "image::flipped_y"), *sl;1444 uint8_t *rev=(uint8_t *)malloc(width()), *sl; 1445 1445 CONDITION(rev, "memory allocation"); 1446 1446 int y; … … 1455 1455 } 1456 1456 unlock(); 1457 jfree(rev);1457 free(rev); 1458 1458 } 1459 1459 -
abuse/trunk/src/imlib/image24.cpp
r124 r129 19 19 h=height; 20 20 21 data=(unsigned char *) jmalloc(width*height*3,"image24");21 data=(unsigned char *)malloc(width*height*3); 22 22 CONDITION(data,"unable to alloc enough memory for 24 bit image"); 23 23 } -
abuse/trunk/src/imlib/image24.hpp
r124 r129 39 39 unsigned char b=0); 40 40 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); } 42 42 } ; 43 43 -
abuse/trunk/src/imlib/input.cpp
r124 r129 221 221 x=X; y=Y; id=ID; 222 222 act_id=-1; 223 text=strcpy((char *) jmalloc(strlen(Text)+1,"input button"),Text);223 text=strcpy((char *)malloc(strlen(Text)+1),Text); 224 224 up=1; next=Next; act=0; 225 225 visual=NULL; … … 248 248 { 249 249 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)); 251 251 252 252 strcpy(data,new_data); … … 334 334 335 335 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); 339 339 cur=strlen(data); 340 340 while (cur && data[cur-1]==' ') cur--; … … 349 349 int slen=(strlen(Format)>strlen(num) ? strlen(Format) : strlen(num)); 350 350 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); 354 354 cur=strlen(num); 355 355 while (cur && data[cur-1]==' ') cur--; … … 460 460 { 461 461 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); 463 463 w = -1; 464 464 } -
abuse/trunk/src/imlib/input.hpp
r124 r129 32 32 void change_visual(image *new_visual); 33 33 virtual void remap(filter *f); 34 virtual ~button() { if (text) jfree(text); }34 virtual ~button() { if (text) free(text); } 35 35 void push(); 36 36 virtual char *read() { return (char *)&up; } … … 85 85 virtual void handle_event(event &ev, image *screen, InputManager *im); 86 86 87 virtual ~text_field() { jfree(prompt); jfree(format); jfree(data); }87 virtual ~text_field() { free(prompt); free(format); free(data); } 88 88 virtual char *read(); 89 89 void change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it. … … 106 106 virtual char *read() { return text; } 107 107 virtual int selectable() { return 0; } 108 virtual ~info_field() { jfree(text); }108 virtual ~info_field() { free(text); } 109 109 } ; 110 110 -
abuse/trunk/src/imlib/jwindow.cpp
r128 r129 394 394 _name = NULL; 395 395 if(name) 396 _name = strcpy((char *)jmalloc(strlen(name) + 1, 397 "Jwindow::window name"), name); 396 _name = strcpy((char *)malloc(strlen(name) + 1), name); 398 397 wm->add_window(this); 399 398 } … … 441 440 _name = NULL; 442 441 if(name) 443 _name = strcpy((char *)jmalloc(strlen(name) + 1, 444 "Jwindow::window name"), name); 442 _name = strcpy((char *)malloc(strlen(name) + 1), name); 445 443 446 444 wm->add_window(this); … … 457 455 delete inm; 458 456 if(_name) 459 jfree(_name);457 free(_name); 460 458 } 461 459 -
abuse/trunk/src/imlib/loader.cpp
r124 r129 53 53 break; 54 54 case LOADER_xwd : 55 images=(image **) jmalloc(sizeof(image *),"loader::xwd image * array");55 images=(image **)malloc(sizeof(image *)); 56 56 total_read=1; 57 57 images[0]=readxwd(filename,pal); 58 58 break; 59 59 case LOADER_ppm : 60 images=(image **) jmalloc(sizeof(image *),"loader::ppm image * array");60 images=(image **)malloc(sizeof(image *)); 61 61 total_read=1; 62 62 pal=new palette; … … 64 64 break; 65 65 case LOADER_pic : 66 images=(image **) jmalloc(sizeof(image *),"loader::pic image * array");66 images=(image **)malloc(sizeof(image *)); 67 67 total_read=1; 68 68 pal=NULL; … … 70 70 break; 71 71 case LOADER_bmp8 : 72 images=(image **) jmalloc(sizeof(image *),"loader::bmp image * array");72 images=(image **)malloc(sizeof(image *)); 73 73 total_read=1; 74 74 pal=NULL; … … 76 76 break; 77 77 case LOADER_pcx8 : 78 images=(image **) jmalloc(sizeof(image *),"loader::pcx image * array");78 images=(image **)malloc(sizeof(image *)); 79 79 total_read=1; 80 80 pal=NULL; … … 82 82 break; 83 83 case LOADER_lbm : 84 images=(image **) jmalloc(sizeof(image *),"loader::pcx image * array");84 images=(image **)malloc(sizeof(image *)); 85 85 total_read=1; 86 86 pal=NULL; … … 91 91 if (ref_pal) 92 92 { 93 images=(image **) jmalloc(sizeof(image *),"loader::targa image * array");93 images=(image **)malloc(sizeof(image *)); 94 94 total_read=1; 95 95 images[0]=load_targa(filename,ref_pal); -
abuse/trunk/src/imlib/mdlread.cpp
r124 r129 164 164 } 165 165 if (!current_error()) 166 im=(image **) jmalloc(sizeof(image *)*endn,"mdl_read::image * array");166 im=(image **)malloc(sizeof(image *)*endn); 167 167 168 168 while ((startn<endn || endn==-1) && !feof(fp) && !current_error()) -
abuse/trunk/src/imlib/morph.cpp
r124 r129 119 119 120 120 patches=frames; 121 pats=(morph_patch *) jmalloc(sizeof(morph_patch)*patches,"morph::patch array");121 pats=(morph_patch *)malloc(sizeof(morph_patch)*patches); 122 122 w=max(bound_x2(0),bound_x2(1)); 123 123 h=max(bound_y2(0),bound_y2(1)); … … 261 261 262 262 263 middle_map=(morph_point8 **)jmalloc(w*h*sizeof(morph_point8 *),264 "morph::middle_map"); // create an image of pointers265 end_map=(unsigned char *)jmalloc(w*h,266 "morph::end_map"); // maps all the ending pixels263 // 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); 267 267 268 268 for (frame_on=2;frame_on<frames-1;frame_on++) … … 349 349 } 350 350 351 jfree(middle_map);352 jfree(end_map);351 free(middle_map); 352 free(end_map); 353 353 354 354 } … … 364 364 if (e->type==SPEC_MORPH_POINTS_8 || e->type==SPEC_PATCHED_MORPH) 365 365 { 366 p=(void *) jmalloc(sizeof(morph_point8)*total,"morph8::point array");366 p=(void *)malloc(sizeof(morph_point8)*total); 367 367 fp->read(p,sizeof(morph_point8)*total); 368 368 small=1; … … 370 370 else 371 371 { 372 p=(void *) jmalloc(sizeof(morph_point16)*total,"morph16::point array");372 p=(void *)malloc(sizeof(morph_point16)*total); 373 373 374 374 for (i=0;i<total;i++) … … 544 544 } 545 545 if (small) 546 plist=(void *) jmalloc(sizeof(morph_point8)*total,"morph8::point array");546 plist=(void *)malloc(sizeof(morph_point8)*total); 547 547 else 548 plist=(void *) jmalloc(sizeof(morph_point16)*total,"morph16::point array");548 plist=(void *)malloc(sizeof(morph_point16)*total); 549 549 CHECK(plist); 550 550 for (i=0,color=0;i<total_hints;i++) … … 734 734 735 735 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); 737 737 738 738 dir=frame_direction; … … 897 897 898 898 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); 900 900 901 901 for (i=0;i<patches;i++) … … 904 904 if (pats[i].patches) 905 905 { 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); 907 907 fp->read(pats[i].patch_data,3*pats[i].patches); 908 908 } -
abuse/trunk/src/imlib/morph.hpp
r124 r129 20 20 #include "specs.hpp" 21 21 #include "filter.hpp" 22 #include "jmalloc.hpp"23 22 24 23 … … 66 65 void add_filler(int frames); 67 66 int small_morph() { return small; } 68 ~jmorph() { jfree(p); }67 ~jmorph() { free(p); } 69 68 } ; 70 69 … … 81 80 void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal); 82 81 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); } 84 83 85 84 } ; … … 101 100 void show_frame(image *screen, int x, int y, color_filter *fli); 102 101 void reverse_direction(); 103 ~step_morph() { jfree(points); }102 ~step_morph() { free(points); } 104 103 } ; 105 104 -
abuse/trunk/src/imlib/packet.cpp
r124 r129 14 14 15 15 #include "packet.hpp" 16 #include "jmalloc.hpp"17 16 18 17 int packet::advance(int32_t offset) … … 40 39 41 40 packet::~packet() 42 { jfree(buf); }41 { free(buf); } 43 42 44 43 packet::packet(int prefix_size) … … 46 45 pre_size=prefix_size; 47 46 48 #ifdef MANAGE_MEM49 int sp=alloc_space;50 alloc_space=ALLOC_SPACE_STATIC;51 #endif52 53 47 buf_size=1000; 54 buf=(uint8_t *) jmalloc(buf_size,"packet buffer");48 buf=(uint8_t *)malloc(buf_size); 55 49 reset(); 56 57 #ifdef MANAGE_MEM58 alloc_space=sp;59 #endif60 50 } 61 51 … … 83 73 { 84 74 buf_size=max; 85 buf=(uint8_t *) jrealloc(buf,max,"packet buffer");75 buf=(uint8_t *)realloc(buf,max); 86 76 } 87 77 } -
abuse/trunk/src/imlib/palette.cpp
r124 r129 18 18 #include "video.hpp" 19 19 #include "filter.hpp" 20 #include "jmalloc.hpp"21 20 22 21 palette *lastl=NULL; … … 25 24 { 26 25 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); 29 28 set_all_unused(); 30 29 fp->read(pal,sizeof(color)*ncolors); … … 36 35 fp->seek(e->offset,0); 37 36 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); 40 39 set_all_unused(); 41 40 fp->read(pal,sizeof(color)*ncolors); … … 302 301 } 303 302 palette::~palette() 304 { if (pal) jfree(pal);305 if (usd) jfree(usd);303 { if (pal) free(pal); 304 if (usd) free(usd); 306 305 } 307 306 … … 311 310 ncolors=number_colors; 312 311 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); 315 314 defaults(); 316 315 } -
abuse/trunk/src/imlib/pmenu.cpp
r124 r129 60 60 on_off=on_off_flag; 61 61 if (Name) 62 n=strcpy((char *) jmalloc(strlen(Name)+1,"pmenu_item::name"),Name);62 n=strcpy((char *)malloc(strlen(Name)+1),Name); 63 63 else n=NULL; 64 64 next=Next; … … 73 73 on_off=NULL; 74 74 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); 76 76 sub=Sub; 77 77 } … … 400 400 401 401 pmenu_item::~pmenu_item() 402 { if (n) jfree(n); if (sub) delete sub;402 { if (n) free(n); if (sub) delete sub; 403 403 } 404 404 -
abuse/trunk/src/imlib/pmenu.hpp
r124 r129 11 11 #define __PMENU_HPP_ 12 12 13 #include "jmalloc.hpp"14 13 #include "input.hpp" 15 14 -
abuse/trunk/src/imlib/readwav.cpp
r124 r129 159 159 160 160 data_size=tag.size; 161 data=(unsigned char *) jmalloc(tag.size,"WAV data");161 data=(unsigned char *)malloc(tag.size); 162 162 ERROR(data,"Malloc error"); 163 163 -
abuse/trunk/src/imlib/scroller.cpp
r124 r129 394 394 wid=0; 395 395 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); 397 397 int i=0; 398 398 for (;i<num_entries;i++) … … 557 557 { 558 558 if (select) 559 jfree(select);559 free(select); 560 560 select=NULL; 561 561 … … 566 566 if (m) 567 567 { 568 select=(uint8_t *) jmalloc((t+7)/8,"selection bit array");568 select=(uint8_t *)malloc((t+7)/8); 569 569 memset(select,0,(t+7)/8); 570 570 } else cur_sel=0; -
abuse/trunk/src/imlib/scroller.hpp
r124 r129 86 86 virtual void set_x(int x, image *screen); 87 87 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); } 89 89 } ; 90 90 … … 111 111 virtual void handle_down(image *screen, InputManager *inm); 112 112 int get_selection() { return lis[cur_sel].number; } 113 ~pick_list() { jfree(lis); }113 ~pick_list() { free(lis); } 114 114 } ; 115 115 -
abuse/trunk/src/imlib/specs.cpp
r124 r129 25 25 #include "specs.hpp" 26 26 #include "system.h" 27 #include "jmalloc.hpp"28 27 #include "dprint.hpp" 29 28 … … 75 74 if( spec_prefix ) 76 75 { 77 jfree( spec_prefix );76 free( spec_prefix ); 78 77 } 79 78 80 79 if( prefix ) 81 80 { 82 spec_prefix = strcpy( (char *) jmalloc( strlen( prefix ) + 2, "prefix_name"), prefix );81 spec_prefix = strcpy( (char *)malloc( strlen( prefix ) + 2 ), prefix ); 83 82 int len = strlen( prefix ); 84 83 if( prefix[len - 1] != '\\' && prefix[len - 1] != '/') … … 104 103 if( save_spec_prefix ) 105 104 { 106 jfree( save_spec_prefix );105 free( save_spec_prefix ); 107 106 } 108 107 … … 110 109 { 111 110 int len = strlen( save_prefix ); 112 save_spec_prefix = (char *) jmalloc( len + 1, "prefix_name");111 save_spec_prefix = (char *)malloc( len + 1 ); 113 112 strcpy( save_spec_prefix, save_prefix ); 114 113 /* AK - Commented this out as it may cause problems … … 143 142 { 144 143 rbuf_size=8192; 145 rbuf=(unsigned char *) jmalloc(rbuf_size,"File read buffer");144 rbuf=(unsigned char *)malloc(rbuf_size); 146 145 rbuf_start=rbuf_end=0; 147 146 148 147 wbuf_size=8192; 149 wbuf=(unsigned char *) jmalloc(wbuf_size,"File write buffer");148 wbuf=(unsigned char *)malloc(wbuf_size); 150 149 wbuf_end=0; 151 150 } … … 153 152 bFILE::~bFILE() 154 153 { 155 if (rbuf) jfree(rbuf);154 if (rbuf) free(rbuf); 156 155 flush_writes(); 157 if (wbuf) jfree(wbuf);156 if (wbuf) free(wbuf); 158 157 } 159 158 … … 268 267 rbuf_start=rbuf_end=0; 269 268 if (rbuf) 270 jfree(rbuf);269 free(rbuf); 271 270 rbuf_size=size; 272 rbuf=(unsigned char *) jmalloc(rbuf_size,"File buffer");271 rbuf=(unsigned char *)malloc(rbuf_size); 273 272 } 274 273 … … 645 644 if (total) 646 645 { 647 jfree(data);648 jfree(entries);646 free(data); 647 free(entries); 649 648 } 650 649 } … … 754 753 { 755 754 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); 757 756 long start=fp->tell(); 758 757 … … 768 767 size+=entry_size; 769 768 } 770 data= jmalloc(size,"spec_directory::data");769 data=malloc(size); 771 770 char *dp=(char *)data; 772 771 fp->seek(start,SEEK_SET); … … 972 971 for (;i<total;i++) // compact the pointer array 973 972 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); 975 974 } 976 975 else … … 983 982 { 984 983 total++; 985 entries=(spec_entry **) jrealloc(entries,sizeof(spec_entry *)*total,"spec_directory::entries");984 entries=(spec_entry **)realloc(entries,sizeof(spec_entry *)*total); 986 985 entries[total-1]=e; 987 986 } … … 994 993 995 994 if (total) 996 jfree(entries);995 free(entries); 997 996 } 998 997 -
abuse/trunk/src/imlib/specs.hpp
r124 r129 10 10 #ifndef __SPECS_HPP_ 11 11 #define __SPECS_HPP_ 12 #include "linked.hpp"13 12 #include <stdio.h> 14 #include "jmalloc.hpp"15 #include "system.h"16 13 #include <fcntl.h> 17 14 #include <stdlib.h> 18 15 #include <stdint.h> 16 17 #include "linked.hpp" 18 #include "system.h" 19 19 20 20 extern char const *spec_types[]; … … 157 157 unsigned long data_offset) 158 158 { 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); 160 160 size=data_size; offset=data_offset; 161 161 } 162 162 void print(); 163 ~spec_entry() { if (name) jfree(name); }163 ~spec_entry() { if (name) free(name); } 164 164 } ; 165 165 -
abuse/trunk/src/imlib/status.cpp
r124 r129 24 24 int last_update; 25 25 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); 27 27 show=Show; 28 28 next=Next; 29 29 last_update=0; 30 30 } 31 ~text_status_node() { jfree(name); if (show) delete show; }31 ~text_status_node() { free(name); if (show) delete show; } 32 32 } ; 33 33 -
abuse/trunk/src/imlib/supmorph.cpp
r124 r129 95 95 96 96 t=start; 97 movers=(unsigned char *) jmalloc(t*4,"morph movers");97 movers=(unsigned char *)malloc(t*4); 98 98 99 99 … … 204 204 unsigned char *d=m->movers,*paddr=(unsigned char *)pal->addr(),*pa; 205 205 stepper *p; 206 p=steps=(stepper *) jmalloc(sizeof(stepper)*m->t,"smorph steps");206 p=steps=(stepper *)malloc(sizeof(stepper)*m->t); 207 207 f_left=frames; 208 208 frames--; … … 247 247 } 248 248 249 hole=(unsigned char *) jmalloc(w*h,"hole image");249 hole=(unsigned char *)malloc(w*h); 250 250 } 251 251 -
abuse/trunk/src/imlib/supmorph.hpp
r124 r129 10 10 #ifndef __SUPER_MORPH_HPP__ 11 11 #define __SUPER_MORPH_HPP__ 12 #include "jmalloc.hpp" 12 13 13 #include "timage.hpp" 14 14 … … 20 20 int w,h; 21 21 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); } 23 23 } ; 24 24 … … 37 37 smorph_player(super_morph *m, palette *pal, image *i1, image *i2, int frames, int dir); 38 38 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); } 40 40 } ; 41 41 -
abuse/trunk/src/imlib/timage.cpp
r115 r129 100 100 char st[80]; 101 101 sprintf(st,"trans_image::data (%s)",name); 102 data=(uint8_t *) jmalloc(size,st);102 data=(uint8_t *)malloc(size); 103 103 #else 104 data=(uint8_t *) jmalloc(size,"");104 data=(uint8_t *)malloc(size); 105 105 #endif 106 106 int ww=im->width(),hh=im->height(); -
abuse/trunk/src/imlib/timage.hpp
r124 r129 15 15 #include "palette.hpp" 16 16 #include "filter.hpp" 17 #include "jmalloc.hpp"18 17 19 18 /* data is stored in the following format … … 61 60 int size(); 62 61 image *make_image(); 63 ~trans_image() { jfree(data); }62 ~trans_image() { free(data); } 64 63 } ; 65 64 -
abuse/trunk/src/imlib/unpackgl.cpp
r124 r129 14 14 15 15 #include "system.h" 16 #include "jmalloc.hpp"17 16 #include "macs.hpp" 18 17 … … 59 58 bufsize=0xf000; 60 59 do { 61 buf=(char *) jmalloc(bufsize,"unpack_gl::buffer");60 buf=(char *)malloc(bufsize); 62 61 if (!buf) bufsize-=100; 63 62 } while (!buf); … … 72 71 length-=amread; 73 72 } 74 jfree(buf);73 free(buf); 75 74 if (ot) fclose(ot); 76 75 } -
abuse/trunk/src/imlib/visobj.cpp
r124 r129 25 25 string_visual::string_visual(char *string, int Color) 26 26 { 27 st=strcpy((char *) jmalloc(strlen(string)+1,"string visual"),string);27 st=strcpy((char *)malloc(strlen(string)+1),string); 28 28 color=Color; 29 29 w=-1; -
abuse/trunk/src/imlib/xwdread.cpp
r124 r129 522 522 bytes=(im->width()+3)/4; 523 523 bytes*=4; 524 scrap=(char *) jmalloc(bytes,"xwd_read scrap");524 scrap=(char *)malloc(bytes); 525 525 for (i=im->height();i;i--) 526 526 { … … 528 528 memcpy(im->scan_line(i-1),scrap,im->width()); 529 529 } 530 jfree(scrap);530 free(scrap); 531 531 fclose(fp); 532 532 return im; -
abuse/trunk/src/innet.cpp
r126 r129 159 159 fman=new file_manager(argc,argv,prot); // manages remote file access 160 160 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); 162 162 base->join_list=NULL; 163 163 base->mem_lock=0; … … 184 184 { 185 185 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; 187 187 if (game_sock) { delete game_sock; game_sock=NULL; } 188 188 if (comm_sock) { delete comm_sock; comm_sock=NULL; } -
abuse/trunk/src/items.cpp
r124 r129 29 29 } 30 30 31 inside=(uint8_t *) jmalloc(tot,"Boundary point list");31 inside=(uint8_t *)malloc(tot); 32 32 } 33 33 … … 115 115 if (tot) 116 116 { 117 inside=(uint8_t *) jmalloc(tot,"Boundary point list");117 inside=(uint8_t *)malloc(tot); 118 118 } else inside=NULL; 119 119 for (i=0,point_on=data;i<tot-1;i++) -
abuse/trunk/src/items.hpp
r124 r129 26 26 uint8_t *inside; // tells which side of the line is on the inside 27 27 boundary(boundary *p); // flips the *inside list 28 ~boundary() { if (tot) jfree(inside); }28 ~boundary() { if (tot) free(inside); } 29 29 } ; 30 30 -
abuse/trunk/src/level.cpp
r124 r129 76 76 void level::load_fail() 77 77 { 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; 81 81 82 82 first_active=NULL; … … 111 111 { 112 112 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); 118 118 } 119 119 … … 835 835 836 836 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)); 838 838 memset(new_fg,0,w*h*sizeof(int16_t)); 839 839 … … 843 843 calc_bgsize(w,h,nbw,nbh); 844 844 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)); 846 846 memset(new_bg,0,(int)nbw*(int)nbh*sizeof(int16_t)); 847 847 … … 857 857 new_bg[x+y*nbw]=get_bg(x,y); 858 858 859 jfree(map_fg);860 jfree(map_bg);859 free(map_fg); 860 free(map_bg); 861 861 map_fg=new_fg; 862 862 map_bg=new_bg; … … 898 898 /******************************* Read debug info ******************************/ 899 899 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); 901 901 char old_name[150]; 902 902 for (i=0;i<old_tot;i++) … … 913 913 /***************************** Read state names *********************************/ 914 914 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); 916 916 for (i=0;i<old_stot;i++) 917 917 { … … 1005 1005 } 1006 1006 1007 1008 1009 jfree(o_remap); 1010 jfree(s_remap); 1007 free(o_remap); 1008 free(s_remap); 1011 1009 } 1012 1010 … … 1034 1032 return ; 1035 1033 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); 1038 1036 memset(o_backmap,0xff,total_objects*2); 1039 1037 char old_name[150]; … … 1052 1050 1053 1051 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)); 1057 1055 fp->seek(se->offset,0); 1058 1056 int i=0; … … 1063 1061 if (t) 1064 1062 { 1065 s_remap[i]=(int16_t *) jmalloc(t*sizeof(int16_t),"state remap");1063 s_remap[i]=(int16_t *)malloc(t*sizeof(int16_t)); 1066 1064 int j=0; 1067 1065 for (;j<t;j++) … … 1094 1092 if (se) 1095 1093 { 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)); 1098 1096 1099 1097 fp->seek(se->offset,0); … … 1105 1103 if (t) 1106 1104 { 1107 v_remap[i]=(int16_t *) jmalloc(t*sizeof(int16_t),"var remap");1105 v_remap[i]=(int16_t *)malloc(t*sizeof(int16_t)); 1108 1106 memset(v_remap[i],0xff,t*sizeof(int16_t)); 1109 1107 } else { v_remap[i]=NULL; } … … 1256 1254 { 1257 1255 if (s_remap_totals[k]) 1258 jfree(s_remap[k]);1256 free(s_remap[k]); 1259 1257 } 1260 1258 … … 1263 1261 { 1264 1262 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); 1273 1271 } 1274 1272 … … 1298 1296 sprintf(cmd,symbol_str("loading"),lev_name); 1299 1297 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); 1301 1299 1302 1300 e=sd->find("first name"); … … 1305 1303 fp->seek(e->offset,0); 1306 1304 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); 1308 1306 fp->read(first_name,len); // read the string 1309 1307 } else 1310 1308 { 1311 first_name=(char *) jmalloc(strlen(Name)+1,"level first name");1309 first_name=(char *)malloc(strlen(Name)+1); 1312 1310 strcpy(first_name,Name); 1313 1311 } … … 1321 1319 fg_width=fp->read_uint32(); 1322 1320 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); 1324 1322 fp->read((char *)map_fg,2*fg_width*fg_height); 1325 1323 int t=fg_width*fg_height; … … 1339 1337 bg_width=fp->read_uint32(); 1340 1338 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); 1342 1340 fp->read((char *)map_bg,2*bg_width*bg_height); 1343 1341 int t=bg_width*bg_height; … … 1354 1352 fg_width=bg_width; 1355 1353 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); 1357 1355 memset(map_fg,0,2*fg_width*fg_height); 1358 1356 } … … 1362 1360 bg_width=fg_width/8+8; 1363 1361 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); 1365 1363 memset(map_bg,0,2*bg_width*bg_height); 1366 1364 } … … 2217 2215 else 2218 2216 { 2217 uint8_t buf[0x1000]; 2219 2218 int32_t size = fp->file_size(); 2220 uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf");2221 2219 int tr = 1; 2222 2220 while( size && tr ) … … 2227 2225 size -= tr; 2228 2226 } 2229 jfree(buf);2230 2227 } 2231 2228 delete bk; … … 2241 2238 { 2242 2239 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 ); 2245 2242 strcpy( first_name, name ); 2246 2243 } … … 2381 2378 calc_bgsize(fg_width,fg_height,bg_width,bg_height); 2382 2379 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); 2385 2382 2386 2383 … … 3117 3114 { 3118 3115 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); 3121 3117 } 3122 3118 attack_list[attack_total]=who; … … 3131 3127 { 3132 3128 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); 3135 3130 } 3136 3131 target_list[target_total]=who; … … 3145 3140 { 3146 3141 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); 3149 3143 } 3150 3144 block_list[block_total]=who; … … 3158 3152 { 3159 3153 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); 3162 3155 } 3163 3156 all_block_list[all_block_total]=who; -
abuse/trunk/src/level.hpp
r124 r129 98 98 level(int width, int height, char const *name); 99 99 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); } 101 101 void set_size(int w, int h); 102 102 void remove_light(light_source *which); -
abuse/trunk/src/light.cpp
r125 r129 204 204 void calc_light_table(palette *pal) 205 205 { 206 white_light_initial=(uint8_t *) jmalloc(256*64,"light table");206 white_light_initial=(uint8_t *)malloc(256*64); 207 207 white_light=white_light_initial; 208 208 209 // green_light=(uint8_t *) jmalloc(256*64,"green light");209 // green_light=(uint8_t *)malloc(256*64); 210 210 int i = 0; 211 211 for( ; i < TTINTS; i++ ) 212 212 { 213 tints[i] = (uint8_t *) jmalloc( 256, "color tint");213 tints[i] = (uint8_t *)malloc( 256 ); 214 214 } 215 215 216 216 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 ); 218 218 sprintf( lightpath, "%slight.tbl", get_save_filename_prefix() ); 219 219 … … 235 235 fp->read(tints[i],256); 236 236 fp->read(bright_tint,256); 237 // trans_table=(uint8_t *) jmalloc(256*256,"transparency table");237 // trans_table=(uint8_t *)malloc(256*256); 238 238 // fp.read(trans_table,256*256); 239 239 } … … 329 329 stat_man->pop(); 330 330 /* 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); 332 332 333 333 uint8_t *tp=trans_table; … … 366 366 delete f; 367 367 } 368 jfree( lightpath );368 free( lightpath ); 369 369 } 370 370 … … 376 376 if (total) 377 377 { 378 p->lights=(light_source **) jmalloc(total*sizeof(light_source *),"light patches");378 p->lights=(light_source **)malloc(total*sizeof(light_source *)); 379 379 memcpy(p->lights,lights,total*(sizeof(light_source *))); 380 380 } … … 460 460 461 461 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); 463 463 p->lights[p->total-1]=who; 464 464 return ; … … 478 478 if (p->total==MAX_LP) return ; 479 479 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); 481 481 p->lights[p->total-1]=who; 482 482 return ; … … 786 786 int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run); 787 787 788 uint8_t *remap_line=(uint8_t *) jmalloc(remap_size,"light remap line");788 uint8_t *remap_line=(uint8_t *)malloc(remap_size); 789 789 790 790 light_patch *f=first; … … 891 891 delete p; 892 892 } 893 jfree(remap_line);893 free(remap_line); 894 894 } 895 895 … … 963 963 int32_t remap_size=((cx2-cx1+1-prefix-suffix)>>lx_run); 964 964 965 uint8_t *remap_line=(uint8_t *) jmalloc(remap_size,"light remap line");965 uint8_t *remap_line=(uint8_t *)malloc(remap_size); 966 966 967 967 light_patch *f=first; … … 1102 1102 delete p; 1103 1103 } 1104 jfree(remap_line);1104 free(remap_line); 1105 1105 } 1106 1106 -
abuse/trunk/src/light.hpp
r124 r129 56 56 void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who); 57 57 light_patch *copy(light_patch *Next); 58 ~light_patch() { if (total) jfree(lights); }58 ~light_patch() { if (total) free(lights); } 59 59 } ; 60 60 -
abuse/trunk/src/lisp/lisp.cpp
r125 r129 25 25 #else 26 26 #include "status.hpp" 27 #include "jmalloc.hpp"28 27 #include "macs.hpp" 29 28 #include "specs.hpp" … … 862 861 current_space=PERM_SPACE; // make sure all symbols get defined in permanant space 863 862 864 p=(lisp_symbol *) jmalloc(sizeof(lisp_symbol),"lsymbol");863 p=(lisp_symbol *)malloc(sizeof(lisp_symbol)); 865 864 p->type=L_SYMBOL; 866 865 p->name=new_lisp_string(name); … … 889 888 ldelete_syms(root->left); 890 889 ldelete_syms(root->right); 891 jfree(root);890 free(root); 892 891 } 893 892 } … … 1646 1645 if (!num_args) return 0; 1647 1646 1648 void **arg_on=(void **) jmalloc(sizeof(void *)*num_args,"mapcar tmp array");1647 void **arg_on=(void **)malloc(sizeof(void *)*num_args); 1649 1648 cons_cell *list_on=(cons_cell *)CDR(arg_list); 1650 1649 long old_ptr_son=l_ptr_stack.son; … … 1661 1660 if (stop) 1662 1661 { 1663 jfree(arg_on);1662 free(arg_on); 1664 1663 return NULL; 1665 1664 } … … 1704 1703 l_ptr_stack.son=old_ptr_son; 1705 1704 1706 jfree(arg_on);1705 free(arg_on); 1707 1706 return return_list; 1708 1707 } … … 1722 1721 else 1723 1722 { 1724 void **str_eval=(void **) jmalloc(elements*sizeof(void *),"tmp eval array");1723 void **str_eval=(void **)malloc(elements*sizeof(void *)); 1725 1724 int i,old_ptr_stack_start=l_ptr_stack.son; 1726 1725 … … 1784 1783 } 1785 1784 } 1786 jfree(str_eval);1785 free(str_eval); 1787 1786 l_ptr_stack.son=old_ptr_stack_start; // restore pointer GC stack 1788 1787 *s=0; … … 2409 2408 { 2410 2409 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 ); 2412 2411 sprintf( gammapath, "%sgamma.lsp", get_save_filename_prefix() ); 2413 2412 fp = new jFILE( gammapath, "rb" ); 2414 jfree( gammapath );2413 free( gammapath ); 2415 2414 } 2416 2415 else … … 2434 2433 { 2435 2434 long l=fp->file_size(); 2436 char *s=(char *) jmalloc(l+1,"loaded script");2435 char *s=(char *)malloc(l + 1); 2437 2436 if (!s) 2438 2437 { … … 2468 2467 if (stat_man) stat_man->pop(); 2469 2468 #endif 2470 jfree(s);2469 free(s); 2471 2470 ret=fn; 2472 2471 } … … 3200 3199 } else if (free_space[TMP_SPACE]==space[TMP_SPACE]) 3201 3200 { 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); 3203 3202 space_size[TMP_SPACE]=new_size; 3204 3203 dprintf("Lisp : tmp space resized to %d\n",new_size); … … 3212 3211 lsym_root=NULL; 3213 3212 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); 3215 3214 space_size[0]=perm_size; 3216 3215 3217 3216 3218 free_space[1]=space[1]=(char *) jmalloc(tmp_size,"lisp tmp space");3217 free_space[1]=space[1]=(char *)malloc(tmp_size); 3219 3218 space_size[1]=tmp_size; 3220 3219 … … 3234 3233 void lisp_uninit() 3235 3234 { 3236 jfree(space[0]);3237 jfree(space[1]);3235 free(space[0]); 3236 free(space[1]); 3238 3237 ldelete_syms(lsym_root); 3239 3238 lsym_root=NULL; -
abuse/trunk/src/lisp/lisp_gc.cpp
r124 r129 17 17 #include "fakelib.hpp" 18 18 #else 19 #include "jmalloc.hpp"20 19 #include "macs.hpp" 21 20 #endif … … 46 45 { 47 46 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); 49 48 } 50 49 reg_ptr_list[reg_ptr_total++]=addr; … … 257 256 258 257 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]); 260 259 current_space=GC_SPACE; 261 260 free_space[GC_SPACE]=space[GC_SPACE]=(char *)new_space; … … 268 267 269 268 memset(space[which_space],0,space_size[which_space]); // for debuging clear it out 270 jfree(space[which_space]);269 free(space[which_space]); 271 270 272 271 space[which_space]=(char *)new_space; -
abuse/trunk/src/lisp/stack.hpp
r124 r129 12 12 13 13 #include <stdio.h> 14 15 #ifndef NO_LIBS 16 # include "jmalloc.hpp" 17 #else 18 # include "fakelib.hpp" 19 #endif 14 #include <stdlib.h> 20 15 21 16 // A fixed-size stack class … … 34 29 smax = max_size; 35 30 son = 0; 36 sdata = (T **) jmalloc(sizeof(T *) * smax, "pointer stack");31 sdata = (T **)malloc(sizeof(T *) * smax); 37 32 } 38 33 … … 63 58 if(son != 0) 64 59 fprintf(stderr, "warning: cleaning up stack and not empty\n"); 65 jfree(sdata);60 free(sdata); 66 61 sdata = NULL; 67 62 son = 0; -
abuse/trunk/src/loader2.cpp
r124 r129 141 141 int fon=nforetiles,bon=nbacktiles; 142 142 if (ft) 143 foretiles=(int *) jrealloc(foretiles,sizeof(int)*(nforetiles+ft),"foretile id array ptrs");143 foretiles=(int *)realloc(foretiles,sizeof(int)*(nforetiles+ft)); 144 144 if (bt) 145 backtiles=(int *) jrealloc(backtiles,sizeof(int)*(nbacktiles+bt),"foretile id array ptrs");145 backtiles=(int *)realloc(backtiles,sizeof(int)*(nbacktiles+bt)); 146 146 147 147 for (i=0;i<sd.total;i++) … … 218 218 if (nbacktiles>old_bsize) 219 219 { 220 backtiles=(int *) jrealloc(backtiles,sizeof(int)*nbacktiles,"backtile id array ptrs");220 backtiles=(int *)realloc(backtiles,sizeof(int)*nbacktiles); 221 221 memset(backtiles+old_bsize,-1,(nbacktiles-old_bsize)*sizeof(int)); 222 222 } … … 224 224 if (nforetiles>old_fsize) 225 225 { 226 foretiles=(int *) jrealloc(foretiles,sizeof(int)*nforetiles,"foretile id array ptrs");226 foretiles=(int *)realloc(foretiles,sizeof(int)*nforetiles); 227 227 memset(foretiles+old_fsize,-1,(nforetiles-old_fsize)*sizeof(int)); 228 228 } … … 296 296 297 297 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 ); 299 299 sprintf( cachepath, "%ssd_cache.tmp", get_save_filename_prefix() ); 300 300 … … 401 401 if (total_help_screens) 402 402 { 403 help_screens=(int *) jmalloc(sizeof(int)*total_help_screens,"help image ids");403 help_screens=(int *)malloc(sizeof(int)*total_help_screens); 404 404 v=CDR(symbol_value(l_help_screens)); 405 405 int i=0; … … 472 472 past_startup = 1; 473 473 #if 0 474 jfree( cachepath );474 free( cachepath ); 475 475 #endif 476 476 } … … 494 494 495 495 long l=fp->file_size(); 496 s=(char *) jmalloc(l+1,"loaded script");496 s=(char *)malloc(l+1); 497 497 ERROR(s,"Malloc error in load_script"); 498 498 -
abuse/trunk/src/ltree.cpp
r124 r129 45 45 } 46 46 47 p= jmalloc(sizeof(lisp_symbol),"lsymbol");47 p=malloc(sizeof(lisp_symbol)); 48 48 p->type=L_SYMBOL; 49 49 p->name=new_lisp_string(name); -
abuse/trunk/src/newlight.cpp
r124 r129 185 185 void calc_light_table(palette *pal) 186 186 { 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); 189 189 for (int i=0;i<TTINTS;i++) 190 tints[i]=(uchar *) jmalloc(256,"color tint");190 tints[i]=(uchar *)malloc(256); 191 191 192 192 jFILE fp("light.tbl","rb"); … … 300 300 if (total) 301 301 { 302 p->lights=(light_source **) jmalloc(total*sizeof(light_source *),"light patches");302 p->lights=(light_source **)malloc(total*sizeof(light_source *)); 303 303 memcpy(p->lights,lights,total*(sizeof(light_source *))); 304 304 } … … 348 348 p->x1=x1; p->y1=y1; p->x2=x2; p->y2=y2; 349 349 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); 351 351 p->lights[p->total-1]=who; 352 352 return ; … … 366 366 if (p->total==MAX_LP) return ; 367 367 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); 369 369 p->lights[p->total-1]=who; 370 370 return ; -
abuse/trunk/src/objects.cpp
r126 r129 341 341 game_object::~game_object() 342 342 { 343 if (lvars) jfree(lvars);343 if (lvars) free(lvars); 344 344 clean_up(); 345 345 } … … 1563 1563 if (t) 1564 1564 { 1565 lvars=(int32_t *) jmalloc(t*4,"object vars");1565 lvars=(int32_t *)malloc(t * 4); 1566 1566 memset(lvars,0,t*4); 1567 1567 } … … 1620 1620 void game_object::change_type(int new_type) 1621 1621 { 1622 if (lvars) jfree(lvars); // free old variable1622 if (lvars) free(lvars); // free old variable 1623 1623 1624 1624 if (otype<0xffff) … … 1627 1627 if (t) 1628 1628 { 1629 lvars=(int32_t *) jmalloc(t*4,"object vars");1629 lvars=(int32_t *)malloc(t*4); 1630 1630 memset(lvars,0,t*4); 1631 1631 } -
abuse/trunk/src/old.nfclient.cpp
r124 r129 145 145 { 146 146 int ret=new_read(buf,count); 147 void *comp= jmalloc(count,"compare");147 void *comp=malloc(count); 148 148 /* ::read(check_fd,comp,count); 149 149 if (memcmp(comp,buf,count)) … … 151 151 printf("bad read!\n"); 152 152 } 153 jfree(comp);*/153 free(comp);*/ 154 154 return ret; 155 155 } -
abuse/trunk/src/old.nfserver.cpp
r124 r129 49 49 delete file_list[i]; 50 50 if (file_list) 51 jfree(file_list);51 free(file_list); 52 52 } 53 53 … … 64 64 // we need to enlarge the file_list 65 65 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); 67 67 file_list[file_list_size-1]=fp; 68 68 return file_list_size-1; -
abuse/trunk/src/old_server.cpp
r124 r129 623 623 { fputs(re,stderr); exit(0); } 624 624 rand_on=lstl(rand_on); 625 uint16_t *rtab=(uint16_t *)jmalloc(1024*2,"tmp rtab");625 uint16_t rtab[1024]; 626 626 if (!pk.read((uint8_t *)rtab,1024*2)) { fputs(re,stderr); exit(0); } // read the rand table 627 627 … … 629 629 if (((uint8_t *)rtab)[j]!=((uint8_t *)rtable)[j]) 630 630 { printf("rtables differ on byte %d\n",j); exit(0); } 631 632 jfree(rtab);633 634 635 631 636 632 if (last) -
abuse/trunk/src/oldhelp.cpp
r124 r129 23 23 FILE *fp=fopen("help.txt","r"); 24 24 if (!fp) 25 return strcpy((char *) jmalloc(40,"Help missing error string"),"help.txt missing");25 return strcpy((char *)malloc(40),"help.txt missing"); 26 26 else 27 27 { … … 35 35 { 36 36 fclose(fp); 37 return strcpy((char *) jmalloc(30,"help : page missing string"),"missing page");37 return strcpy((char *)malloc(30),"missing page"); 38 38 } 39 39 … … 45 45 { 46 46 fclose(fp); 47 return strcpy((char *) jmalloc(strlen(tmp)+1,"help page"),tmp);47 return strcpy((char *)malloc(strlen(tmp)+1),tmp); 48 48 } 49 49 else strcat(tmp,line); … … 124 124 wm->font()->put_string(s,0,yres-10,"Missing image!"); 125 125 delete fp; 126 jfree(ho);126 free(ho); 127 127 return ; 128 128 } … … 169 169 if (*h) h++; 170 170 } 171 jfree(ho);171 free(ho); 172 172 delete fp; 173 173 } -
abuse/trunk/src/particle.cpp
r123 r129 27 27 delete pseqs[i]; 28 28 if (total_pseqs) 29 jfree(pseqs);29 free(pseqs); 30 30 } 31 31 32 32 part_frame::~part_frame() 33 33 { 34 jfree(data);34 free(data); 35 35 } 36 36 … … 72 72 set_symbol_number(sym,total_pseqs); // set the symbol value to the object number 73 73 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)); 75 75 76 76 args=lcdr(args); … … 105 105 for (;i<sd.total;i++) 106 106 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); 108 108 109 109 int on=0; … … 117 117 { 118 118 t=fp->read_uint32(); 119 data=(part *) jmalloc(sizeof(part)*t,"particle frame");119 data=(part *)malloc(sizeof(part)*t); 120 120 x1=y1=100000; x2=y2=-100000; 121 121 for (int i=0;i<t;i++) -
abuse/trunk/src/particle.hpp
r57 r129 45 45 int *frames; // array of id's 46 46 part_sequence(void *args); 47 ~part_sequence() { if (tframes) jfree(frames); }47 ~part_sequence() { if (tframes) free(frames); } 48 48 } ; 49 49 -
abuse/trunk/src/points.cpp
r124 r129 20 20 if (tot) 21 21 { 22 data=(unsigned char *) jmalloc((int)how_many*2,"point list");22 data=(unsigned char *)malloc((int)how_many*2); 23 23 memcpy(data,Data,(int)tot*2); 24 24 } else data=NULL; … … 30 30 if (tot) 31 31 { 32 data=(unsigned char *) jmalloc((int)tot*2,"point list : loaded");32 data=(unsigned char *)malloc((int)tot*2); 33 33 fp->read(data,(int)tot*2); 34 34 -
abuse/trunk/src/points.hpp
r57 r129 10 10 #ifndef __POINTS_HPP_ 11 11 #define __POINTS_HPP_ 12 12 13 #include <stdio.h> 13 14 #include <stdlib.h> 14 #include "jmalloc.hpp" 15 15 16 #include "specs.hpp" 16 17 … … 26 27 long size() { return 1+2*tot; } 27 28 point_list *copy() { return new point_list(tot,data); } 28 ~point_list() { if (tot) { jfree(data); } }29 ~point_list() { if (tot) { free(data); } } 29 30 } ; 30 31 -
abuse/trunk/src/profile.cpp
r124 r129 52 52 { 53 53 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); 55 55 profile_reset(); 56 56 … … 79 79 void profile_uninit() 80 80 { 81 if (prof_list) jfree(prof_list);81 if (prof_list) free(prof_list); 82 82 prof_list=NULL; 83 83 if (prof_win) { wm->close_window(prof_win); prof_win=NULL; } -
abuse/trunk/src/property.cpp
r124 r129 14 14 15 15 #include "property.hpp" 16 #include "jmalloc.hpp"17 16 #include "dprint.hpp" 18 17 #include "game.hpp" … … 25 24 int def_num; 26 25 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); 28 27 def_num=Def; 29 28 def_str=NULL; … … 32 31 33 32 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); 36 35 next=NULL; 37 36 } … … 40 39 { if (def_str) 41 40 { 42 jfree(def_str);41 free(def_str); 43 42 def_str=NULL; 44 43 } … … 50 49 if (def_str) 51 50 { 52 jfree(def_str);51 free(def_str); 53 52 def_str=NULL; 54 53 } 55 def_str=strcpy((char *) jmalloc(strlen(x)+1,"Property text"),x);54 def_str=strcpy((char *)malloc(strlen(x)+1),x); 56 55 } 57 56 … … 59 58 { 60 59 if (def_str) 61 jfree(def_str);62 jfree(name);60 free(def_str); 61 free(name); 63 62 } 64 63 property *next; -
abuse/trunk/src/ramfile.cpp
r56 r129 13 13 { 14 14 buf_size=2048; 15 buf=(uchar *) jmalloc(buf_size,"ram file buffer");15 buf=(uchar *)malloc(buf_size); 16 16 buf_end=0; 17 17 } -
abuse/trunk/src/scene.cpp
r124 r129 34 34 { l=Left; 35 35 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); } 39 39 char *name() { return n; } 40 40 string_node *left() { return l; } … … 115 115 116 116 scene_sequence::~scene_sequence() 117 { jfree(n);117 { free(n); 118 118 while (first) 119 119 { scene_frame *p=first; … … 132 132 133 133 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); 135 135 cur=first=new scene_frame(s); 136 136 … … 216 216 int y() { return the_game->screeny(me->y)-cache.fig(current_frame->picture)->forward->height(); } 217 217 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; } 219 219 } ; 220 220 … … 271 271 expect(get_token(s,tmp),sLEFT_PAREN,s); 272 272 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); 274 274 expect(get_token(s,tmp),sNUMBER,s); 275 275 … … 487 487 text_blocker *text_blockers=NULL; 488 488 489 char *strng=(char *) jmalloc(MAX_SCROLL_DATA,"tmp token space");489 char *strng=(char *)malloc(MAX_SCROLL_DATA); 490 490 strcpy(scene_filename,filename); 491 491 … … 706 706 next_token(s); 707 707 708 jfree(strng);708 free(strng); 709 709 screen->set_clip(cx1,cy1,cx2,cy2); 710 710 -
abuse/trunk/src/sdlport/jdir.cpp
r124 r129 27 27 #include <unistd.h> 28 28 29 #include "jmalloc.hpp"30 31 29 void get_directory(char *path, char **&files, int &tfiles, char **&dirs, int &tdirs) 32 30 { … … 53 51 { 54 52 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); 57 55 } 58 56 } while( de ); … … 65 63 { 66 64 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]); 69 67 closedir( d ); 70 68 } … … 72 70 { 73 71 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]); 76 74 } 77 jfree( tlist[i] );75 free( tlist[i] ); 78 76 } 79 77 if( t ) 80 jfree( tlist );78 free( tlist ); 81 79 chdir( curdir ); 82 80 } -
abuse/trunk/src/sdlport/jnet.cpp
r124 r129 38 38 #include "jnet.hpp" 39 39 #include "macs.hpp" 40 #include "jmalloc.hpp"41 40 42 41 int current_sock_err; -
abuse/trunk/src/sdlport/jnet.hpp
r124 r129 57 57 // 4 (net number) 6 node number for IPX 58 58 59 uchar *get_local_address(); // same format as above (be sure to jfree this)59 uchar *get_local_address(); // same format as above (be sure to free this) 60 60 61 61 -
abuse/trunk/src/sdlport/setup.cpp
r124 r129 128 128 char *result; 129 129 130 rcfile = (char *) jmalloc( strlen( get_save_filename_prefix() ) + 9, "rcfile");130 rcfile = (char *)malloc( strlen( get_save_filename_prefix() ) + 9 ); 131 131 sprintf( rcfile, "%s/abuserc", get_save_filename_prefix() ); 132 132 if( (fd = fopen( rcfile, "r" )) != NULL ) … … 247 247 createRCFile( rcfile ); 248 248 } 249 jfree( rcfile );249 free( rcfile ); 250 250 } 251 251 … … 387 387 if( (homedir = getenv( "HOME" )) != NULL ) 388 388 { 389 savedir = (char *) jmalloc( strlen( homedir ) + 9, "savedir");389 savedir = (char *)malloc( strlen( homedir ) + 9 ); 390 390 sprintf( savedir, "%s/.abuse/", homedir ); 391 391 // Check if we already have a savegame directory … … 400 400 } 401 401 set_save_filename_prefix( savedir ); 402 jfree( savedir );402 free( savedir ); 403 403 } 404 404 else -
abuse/trunk/src/sdlport/sound.cpp
r124 r129 23 23 24 24 #include "sound.hpp" 25 #include "jmalloc.hpp"26 25 #include "readwav.hpp" 27 26 #include "specs.hpp" … … 127 126 // Check for the sfx directory, disable sound if we can't find it. 128 127 datadir = get_filename_prefix(); 129 sfxdir = (char *) jmalloc( strlen( datadir ) + 5 + 1, "sfxdir");128 sfxdir = (char *)malloc( strlen( datadir ) + 5 + 1 ); 130 129 sprintf( sfxdir, "%s/sfx/", datadir ); 131 130 if( (fd = fopen( sfxdir,"r" )) == NULL ) … … 135 134 return 0; 136 135 } 137 jfree( sfxdir );136 free( sfxdir ); 138 137 139 138 audioWanted.freq = 11025; … … 174 173 effect_handle *last = fx_list; 175 174 fx_list = fx_list->next; 176 jfree( last );175 free( last ); 177 176 } 178 177 SDL_CloseAudio(); … … 205 204 if( data ) 206 205 { 207 jfree( data );206 free( data ); 208 207 } 209 208 } … … 296 295 { 297 296 data = NULL; 298 Name = strcpy((char *) jmalloc( strlen( filename ) + 1, "song name"), filename );297 Name = strcpy((char *)malloc( strlen( filename ) + 1 ), filename ); 299 298 song_id = 0; 300 299 } … … 308 307 if( data ) 309 308 { 310 jfree( data );311 } 312 jfree( Name );309 free( data ); 310 } 311 free( Name ); 313 312 } 314 313 -
abuse/trunk/src/sdlport/video-overlay.cpp
r124 r129 28 28 #include "macs.hpp" 29 29 #include "image.hpp" 30 #include "jmalloc.hpp"31 30 #include "setup.h" 32 31 … … 346 345 else 347 346 { 348 data = (unsigned char *) jmalloc( width * height, "image::data");347 data = (unsigned char *)malloc(width * height); 349 348 } 350 349 } … … 357 356 if( !special || !special->static_mem ) 358 357 { 359 jfree( data );358 free( data ); 360 359 } 361 360 } -
abuse/trunk/src/sdlport/video.cpp
r124 r129 35 35 #include "macs.hpp" 36 36 #include "image.hpp" 37 #include "jmalloc.hpp"38 37 #include "setup.h" 39 38 … … 411 410 { 412 411 if( page_buffer ) 413 {414 412 data = page_buffer; 415 }416 413 else 417 { 418 data = (unsigned char *)jmalloc( width * height, "image::data" ); 419 } 414 data = (unsigned char *)malloc( width * height ); 420 415 } 421 416 … … 426 421 { 427 422 if( !special || !special->static_mem ) 428 { 429 jfree( data ); 430 } 423 free( data ); 431 424 } 432 425 -
abuse/trunk/src/seq.cpp
r124 r129 42 42 total=list_length(pict_list); 43 43 44 seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array");44 seq=(int *) malloc(sizeof(int)*total); 45 45 if (item_type(pict_list)==L_STRING) 46 46 seq[0]=cache.reg_object(filename,pict_list,SPEC_CHARACTER2,1); … … 58 58 sequence::~sequence() 59 59 { 60 jfree(seq);60 free(seq); 61 61 } 62 62 … … 87 87 88 88 s=picts; 89 seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array");89 seq=(int *) malloc(sizeof(int)*total); 90 90 91 91 for (i=0;i<total;) -
abuse/trunk/src/smoosh.cpp
r124 r129 10 10 #include "config.h" 11 11 12 #include "jmalloc.hpp"13 12 #define PARTICLE_SIZE 2 // 2x2 block of pixels 14 13 … … 20 19 particle *left,*right,*up,*down; 21 20 particle(int X, int Y, int size); 22 ~particle() { jfree(pict); }21 ~particle() { free(pict); } 23 22 } ; 24 23 … … 27 26 x=X; y=Y; 28 27 left=right=up=down=NULL; 29 pict=(unsigned char *) jmalloc(size*size,"Particle");28 pict=(unsigned char *)malloc(size*size); 30 29 } 31 30 -
abuse/trunk/src/specache.hpp
r124 r129 25 25 filename_node(char const *filename, spec_directory *dir) 26 26 { 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); 28 28 sd=dir; 29 29 next=left=right=0; -
abuse/trunk/src/status.cpp
r124 r129 39 39 time_marker last_update; 40 40 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); 42 42 show=Show; 43 43 next=Next; 44 44 } 45 ~status_node() { jfree(name); if (show) delete show; }45 ~status_node() { free(name); if (show) delete show; } 46 46 } 47 47 -
abuse/trunk/src/view.cpp
r126 r129 44 44 if (total_weapons) 45 45 { 46 jfree(weapons);47 jfree(last_weapons);46 free(weapons); 47 free(last_weapons); 48 48 } 49 49 } … … 254 254 if (total_weapons) 255 255 { 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)); 258 258 memset(weapons,0xff,total_weapons*sizeof(int32_t)); // set all to -1 259 259 memset(last_weapons,0xff,total_weapons*sizeof(int32_t)); // set all to -1
Note: See TracChangeset
for help on using the changeset viewer.