aboutsummaryrefslogtreecommitdiff
path: root/util/sokol_debugtext.h
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2023-10-03 14:39:54 +0200
committerAndre Weissflog <floooh@gmail.com>2023-10-03 14:39:54 +0200
commit9a1421dd1e4b6dad8312e66cf78e75d3fc7d2fc3 (patch)
treeb964166b974954ffb2d3f6fb4479d9fed5a8ed87 /util/sokol_debugtext.h
parentdf394f8e0105030ead34776048e1a4236b1f3c69 (diff)
parent5bfa84212b7428ed8ca3b55ffce214aff9e4954b (diff)
Merge branch 'master' into sgfx-wgpu
Diffstat (limited to 'util/sokol_debugtext.h')
-rw-r--r--util/sokol_debugtext.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h
index 981cab46..09da6019 100644
--- a/util/sokol_debugtext.h
+++ b/util/sokol_debugtext.h
@@ -427,8 +427,8 @@
sdtx_setup(&(sdtx_desc_t){
// ...
.allocator = {
- .alloc = my_alloc,
- .free = my_free,
+ .alloc_fn = my_alloc,
+ .free_fn = my_free,
.user_data = ...;
}
});
@@ -658,12 +658,12 @@ typedef struct sdtx_context_desc_t {
Used in sdtx_desc_t to provide custom memory-alloc and -free functions
to sokol_debugtext.h. If memory management should be overridden, both the
- alloc and free function must be provided (e.g. it's not valid to
+ alloc_fn and free_fn function must be provided (e.g. it's not valid to
override one function but not the other).
*/
typedef struct sdtx_allocator_t {
- void* (*alloc)(size_t size, void* user_data);
- void (*free)(void* ptr, void* user_data);
+ void* (*alloc_fn)(size_t size, void* user_data);
+ void (*free_fn)(void* ptr, void* user_data);
void* user_data;
} sdtx_allocator_t;
@@ -3598,8 +3598,8 @@ static void _sdtx_clear(void* ptr, size_t size) {
static void* _sdtx_malloc(size_t size) {
SOKOL_ASSERT(size > 0);
void* ptr;
- if (_sdtx.desc.allocator.alloc) {
- ptr = _sdtx.desc.allocator.alloc(size, _sdtx.desc.allocator.user_data);
+ if (_sdtx.desc.allocator.alloc_fn) {
+ ptr = _sdtx.desc.allocator.alloc_fn(size, _sdtx.desc.allocator.user_data);
} else {
ptr = malloc(size);
}
@@ -3616,8 +3616,8 @@ static void* _sdtx_malloc_clear(size_t size) {
}
static void _sdtx_free(void* ptr) {
- if (_sdtx.desc.allocator.free) {
- _sdtx.desc.allocator.free(ptr, _sdtx.desc.allocator.user_data);
+ if (_sdtx.desc.allocator.free_fn) {
+ _sdtx.desc.allocator.free_fn(ptr, _sdtx.desc.allocator.user_data);
} else {
free(ptr);
}
@@ -4197,7 +4197,7 @@ SOKOL_API_IMPL void _sdtx_draw_layer(_sdtx_context_t* ctx, int layer_id) {
static sdtx_desc_t _sdtx_desc_defaults(const sdtx_desc_t* desc) {
- SOKOL_ASSERT((desc->allocator.alloc && desc->allocator.free) || (!desc->allocator.alloc && !desc->allocator.free));
+ SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn));
sdtx_desc_t res = *desc;
res.context_pool_size = _sdtx_def(res.context_pool_size, _SDTX_DEFAULT_CONTEXT_POOL_SIZE);
res.printf_buf_size = _sdtx_def(res.printf_buf_size, _SDTX_DEFAULT_PRINTF_BUF_SIZE);