]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts-flatcurve: fts_flatcurve_build_query_arg_term() - Use move constructor when available
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 18 Jul 2023 10:31:09 +0000 (10:31 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 19 Jul 2023 05:02:06 +0000 (05:02 +0000)
Found by coverity

src/plugins/fts-flatcurve/fts-backend-flatcurve-xapian.cc

index c7a8655570e74a5cbb799e82fe85296a1e6a44f6..36f3f031cf8bfb5508efd210b0053b5323c8320f 100644 (file)
@@ -27,6 +27,12 @@ extern "C" {
 #  include <xapian.h>
 #pragma GCC diagnostic pop
 
+#ifdef XAPIAN_MOVE_SEMANTICS
+#  define std_move(x) std::move(x)
+#else
+#  define std_move(x) x
+#endif
+
 #include <algorithm>
 #include <sstream>
 #include <string>
@@ -2034,7 +2040,7 @@ fts_flatcurve_build_query_arg_term(struct flatcurve_fts_query *query,
                                  Xapian::Query::MatchAll, q);
 
        if (x->query == NULL)
-               x->query = new Xapian::Query(q);
+               x->query = new Xapian::Query(std_move(q));
        else {
                oldq = x->query;
                x->query = new Xapian::Query(op, *(x->query), q);