]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Fixed compiling on some older pre-C99 compilers.
authorTimo Sirainen <tss@iki.fi>
Sat, 12 Jul 2008 13:24:47 +0000 (16:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 12 Jul 2008 13:24:47 +0000 (16:24 +0300)
--HG--
branch : HEAD

configure.in
src/lib-imap/imap-match.c
src/lib/str-find.c

index e1d09883d10df1d6651f4fa0b5e8a9ce9ec4d4b4..5a858ba2e06b52ccc6751272ae19e21c779d62e9 100644 (file)
@@ -1020,6 +1020,25 @@ 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])
 AC_CACHE_VAL(i_cv_struct_iovec,
index c76f3d1f5e7048d649808ea8733f1554997079dd..2d5cd7ba3540ef1e82845cdb0e251e00b842da83 100644 (file)
@@ -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 {
index a37c0dabf6a7370a947d0d5d6bd787c1bd99159d..d0c045a0b34d15a4b1d002e4f70dbc215d4b460b 100644 (file)
@@ -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)