diff options
| author | Lion Kortlepel <[email protected]> | 2026-01-14 23:58:17 +0100 |
|---|---|---|
| committer | Lion Kortlepel <[email protected]> | 2026-01-14 23:58:52 +0100 |
| commit | 9a3f974268b6a7d806154c2466229b67843e0f7e (patch) | |
| tree | e52b41ede7a230ab5cb781e10057c3be8e0dbb10 | |
| parent | e4bbedd87ad6462301c30357c9e87a7ee6be8fd0 (diff) | |
| download | queue-2.0.tar.zst queue-2.0.zip | |
feat!: rename macros to simplify themv2.0
breaking, bump to v2.0
| -rw-r--r-- | ls_queue.h | 24 | ||||
| -rw-r--r-- | tests/tests.c | 2 |
2 files changed, 13 insertions, 13 deletions
@@ -2,7 +2,7 @@ /* Lion's Standard (LS) type-safe ANSI C queue. * - * Version: 1.0 + * Version: 2.0 * Repo: https://github.com/lionkor/ls_queue * SPDX-License-Identifier: MIT * @@ -34,7 +34,7 @@ * * Simple example: * - * LS_QUEUE_TYPE_INLINE(int, int_queue, 32) + * LS_QUEUE_INLINE(int, int_queue, 32) * * // somewhere in the same file * int_queue q; @@ -48,10 +48,10 @@ * Alternative example with decl and inline split: * * // In your header file: - * LS_QUEUE_CAP_DECL(int, int_queue, 32) + * LS_QUEUE_DECL(int, int_queue, 32) * * // In one source file: - * LS_QUEUE_CAP_IMPL(int, int_queue, 32) + * LS_QUEUE_IMPL(int, int_queue, 32) * * // Usage in your code: * int_queue q; @@ -95,18 +95,18 @@ #include <assert.h> #include <stddef.h> -#define LS_QUEUE_TYPE_INLINE(T, name, cap) \ +#define LS_QUEUE_INLINE(T, name, cap) \ typedef struct name##_##cap { \ T data[(cap) + 1]; \ size_t read; \ size_t write; \ } name; \ - _ls_QUEUE_TYPE_IMPL_DETAIL(T, name, cap, static inline) + _ls_QUEUE_IMPL_DETAIL(T, name, cap, static inline) -#define LS_QUEUE_TYPE_IMPL(T, name, cap) \ - _ls_QUEUE_TYPE_IMPL_DETAIL(T, name, cap, ) +#define LS_QUEUE_IMPL(T, name, cap) \ + _ls_QUEUE_IMPL_DETAIL(T, name, cap, ) -#define LS_QUEUE_TYPE_DECL(T, name, cap) \ +#define LS_QUEUE_DECL(T, name, cap) \ typedef struct name##_##cap { \ T data[(cap) + 1]; \ size_t read; \ @@ -118,8 +118,8 @@ /* Returns 0 if empty, 1 if successful. */ \ int name##_pop(name* q, T* out); -/* DO NOT USE THE MACRO BELOW. Use LS_QUEUE_TYPE_INLINE or - * LS_QUEUE_TYPE_{IMPL,DECL} instead. +/* DO NOT USE THE MACRO BELOW. Use LS_QUEUE_INLINE or + * LS_QUEUE_{IMPL,DECL} instead. * * What follows are some ramblings about the implementation. * @@ -141,7 +141,7 @@ * so the typedefs exist, and the functions are named without the size * specifier, too. */ -#define _ls_QUEUE_TYPE_IMPL_DETAIL(T, name, cap, specifier) \ +#define _ls_QUEUE_IMPL_DETAIL(T, name, cap, specifier) \ specifier void name##_init(struct name##_##cap* q) { \ assert(q != NULL); \ q->read = 0; \ diff --git a/tests/tests.c b/tests/tests.c index c07c5f3..7486a3d 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -3,7 +3,7 @@ #include "ls_queue.h" -LS_QUEUE_TYPE_INLINE(int, int_queue, 4) +LS_QUEUE_INLINE(int, int_queue, 4) TEST_CASE(queue_init) { int_queue q; |
