Skip to content

Commit 8f2f14b

Browse files
committed
We don't need user property for memory blocks
1 parent 1d3ccd1 commit 8f2f14b

21 files changed

+82
-105
lines changed

d_mapinfo.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static char *G_MapinfoSectionCStr(const char* buf, const char *name, char *outme
330330
if (outmem)
331331
newstr = outmem;
332332
else
333-
newstr = Z_Malloc(sectionlen + 1, PU_STATIC, NULL);
333+
newstr = Z_Malloc(sectionlen + 1, PU_STATIC);
334334
D_memcpy(newstr, section, sectionlen);
335335
newstr[sectionlen] = '\0';
336336

@@ -429,7 +429,7 @@ dmapinfo_t **G_LoadMaplist(int *pmapcount)
429429
if (!mapcount)
430430
return NULL;
431431

432-
maplist = Z_Malloc(sizeof(*maplist) * (mapcount + 1), PU_STATIC, NULL);
432+
maplist = Z_Malloc(sizeof(*maplist) * (mapcount + 1), PU_STATIC);
433433

434434
i = 0;
435435

@@ -444,7 +444,7 @@ dmapinfo_t **G_LoadMaplist(int *pmapcount)
444444
if (!section)
445445
break;
446446

447-
mi = Z_Malloc(sizeof(dmapinfo_t) + sectionlen + 1, PU_STATIC, NULL);
447+
mi = Z_Malloc(sizeof(dmapinfo_t) + sectionlen + 1, PU_STATIC);
448448
zsection = (char *)mi + sizeof(dmapinfo_t);
449449
D_memcpy(zsection, section, sectionlen);
450450
zsection[sectionlen] = '\0';

doomdef.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -610,17 +610,13 @@ long LongSwap (long dat);
610610
#define PU_MUSIC 3 /* static while playing */
611611
#define PU_LEVEL 50 /* static until level exited */
612612
#define PU_LEVSPEC 51 /* a special thinker in a level */
613-
/* tags >= 100 are purgable whenever needed */
614-
#define PU_PURGELEVEL 100
615-
#define PU_CACHE 101
616613

617614
#define ZONEID 0x1d4a
618615

619616

620617
typedef struct memblock_s
621618
{
622619
int size; /* including the header and possibly tiny fragments */
623-
void **user; /* NULL if a free block */
624620
short tag; /* purgelevel */
625621
short id; /* should be ZONEID */
626622
#ifndef MARS
@@ -647,10 +643,10 @@ extern memzone_t *refzone;
647643
void Z_Init (void);
648644
memzone_t *Z_InitZone (byte *base, int size);
649645

650-
void *Z_Malloc2 (memzone_t *mainzone, int size, int tag, void *user, boolean err);
646+
void *Z_Malloc2 (memzone_t *mainzone, int size, int tag, boolean err);
651647
void Z_Free2 (memzone_t *mainzone,void *ptr);
652648

653-
#define Z_Malloc(x,y,z) Z_Malloc2(mainzone,x,y,z,true)
649+
#define Z_Malloc(x,y) Z_Malloc2(mainzone,x,y,true)
654650
#define Z_Free(x) Z_Free2(mainzone,x)
655651

656652
void Z_FreeTags (memzone_t *mainzone);

f_main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void F_Start (void)
309309
else
310310
S_StartSong(gameinfo.endMus, 1, cdtrack_end);
311311

312-
fin = Z_Malloc(sizeof(*fin), PU_STATIC, NULL);
312+
fin = Z_Malloc(sizeof(*fin), PU_STATIC);
313313
D_memset(fin, 0, sizeof(*fin));
314314

315315
fin->status = fin_endtext; /* END TEXT PRINTS FIRST */
@@ -319,7 +319,7 @@ void F_Start (void)
319319
fin->text_x = STARTX;
320320
fin->text_y = STARTY;
321321
fin->drawbg = 3;
322-
fin->endobj = Z_Malloc(sizeof(*fin->endobj) * NUMENDOBJ, PU_STATIC, NULL);
322+
fin->endobj = Z_Malloc(sizeof(*fin->endobj) * NUMENDOBJ, PU_STATIC);
323323

324324
l = W_GetNumForName ("CHAR_097");
325325
for (i = 0; i < NUMENDOBJ; i++)

g_game.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ void G_Init(void)
473473
gamemapcount = mapcount;
474474
if (mapcount > 0)
475475
{
476-
gamemapnumbers = Z_Malloc(sizeof(*gamemapnumbers) * mapcount, PU_STATIC, 0);
477-
gamemaplumps = Z_Malloc(sizeof(*gamemaplumps) * mapcount, PU_STATIC, 0);
476+
gamemapnumbers = Z_Malloc(sizeof(*gamemapnumbers) * mapcount, PU_STATIC);
477+
gamemaplumps = Z_Malloc(sizeof(*gamemaplumps) * mapcount, PU_STATIC);
478478
for (i = 0; i < mapcount; i++)
479479
{
480480
gamemapnumbers[i] = tempmapnums[i*2];
@@ -719,7 +719,7 @@ int G_PlayDemoPtr (unsigned *demo)
719719

720720
void G_RecordDemo (void)
721721
{
722-
demo_p = demobuffer = Z_Malloc (0x8000, PU_STATIC, NULL);
722+
demo_p = demobuffer = Z_Malloc (0x8000, PU_STATIC);
723723

724724
*demo_p++ = startskill;
725725
*demo_p++ = startmap;

in_main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,14 @@ void IN_Start (void)
323323
int i,l;
324324
VINT *infaces;
325325

326-
interm = Z_Malloc(sizeof(*interm), PU_STATIC, 0);
326+
interm = Z_Malloc(sizeof(*interm), PU_STATIC);
327327
D_memset(interm, 0, sizeof(*interm));
328328

329329
interm->earlyexit = false;
330330

331331
interm->valsdrawn = false;
332332

333-
interm->nextmapinfo = Z_Malloc(sizeof(dmapinfo_t), PU_STATIC, 0);
333+
interm->nextmapinfo = Z_Malloc(sizeof(dmapinfo_t), PU_STATIC);
334334
D_memset(interm->nextmapinfo, 0, sizeof(dmapinfo_t));
335335

336336
if (gameaction == ga_secretexit && gamemapinfo.secretNext)

m_fire.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,19 @@ void I_InitMenuFire(jagobj_t *titlepic)
211211

212212
doompalette = W_POINTLUMPNUM(W_GetNumForName("PLAYPALS"));
213213

214-
m_fire = Z_Malloc(sizeof(*m_fire), PU_STATIC, NULL);
214+
m_fire = Z_Malloc(sizeof(*m_fire), PU_STATIC);
215215
D_memset(m_fire, 0, sizeof(*m_fire));
216216
m_fire->start_song = 1;
217217

218218
m_fire->firePalCols = sizeof(fireRGBs) / 3;
219-
m_fire->firePal = Z_Malloc(sizeof(*m_fire->firePal) * m_fire->firePalCols, PU_STATIC, NULL);
219+
m_fire->firePal = Z_Malloc(sizeof(*m_fire->firePal) * m_fire->firePalCols, PU_STATIC);
220220

221-
m_fire->firePix = Z_Malloc(sizeof(*m_fire->firePix) * FIRE_WIDTH * (FIRE_HEIGHT + 1), PU_STATIC, NULL);
221+
m_fire->firePix = Z_Malloc(sizeof(*m_fire->firePix) * FIRE_WIDTH * (FIRE_HEIGHT + 1), PU_STATIC);
222222
m_fire->firePix += FIRE_WIDTH;
223223
D_memset(m_fire->firePix, 0, sizeof(*m_fire->firePix) * FIRE_WIDTH * FIRE_HEIGHT);
224224

225225
m_fire->rndindex = 0;
226-
m_fire->rndtable = Z_Malloc(sizeof(*m_fire->rndtable) * 256, PU_STATIC, NULL);
226+
m_fire->rndtable = Z_Malloc(sizeof(*m_fire->rndtable) * 256, PU_STATIC);
227227

228228
m_fire->titlepic = titlepic;
229229
if (titlepic)

marssound.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void S_Init(void)
172172

173173
if (num_music > 0)
174174
{
175-
vgm_tracks = Z_Malloc(sizeof(*vgm_tracks) * num_music, PU_STATIC, 0);
175+
vgm_tracks = Z_Malloc(sizeof(*vgm_tracks) * num_music, PU_STATIC);
176176
for (i = 0; i < num_music; i++) {
177177
vgm_tracks[i] = tmp_tracks[i];
178178
}

p_ceilng.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ int EV_DoCeiling (line_t *line, ceiling_e type)
139139
/* new door thinker */
140140
/* */
141141
rtn = 1;
142-
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC, 0);
142+
ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC);
143143
P_AddThinker (&ceiling->thinker);
144144
sec->specialdata = ceiling;
145145
ceiling->thinker.function = T_MoveCeiling;

p_doors.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ int EV_DoDoor (line_t *line, vldoor_e type)
141141
/* new door thinker */
142142
/* */
143143
rtn = 1;
144-
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
144+
door = Z_Malloc (sizeof(*door), PU_LEVSPEC);
145145
P_AddThinker (&door->thinker);
146146
sec->specialdata = door;
147147
door->thinker.function = T_VerticalDoor;
@@ -352,7 +352,7 @@ void EV_VerticalDoor (line_t *line, mobj_t *thing)
352352
/* */
353353
/* new door thinker */
354354
/* */
355-
door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
355+
door = Z_Malloc (sizeof(*door), PU_LEVSPEC);
356356
P_AddThinker (&door->thinker);
357357
sec->specialdata = door;
358358
door->thinker.function = T_VerticalDoor;
@@ -402,7 +402,7 @@ void P_SpawnDoorCloseIn30 (sector_t *sec)
402402
{
403403
vldoor_t *door;
404404

405-
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
405+
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC);
406406
P_AddThinker (&door->thinker);
407407
sec->specialdata = door;
408408
sec->special = 0;
@@ -423,7 +423,7 @@ void P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum)
423423
{
424424
vldoor_t *door;
425425

426-
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
426+
door = Z_Malloc ( sizeof(*door), PU_LEVSPEC);
427427
P_AddThinker (&door->thinker);
428428
sec->specialdata = door;
429429
sec->special = 0;

p_floor.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ int EV_DoFloor(line_t *line,floor_e floortype)
225225
/* new floor thinker */
226226
/* */
227227
rtn = 1;
228-
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
228+
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC);
229229
P_AddThinker (&floor->thinker);
230230
sec->specialdata = floor;
231231
floor->thinker.function = T_MoveFloor;
@@ -388,7 +388,7 @@ int EV_BuildStairs(line_t *line, int type)
388388
/* new floor thinker */
389389
/* */
390390
rtn = 1;
391-
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
391+
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC);
392392
P_AddThinker (&floor->thinker);
393393
sec->specialdata = floor;
394394
floor->thinker.function = T_MoveFloor;
@@ -447,7 +447,7 @@ int EV_BuildStairs(line_t *line, int type)
447447

448448
sec = tsec;
449449
secnum = newsecnum;
450-
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0);
450+
floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC);
451451
P_AddThinker (&floor->thinker);
452452
sec->specialdata = floor;
453453
floor->thinker.function = T_MoveFloor;

p_lights.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void P_SpawnLightFlash (sector_t *sector)
5151

5252
sector->special = 0; /* nothing special about it during gameplay */
5353

54-
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
54+
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC);
5555
P_AddThinker (&flash->thinker);
5656
flash->thinker.function = T_LightFlash;
5757
flash->sector = sector;
@@ -107,7 +107,7 @@ void P_SpawnStrobeFlash (sector_t *sector,int fastOrSlow, int inSync)
107107
{
108108
strobe_t *flash;
109109

110-
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0);
110+
flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC);
111111
P_AddThinker (&flash->thinker);
112112
flash->sector = sector;
113113
flash->darktime = fastOrSlow;
@@ -257,7 +257,7 @@ void P_SpawnGlowingLight(sector_t *sector)
257257
{
258258
glow_t *g;
259259

260-
g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0);
260+
g = Z_Malloc( sizeof(*g), PU_LEVSPEC);
261261
P_AddThinker(&g->thinker);
262262
g->sector = sector;
263263
g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
@@ -301,7 +301,7 @@ void P_SpawnFireFlicker (sector_t *sector)
301301
// Nothing special about it during gameplay.
302302
sector->special = 0;
303303

304-
flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0);
304+
flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC);
305305
P_AddThinker (&flick->thinker);
306306
flick->thinker.function = T_FireFlicker;
307307
flick->sector = sector;

p_mobj.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ mobj_t *P_SpawnMobj (fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
257257
}
258258
else
259259
{
260-
mobj = Z_Malloc (static_mobj_size, PU_LEVEL, NULL);
260+
mobj = Z_Malloc (static_mobj_size, PU_LEVEL);
261261
}
262262
D_memset (mobj, 0, static_mobj_size);
263263
}
@@ -270,7 +270,7 @@ mobj_t *P_SpawnMobj (fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
270270
}
271271
else
272272
{
273-
mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL);
273+
mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL);
274274
}
275275
D_memset (mobj, 0, sizeof (*mobj));
276276
mobj->speed = info->speed;
@@ -351,7 +351,7 @@ void P_PreSpawnMobjs(int count, int staticcount)
351351
{
352352
if (count > 0)
353353
{
354-
mobj_t *mobj = Z_Malloc (sizeof(*mobj)*count, PU_LEVEL, NULL);
354+
mobj_t *mobj = Z_Malloc (sizeof(*mobj)*count, PU_LEVEL);
355355
for (; count > 0; count--) {
356356
P_AddMobjToList(mobj, (void *)&freemobjhead);
357357
mobj++;
@@ -360,7 +360,7 @@ void P_PreSpawnMobjs(int count, int staticcount)
360360

361361
if (staticcount > 0)
362362
{
363-
uint8_t *mobj = Z_Malloc (static_mobj_size*staticcount, PU_LEVEL, NULL);
363+
uint8_t *mobj = Z_Malloc (static_mobj_size*staticcount, PU_LEVEL);
364364
for (; staticcount > 0; staticcount--) {
365365
P_AddMobjToList((void *)mobj, (void *)&freestaticmobjhead);
366366
mobj += static_mobj_size;

p_plats.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ int EV_DoPlat(line_t *line,plattype_e type,int amount)
117117
/* Find lowest & highest floors around sector */
118118
/* */
119119
rtn = 1;
120-
plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0);
120+
plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC);
121121
P_AddThinker(&plat->thinker);
122122

123123
plat->type = type;

0 commit comments

Comments
 (0)