more function attribute updates

This commit is contained in:
leitner
2024-11-22 19:40:24 +00:00
parent 626c55b122
commit 4b84fba68b
4 changed files with 136 additions and 48 deletions

View File

@@ -1,9 +1,16 @@
#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))
buffer_frombuf(b,NULL,0);
else
if (array_failed(a)) {
memset(b,0,sizeof *b);
b->op=fail;
} else
buffer_frombuf(b,array_start(a),a->initialized);
}