Brendan Shanks : include: Add WINE_ALLOC_SIZE attribute to heap_calloc().

Alexandre Julliard julliard at winehq.org
Wed May 4 16:14:45 CDT 2022


Module: wine
Branch: master
Commit: 1c4131ba788579f511318270410734d73575caa6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1c4131ba788579f511318270410734d73575caa6

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Thu Apr 28 21:13:16 2022 -0700

include: Add WINE_ALLOC_SIZE attribute to heap_calloc().

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/heap.h | 2 +-
 include/winnt.h     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/wine/heap.h b/include/wine/heap.h
index 97d3a5662be..fb687c92393 100644
--- a/include/wine/heap.h
+++ b/include/wine/heap.h
@@ -46,7 +46,7 @@ static inline void heap_free(void *mem)
     HeapFree(GetProcessHeap(), 0, mem);
 }
 
-static inline void *heap_calloc(SIZE_T count, SIZE_T size)
+static inline void * __WINE_ALLOC_SIZE(1,2) heap_calloc(SIZE_T count, SIZE_T size)
 {
     SIZE_T len = count * size;
 
diff --git a/include/winnt.h b/include/winnt.h
index e853ddbc7ae..79df4259f59 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -199,9 +199,9 @@ extern "C" {
 #endif
 
 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
-#define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
+#define __WINE_ALLOC_SIZE(...) __attribute__((__alloc_size__(__VA_ARGS__)))
 #else
-#define __WINE_ALLOC_SIZE(x)
+#define __WINE_ALLOC_SIZE(...)
 #endif
 
 /* Anonymous union/struct handling */




More information about the wine-cvs mailing list