home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / may94 / util / edit / jade.lha / Jade / src / unix_memory.c < prev    next >
C/C++ Source or Header  |  1994-04-19  |  1KB  |  68 lines

  1. /* unix_memory.c -- Memory allocation for Unix
  2.    Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4. This file is part of Jade.
  5.  
  6. Jade is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. Jade is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with Jade; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #include "jade.h"
  21. #include "jade_protos.h"
  22.  
  23. #include <stdlib.h>
  24.  
  25. _PR void *mymalloc(int length);
  26. _PR void *mycalloc(int length);
  27. _PR void myfree(void *mem);
  28. _PR int    initmem(void);
  29. _PR void killmem(void);
  30.  
  31. void *
  32. mymalloc(int length)
  33. {
  34.     void *mem = malloc(length);
  35.     if(mem)
  36.     return(mem);
  37.     sm_flush(&MainStrMem);
  38.     return(malloc(length));
  39. }
  40.  
  41. void *
  42. mycalloc(int length)
  43. {
  44.     void *mem = calloc(length, 1);
  45.     if(mem)
  46.     return(mem);
  47.     sm_flush(&MainStrMem);
  48.     return(calloc(length, 1));
  49. }
  50.  
  51. void
  52. myfree(void *mem)
  53. {
  54.     if(mem)
  55.     free(mem);
  56. }
  57.  
  58. int
  59. initmem(void)
  60. {
  61.     return(TRUE);
  62. }
  63. void
  64. killmem(void)
  65. {
  66.     ;
  67. }
  68.