dovecot-2.2: lib: array/hash - enable typof checks for more comp...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 14 22:15:38 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/77638cc62ca8
changeset: 18090:77638cc62ca8
user:      Phil Carmody <phil at dovecot.fi>
date:      Sat Nov 15 00:14:20 2014 +0200
description:
lib: array/hash - enable typof checks for more compilers
We have a HAVE_TYPEOF macro from autoconf, we may as well make use of it.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/array.h |  4 ++--
 src/lib/hash.h  |  2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 922ac3245e17 -r 77638cc62ca8 src/lib/array.h
--- a/src/lib/array.h	Sat Nov 15 00:06:09 2014 +0200
+++ b/src/lib/array.h	Sat Nov 15 00:14:20 2014 +0200
@@ -2,7 +2,7 @@
 #define ARRAY_H
 
 /* Array is a buffer accessible using fixed size elements. As long as the
-   compiler provides typeof() function, the array provides type safety. If
+   compiler provides a typeof() operator, the array provides type safety. If
    a wrong type is tried to be added to the array, or if the array's contents
    are tried to be used using a wrong type, the compiler will give a warning.
 
@@ -39,7 +39,7 @@
 #define t_array_init(array, init_count) \
 	p_array_init(array, pool_datastack_create(), init_count)
 
-#ifdef __GNUC__
+#ifdef HAVE_TYPEOF
 #  define ARRAY_TYPE_CAST_CONST(array) \
 	(typeof(*(array)->v))
 #  define ARRAY_TYPE_CAST_MODIFIABLE(array) \
diff -r 922ac3245e17 -r 77638cc62ca8 src/lib/hash.h
--- a/src/lib/hash.h	Sat Nov 15 00:06:09 2014 +0200
+++ b/src/lib/hash.h	Sat Nov 15 00:14:20 2014 +0200
@@ -3,7 +3,7 @@
 
 struct hash_table;
 
-#ifdef __GNUC__
+#ifdef HAVE_TYPEOF
 #  define HASH_VALUE_CAST(table) (typeof((table)._value))
 #else
 #  define HASH_VALUE_CAST(table)


More information about the dovecot-cvs mailing list