mbfl_allocators.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * "streamable kanji code filter and converter"
  3. * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
  4. *
  5. * LICENSE NOTICES
  6. *
  7. * This file is part of "streamable kanji code filter and converter",
  8. * which is distributed under the terms of GNU Lesser General Public
  9. * License (version 2) as published by the Free Software Foundation.
  10. *
  11. * This software is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with "streamable kanji code filter and converter";
  18. * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  19. * Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * The author of this file:
  22. *
  23. */
  24. /*
  25. * The source code included in this files was separated from mbfilter.c
  26. * by Moriyoshi Koizumi <moriyoshi@php.net> on 20 Dec 2002. The file
  27. * mbfilter.c is included in this package .
  28. *
  29. */
  30. #ifdef HAVE_CONFIG_H
  31. #include "config.h"
  32. #endif
  33. #ifdef HAVE_STDLIB_H
  34. #include <stdlib.h>
  35. #endif
  36. #ifdef HAVE_MEMORY_H
  37. #include <memory.h>
  38. #endif
  39. #ifdef HAVE_STRING_H
  40. #include <string.h>
  41. #endif
  42. #ifdef HAVE_STRINGS_H
  43. #include <strings.h>
  44. #endif
  45. #ifdef HAVE_STDDEF_H
  46. #include <stddef.h>
  47. #endif
  48. #include "mbfl_allocators.h"
  49. static void *__mbfl__malloc(unsigned int);
  50. static void *__mbfl__realloc(void *, unsigned int);
  51. static void *__mbfl__calloc(unsigned int, unsigned int);
  52. static void __mbfl__free(void *);
  53. static mbfl_allocators default_allocators = {
  54. __mbfl__malloc,
  55. __mbfl__realloc,
  56. __mbfl__calloc,
  57. __mbfl__free,
  58. __mbfl__malloc,
  59. __mbfl__realloc,
  60. __mbfl__free
  61. };
  62. mbfl_allocators *__mbfl_allocators = &default_allocators;
  63. static void *__mbfl__malloc(unsigned int sz)
  64. {
  65. return malloc(sz);
  66. }
  67. static void *__mbfl__realloc(void *ptr, unsigned int sz)
  68. {
  69. return realloc(ptr, sz);
  70. }
  71. static void *__mbfl__calloc(unsigned int nelems, unsigned int szelem)
  72. {
  73. return calloc(nelems, szelem);
  74. }
  75. static void __mbfl__free(void *ptr)
  76. {
  77. free(ptr);
  78. }