summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-03 09:32:53 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-05-03 09:32:53 -0700
commitd3d7896408b435ab42656398839ff4351a37724d (patch)
treed6608206dd1de1592ac3ff2d39d9c1d44229e4dc
parent393921cf2188b2b0713cc157effaf17d0abab783 (diff)
clang analyzer: Don't warn about Xmalloc(0)
This will prevent a number of false positives in where clang's static analysis reports about calls to malloc(0). Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--include/X11/Xlibint.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/X11/Xlibint.h b/include/X11/Xlibint.h
index 05d344ca..d199a8b3 100644
--- a/include/X11/Xlibint.h
+++ b/include/X11/Xlibint.h
@@ -336,7 +336,7 @@ extern LockInfoPtr _Xglobal_lock;
* define MALLOC_0_RETURNS_NULL. This is necessary because some
* Xlib code expects malloc(0) to return a valid pointer to storage.
*/
-#ifdef MALLOC_0_RETURNS_NULL
+#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))