Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Dec 7, 2024
1 parent 7729ef1 commit d2a257b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/d_deh.c
Original file line number Diff line number Diff line change
Expand Up @@ -4536,7 +4536,7 @@ void D_PostProcessDeh(void)
// action pointer expects, for future-proofing's sake
for (j = MAXSTATEARGS - 1; j >= bexptr_match->argcount; j--)
if (states[i].args[j])
I_Error("Action %s on state %i expects no more than %i nonzero args (%i found). Check your dehacked.",
I_Error("Action %s on state %i expects no more than %i non-zero args (%i found).\nCheck your DEHACKED lump.",
bexptr_match->lookup, i, bexptr_match->argcount, j + 1);

// replace unset fields with default values
Expand Down
3 changes: 1 addition & 2 deletions src/f_finale.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ void F_Ticker(void)

if (finalestage == F_STAGE_CAST)
F_CastTicker();

if (finalestage == F_STAGE_TEXT)
else if (finalestage == F_STAGE_TEXT)
{
if (finalecount > FixedMul((fixed_t)strlen(finaletext) * FRACUNIT, TextSpeed()) + (midstage ? NEWTEXTWAIT : TEXTWAIT)
|| (midstage && acceleratestage))
Expand Down
14 changes: 7 additions & 7 deletions src/z_zone.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "z_zone.h"

// Minimum chunk size at which blocks are allocated
#define CHUNK_SIZE 32
#define CHUNKSIZE 32

typedef struct memblock_s
{
Expand All @@ -49,8 +49,8 @@ typedef struct memblock_s
} memblock_t;

// size of block header
// cph - base on sizeof(memblock_t), which can be larger than CHUNK_SIZE on 64bit architectures
static const size_t headersize = ((sizeof(memblock_t) + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1));
// cph - base on sizeof(memblock_t), which can be larger than CHUNKSIZE on 64-bit architectures
static const size_t headersize = ((sizeof(memblock_t) + CHUNKSIZE - 1) & ~(CHUNKSIZE - 1));

static memblock_t *blockbytag[PU_MAX];

Expand All @@ -73,7 +73,7 @@ void *Z_Malloc(size_t size, unsigned char tag, void **user)
if (!size)
return (user ? (*user = NULL) : NULL); // malloc(0) returns NULL

size = ((size + CHUNK_SIZE - 1) & ~(CHUNK_SIZE - 1)); // round to chunk size
size = ((size + CHUNKSIZE - 1) & ~(CHUNKSIZE - 1)); // round to chunk size

while (!(block = malloc(size + headersize)))
{
Expand Down Expand Up @@ -152,20 +152,20 @@ void Z_FreeTags(unsigned char lowtag, unsigned char hightag)
for (; lowtag <= hightag; lowtag++)
{
memblock_t *block = blockbytag[lowtag];
memblock_t *end_block;
memblock_t *endblock;

if (!block)
continue;

end_block = block->prev;
endblock = block->prev;

while (true)
{
memblock_t *next = block->next;

Z_Free((char *)block + headersize);

if (block == end_block)
if (block == endblock)
break;

block = next; // Advance to next block
Expand Down

0 comments on commit d2a257b

Please sign in to comment.