ngx_alloc.h 670 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */
  5. #ifndef _NGX_ALLOC_H_INCLUDED_
  6. #define _NGX_ALLOC_H_INCLUDED_
  7. #include <stdlib.h>
  8. void *ngx_alloc(size_t size);
  9. void *ngx_calloc(size_t size);
  10. #define ngx_free free
  11. /*
  12. * Linux has memalign() or posix_memalign()
  13. * Solaris has memalign()
  14. * FreeBSD 7.0 has posix_memalign(), besides, early version's malloc()
  15. * aligns allocations bigger than page size at the page boundary
  16. */
  17. #if (NGX_HAVE_POSIX_MEMALIGN || NGX_HAVE_MEMALIGN)
  18. void *ngx_memalign(size_t alignment, size_t size, ngx_log_t *log);
  19. #else
  20. #define ngx_memalign(alignment, size) ngx_alloc(size)
  21. #endif
  22. #endif /* _NGX_ALLOC_H_INCLUDED_ */