Commit fbb7e4e0 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Minor debug fixes

PSprite.c: move the trace message up before the label, so if tb is NULL there isn't a NULL pointer dereference
guard.c: refactor assert() to not check ptr!=0 a second time
Found by cppcheck static analysis.
Tagged as Paint-2_23-1 since both are debug code only.
parent 72200567
......@@ -833,8 +833,8 @@ main_ttab *psprite_ttab_new (main_sprite *sprite, int dmode, int *dpal)
tb->ttab2_size = 0;
}
finish:
ftracef2 ("table 0x%X, table2 0x%X\n", tb->table, tb->table2);
finish:
if (msg != NULL)
{ if (done_table2 && tb->ttab2_size != 0)
......
......@@ -249,7 +249,7 @@ void guard_free (char *file, int line, void *ptr, size_t size)
{ header = (Block_Header *) ptr - 1;
actual_size = header->size;
assert (!(ptr == 0 || (int) ptr < 0));
assert ((int) ptr > 0);
assert (header->guard == GUARD_WORD); /*protects against multiple
freeing*/
assert (size == 0 || actual_size == size);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment