| Index: include/freetype/internal/ftmemory.h
|
| diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
|
| index 026aa63eaa9f17edbaa773bf5ce59263d63fb9eb..3d51aeec69fd061bc6ed261efe456c1d2fa36ef4 100644
|
| --- a/include/freetype/internal/ftmemory.h
|
| +++ b/include/freetype/internal/ftmemory.h
|
| @@ -4,7 +4,7 @@
|
| /* */
|
| /* The FreeType memory management macros (specification). */
|
| /* */
|
| -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by */
|
| +/* Copyright 1996-2002, 2004-2007, 2010, 2013 by */
|
| /* David Turner, Robert Wilhelm, and Werner Lemberg */
|
| /* */
|
| /* This file is part of the FreeType project, and may only be used, */
|
| @@ -141,8 +141,10 @@ FT_BEGIN_HEADER
|
| const void* P );
|
|
|
|
|
| -#define FT_MEM_ALLOC( ptr, size ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )
|
| +#define FT_MEM_ALLOC( ptr, size ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \
|
| + (FT_Long)(size), \
|
| + &error ) )
|
|
|
| #define FT_MEM_FREE( ptr ) \
|
| FT_BEGIN_STMNT \
|
| @@ -154,45 +156,60 @@ FT_BEGIN_HEADER
|
| FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
|
|
|
| #define FT_MEM_REALLOC( ptr, cursz, newsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1, \
|
| - (cursz), (newsz), \
|
| - (ptr), &error ) )
|
| -
|
| -#define FT_MEM_QALLOC( ptr, size ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
| + 1, \
|
| + (FT_Long)(cursz), \
|
| + (FT_Long)(newsz), \
|
| + (ptr), \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_QALLOC( ptr, size ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \
|
| + (FT_Long)(size), \
|
| + &error ) )
|
|
|
| #define FT_MEM_QNEW( ptr ) \
|
| FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
|
|
|
| -#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1, \
|
| - (cursz), (newsz), \
|
| - (ptr), &error ) )
|
| -
|
| -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
| - (cursz), (newsz), \
|
| - (ptr), &error ) )
|
| -
|
| -#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \
|
| - 0, (count), \
|
| - NULL, &error ) )
|
| -
|
| -#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz), \
|
| - (oldcnt), (newcnt), \
|
| - (ptr), &error ) )
|
| -
|
| -#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \
|
| - 0, (count), \
|
| - NULL, &error ) )
|
| -
|
| -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz), \
|
| - (oldcnt), (newcnt), \
|
| - (ptr), &error ) )
|
| +#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
| + 1, \
|
| + (FT_Long)(cursz), \
|
| + (FT_Long)(newsz), \
|
| + (ptr), \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
| + (FT_Long)(item_size), \
|
| + 0, \
|
| + (FT_Long)(count), \
|
| + NULL, \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
| + (FT_Long)(itmsz), \
|
| + (FT_Long)(oldcnt), \
|
| + (FT_Long)(newcnt), \
|
| + (ptr), \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
| + (FT_Long)(item_size), \
|
| + 0, \
|
| + (FT_Long)(count), \
|
| + NULL, \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
| + (FT_Long)(itmsz), \
|
| + (FT_Long)(oldcnt), \
|
| + (FT_Long)(newcnt), \
|
| + (ptr), \
|
| + &error ) )
|
|
|
|
|
| #define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
|
| @@ -236,26 +253,37 @@ FT_BEGIN_HEADER
|
| /* _typed_ in order to automatically compute array element sizes. */
|
| /* */
|
|
|
| -#define FT_MEM_NEW_ARRAY( ptr, count ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
| - 0, (count), \
|
| - NULL, &error ) )
|
| -
|
| -#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
| - (cursz), (newsz), \
|
| - (ptr), &error ) )
|
| -
|
| -#define FT_MEM_QNEW_ARRAY( ptr, count ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
| - 0, (count), \
|
| - NULL, &error ) )
|
| -
|
| -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
| - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
| - (cursz), (newsz), \
|
| - (ptr), &error ) )
|
| -
|
| +#define FT_MEM_NEW_ARRAY( ptr, count ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
| + sizeof ( *(ptr) ), \
|
| + 0, \
|
| + (FT_Long)(count), \
|
| + NULL, \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
| + sizeof ( *(ptr) ), \
|
| + (FT_Long)(cursz), \
|
| + (FT_Long)(newsz), \
|
| + (ptr), \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_QNEW_ARRAY( ptr, count ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
| + sizeof ( *(ptr) ), \
|
| + 0, \
|
| + (FT_Long)(count), \
|
| + NULL, \
|
| + &error ) )
|
| +
|
| +#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
| + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
| + sizeof ( *(ptr) ), \
|
| + (FT_Long)(cursz), \
|
| + (FT_Long)(newsz), \
|
| + (ptr), \
|
| + &error ) )
|
|
|
| #define FT_ALLOC( ptr, size ) \
|
| FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
|
| @@ -303,37 +331,6 @@ FT_BEGIN_HEADER
|
| FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
|
|
|
|
|
| -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
| -
|
| - FT_BASE( FT_Error )
|
| - FT_Alloc( FT_Memory memory,
|
| - FT_Long size,
|
| - void* *P );
|
| -
|
| - FT_BASE( FT_Error )
|
| - FT_QAlloc( FT_Memory memory,
|
| - FT_Long size,
|
| - void* *p );
|
| -
|
| - FT_BASE( FT_Error )
|
| - FT_Realloc( FT_Memory memory,
|
| - FT_Long current,
|
| - FT_Long size,
|
| - void* *P );
|
| -
|
| - FT_BASE( FT_Error )
|
| - FT_QRealloc( FT_Memory memory,
|
| - FT_Long current,
|
| - FT_Long size,
|
| - void* *p );
|
| -
|
| - FT_BASE( void )
|
| - FT_Free( FT_Memory memory,
|
| - void* *P );
|
| -
|
| -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
| -
|
| -
|
| FT_BASE( FT_Pointer )
|
| ft_mem_strdup( FT_Memory memory,
|
| const char* str,
|
| @@ -345,6 +342,7 @@ FT_BEGIN_HEADER
|
| FT_ULong size,
|
| FT_Error *p_error );
|
|
|
| +
|
| #define FT_MEM_STRDUP( dst, str ) \
|
| (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error )
|
|
|
|
|