home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / OAKALLOC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  1.6 KB  |  90 lines

  1. /*
  2.     oakalloc.c  
  3.  
  4.     % 'oakland' insulated alloc functions
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1986, 1987, 1988 by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12. */
  13.  
  14. #include "oakhead.h"
  15.  
  16. /* -------------------------------------------------------------------------- */
  17.  
  18. VOID *omalloc(tag, size)
  19.     int tag;
  20.     SIZE_T size;
  21. /*
  22.     Call malloc with the given size.
  23.     Return the result.
  24.     If malloc fails, sets oak_errno to tag
  25. */
  26. {
  27.     VOID *m;
  28.  
  29.     if ((m = (VOID *)malloc(size)) == NULL) {
  30.         oak_SetErrno(tag);
  31.     }
  32.  
  33.     return(m);
  34. }
  35. /* -------------------------------------------------------------------------- */
  36.  
  37. VOID *ocalloc(tag, n, size)
  38.     int tag;
  39.     SIZE_T n;
  40.     SIZE_T size;
  41. /*
  42.     Call calloc with the given size.
  43.     Return the result.
  44.     If calloc fails, sets oak_errno to tag
  45. */
  46. {
  47.     VOID *m;
  48.  
  49.     if ((m = (VOID *)calloc(n, size)) == NULL) {
  50.         oak_SetErrno(tag);
  51.     }
  52.  
  53.     return(m);
  54. }
  55. /* -------------------------------------------------------------------------- */
  56.  
  57. VOID *orealloc(tag, buffer, size)
  58.     int tag;
  59.     VOID *buffer;
  60.     SIZE_T size;
  61. /*
  62.     Call realloc with the given size and buffer.
  63.     Return the result.
  64.     If realloc fails, sets oak_errno to tag
  65. */
  66. {
  67.     VOID *m;
  68.  
  69.     if ((m = (VOID *)realloc(buffer, size)) == NULL) {
  70.         oak_SetErrno(tag);
  71.     }
  72.  
  73.     return(m);
  74. }
  75. /* -------------------------------------------------------------------------- */
  76.  
  77. void ofree(tag, buffer)
  78.     int tag;
  79.     VOID *buffer;
  80. /*
  81.     Call free with the given buffer.
  82.     Return the result.
  83. */
  84. {
  85.     free(buffer);
  86.     /* tag not used in this version */    oak_notused(tag);
  87. }
  88. /* -------------------------------------------------------------------------- */
  89.  
  90.