memdebug.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef HEADER_CURL_MEMDEBUG_H
  2. #define HEADER_CURL_MEMDEBUG_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <[email protected]>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. /*
  27. * CAUTION: this header is designed to work when included by the app-side
  28. * as well as the library. Do not mix with library internals!
  29. */
  30. #ifdef CURLDEBUG
  31. /* Set this symbol on the command-line, recompile all lib-sources */
  32. #undef strdup
  33. #define strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
  34. #undef malloc
  35. #define malloc(size) curl_dbg_malloc(size, __LINE__, __FILE__)
  36. #undef calloc
  37. #define calloc(nbelem,size) curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
  38. #undef realloc
  39. #define realloc(ptr,size) curl_dbg_realloc(ptr, size, __LINE__, __FILE__)
  40. #undef free
  41. #define free(ptr) curl_dbg_free(ptr, __LINE__, __FILE__)
  42. #ifdef _WIN32
  43. #undef Curl_tcsdup
  44. #ifdef UNICODE
  45. #define Curl_tcsdup(ptr) curl_dbg_wcsdup(ptr, __LINE__, __FILE__)
  46. #else
  47. #define Curl_tcsdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
  48. #endif
  49. #endif /* _WIN32 */
  50. #endif /* CURLDEBUG */
  51. #endif /* HEADER_CURL_MEMDEBUG_H */