Artifact 97b258e32954a5e8818803d7a042e3fa29e2858ed2d2f6efec0c900e461c6671:
- File clib/buffer.h — part of check-in [0894d03fbf] at 2023-04-15 20:47:04 on branch trunk — add generic routines from vesper (user: lexi, size: 380) [annotate] [blame] [check-ins using]
#pragma once #include "type.h" typedef struct buffer { size_t sz, run; char* ptr; } buffer; void buffer_init(buffer* b); buffer buffer_mk(); void buffer_push(buffer* b, strp const data); strp buffer_crush(buffer* b, size_t max); size_t buffer_pushs(buffer* b, char const* data); #define buffer_pushl(b, d) (buffer_push(b, (strp){sizeof(d),(d)})) void buffer_clear(buffer* b);