Formatting.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
diff --git a/ChangeLog b/ChangeLog
index 5f9aec6..842cd62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
2006-05-03 David Turner <david@freetype.org>
- * include/freetype/internal/ftmemory.h: allow compilation with
- C++ compilers
+ Allow compilation again with C++ compilers.
+
+ * include/freetype/internal/ftmemory.h (FT_ASSIGNP,
+ FT_ASSIGNP_INNER): New macros which do the actual assignment, and
+ which exist in two variants (for C and C++).
+ Update callers accordingly.
2006-05-03 Werner Lemberg <wl@gnu.org>
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index d7f4ded..a4c1a70 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -57,14 +57,16 @@ FT_BEGIN_HEADER
/*************************************************************************/
- /* C++ absolutely hates statements like p = (void*)anything; where 'p' is
- * a typed pointer. Since we don't have a typeof operator in standard C++,
- * we need some really ugly casts, like:
- */
+ /*
+ * C++ refuses to handle statements like p = (void*)anything; where `p'
+ * is a typed pointer. Since we don't have a `typeof' operator in
+ * standard C++, we have to use ugly casts.
+ */
+
#ifdef __cplusplus
-# define FT_ASSIGNP(p,val) *((void**)&(p)) = (val)
+#define FT_ASSIGNP( p, val ) *((void**)&(p)) = (val)
#else
-# define FT_ASSIGNP(p,val) (p) = (val)
+#define FT_ASSIGNP( p, val ) (p) = (val)
#endif
@@ -74,18 +76,18 @@ FT_BEGIN_HEADER
FT_BASE( const char* ) _ft_debug_file;
FT_BASE( long ) _ft_debug_lineno;
-# define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
- _ft_debug_lineno = __LINE__, \
- (exp) )
+#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
+ _ft_debug_lineno = __LINE__, \
+ (exp) )
-# define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \
- _ft_debug_lineno = __LINE__, \
- FT_ASSIGNP( p, exp ) )
+#define FT_ASSIGNP_INNER( p, exp ) ( _ft_debug_file = __FILE__, \
+ _ft_debug_lineno = __LINE__, \
+ FT_ASSIGNP( p, exp ) )
#else /* !FT_DEBUG_MEMORY */
-# define FT_DEBUG_INNER( exp ) (exp)
-# define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )
+#define FT_DEBUG_INNER( exp ) (exp)
+#define FT_ASSIGNP_INNER( p, exp ) FT_ASSIGNP( p, exp )
#endif /* !FT_DEBUG_MEMORY */
@@ -127,7 +129,7 @@ FT_BEGIN_HEADER
const void* P );
-#define FT_MEM_ALLOC( ptr, size ) \
+#define FT_MEM_ALLOC( ptr, size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )
#define FT_MEM_FREE( ptr ) \
@@ -144,7 +146,7 @@ FT_BEGIN_HEADER
(cursz), (newsz), \
(ptr), &error ) )
-#define FT_MEM_QALLOC( ptr, size ) \
+#define FT_MEM_QALLOC( ptr, size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )
#define FT_MEM_QNEW( ptr ) \
@@ -155,22 +157,22 @@ FT_BEGIN_HEADER
(cursz), (newsz), \
(ptr), &error ) )
-#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
+#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 ) \
+#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 ) \
+#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 ) \
+#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \
0, (count), \
NULL, &error ) )
@@ -222,22 +224,22 @@ FT_BEGIN_HEADER
/* _typed_ in order to automatically compute array element sizes. */
/* */
-#define FT_MEM_NEW_ARRAY( ptr, count ) \
+#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 ) \
+#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 ) \
+#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 ) \
+#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
(cursz), (newsz), \
(ptr), &error ) )