]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: replace event_copy_categories_fields() into two
authorJosef 'Jeff' Sipek <jeff.sipek@open-xchange.com>
Fri, 15 Mar 2019 00:21:15 +0000 (20:21 -0400)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 20 May 2019 06:46:32 +0000 (06:46 +0000)
It is more flexible to allow to copy only categories or only fields.

src/lib-master/stats-client.c
src/lib/lib-event.c
src/lib/lib-event.h

index 6cea2313c247402ec3ed06fc13d9dad0b3263f88..5acf197f6b633503dda0e809150f1cb338ce5074 100644 (file)
@@ -176,7 +176,8 @@ static struct event *stats_event_get_merged(struct event *event)
                                res = event_dup(event);
                                use_original = FALSE;
                        }
-                       event_copy_categories_fields(res, p);
+                       event_copy_categories(res, p);
+                       event_copy_fields(res, p);
                }
        }
 
index ffa4a85760ebbfc0f2f1f0e0d8e8fbb5eb9b6162..20b985db38a55ef6d1c0e3bd5deffac97df66d5a 100644 (file)
@@ -54,12 +54,16 @@ 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);
 
-void event_copy_categories_fields(struct event *to, struct event *from)
+void event_copy_categories(struct event *to, struct event *from)
 {
        unsigned int cat_count;
        struct event_category *const *categories = event_get_categories(from, &cat_count);
        while (cat_count-- > 0)
                event_add_category(to, categories[cat_count]);
+}
+
+void event_copy_fields(struct event *to, struct event *from)
+{
        const struct event_field *fld;
        if (!array_is_created(&from->fields))
                return;
index 5efe4bc13f9b71cecbb70408e6331176dabf1e8c..e598044572fd695f96537dd37531dab81f810fbd 100644 (file)
@@ -87,10 +87,14 @@ bool event_has_all_fields(struct event *event, const struct event *other);
 
 /* Returns the source event duplicated into a new event. */
 struct event *event_dup(const struct event *source);
-/* Copy all categories and fields from source to dest.
-   Only the fields and categories in source event itself are copied.
-   Parent events' fields and categories aren't copied. */
-void event_copy_categories_fields(struct event *dest, struct event *source);
+/* Copy all categories from source to dest.
+   Only the categories in source event itself are copied.
+   Parent events' categories aren't copied. */
+void event_copy_categories(struct event *to, struct event *from);
+/* Copy all fields from source to dest.
+   Only the fields in source event itself are copied.
+   Parent events' fields aren't copied. */
+void event_copy_fields(struct event *to, struct event *from);
 
 /* Create a new empty event under the parent event, or NULL for root event. */
 struct event *event_create(struct event *parent, const char *source_filename,