summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/freetype/internal/ftmemory.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index f0891ae09..7a8eeb8ac 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -57,6 +57,14 @@ FT_BEGIN_HEADER
/*************************************************************************/
+ /* The calculation `NULL + n' is undefined in C. Even if the resulting */
+ /* pointer doesn't get dereferenced, this causes warnings with */
+ /* sanitizers. */
+ /* */
+ /* We thus provide a macro that should be used if `base' can be NULL. */
+#define FT_OFFSET( base, count ) ( (base) ? (base) + (count) : NULL )
+
+
/*
* C++ refuses to handle statements like p = (void*)anything, with `p' a
* typed pointer. Since we don't have a `typeof' operator in standard C++,