]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-sql: Don't allow passing NULL duration_r to sql_query_finished_event()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Jan 2023 14:13:27 +0000 (16:13 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Jan 2023 14:17:18 +0000 (16:17 +0200)
Almost everyone provides it in any case.

src/lib-sql/driver-cassandra.c
src/lib-sql/sql-api.c

index 0f9b549eadcb7bc6b8d314f5040ffbb3642b7a7a..46b5d539c65dba74f6834a7ad8ff16bd03917a1b 100644 (file)
@@ -1160,6 +1160,7 @@ static void driver_cassandra_log_result(struct cassandra_result *result,
 {
        struct cassandra_db *db = container_of(result->api.db, struct cassandra_db, api);
        struct timeval now;
+       int duration ATTR_UNUSED;
        unsigned int row_count;
 
        i_gettimeofday(&now);
@@ -1184,7 +1185,7 @@ static void driver_cassandra_log_result(struct cassandra_result *result,
        struct event_passthrough *e =
                sql_query_finished_event(&db->api, result->api.event,
                                         result->log_query, result->error == NULL,
-                                        NULL);
+                                        &duration);
        if (result->error != NULL)
                e->add_str("error", result->error);
 
index 24c3b0db9de227b42354ce6a830303294e74c7fa..3de8b45f5ef15c84002910ed43e6185a39cb77a5 100644 (file)
@@ -826,9 +826,7 @@ sql_query_finished_event(struct sql_db *db, struct event *event, const char *que
                e->add_str("slow_query", "y");
                db->slow_queries++;
        }
-
-       if (duration_r != NULL)
-               *duration_r = diff;
+       *duration_r = diff;
 
        return e;
 }