< prev index next >

src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h

Print this page

        

@@ -2,11 +2,11 @@
  *
  * ftmemory.h
  *
  *   The FreeType memory management macros (specification).
  *
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2020 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
  * modified, and distributed under the terms of the FreeType project
  * license, LICENSE.TXT.  By continuing to use, modify, or distribute

@@ -55,10 +55,18 @@
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
 
 
+  /* 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++,
    * we have to use a template to emulate it.
    */

@@ -153,11 +161,11 @@
                                                (FT_Long)(size), \
                                                &error ) )
 
 #define FT_MEM_FREE( ptr )                \
           FT_BEGIN_STMNT                  \
-            ft_mem_free( memory, (ptr) ); \
+            FT_DEBUG_INNER( ft_mem_free( memory, (ptr) ) ); \
             (ptr) = NULL;                 \
           FT_END_STMNT
 
 #define FT_MEM_NEW( ptr )                        \
           FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
< prev index next >