dovecot-2.0: Inlined IMAP_ARG_*() macros' error handling functions.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 23 21:45:10 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/a81dfcf5a78d
changeset: 9511:a81dfcf5a78d
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 23 14:44:24 2009 -0400
description:
Inlined IMAP_ARG_*() macros' error handling functions.
diffstat:
2 files changed, 30 insertions(+), 33 deletions(-)
src/lib-imap/imap-parser.c | 24 ------------------------
src/lib-imap/imap-parser.h | 39 ++++++++++++++++++++++++++++++---------
diffs (97 lines):
diff -r 5ef9cca6fa27 -r a81dfcf5a78d src/lib-imap/imap-parser.c
--- a/src/lib-imap/imap-parser.c Tue Jun 23 14:30:09 2009 -0400
+++ b/src/lib-imap/imap-parser.c Tue Jun 23 14:44:24 2009 -0400
@@ -726,27 +726,3 @@ const char *imap_arg_string(const struct
return NULL;
}
}
-
-char *imap_arg_str_error(const struct imap_arg *arg)
-{
- i_panic("Tried to access imap_arg type %d as string", arg->type);
-#ifndef ATTRS_DEFINED
- return NULL;
-#endif
-}
-
-uoff_t imap_arg_literal_size_error(const struct imap_arg *arg)
-{
- i_panic("Tried to access imap_arg type %d as literal size", arg->type);
-#ifndef ATTRS_DEFINED
- return 0;
-#endif
-}
-
-ARRAY_TYPE(imap_arg_list) *imap_arg_list_error(const struct imap_arg *arg)
-{
- i_panic("Tried to access imap_arg type %d as list", arg->type);
-#ifndef ATTRS_DEFINED
- return NULL;
-#endif
-}
diff -r 5ef9cca6fa27 -r a81dfcf5a78d src/lib-imap/imap-parser.h
--- a/src/lib-imap/imap-parser.h Tue Jun 23 14:30:09 2009 -0400
+++ b/src/lib-imap/imap-parser.h Tue Jun 23 14:44:24 2009 -0400
@@ -68,21 +68,21 @@ struct imap_arg {
#define IMAP_ARG_STR(arg) \
((arg)->type == IMAP_ARG_NIL ? NULL : \
IMAP_ARG_TYPE_IS_STRING((arg)->type) ? \
- (arg)->_data.str : imap_arg_str_error(arg))
+ (arg)->_data.str : imap_arg_str_error())
#define IMAP_ARG_STR_NONULL(arg) \
((arg)->type == IMAP_ARG_ATOM || (arg)->type == IMAP_ARG_STRING || \
(arg)->type == IMAP_ARG_LITERAL ? \
- (arg)->_data.str : imap_arg_str_error(arg))
+ (arg)->_data.str : imap_arg_str_error())
#define IMAP_ARG_LITERAL_SIZE(arg) \
(((arg)->type == IMAP_ARG_LITERAL_SIZE || \
(arg)->type == IMAP_ARG_LITERAL_SIZE_NONSYNC) ? \
- (arg)->_data.literal_size : imap_arg_literal_size_error(arg))
+ (arg)->_data.literal_size : imap_arg_literal_size_error())
#define IMAP_ARG_LIST(arg) \
((arg)->type == IMAP_ARG_LIST ? \
- &(arg)->_data.list : imap_arg_list_error(arg))
+ &(arg)->_data.list : imap_arg_list_error())
#define IMAP_ARG_LIST_ARGS(arg) \
array_idx(IMAP_ARG_LIST(arg), 0)
#define IMAP_ARG_LIST_COUNT(arg) \
@@ -144,10 +144,31 @@ const char *imap_arg_string(const struct
const char *imap_arg_string(const struct imap_arg *arg);
/* Error functions */
-char *imap_arg_str_error(const struct imap_arg *arg) ATTR_NORETURN;
-uoff_t imap_arg_literal_size_error(const struct imap_arg *arg)
- ATTR_NORETURN;
-ARRAY_TYPE(imap_arg_list) *imap_arg_list_error(const struct imap_arg *arg)
- ATTR_NORETURN;
+static inline char * ATTR_NORETURN
+imap_arg_str_error(void)
+{
+ i_unreached();
+#ifndef ATTRS_DEFINED
+ return NULL;
+#endif
+}
+
+static inline uoff_t ATTR_NORETURN
+imap_arg_literal_size_error(void)
+{
+ i_unreached();
+#ifndef ATTRS_DEFINED
+ return 0;
+#endif
+}
+
+static inline ARRAY_TYPE(imap_arg_list) * ATTR_NORETURN
+imap_arg_list_error(void)
+{
+ i_unreached();
+#ifndef ATTRS_DEFINED
+ return NULL;
+#endif
+}
#endif
More information about the dovecot-cvs
mailing list