shithub: freetype+ttf2subf

Download patch

ref: a94746caeee0fd861c0711f14b7870a0952338a1
parent: 679a252c24e3ccbe2dadfacd363139f7e1dd01cb
author: Werner Lemberg <[email protected]>
date: Wed May 3 16:39:55 EDT 2006

Formatting.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
 2006-05-03  David Turner  <[email protected]>
 
-    * 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  <[email protected]>
 
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -57,14 +57,16 @@
   /*************************************************************************/
 
 
- /* 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_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 @@
                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 @@
                                                  (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 @@
                                                   (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 @@
   /* _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 ) )