dovecot-1.2: Fixed compiling on some older pre-C99 compilers.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jul 12 16:25:02 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/0d66b44689ee
changeset: 7997:0d66b44689ee
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jul 12 16:24:47 2008 +0300
description:
Fixed compiling on some older pre-C99 compilers.

diffstat:

3 files changed, 21 insertions(+), 2 deletions(-)
configure.in              |   19 +++++++++++++++++++
src/lib-imap/imap-match.c |    2 +-
src/lib/str-find.c        |    2 +-

diffs (53 lines):

diff -r fa90c913eae4 -r 0d66b44689ee configure.in
--- a/configure.in	Sat Jul 12 16:16:19 2008 +0300
+++ b/configure.in	Sat Jul 12 16:24:47 2008 +0300
@@ -1019,6 +1019,25 @@ if test $i_cv_signed_time_t = yes; then
 if test $i_cv_signed_time_t = yes; then
   AC_DEFINE(TIME_T_SIGNED,, Define if your time_t is signed)
 fi
+
+dnl Our implementation of AC_C_FLEXIBLE_ARRAY_MEMBER.
+dnl Use it until autoconf 2.61+ becomes more widely used
+AC_MSG_CHECKING([if we can use C99-like flexible array members])
+AC_TRY_COMPILE([
+  struct foo {
+    int x;
+    char y[];
+  };
+], [
+  struct foo foo;
+], [
+  flexible_value=""
+  AC_MSG_RESULT(yes)
+], [
+  flexible_value=1
+  AC_MSG_RESULT(no)
+])
+AC_DEFINE_UNQUOTED(FLEXIBLE_ARRAY_MEMBER, $flexible_value, How to define flexible array members in structs)
 
 dnl * do we have struct iovec
 AC_MSG_CHECKING([for struct iovec])
diff -r fa90c913eae4 -r 0d66b44689ee src/lib-imap/imap-match.c
--- a/src/lib-imap/imap-match.c	Sat Jul 12 16:16:19 2008 +0300
+++ b/src/lib-imap/imap-match.c	Sat Jul 12 16:24:47 2008 +0300
@@ -19,7 +19,7 @@ struct imap_match_glob {
 	struct imap_match_pattern *patterns;
 
 	char sep;
-	char patterns_data[];
+	char patterns_data[FLEXIBLE_ARRAY_MEMBER];
 };
 
 struct imap_match_context {
diff -r fa90c913eae4 -r 0d66b44689ee src/lib/str-find.c
--- a/src/lib/str-find.c	Sat Jul 12 16:16:19 2008 +0300
+++ b/src/lib/str-find.c	Sat Jul 12 16:24:47 2008 +0300
@@ -14,7 +14,7 @@ struct str_find_context {
 	unsigned int match_count;
 
 	int badtab[UCHAR_MAX+1];
-	int goodtab[];
+	int goodtab[FLEXIBLE_ARRAY_MEMBER];
 };
 
 static void init_badtab(struct str_find_context *ctx)


More information about the dovecot-cvs mailing list