libowfat/io/iob_new.c

18 lines
373 B
C
Raw Normal View History

2003-09-08 20:29:39 +00:00
#include <stdlib.h>
#include "byte.h"
2003-09-08 20:29:39 +00:00
#include "iob_internal.h"
io_batch* iob_new(int hint_entries) {
io_batch* b=(io_batch*)malloc(sizeof(io_batch));
if (!b) return 0;
byte_zero(b,sizeof(io_batch));
2003-09-08 20:29:39 +00:00
if (hint_entries) {
if (!array_allocate(&b->b,sizeof(iob_entry),hint_entries)) {
2003-09-08 20:29:39 +00:00
free(b);
return 0;
}
array_trunc(&b->b);
}
return b;
}