Skip to content

Commit 4f13bfd

Browse files
committed
warnings cleanup, fix pqueue crash
1 parent b86f742 commit 4f13bfd

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎gs.h‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,7 @@ typedef uint32_t gs_slot_map_iter;
24952495
#define gs_pqueue_child_right_idx(I) ((I * 2) + 2)
24962496

24972497
GS_API_DECL void**
2498-
gs_pqueue_init(void** pq);
2498+
gs_pqueue_init(void** pq, size_t sz);
24992499

25002500
#define gs_pqueue_init_all(__PQ, __V)\
25012501
(gs_pqueue_init((void**)&(__PQ), sizeof(*(__PQ))), gs_dyn_array_init((void**)&((__PQ)->priority), sizeof(int32_t)),\
@@ -2514,7 +2514,7 @@ gs_pqueue_init(void** pq);
25142514
} while (0)
25152515

25162516
#define gs_pqueue_empty(__PQ)\
2517-
(!gs_pqueue_size(__PQ))
2517+
(!(__PQ) || !gs_pqueue_size(__PQ))
25182518

25192519
#define __gs_pqueue_swp(__PQ, __I0, __I1, __SZ)\
25202520
do {\
@@ -6707,7 +6707,8 @@ typedef struct gs_context_t
67076707
gs_audio_t* audio;
67086708
gs_app_desc_t app;
67096709
gs_os_api_t os;
6710-
} gs_context_t;
6710+
gs_atomic_int_t lock;
6711+
} gs_context_t;
67116712

67126713
typedef struct gs_t
67136714
{
@@ -8844,6 +8845,7 @@ GS_API_DECL bool gs_token_compare_type(const gs_token_t* t, gs_token_type type)
88448845

88458846
GS_API_DECL bool gs_token_compare_text(const gs_token_t* t, const char* match)
88468847
{
8848+
if (t->len != gs_string_length(match)) return false;
88478849
return (gs_string_compare_equal_n(t->text, match, t->len));
88488850
}
88498851

@@ -9336,6 +9338,8 @@ gs_create(gs_app_desc_t app_desc)
93369338
_gs_instance = (gs_t*)os.malloc(sizeof(gs_t));
93379339
memset(_gs_instance, 0, sizeof(gs_t));
93389340

9341+
gs_instance()->ctx.lock = SCHED_PIPE_INVALID;
9342+
93399343
// Set os api now allocated
93409344
gs_instance()->ctx.os = os;
93419345

‎util/gs_gfxt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ gs_gfxt_mesh_t gs_gfxt_mesh_unit_quad_generate(gs_gfxt_mesh_import_options_t* op
19561956
mesh.desc = mdesc;
19571957

19581958
// Free data
1959-
gs_dyn_array_free(mesh_data.primitives);
1959+
if (mesh_data.primitives) gs_dyn_array_free(mesh_data.primitives);
19601960

19611961
return mesh;
19621962
}

0 commit comments

Comments
 (0)