idn-free.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* idn-free.h --- Invoke the free function to release memory
  2. Copyright (C) 2004-2024 Simon Josefsson
  3. This file is part of GNU Libidn.
  4. GNU Libidn is free software: you can redistribute it and/or
  5. modify it under the terms of either:
  6. * the GNU Lesser General Public License as published by the Free
  7. Software Foundation; either version 3 of the License, or (at
  8. your option) any later version.
  9. or
  10. * the GNU General Public License as published by the Free
  11. Software Foundation; either version 2 of the License, or (at
  12. your option) any later version.
  13. or both in parallel, as here.
  14. GNU Libidn is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. General Public License for more details.
  18. You should have received copies of the GNU General Public License and
  19. the GNU Lesser General Public License along with this program. If
  20. not, see <https://www.gnu.org/licenses/>. */
  21. #ifndef IDN_FREE_H
  22. # define IDN_FREE_H
  23. /**
  24. * SECTION:idn-free
  25. * @title: idn-free.h
  26. * @short_description: Memory deallocation functions
  27. *
  28. * Memory deallocation functions.
  29. */
  30. # ifndef IDNAPI
  31. # define IDNAPI
  32. # endif
  33. # ifdef __cplusplus
  34. extern "C"
  35. {
  36. # endif
  37. /* I don't recommend using this interface in general. Use `free'.
  38. *
  39. * I'm told Microsoft Windows may use one set of `malloc' and `free'
  40. * in a library, and another incompatible set in a statically compiled
  41. * application that link to the library, thus creating problems if the
  42. * application would invoke `free' on a pointer pointing to memory
  43. * allocated by the library. This motivated adding this function.
  44. *
  45. * The theory of isolating all memory allocations and de-allocations
  46. * within a code package (library) sounds good, to simplify hunting
  47. * down memory allocation related problems, but I'm not sure if it is
  48. * worth enough to motivate recommending this interface over calling
  49. * `free' directly, though.
  50. *
  51. * See the manual section 'Memory handling under Windows' for more
  52. * information.
  53. */
  54. extern void IDNAPI idn_free (void *ptr);
  55. # ifdef __cplusplus
  56. }
  57. # endif
  58. #endif /* IDN_FREE_H */