]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Inlined IMAP_ARG_*() macros' error handling functions.
authorTimo Sirainen <tss@iki.fi>
Tue, 23 Jun 2009 18:44:24 +0000 (14:44 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 23 Jun 2009 18:44:24 +0000 (14:44 -0400)
--HG--
branch : HEAD

src/lib-imap/imap-parser.c
src/lib-imap/imap-parser.h

index abf37c5254736667f294030016d249a6689345cf..e8fdc3476efd105106a6f4dd2c842642da7a4390 100644 (file)
@@ -726,27 +726,3 @@ const char *imap_arg_string(const struct imap_arg *arg)
                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
-}
index 5194f2fcb24d2458902004eeba9bc3064f55b16f..b9ff84da96184f792ba1bd159df2907a3257e3ea 100644 (file)
@@ -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_parser_read_word(struct imap_parser *parser);
 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