gnucash stable: Multiple changes pushed
Christopher Lam
clam at code.gnucash.org
Tue Sep 19 19:29:58 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/550c43d1 (commit)
via https://github.com/Gnucash/gnucash/commit/8e21d332 (commit)
from https://github.com/Gnucash/gnucash/commit/a49fd0bc (commit)
commit 550c43d13a24f11fe43a67f64f4843883d733f60
Merge: a49fd0bc09 8e21d3328f
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Sep 20 07:29:16 2023 +0800
Merge branch 'free-guid-string' into stable #1777
commit 8e21d3328f6b83a56ee5eed5710d433319a27280
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Tue Sep 19 20:25:30 2023 +0800
guid_to_string should be freed.
diff --git a/bindings/guile/gnc-optiondb.i b/bindings/guile/gnc-optiondb.i
index 4e3874bc51..4b81198e0e 100644
--- a/bindings/guile/gnc-optiondb.i
+++ b/bindings/guile/gnc-optiondb.i
@@ -1226,9 +1226,10 @@ inline SCM return_scm_value(ValueType value)
if (guid_list.empty())
return scm_simple_format(SCM_BOOL_F, list_format_str, scm_list_1(no_value));
SCM string_list{SCM_EOL};
+ char guid_str[GUID_ENCODING_LENGTH+1];
for(auto guid : guid_list)
{
- auto guid_str{guid_to_string(&guid)};
+ guid_to_string_buff (&guid, guid_str);
auto guid_scm{scm_from_utf8_string(guid_str)};
string_list = scm_cons(guid_scm, string_list);
}
diff --git a/libgnucash/backend/sql/gnc-owner-sql.cpp b/libgnucash/backend/sql/gnc-owner-sql.cpp
index 46b5ca360c..2a5e736c98 100644
--- a/libgnucash/backend/sql/gnc-owner-sql.cpp
+++ b/libgnucash/backend/sql/gnc-owner-sql.cpp
@@ -225,7 +225,11 @@ GncSqlColumnTableEntryImpl<CT_OWNERREF>::add_to_query(QofIdTypeConst obj_name,
buf.str("");
auto guid = qof_instance_get_guid(inst);
if (guid != nullptr)
- buf << guid_to_string(guid);
+ {
+ char strbuff[GUID_ENCODING_LENGTH+1];
+ guid_to_string_buff (guid, strbuff);
+ buf << strbuff;
+ }
else
buf << "NULL";
vec.emplace_back(std::make_pair(guid_hdr, quote_string(buf.str())));
diff --git a/libgnucash/engine/gnc-option-impl.cpp b/libgnucash/engine/gnc-option-impl.cpp
index b60b18a2ae..a2e7d05928 100644
--- a/libgnucash/engine/gnc-option-impl.cpp
+++ b/libgnucash/engine/gnc-option-impl.cpp
@@ -877,7 +877,12 @@ std::string
GncOptionAccountSelValue::serialize() const noexcept
{
static const std::string no_value{"No Value"};
- return guid_equal(guid_null(), &m_value) ? no_value : guid_to_string(&m_value);
+ if (guid_equal(guid_null(), &m_value))
+ return no_value;
+
+ gchar strbuff[GUID_ENCODING_LENGTH + 1];
+ guid_to_string_buff (&m_value, strbuff);
+ return strbuff;
}
bool
diff --git a/libgnucash/engine/gnc-option-impl.hpp b/libgnucash/engine/gnc-option-impl.hpp
index 4ebaa36708..ed4b8ad847 100644
--- a/libgnucash/engine/gnc-option-impl.hpp
+++ b/libgnucash/engine/gnc-option-impl.hpp
@@ -898,7 +898,9 @@ operator<< <GncOptionAccountListValue>(std::ostream& oss,
first = false;
else
oss << " ";
- oss << guid_to_string(&value);
+ char strbuff[GUID_ENCODING_LENGTH+1];
+ guid_to_string_buff (&value, strbuff);
+ oss << strbuff;
}
return oss;
}
Summary of changes:
bindings/guile/gnc-optiondb.i | 3 ++-
libgnucash/backend/sql/gnc-owner-sql.cpp | 6 +++++-
libgnucash/engine/gnc-option-impl.cpp | 7 ++++++-
libgnucash/engine/gnc-option-impl.hpp | 4 +++-
4 files changed, 16 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list