[dovecot-cvs] dovecot/src/lib array.h,1.22,1.23
tss at dovecot.org
tss at dovecot.org
Sat Mar 31 08:01:09 EEST 2007
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request.c, 1.94, 1.95 auth-request.h, 1.35, 1.36 auth-worker-client.c, 1.32, 1.33 db-sql.c, 1.13, 1.14 db-sql.h, 1.5, 1.6 mech-apop.c, 1.25, 1.26 mech-cram-md5.c, 1.26, 1.27 mech-digest-md5.c, 1.44, 1.45 mech-ntlm.c, 1.28, 1.29 mech-otp.c, 1.2, 1.3 mech-rpa.c, 1.29, 1.30 mech-skey.c, 1.2, 1.3 passdb-sql.c, 1.32, 1.33 passdb.c, 1.48, 1.49 passdb.h, 1.38, 1.39 userdb-static.c, 1.24, 1.25
- Next message: [dovecot-cvs] dovecot/src/lib module-context.h,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv10622
Modified Files:
array.h
Log Message:
Use COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE() for validating the data type.
Index: array.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/array.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- array.h 25 Jan 2007 13:17:12 -0000 1.22
+++ array.h 31 Mar 2007 05:01:06 -0000 1.23
@@ -45,13 +45,12 @@
# define ARRAY_TYPE_CAST_MODIFIABLE(array) \
(typeof(*(array)->v_modifiable))
# define ARRAY_TYPE_CHECK(array, data) \
- typeof(const typeof(**(array)->v_modifiable) *) \
- __tmp_array_data2 __attr_unused__ = \
- (typeof(const typeof(typeof(*(data)) *)))NULL;
+ COMPILE_ERROR_IF_TYPES_NOT_COMPATIBLE( \
+ **(array)->v_modifiable, *data)
#else
# define ARRAY_TYPE_CAST_CONST(array)
# define ARRAY_TYPE_CAST_MODIFIABLE(array)
-# define ARRAY_TYPE_CHECK(array, data)
+# define ARRAY_TYPE_CHECK(array, data) 0
#endif
static inline void
@@ -107,10 +106,9 @@
buffer_append(array->buffer, data, count * array->element_size);
}
-#define array_append(array, data, count) STMT_START { \
- ARRAY_TYPE_CHECK(array, data) \
- _array_append(&(array)->arr, data, count); \
-} STMT_END
+#define array_append(array, data, count) \
+ _array_append(&(array)->arr + ARRAY_TYPE_CHECK(array, data), \
+ data, count)
static inline void
_array_append_array(struct array *dest_array, const struct array *src_array)
@@ -129,10 +127,9 @@
data, count * array->element_size);
}
-#define array_insert(array, idx, data, count) STMT_START { \
- ARRAY_TYPE_CHECK(array, data) \
- _array_insert(&(array)->arr, idx, data, count); \
- } STMT_END
+#define array_insert(array, idx, data, count) \
+ _array_insert(&(array)->arr + ARRAY_TYPE_CHECK(array, data), \
+ idx, data, count)
static inline void
_array_delete(struct array *array, unsigned int idx, unsigned int count)
@@ -200,10 +197,8 @@
}
buffer_write(array->buffer, pos, data, array->element_size);
}
-#define array_idx_set(array, idx, data) STMT_START { \
- ARRAY_TYPE_CHECK(array, data) \
- _array_idx_set(&(array)->arr, idx, data); \
- } STMT_END
+#define array_idx_set(array, idx, data) \
+ _array_idx_set(&(array)->arr + ARRAY_TYPE_CHECK(array, data), idx, data)
static inline void
_array_idx_clear(struct array *array, unsigned int idx)
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request.c, 1.94, 1.95 auth-request.h, 1.35, 1.36 auth-worker-client.c, 1.32, 1.33 db-sql.c, 1.13, 1.14 db-sql.h, 1.5, 1.6 mech-apop.c, 1.25, 1.26 mech-cram-md5.c, 1.26, 1.27 mech-digest-md5.c, 1.44, 1.45 mech-ntlm.c, 1.28, 1.29 mech-otp.c, 1.2, 1.3 mech-rpa.c, 1.29, 1.30 mech-skey.c, 1.2, 1.3 passdb-sql.c, 1.32, 1.33 passdb.c, 1.48, 1.49 passdb.h, 1.38, 1.39 userdb-static.c, 1.24, 1.25
- Next message: [dovecot-cvs] dovecot/src/lib module-context.h,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list