+ res = readFully (fdin, &magic, sizeof(magic)); + if (res != 4 || magic != magicNumber()) {
s/4/sizeof(magic)/ --- +extern int errno; Delete. --- +#define ALLOC(X,Y) { \ + void *mptr; \ + mptr = malloc (Y); \ + if (mptr == 0) { \ + error (fdout, ERR_MALLOC); \ + } \ + X = mptr; \ +} It's traditional to define such a thing as a real function instead of a macro, often with the name xmalloc. Compare with static void* xmalloc(JNIEnv *env, size_t size) { void *p = malloc(size); if (p == NULL) JNU_ThrowOutOfMemoryError(env, NULL); return p; } #define NEW(type, n) ((type *) xmalloc(env, (n) * sizeof(type)))