Files
mars-libowfat/buffer/buffer_0.c
leitner b7b8a0efc1 gcc 15 and C23 force some union trickery on buffer.h :-(
add a few buffer_init*_forread variants to pretend we have type safety
  make sure buffer_init_staticcontents handles flushing attempts
2025-04-22 09:32:03 +00:00

13 lines
320 B
C

#include <unistd.h>
#include "buffer.h"
static ssize_t b0read(int fd,void* buf, size_t len) {
if (buffer_flush(buffer_1)<0) return -1;
return read(fd,buf,len);
}
static char buffer_0_space[BUFFER_INSIZE];
static buffer it = BUFFER_INIT_READ(b0read,0,buffer_0_space,sizeof buffer_0_space);
buffer *buffer_0 = &it;