summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTylo <[email protected]>2020-06-24 17:51:45 +0200
committerTylo <[email protected]>2020-06-24 17:51:45 +0200
commite9ecb318d3181676766641053b7ac444f74ef061 (patch)
tree9e2c9cdc0a7b4c7f5c431506dd4b6136c2dfa3dd
parent258bf942f635da5709902b96d84b952d5e588c8c (diff)
downloadSTC-modified-e9ecb318d3181676766641053b7ac444f74ef061.tar.gz
STC-modified-e9ecb318d3181676766641053b7ac444f74ef061.zip
Added shash_xx_make(initialSize) function, like cvector and carray also has.
-rw-r--r--stc/chash.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/stc/chash.h b/stc/chash.h
index 8e17d071..7c99c6a1 100644
--- a/stc/chash.h
+++ b/stc/chash.h
@@ -138,6 +138,8 @@ typedef struct { \
uint32_t hashx; \
} CHashBucket_##tag; \
\
+STC_API CHash_##tag \
+chash_##tag##_make(size_t initialSize); \
STC_API void \
chash_##tag##_destroy(CHash_##tag* self); \
STC_API void \
@@ -178,6 +180,13 @@ typedef Value CHashValue_##tag
#define implement_CHash_11(tag, type, Key, Value, valueDestroy, keyHashRaw, keyEqualsRaw, \
keyDestroy, RawKey, keyGetRaw, keyInitRaw) \
\
+STC_API CHash_##tag \
+chash_##tag##_make(size_t initialSize) { \
+ CHash_##tag h = chash_init; \
+ chash_##tag##_reserve(&h, initialSize); \
+ return h; \
+} \
+ \
STC_API void \
chash_##tag##_destroy(CHash_##tag* self) { \
if (chash_size(*self)) { \