Files
mars-libowfat/buffer/buffer_mmapread.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

19 lines
358 B
C

#include <libowfat/buffer.h>
#include <libowfat/mmap.h>
static ssize_t op(int fd,void* buf,size_t l) {
(void)fd;
(void)buf;
(void)l;
return 0;
}
int buffer_mmapread(buffer* b,const char* filename) {
if (!(b->x=(char*)mmap_read(filename,&b->n))) return -1;
b->p=0; b->a=b->n;
b->fd=-1;
b->op.rop=op;
b->deinit=buffer_munmap;
return 0;
}