]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Move event_send_callbacks() and event_send_free() earlier in the file
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 5 Sep 2019 08:51:44 +0000 (11:51 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 5 Sep 2019 13:29:28 +0000 (13:29 +0000)
src/lib/lib-event.c

index b5aca13abcd4ec74f88d7505e25b2980ed4a8a3f..f7aaceefc2f8e53c47aae3fe2dd89aa4e61b5d78 100644 (file)
@@ -54,6 +54,39 @@ event_find_category(struct event *event, const struct event_category *category);
 static struct event_field *
 event_find_field_int(struct event *event, const char *key);
 
+static bool
+event_send_callbacks(struct event *event, enum event_callback_type type,
+                    struct failure_context *ctx, const char *fmt, va_list args)
+{
+       event_callback_t *const *callbackp;
+
+       array_foreach(&event_handlers, callbackp) {
+               bool ret;
+
+               T_BEGIN {
+                       ret = (*callbackp)(event, type, ctx, fmt, args);
+               } T_END;
+               if (!ret) {
+                       /* event sending was stopped */
+                       return FALSE;
+               }
+       }
+       return TRUE;
+}
+
+static void event_send_free(struct event *event, ...)
+{
+       va_list args;
+
+       /* the args are empty and not used for anything, but there doesn't seem
+          to be any nice and standard way of passing an initialized va_list
+          as a parameter without va_start(). */
+       va_start(args, event);
+       (void)event_send_callbacks(event, EVENT_CALLBACK_TYPE_FREE,
+                                  NULL, NULL, args);
+       va_end(args);
+}
+
 void event_copy_categories(struct event *to, struct event *from)
 {
        unsigned int cat_count;
@@ -327,26 +360,6 @@ event_create_passthrough(struct event *parent, const char *source_filename,
        return event_last_passthrough;
 }
 
-static bool
-event_send_callbacks(struct event *event, enum event_callback_type type,
-                    struct failure_context *ctx, const char *fmt, va_list args)
-{
-       event_callback_t *const *callbackp;
-
-       array_foreach(&event_handlers, callbackp) {
-               bool ret;
-
-               T_BEGIN {
-                       ret = (*callbackp)(event, type, ctx, fmt, args);
-               } T_END;
-               if (!ret) {
-                       /* event sending was stopped */
-                       return FALSE;
-               }
-       }
-       return TRUE;
-}
-
 struct event *event_ref(struct event *event)
 {
        i_assert(event->refcount > 0);
@@ -355,19 +368,6 @@ struct event *event_ref(struct event *event)
        return event;
 }
 
-static void event_send_free(struct event *event, ...)
-{
-       va_list args;
-
-       /* the args are empty and not used for anything, but there doesn't seem
-          to be any nice and standard way of passing an initialized va_list
-          as a parameter without va_start(). */
-       va_start(args, event);
-       (void)event_send_callbacks(event, EVENT_CALLBACK_TYPE_FREE,
-                                  NULL, NULL, args);
-       va_end(args);
-}
-
 void event_unref(struct event **_event)
 {
        struct event *event = *_event;