diff options
| author | Lion Kortlepel <[email protected]> | 2026-01-14 23:49:43 +0100 |
|---|---|---|
| committer | Lion Kortlepel <[email protected]> | 2026-01-14 23:49:43 +0100 |
| commit | e4bbedd87ad6462301c30357c9e87a7ee6be8fd0 (patch) | |
| tree | 4850864f0b8aa52e4bfffe9ace1dd02cbd22e657 | |
| parent | a61536f9d34daf94b2824eb2f3098df5f732163f (diff) | |
| download | queue-1.0.tar.zst queue-1.0.zip | |
docs: complete readmev1.0
| -rw-r--r-- | README.md | 43 |
1 files changed, 41 insertions, 2 deletions
@@ -1,6 +1,45 @@ # LS Ring-Buffer Queue -Single-header queue implementation in ANSI C. +Minimal, single-header ring-buffer queue for C. -- Header-only +- Type-safe via macro code generation (not macro function calls) - ANSI C +- Header-only +- Ring-buffer (no memory copying, no allocations) +- Full coverage tests (branches, lines, functions) + +## Quick Start + +1. Copy `ls_queue.h` to your project. +2. Define any number of queue types: + ```c + LS_QUEUE_TYPE_INLINE(int, int_queue, 32) + ``` + + **OR** for separate declaration/implementation: + + ```c + // In header: + LS_QUEUE_TYPE_DECL(int, int_queue, 32) + + // In source file: + LS_QUEUE_TYPE_IMPL(int, int_queue, 32) + ``` +3. Use the queue with normal C function calls: + ```c + int_queue q; + int_queue_init(&q); + if (!int_queue_push(&q, 42)) { + // push failed, queue full, handle that here + } + int val; + if (int_queue_pop(&q, &val)) { + // use val + } + ``` + +See [`ls_queue.h`](ls_queue.h) for detailed documentation and usage patterns. + +## License + +MIT. |
