changeset 3343:239520983a32 HEAD

Still more changes to how typeof() is used. Now it finally seems to be working nicely.
author Timo Sirainen <tss@iki.fi>
date Tue, 26 Apr 2005 21:36:05 +0300
parents 43d4aad84752
children 09457ba69253
files src/lib/array.h
diffstat 1 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/array.h	Tue Apr 26 19:32:02 2005 +0300
+++ b/src/lib/array.h	Tue Apr 26 21:36:05 2005 +0300
@@ -120,7 +120,7 @@
 #  define array_append _array_append
 #else
 #  define array_append(array, data, count) STMT_START { \
-	typeof(*(array ## __ ## type)) _array_tmp = data; \
+	typeof(const typeof(**(array ## __ ## type)) *) _array_tmp = data; \
 	_array_append(array, _array_tmp, count); \
 	} STMT_END
 #endif
@@ -143,7 +143,7 @@
 #  define array_insert _array_insert
 #else
 #  define array_insert(array, idx, data, count) STMT_START { \
-	typeof(*(array ## __ ## type)) _array_tmp = data; \
+	typeof(const typeof(**(array ## __ ## type)) *) _array_tmp = data; \
 	_array_insert(array, idx, _array_tmp, count); \
 	} STMT_END
 #endif
@@ -166,7 +166,7 @@
 #  define array_get _array_get
 #else
 #  define array_get(array, count) \
-	(const typeof(*(array ## __ ## type)))_array_get(array, count)
+	(typeof(typeof(**array ## __ ## type) const *))_array_get(array, count)
 #endif
 
 static inline const void *
@@ -179,7 +179,7 @@
 #  define array_idx _array_idx
 #else
 #  define array_idx(array, idx) \
-	(const typeof(*(array ## __ ## type)))_array_idx(array, idx)
+	(typeof(typeof(**array ## __ ## type) const *))_array_idx(array, idx)
 #endif
 
 static inline void *
@@ -193,8 +193,7 @@
 #  define array_get_modifyable _array_get_modifyable
 #else
 #  define array_get_modifyable(array, count) \
-	(typeof(*(array ## __ ## type))) \
-		_array_get_modifyable(array, count)
+	(typeof(*array ## __ ## type))_array_get_modifyable(array, count)
 #endif
 
 static inline void *
@@ -214,8 +213,7 @@
 #  define array_modifyable_idx _array_modifyable_idx
 #else
 #  define array_modifyable_idx(array, count) \
-	(typeof(*(array ## __ ## type))) \
-		_array_modifyable_idx(array, count)
+	(typeof(*array ## __ ## type))_array_modifyable_idx(array, count)
 #endif
 
 static inline void
@@ -234,7 +232,7 @@
 #  define array_idx_set _array_idx_set
 #else
 #  define array_idx_set(array, idx, data) STMT_START { \
-	typeof(*(array ## __ ## type)) _array_tmp = data; \
+	typeof(const typeof(**(array ## __ ## type)) *) _array_tmp = data; \
 	_array_idx_set(array, idx, _array_tmp); \
 	} STMT_END
 #endif
@@ -252,8 +250,7 @@
 #  define array_modifyable_append _array_modifyable_append
 #else
 #  define array_modifyable_append(array) \
-	(typeof(*(array ## __ ## type))) \
-		_array_modifyable_append(array)
+	(typeof(*array ## __ ## type))_array_modifyable_append(array)
 #endif
 
 static inline void *
@@ -274,8 +271,7 @@
 #  define array_modifyable_insert _array_modifyable_insert
 #else
 #  define array_modifyable_insert(array, idx) \
-	(typeof(*(array ## __ ## type))) \
-		_array_modifyable_insert(array, idx)
+	(typeof(*array ## __ ## type))_array_modifyable_insert(array, idx)
 #endif
 
 static inline unsigned int