move ALLOC_* macros to curl_setup.h

This commit is contained in:
Viktor Szakats 2025-07-05 18:16:30 +02:00
parent 71164747ce
commit fe9ffba8af
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 23 additions and 23 deletions

View file

@ -990,6 +990,29 @@ extern curl_calloc_callback Curl_ccalloc;
do { free((ptr)); (ptr) = NULL;} while(0)
#ifdef CURLDEBUG
#ifdef __clang__
# define ALLOC_FUNC __attribute__((__malloc__))
# if __clang_major__ >= 4
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
# else
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 3
# define ALLOC_FUNC __attribute__((__malloc__))
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
#elif defined(_MSC_VER)
# define ALLOC_FUNC __declspec(restrict)
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#else
# define ALLOC_FUNC
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#endif
#define CURL_GETADDRINFO(host,serv,hint,res) \
curl_dbg_getaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#define CURL_FREEADDRINFO(data) \

View file

@ -33,29 +33,6 @@
#include <curl/curl.h>
#include "functypes.h"
#ifdef __clang__
# define ALLOC_FUNC __attribute__((__malloc__))
# if __clang_major__ >= 4
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
# else
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
# endif
#elif defined(__GNUC__) && __GNUC__ >= 3
# define ALLOC_FUNC __attribute__((__malloc__))
# define ALLOC_SIZE(s) __attribute__((__alloc_size__(s)))
# define ALLOC_SIZE2(n, s) __attribute__((__alloc_size__(n, s)))
#elif defined(_MSC_VER)
# define ALLOC_FUNC __declspec(restrict)
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#else
# define ALLOC_FUNC
# define ALLOC_SIZE(s)
# define ALLOC_SIZE2(n, s)
#endif
/* Avoid redundant redeclaration warnings with modern compilers, when including
this header multiple times. */
#ifndef HEADER_CURL_MEMDEBUG_H_EXTERNS