Skip to content

Commit 650e7ee

Browse files
committedFeb 5, 2024
Make dictionary user-data const.
1 parent 724d879 commit 650e7ee

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎dictionary.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ cc_bool Dictionary_Remove(Dictionary_State *state, const char *identifier, size_
356356
return success;
357357
}
358358

359-
void Dictionary_Filter(Dictionary_State *state, cc_bool (*filter_function)(Dictionary_Entry *entry, const char *identifier, size_t identifier_length, void *user_data), void *user_data)
359+
void Dictionary_Filter(Dictionary_State *state, cc_bool (*filter_function)(Dictionary_Entry *entry, const char *identifier, size_t identifier_length, void *user_data), const void *user_data)
360360
{
361361
Dictionary_Bucket *bucket;
362362

@@ -370,7 +370,7 @@ void Dictionary_Filter(Dictionary_State *state, cc_bool (*filter_function)(Dicti
370370
{
371371
Dictionary_Node* const next_node = node->next;
372372

373-
if (!filter_function(&node->entry, &node->identifier, node->identifier_length, user_data))
373+
if (!filter_function(&node->entry, &node->identifier, node->identifier_length, (void*)user_data))
374374
RemoveNodeFromBucket(bucket, node);
375375

376376
node = next_node;

‎dictionary.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ void Dictionary_Deinit(Dictionary_State *state);
6868
cc_bool Dictionary_LookUpAndCreateIfNotExist(Dictionary_State *state, const char *identifier, size_t identifier_length, Dictionary_Entry **entry_pointer);
6969
Dictionary_Entry* Dictionary_LookUp(Dictionary_State *state, const char *identifier, size_t identifier_length);
7070
cc_bool Dictionary_Remove(Dictionary_State *state, const char *identifier, size_t identifier_length);
71-
void Dictionary_Filter(Dictionary_State *state, cc_bool (*filter_function)(Dictionary_Entry *entry, const char *identifier, size_t identifier_length, void *user_data), void *user_data);
71+
void Dictionary_Filter(Dictionary_State *state, cc_bool (*filter_function)(Dictionary_Entry *entry, const char *identifier, size_t identifier_length, void *user_data), const void *user_data);
7272

7373
#endif /* DICTIONARY_H */

0 commit comments

Comments
 (0)
Please sign in to comment.