Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.9 KiB

  1. #ifndef _POSIX_HEAP_HPP_
  2. #define _POSIX_HEAP_HPP_
  3. // Ruler
  4. // 1 2 3 4 5 6 7 8
  5. //345678901234567890123456789012345678901234567890123456789012345678901234567890
  6. /********************************************************************/
  7. /* */
  8. /* The standard layout. */
  9. /* */
  10. /* The standard layout for 'hpp' files for this code is as */
  11. /* follows: */
  12. /* */
  13. /* 1. Include files. */
  14. /* 2. Constants exported from the class. */
  15. /* 3. Data structures exported from the class. */
  16. /* 4. Forward references to other data structures. */
  17. /* 5. Class specifications (including inline functions). */
  18. /* 6. Additional large inline functions. */
  19. /* */
  20. /* Any portion that is not required is simply omitted. */
  21. /* */
  22. /********************************************************************/
  23. #include "DefaultHeap.hpp"
  24. /********************************************************************/
  25. /* */
  26. /* The standard posix interface. */
  27. /* */
  28. /* The Posix interface allows Rockall to be linked into Unix */
  29. /* applications with a minimal amount of fuss. Although the */
  30. /* function names are not identical to the posix names (so as */
  31. /* to avoid name clashes) functionally they are close enough */
  32. /* to be simple replacements. */
  33. /* */
  34. /********************************************************************/
  35. inline void *Calloc( int Size )
  36. { return DefaultHeap.New( Size,NULL,true ); }
  37. inline bool Free( void *Address,int Size = NoSize )
  38. { return DefaultHeap.Delete( Address,Size ); }
  39. inline void *Malloc( int Size )
  40. { return DefaultHeap.New( Size ); }
  41. inline void *Realloc( void *Address,int NewSize )
  42. { return DefaultHeap.Resize( Address,NewSize ); }
  43. #ifdef POSIX_EXTENSIONS
  44. /********************************************************************/
  45. /* */
  46. /* Extensions to the posix interface. */
  47. /* */
  48. /* The Posix interface is fairly restricted and only gives */
  49. /* access to a small portion of Rockall. The functions that */
  50. /* follow expose additional Rockall functionality. */
  51. /* */
  52. /********************************************************************/
  53. inline void DeleteAll( bool Recycle = true )
  54. { DefaultHeap.DeleteAll( Recycle ); }
  55. inline bool MultipleFree
  56. (
  57. int Actual,
  58. void *Array[],
  59. int Size = NoSize
  60. )
  61. { return DefaultHeap.MultipleDelete( Actual,Array,Size ); }
  62. inline bool MultipleMalloc
  63. (
  64. int *Actual,
  65. void *Array[],
  66. int Requested,
  67. int Size
  68. )
  69. { return DefaultHeap.MultipleNew( Actual,Array,Requested,Size ); }
  70. #endif
  71. #endif