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 n

⟦9c2507800⟧ TextFile

    Length: 822 (0x336)
    Types: TextFile
    Names: »new.c«

Derivation

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

TextFile

/*
 * Copyright (C) 1986   Alan Kent
 *
 * Permission is granted to freely distribute part or
 * all of this code as long as it is not for profit
 * and this message is retained in the code.
 *
 * No resposibility is taken for any damage or incorect
 * results this program generates.
 * 
 */


#include <stdio.h>


extern char *malloc ();

int bytes_allocated = 0;


char *
new ( size )
int size;
{
    char *p;
    char buf[100];

    if ( size < 1 )
	size = 1;
    p = malloc ( size );
    if ( p == NULL ) {
	sprintf ( buf ,
	    "out of memory: request for %d bytes failed, %d allocated so far\n",
	    size , bytes_allocated );
	abort ( buf );
    }
    bytes_allocated += size;
    return ( p );
}


release ( mem )
char *mem;
{
    if ( mem == NULL )
	abort ( "Trying to free NULL pointer" );
    free ( mem );
}