1: /* alloc.c - version 1.0.2 */
   2: #ifdef LINT
   3: 
   4: /*
   5:    a ridiculous definition, suppressing
   6: 	"possible pointer alignment problem" for (long *) malloc()
   7: 	"enlarg defined but never used"
   8: 	"ftell defined (in <stdio.h>) but never used"
   9:    from lint
  10: */
  11: #include <stdio.h>
  12: long *
  13: alloc(n) unsigned n; {
  14: long dummy = ftell(stderr);
  15:     if(n) dummy = 0;    /* make sure arg is used */
  16:     return(&dummy);
  17: }
  18: 
  19: #else
  20: 
  21: extern char *malloc();
  22: extern char *realloc();
  23: 
  24: long *
  25: alloc(lth)
  26: register unsigned lth;
  27: {
  28:     register char *ptr;
  29: 
  30:     if(!(ptr = malloc(lth)))
  31:         panic("Cannot get %d bytes", lth);
  32:     return((long *) ptr);
  33: }
  34: 
  35: long *
  36: enlarge(ptr,lth)
  37: register char *ptr;
  38: register unsigned lth;
  39: {
  40:     register char *nptr;
  41: 
  42:     if(!(nptr = realloc(ptr,lth)))
  43:         panic("Cannot reallocate %d bytes", lth);
  44:     return((long *) nptr);
  45: }
  46: 
  47: #endif LINT
Last modified: 1985-10-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 414
Valid CSS Valid XHTML 1.0 Strict