From 55e3000084ad2f1e9c8287def8870540fda20a48 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 9 Jan 2021 08:07:02 -0800 Subject: [PATCH] Add missing functions --- ck-polyfill.c | 15 +++++++++++++++ ck-polyfill.h | 1 + 2 files changed, 16 insertions(+) diff --git a/ck-polyfill.c b/ck-polyfill.c index 534839ba..9d961595 100644 --- a/ck-polyfill.c +++ b/ck-polyfill.c @@ -238,6 +238,13 @@ ck_pr_load_8(const uint8_t *target) return result; } +void ck_pr_store_ptr(void *target, void *value) +{ + pthread_mutex_lock(&glock); + *(void **)target = value; + pthread_mutex_unlock(&glock); +} + // Simple hashset @@ -274,6 +281,14 @@ simple_hashset_t simple_hashset_create() return set; } +void simple_hashset_destroy(simple_hashset_t set) +{ + if (set) { + free(set->items); + } + free(set); +} + void simple_hashset_set_hash_function(simple_hashset_t set, hash_func_t func) { set->hash_func = func; diff --git a/ck-polyfill.h b/ck-polyfill.h index 49a3b210..d0b52eb6 100644 --- a/ck-polyfill.h +++ b/ck-polyfill.h @@ -236,4 +236,5 @@ ck_pr_load_int(const int *target); uint8_t ck_pr_load_8(const uint8_t *target); +void ck_pr_store_ptr(void *target, void *value); #endif /* CYCLONE_CK_POLYFILL_H */