aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrace Andreason <tandreason@gmail.com>2024-05-14 09:57:07 -0700
committerTrace Andreason <tandreason@gmail.com>2024-05-14 09:57:07 -0700
commit0c8d43ea8e16025374dc5d92b1f3c54e306e8704 (patch)
treee861b58239db6380c8700b8afdbcda7f4b8f17c3
parent57d10ef03fabf65d5059aba0adef0e979f949937 (diff)
remove callback typedef
-rw-r--r--bindgen/gen_zig.py2
-rw-r--r--sokol_fetch.h17
2 files changed, 7 insertions, 12 deletions
diff --git a/bindgen/gen_zig.py b/bindgen/gen_zig.py
index 1f0f1ca3..a736cb0e 100644
--- a/bindgen/gen_zig.py
+++ b/bindgen/gen_zig.py
@@ -377,8 +377,6 @@ def gen_struct(decl, prefix):
sys.exit(f"ERROR gen_struct is_2d_array_type: {array_type}")
t0 = f"[{array_sizes[0]}][{array_sizes[1]}]{zig_type}"
l(f" {field_name}: {t0} = [_][{array_sizes[1]}]{zig_type}{{[_]{zig_type}{{{def_val}}} ** {array_sizes[1]}}} ** {array_sizes[0]},")
- elif field_name == "callback":
- l(f" {field_name}: fn (*Response) void,")
else:
sys.exit(f"ERROR gen_struct: {field_name}: {field_type};")
l("};")
diff --git a/sokol_fetch.h b/sokol_fetch.h
index 510c5b5b..f94f5c82 100644
--- a/sokol_fetch.h
+++ b/sokol_fetch.h
@@ -1071,17 +1071,14 @@ typedef struct sfetch_response_t {
sfetch_range_t buffer; // the user-provided buffer which holds the fetched data
} sfetch_response_t;
-/* response callback function signature */
-typedef void(*sfetch_callback_t)(const sfetch_response_t*);
-
/* request parameters passed to sfetch_send() */
typedef struct sfetch_request_t {
- uint32_t channel; // index of channel this request is assigned to (default: 0)
- const char* path; // filesystem path or HTTP URL (required)
- sfetch_callback_t callback; // response callback function pointer (required)
- uint32_t chunk_size; // number of bytes to load per stream-block (optional)
- sfetch_range_t buffer; // a memory buffer where the data will be loaded into (optional)
- sfetch_range_t user_data; // ptr/size of a POD user data block which will be memcpy'd (optional)
+ uint32_t channel; // index of channel this request is assigned to (default: 0)
+ const char* path; // filesystem path or HTTP URL (required)
+ void (*callback) (const sfetch_response_t*); // response callback function pointer (required)
+ uint32_t chunk_size; // number of bytes to load per stream-block (optional)
+ sfetch_range_t buffer; // a memory buffer where the data will be loaded into (optional)
+ sfetch_range_t user_data; // ptr/size of a POD user data block which will be memcpy'd (optional)
} sfetch_request_t;
/* setup sokol-fetch (can be called on multiple threads) */
@@ -1302,7 +1299,7 @@ typedef struct {
uint32_t channel;
uint32_t lane;
uint32_t chunk_size;
- sfetch_callback_t callback;
+ void (*callback) (const sfetch_response_t*);
sfetch_range_t buffer;
/* updated by IO-thread, off-limits to user thread */