aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-05-03 09:32:53 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:26 +0200
commit5062342d464eecc35cd39df7dd303dcda86d57cc (patch)
treed1d14b509e41aee8f80c5550b4a2a411c28ca2ed
parentc19cda6d6c63d1889b0d7fd97794ac45cd4e5fca (diff)
downloadnx-libs-5062342d464eecc35cd39df7dd303dcda86d57cc.tar.gz
nx-libs-5062342d464eecc35cd39df7dd303dcda86d57cc.tar.bz2
nx-libs-5062342d464eecc35cd39df7dd303dcda86d57cc.zip
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> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r--nx-X11/lib/X11/Xlibint.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h
index cd42913f0..603139fd6 100644
--- a/nx-X11/lib/X11/Xlibint.h
+++ b/nx-X11/lib/X11/Xlibint.h
@@ -367,7 +367,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)))