DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T d

⟦c8b6b5ea4⟧ TextFile

    Length: 672 (0x2a0)
    Types: TextFile
    Names: »doalloc.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/p2c/doalloc.c« 

TextFile

/* doalloc.c: memory allocations which exit upon error */

#include <stdio.h>
#ifndef NULL
#define NULL ((char *) 0)
#endif

/* act like calloc, but return only if no error */
char *DoRealloc(ptr,size)
    char *ptr;
    unsigned size;
{
    extern char *realloc();
    char *p;

    if ((p=realloc(ptr, size)) == NULL) {
	fprintf(stderr, "memory allocation (realloc) error");
	exit(1);
    }
    return (p);
}


/* act like malloc, but return only if no error */
char *DoMalloc(size)
    unsigned size;
{
    extern char *malloc();
    char *p;

    if ((p=malloc(size)) == NULL) {
	fprintf(stderr, "memory allocation (malloc) error");
	exit(1);
    }
    return (p);
}