|
|
@ -1,9 +1,11 @@
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "byte.h"
|
|
|
|
#include "iob_internal.h"
|
|
|
|
#include "iob_internal.h"
|
|
|
|
|
|
|
|
|
|
|
|
io_batch* iob_new(int hint_entries) {
|
|
|
|
io_batch* iob_new(int hint_entries) {
|
|
|
|
io_batch* b=(io_batch*)malloc(sizeof(io_batch));
|
|
|
|
io_batch* b=(io_batch*)malloc(sizeof(io_batch));
|
|
|
|
if (!b) return 0;
|
|
|
|
if (!b) return 0;
|
|
|
|
|
|
|
|
byte_zero(b,sizeof(io_batch));
|
|
|
|
if (hint_entries) {
|
|
|
|
if (hint_entries) {
|
|
|
|
if (!array_allocate(&b->b,sizeof(iob_entry),hint_entries)) {
|
|
|
|
if (!array_allocate(&b->b,sizeof(iob_entry),hint_entries)) {
|
|
|
|
free(b);
|
|
|
|
free(b);
|
|
|
@ -11,7 +13,5 @@ io_batch* iob_new(int hint_entries) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
array_trunc(&b->b);
|
|
|
|
array_trunc(&b->b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
b->next=b->bufs=b->files=0;
|
|
|
|
|
|
|
|
b->bytesleft=0;
|
|
|
|
|
|
|
|
return b;
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|