pool.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. #include <config.h>
  11. #endif
  12. #ifndef BASE_POOL_H
  13. #define BASE_POOL_H
  14. #ifndef NOINTNSAPI
  15. #define INTNSAPI
  16. #endif /* !NOINTNSAPI */
  17. /*
  18. * pool.h
  19. *
  20. * Module for handling memory allocations.
  21. *
  22. * Notes:
  23. * This module is used instead of the NSPR prarena module because the prarenas
  24. * did not fit as cleanly into the existing server.
  25. *
  26. * Mike Belshe
  27. * 10-02-95
  28. *
  29. */
  30. #ifdef MALLOC_POOLS
  31. #ifndef NETSITE_H
  32. #include "netsite.h"
  33. #endif /* !NETSITE_H */
  34. /* --- Begin function prototypes --- */
  35. #ifdef INTNSAPI
  36. NSPR_BEGIN_EXTERN_C
  37. int pool_internal_init(void);
  38. #ifdef DEBUG_CACHES
  39. NSAPI_PUBLIC int INTpool_service_debug(pblock *pb, Session *sn, Request *rq);
  40. #endif
  41. NSAPI_PUBLIC pool_handle_t *INTpool_create(void);
  42. NSAPI_PUBLIC void INTpool_terminate(void);
  43. NSAPI_PUBLIC void INTpool_destroy(pool_handle_t *pool_handle);
  44. NSAPI_PUBLIC int INTpool_enabled(void);
  45. NSAPI_PUBLIC void *INTpool_malloc(pool_handle_t *pool_handle, size_t size);
  46. NSAPI_PUBLIC void INTpool_free(pool_handle_t *pool_handle, void *ptr);
  47. NSAPI_PUBLIC void *INTpool_calloc(pool_handle_t *pool_handle, size_t nelem, size_t elsize);
  48. NSAPI_PUBLIC
  49. void *INTpool_realloc(pool_handle_t *pool_handle, void *ptr, size_t size);
  50. NSAPI_PUBLIC
  51. char *INTpool_strdup(pool_handle_t *pool_handle, const char *orig_str);
  52. NSPR_END_EXTERN_C
  53. #ifdef DEBUG_CACHES
  54. #define pool_service_debug INTpool_service_debug
  55. #endif /* DEBUG_CACHES */
  56. #define pool_create INTpool_create
  57. #define pool_terminate INTpool_terminate
  58. #define pool_destroy INTpool_destroy
  59. #define pool_enabled INTpool_enabled
  60. #define pool_malloc INTpool_malloc
  61. #define pool_free INTpool_free
  62. #define pool_calloc INTpool_calloc
  63. #define pool_realloc INTpool_realloc
  64. #define pool_strdup INTpool_strdup
  65. #endif /* INTNSAPI */
  66. #endif /* MALLOC_POOLS */
  67. #endif /* !BASE_POOL_H_ */