X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=include%2Finternal%2Fftmemory.h;fp=include%2Ffreetype%2Finternal%2Fftmemory.h;h=3d51aeec69fd061bc6ed261efe456c1d2fa36ef4;hb=afcae9b7a0a6009d33581fac78416fc9623a8a18;hp=026aa63eaa9f17edbaa773bf5ce59263d63fb9eb;hpb=46ec2c26b7d34b4a37c96ed6049ce3fd0702dc78;p=framework%2Fgraphics%2Ffreetype.git diff --git a/include/freetype/internal/ftmemory.h b/include/internal/ftmemory.h similarity index 71% rename from include/freetype/internal/ftmemory.h rename to include/internal/ftmemory.h index 026aa63..3d51aee 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/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 )