From 345f3a4296200c4d852f025043b383b2ea9534cd Mon Sep 17 00:00:00 2001 From: Tadashi Saito Date: Sat, 12 Oct 2024 23:56:01 +0900 Subject: [PATCH] Privatize scary_push_ref. --- scary.c | 2 +- scary.h | 1 - testlib.c | 12 ++++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scary.c b/scary.c index 012eaeb..0423128 100644 --- a/scary.c +++ b/scary.c @@ -79,7 +79,7 @@ size_t scary_length(const void *p) return ary->length; } -void scary_push_ref(void *p, const void *elem) +static void scary_push_ref(void *p, const void *elem) { void **pp = p; Scary *ary = get(*pp); diff --git a/scary.h b/scary.h index 4eb8321..a9fab61 100644 --- a/scary.h +++ b/scary.h @@ -7,7 +7,6 @@ void *scary_new(size_t size); void scary_free(void *ary); size_t scary_length(const void *ary); -void scary_push_ref(void *ary, const void *elem); #ifdef __APPLE__ #define scary_push_archdep_pattern() unsigned long: scary_push_uint64, #else diff --git a/testlib.c b/testlib.c index 1ccccba..6c91af9 100644 --- a/testlib.c +++ b/testlib.c @@ -3,18 +3,18 @@ #include "scary.h" -Test(libscary, push_ref_and_length) { - int *a = scary_new(sizeof(int)); +Test(libscary, push_and_length) { + int32_t *a = scary_new(sizeof(int32_t)); cr_expect(eq(sz, 0, scary_length(a))); - int l[] = { 1, -2, 3, -5, 7, -11 }, *p = l; + int32_t l[] = { 1, -2, 3, -5, 7, -11 }, *p = l; const size_t n = sizeof(l)/sizeof(*l); for (size_t i = 0; i < n; i++) - scary_push_ref(&a, p++); + scary_push_int32(&a, *p++); cr_expect(eq(sz, n, scary_length(a))); - cr_expect(eq(int, 1, a[0])); - cr_expect(eq(int[n], l, a)); + cr_expect(eq(i32, 1, a[0])); + cr_expect(eq(i32[n], l, a)); scary_free(a); }