Skip to content

Commit

Permalink
fixup! [account.cpp] test equality for kvp_string, bail if unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Oct 13, 2024
1 parent 7383fb5 commit aacb8bf
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libgnucash/engine/Account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,12 +2495,23 @@ get_kvp_gnc_numeric_path (const Account *acc, const Path& path)
return qof_instance_get_path_kvp<gnc_numeric> (QOF_INSTANCE(acc), path);
}

static const char*
get_kvp_string_path (const Account *acc, const Path& path)
{
g_return_val_if_fail (GNC_IS_ACCOUNT(acc), nullptr);
auto rv{qof_instance_get_path_kvp<const char*> (QOF_INSTANCE(acc), path)};
return rv ? *rv : nullptr;
}

static void
set_kvp_string_path (Account *acc, std::vector<std::string> const & path,
const char *value)
{
g_return_if_fail(GNC_IS_ACCOUNT(acc));

if (!g_strcmp0 (get_kvp_string_path (acc, path), value)
return;

std::optional<const char*> val;
if (value && *value)
val = g_strdup(value);
Expand All @@ -2510,14 +2521,6 @@ set_kvp_string_path (Account *acc, std::vector<std::string> const & path,
xaccAccountCommitEdit(acc);
}

static const char*
get_kvp_string_path (const Account *acc, const Path& path)
{
g_return_val_if_fail (GNC_IS_ACCOUNT(acc), nullptr);
auto rv{qof_instance_get_path_kvp<const char*> (QOF_INSTANCE(acc), path)};
return rv ? *rv : nullptr;
}

static void
set_kvp_account_path (Account* acc, const Path& path, const Account* kvp_account)
{
Expand Down

0 comments on commit aacb8bf

Please sign in to comment.