home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume12 / postscript / part01 / source / save.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-27  |  966 b   |  46 lines

  1. /*
  2.  * Copyright (C) Rutherford Appleton Laboratory 1987
  3.  * 
  4.  * This source may be copied, distributed, altered or used, but not sold for profit
  5.  * or incorporated into a product except under licence from the author.
  6.  * It is not in the public domain.
  7.  * This notice should remain in the source unaltered, and any changes to the source
  8.  * made by persons other than the author should be marked as such.
  9.  * 
  10.  *    Crispin Goswell @ Rutherford Appleton Laboratory caag@uk.ac.rl.vd
  11.  */
  12. #include "main.h"
  13.  
  14. #define SMALL_SIZE    4096
  15.  
  16. static char *small_buf;
  17. static int left = 0;
  18.  
  19. char *Malloc (u) unsigned u;
  20.  {
  21.      char *malloc (), *res;
  22.      
  23.     if (0/*u < SMALL_SIZE*/)
  24.       {
  25.            char *res;
  26.          if (left < u)
  27.           {
  28.              small_buf = Malloc (SMALL_SIZE);
  29.              left = SMALL_SIZE;
  30.           }
  31.           res = small_buf;
  32.           small_buf += u;
  33.           left -= u;
  34.           
  35.           return res;
  36.       }
  37.      
  38.      PanicIf ((res = malloc (u)) == NULL, "malloc failed");
  39.      return res;
  40.  }
  41.  
  42. Free (s) char *s;
  43.  {
  44.     /* free (s);    */
  45.  }
  46.