From e59a101b13272590370bc01fad119c8f8131c2d3 Mon Sep 17 00:00:00 2001 From: Lawrence Stubbs Date: Sun, 22 Dec 2024 06:52:26 -0500 Subject: [PATCH] rename `vector_any` implementation here is variant --- CMakeLists.txt | 2 +- README.md | 2 +- docs/index.md | 2 +- include/raii.h | 4 ++-- src/vector.c | 4 ++-- tests/test-vector.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23aadd4..2e78415 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ endif() project( raii - VERSION 1.3.0 + VERSION 1.3.1 DESCRIPTION "An general RAII implementation for C, with Defer, simple high-level C11/C++11 like Threading/Futures, custom malloc/heap allocation." HOMEPAGE_URL "https://zelang-dev.github.io/c-raii/" LANGUAGES C diff --git a/README.md b/README.md index fdd10ae..18a9073 100644 --- a/README.md +++ b/README.md @@ -354,7 +354,7 @@ C_API args_t args_for(size_t, ...); #define array(count, ...) args_for(count, __VA_ARGS__) #define array_defer(arr) args_destructor_set(arr) -#define vectorize(vec) vectors_t vec = vector_any() +#define vectorize(vec) vectors_t vec = vector_variant() #define vector(vec, count, ...) vectors_t vec = vector_for(nil, count, __VA_ARGS__) #define $push_back(vec, value) vector_push_back(vec, (void_t)value) diff --git a/docs/index.md b/docs/index.md index 3f592c6..b9c18f4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -349,7 +349,7 @@ C_API args_t args_for(size_t, ...); #define array(count, ...) args_for(count, __VA_ARGS__) #define array_defer(arr) args_destructor_set(arr) -#define vectorize(vec) vectors_t vec = vector_any() +#define vectorize(vec) vectors_t vec = vector_variant() #define vector(vec, count, ...) vectors_t vec = vector_for(nil, count, __VA_ARGS__) #define $push_back(vec, value) vector_push_back(vec, (void_t)value) diff --git a/include/raii.h b/include/raii.h index 69cac8f..56ec0de 100644 --- a/include/raii.h +++ b/include/raii.h @@ -549,7 +549,7 @@ C_API u_string str_decode64_ex(memory_t *defer, u_string_t src); C_API bool is_base64(u_string_t src); C_API int strpos(const char *text, char *pattern); -C_API vectors_t vector_any(void); +C_API vectors_t vector_variant(void); C_API vectors_t vector_for(vectors_t, size_t, ...); C_API void vector_insert(vectors_t vec, int pos, void_t val); C_API void vector_clear(vectors_t); @@ -582,7 +582,7 @@ C_API values_type get_arg(void_t); #define array(count, ...) args_for(count, __VA_ARGS__) #define array_defer(arr) args_destructor_set(arr) -#define vectorize(vec) vectors_t vec = vector_any() +#define vectorize(vec) vectors_t vec = vector_variant() #define vector(vec, count, ...) vectors_t vec = vector_for(nil, count, __VA_ARGS__) #define $push_back(vec, value) vector_push_back(vec, (void_t)value) diff --git a/src/vector.c b/src/vector.c index 4c5ca4d..0732191 100644 --- a/src/vector.c +++ b/src/vector.c @@ -131,7 +131,7 @@ vectors_t vector_for(vectors_t v, size_t item_count, ...) { size_t i; if (is_empty(v)) - v = vector_any(); + v = vector_variant(); if (item_count > 0) { va_start(ap, item_count); @@ -143,7 +143,7 @@ vectors_t vector_for(vectors_t v, size_t item_count, ...) { return v; } -RAII_INLINE vectors_t vector_any(void) { +RAII_INLINE vectors_t vector_variant(void) { vectors_t vec = nullptr; size_t cores = thrd_cpu_count(); vector_grow(vec, cores); diff --git a/tests/test-vector.c b/tests/test-vector.c index 3647920..ac8904a 100644 --- a/tests/test-vector.c +++ b/tests/test-vector.c @@ -41,7 +41,7 @@ TEST(vector_for) { return 0; } -TEST(vector_any) { +TEST(vector_variant) { vectorize(v); $push_back(v, strdup("hello")); @@ -67,7 +67,7 @@ TEST(list) { int result = 0; EXEC_TEST(vector_for); - EXEC_TEST(vector_any); + EXEC_TEST(vector_variant); return result; }