From 24f52d9b171f5474a4d1e8c2f10a198dc462ae65 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Tue, 7 Mar 2023 11:44:20 +0000 Subject: [PATCH] Remove incorrect operator!= for GncItem It's better to use the default std::pair implementation - spotted by clang-tidy bugprone-suspicious-string-compare - will always return false, because type is the same Also, - remove redundant "using GncItem ..." --- libgnucash/engine/gnc-option-impl.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/libgnucash/engine/gnc-option-impl.cpp b/libgnucash/engine/gnc-option-impl.cpp index 636960a548..6c97e9aba9 100644 --- a/libgnucash/engine/gnc-option-impl.cpp +++ b/libgnucash/engine/gnc-option-impl.cpp @@ -143,8 +143,6 @@ GncOptionGncOwnerValue::serialize() const noexcept return retval; } -using GncItem = std::pair; - static GncItem make_gnc_item(const QofInstance* inst) { @@ -176,14 +174,6 @@ qof_instance_from_gnc_item(const GncItem& item) return static_cast(qof_collection_lookup_entity(coll, &guid)); } -static bool -operator!=(const GncItem& left, const GncItem& right) -{ - auto [ltype, lguid]{left}; - auto [rtype, rguid]{right}; - return strcmp(rtype, ltype) && !guid_equal(&rguid, &lguid); -} - GncOptionQofInstanceValue::GncOptionQofInstanceValue( const char* section, const char* name, const char* key, const char* doc_string, @@ -233,6 +223,12 @@ GncOptionQofInstanceValue::reset_default_value() m_value = m_default_value; } +static bool +operator==(const GncGUID& l, const GncGUID& r) +{ + return guid_equal(&l, &r); +} + bool GncOptionQofInstanceValue::is_changed() const noexcept { @@ -447,12 +443,6 @@ GncOptionAccountListValue::get_default_value() const return retval; } -static bool -operator==(const GncGUID& l, const GncGUID& r) -{ - return guid_equal(&l, &r); -} - bool GncOptionAccountListValue::is_changed() const noexcept {