home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / A / PS / PROCPS-0.000 / PROCPS-0 / procps-0.97 / alloc.c next >
Encoding:
C/C++ Source or Header  |  1994-09-25  |  704 b   |  28 lines

  1. /***********************************************************************\
  2. *    Copyright (C) 1992 by Michael K. Johnson, johnsonm@sunsite.unc.edu    *
  3. *                                    *
  4. *    This file is placed under the conditions of the GNU public    *
  5. *    license, version 2, or any later version.  See file COPYING    *
  6. *    for information on distribution conditions.            *
  7. \***********************************************************************/
  8.  
  9.  
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include "ps.h"
  13.  
  14. void *xcalloc(void *pointer, int size) {
  15.  
  16.   void * ret;
  17.  
  18.   if (pointer) free(pointer);
  19.   if (!(ret = calloc(1, size))) {
  20.     fprintf(stderr, "xcalloc: allocation error, size = %d\n", size);
  21.     exit(1);
  22.   } else {
  23.     return ret;
  24.   }
  25. }
  26.  
  27.  
  28.