< prev index next >

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

Print this page

        

*** 2,12 **** * * ftmemory.h * * The FreeType memory management macros (specification). * ! * Copyright (C) 1996-2019 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 --- 2,12 ---- * * ftmemory.h * * The FreeType memory management macros (specification). * ! * 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,64 **** --- 55,72 ---- /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ + /* 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,163 **** (FT_Long)(size), \ &error ) ) #define FT_MEM_FREE( ptr ) \ FT_BEGIN_STMNT \ ! ft_mem_free( memory, (ptr) ); \ (ptr) = NULL; \ FT_END_STMNT #define FT_MEM_NEW( ptr ) \ FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) ) --- 161,171 ---- (FT_Long)(size), \ &error ) ) #define FT_MEM_FREE( ptr ) \ FT_BEGIN_STMNT \ ! 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 >