Skip to content

Zero-Allocation buffer handling in C

License

Notifications You must be signed in to change notification settings

rikvdh/zabuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zabuffer

Build Status

Zero-Allocation buffer handling in C

Installation

With clib:

clib install rikvdh/zabuffer

Example

#include "zabuffer.h"
#include <assert.h>

// Create buffer called 'buf' with size of 100 bytes
ZA_BUFFER_DECL(buf, 100)

int main(int argc, char **argv)
{
    za_buffer_write_data(buf, "hello", 5);

    assert(5 == za_buffer_size_inuse(buf));

    za_buffer_flush(&buf);

    return 0;
}