Files
mars-libowfat/buffer/buffer_fromarray.c
2024-11-22 19:40:24 +00:00

17 lines
291 B
C

#include <errno.h>
#include "array.h"
#include "buffer.h"
static ssize_t fail() {
errno=EINVAL;
return -1;
}
void buffer_fromarray(buffer* b,array* a) {
if (array_failed(a)) {
memset(b,0,sizeof *b);
b->op=fail;
} else
buffer_frombuf(b,array_start(a),a->initialized);
}