#include "tag.h" void * emalloc(ulong size) { void *p; if((p = malloc(size)) == nil) sysfatal("emalloc: %r"); return p; } void readrec(Biobuf *b, void *buf, long buflen, long reclen, char *msg) { vlong n; if(reclen > buflen) sysfatal("%s too big for buffer: %ld/%ld", msg, reclen, buflen); n = Bread(b, buf, reclen); if(n < 0) sysfatal("read %s: %r", msg); if(n < reclen) sysfatal("truncated %s: %r", msg); }