Source:NetHack 3.0.0/alloc.c

Below is the full text to alloc.c from the source code of NetHack 3.0.0. To link to a particular line, write [[NetHack 3.0.0/alloc.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)alloc.c	3.0	88/07/21 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    /* since this file is also used in auxiliary programs, don't include all the 6.    * function declarations for all of nethack 7.    */  8.    #define EXTERN_H 9.   #include "config.h"  10. 11.  #ifdef LINT 12.  /*  13.      a ridiculous definition, suppressing 14.  	"possible pointer alignment problem" for (long *) malloc 15.     from lint 16.  */  17.   long * 18.  alloc(n) unsigned int n; { 19.  long dummy = ftell(stderr); 20.  	if(n) dummy = 0;	/* make sure arg is used */ 21.  	return(&dummy); 22.  }  23.    24.   #else 25.  #ifndef __TURBOC__ 26.  extern void panic P((char *,...)); 27.   28.   long * 29.  alloc(lth) 30.  register unsigned int lth; 31.  {  32.   	register genericptr_t ptr; 33.   34.   	if(!(ptr = malloc(lth))) 35.  		panic("Cannot get %d bytes", lth); 36.  	return((long *) ptr); 37.  }  38.   #endif 39.   40.    41.   #endif /* LINT /**/