Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rikvdh/zringbuf
Zero-allocation ring-buffer library
https://github.com/rikvdh/zringbuf
buffer c clib embedded memory ring-buffer ringbuf ringbuffer zero-allocation
Last synced: about 1 month ago
JSON representation
Zero-allocation ring-buffer library
- Host: GitHub
- URL: https://github.com/rikvdh/zringbuf
- Owner: rikvdh
- License: mit
- Created: 2020-06-14T11:52:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-07-16T06:57:31.000Z (over 4 years ago)
- Last Synced: 2023-03-29T05:56:32.993Z (over 1 year ago)
- Topics: buffer, c, clib, embedded, memory, ring-buffer, ringbuf, ringbuffer, zero-allocation
- Language: C
- Size: 3.91 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zringbuf
[![Build Status](https://travis-ci.org/rikvdh/zringbuf.svg?branch=master)](https://travis-ci.org/rikvdh/zringbuf)
Zero-Allocation ring-buffer in C
## Installation
With [clib](https://github.com/clibs/clib):
```sh
clib install rikvdh/zringbuf
```## Example
```c
#include "zringbuf.h"
#include// Create ring-buffer called 'buf' with size of 100 bytes
ZRINGBUF_DECL(buf, 100)int main(int argc, char **argv)
{
zringbuf_queue(&buf, 'a');zringbuf_queue_arr(&buf, "bcd", 3);
assert(4 == zringbuf_size_used(&buf));
char ch;
assert(true == zringbuf_dequeue(&buf, &ch));
assert(ch == 'a');return 0;
}
```