#include #include #include #include #include "dat.h" #include "fns.h" void* emalloc(ulong sz) { void *v; v = malloc(sz); if(v == nil) sysfatal("malloc %lud fails", sz); memset(v, 0, sz); return v; } Block* newblock(ulong length, uchar *data) { Block *b; b = emalloc(sizeof(*b)+length); b->length = length; b->data = (uchar*)&b[1]; memcpy(b->data, data, length); return b; }