[HarfBuzz] harfbuzz-ng: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Nov 18 08:29:18 PST 2009


 configure.ac                     |    2 ++
 src/hb-ot-layout-gpos-private.hh |    4 ++--
 src/hb-private.h                 |   13 ++++++++++---
 3 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit c65b26acf28bd1a5b346fd8f6f28bec1f7d17a2a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Nov 18 11:27:33 2009 -0500

    Use autoconf FLEXIBLE_ARRAY_MEMBER when available

diff --git a/configure.ac b/configure.ac
index 754fd47..12045cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,6 +11,8 @@ AC_PROG_LIBTOOL dnl ([1.4]) Don't remove!
 AC_PROG_CC
 AC_PROG_CXX
 
+AC_C_FLEXIBLE_ARRAY_MEMBER
+
 AC_CHECK_FUNCS(mprotect sysconf getpagesize)
 AC_CHECK_HEADERS(unistd.h sys/mman.h)
 
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index f8cbe78..ad8f241 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -35,8 +35,8 @@
 
 typedef SHORT Value;
 
-typedef Value ValueRecord[VAR];
-ASSERT_SIZE_VAR (Value, 0, ValueRecord);
+typedef Value ValueRecord[VAR0];
+ASSERT_SIZE_VAR (ValueRecord, 0, Value);
 
 struct ValueFormat : USHORT
 {
diff --git a/src/hb-private.h b/src/hb-private.h
index 845d1f0..d86c0c2 100644
--- a/src/hb-private.h
+++ b/src/hb-private.h
@@ -148,11 +148,18 @@ typedef int hb_mutex_t;
 
 #define ASSERT_SIZE(_type, _size) ASSERT_STATIC (sizeof (_type) == (_size))
 
-#define VAR 1 /* Size signifying variable-sized array */
+/* Size signifying variable-sized array */
+#ifdef FLEXIBLE_ARRAY_MEMBER
+#define VAR FLEXIBLE_ARRAY_MEMBER
+#else
+#define VAR 1
+#endif
+
+#define VAR0 (VAR+0)
 #define ASSERT_SIZE_VAR(_type, _size, _var_type) \
-	ASSERT_STATIC (sizeof (_type) == (_size) + VAR * sizeof (_var_type))
+	ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type))
 #define ASSERT_SIZE_VAR2(_type, _size, _var_type1, _var_type2) \
-	ASSERT_STATIC (sizeof (_type) == (_size) + VAR * sizeof (_var_type1) + VAR * sizeof (_var_type2))
+	ASSERT_STATIC (sizeof (_type) == (_size) + VAR0 * sizeof (_var_type1) + VAR0 * sizeof (_var_type2))
 
 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
 #define _HB_BOOLEAN_EXPR(expr) \



More information about the HarfBuzz mailing list