Always put arena pointer in mem_arena_marker, to avoid possible DEBUG value discrepancy between lib and client code

This commit is contained in:
Martin Fouilleul 2023-05-09 18:29:32 +02:00
parent 1ab1d70df2
commit 3f1447f729
4 changed files with 3 additions and 10 deletions

View File

@ -484,13 +484,11 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch
#define STBI_NO_ZLIB #define STBI_NO_ZLIB
#endif #endif
/*
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> // ptrdiff_t on osx #include <stddef.h> // ptrdiff_t on osx
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
*/
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) #if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)
#include <math.h> // ldexp, pow #include <math.h> // ldexp, pow

View File

@ -22,7 +22,6 @@
#else #else
#include<string.h> #include<string.h>
#include<stdio.h>
#endif #endif
#endif //__PLATFORM_STRINGS_H_ #endif //__PLATFORM_STRINGS_H_

View File

@ -117,11 +117,9 @@ void mem_arena_clear(mem_arena* arena)
mem_arena_marker mem_arena_mark(mem_arena* arena) mem_arena_marker mem_arena_mark(mem_arena* arena)
{ {
mem_arena_marker marker = {.chunk = arena->currentChunk, mem_arena_marker marker = {.arena = arena,
.chunk = arena->currentChunk,
.offset = arena->currentChunk->offset}; .offset = arena->currentChunk->offset};
#if DEBUG
marker.arena = arena;
#endif
return(marker); return(marker);
} }

View File

@ -40,9 +40,7 @@ typedef struct mem_arena
typedef struct mem_arena_marker typedef struct mem_arena_marker
{ {
#if DEBUG
mem_arena* arena; mem_arena* arena;
#endif
mem_arena_chunk* chunk; mem_arena_chunk* chunk;
u64 offset; u64 offset;
} mem_arena_marker; } mem_arena_marker;