gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Sep 10 18:09:07 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/e3d682c0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8a91fa8d (commit)
	 via  https://github.com/Gnucash/gnucash/commit/75f49aae (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9fe19d6c (commit)
	from  https://github.com/Gnucash/gnucash/commit/6c9d0dca (commit)



commit e3d682c0e55e483069fc12330b77a6b15753f594
Merge: 6c9d0dca2c 8a91fa8deb
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 10 15:08:32 2023 -0700

    Merge Richard Cohen's 'fix-gnc-mktime' into stable.


commit 8a91fa8deb61302b0edc54aaadfd4ab37c9f72db
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Sep 10 15:06:46 2023 -0700

    Remove defective and fortunately unused typemap.

diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index ebd1355d4d..e70a365a56 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -121,30 +121,6 @@ typedef char gchar;
  
 %typemap(newfree) struct tm * "gnc_tm_free($1);"
 
-%typemap(argout) struct tm * {
-    struct tm* t = $1;
-    SCM tm = $input;
-    if (t == NULL)
-    {
-        SCM_SIMPLE_VECTOR_SET(tm, 0, scm_from_int(t->tm_sec));
-        SCM_SIMPLE_VECTOR_SET(tm, 1, scm_from_int(t->tm_min));
-        SCM_SIMPLE_VECTOR_SET(tm, 2, scm_from_int(t->tm_hour));
-        SCM_SIMPLE_VECTOR_SET(tm, 3, scm_from_int(t->tm_mday));
-        SCM_SIMPLE_VECTOR_SET(tm, 4, scm_from_int(t->tm_mon));
-        SCM_SIMPLE_VECTOR_SET(tm, 5, scm_from_int(t->tm_year));
-        SCM_SIMPLE_VECTOR_SET(tm, 6, scm_from_int(t->tm_wday));
-        SCM_SIMPLE_VECTOR_SET(tm, 7, scm_from_int(t->tm_yday));
-        SCM_SIMPLE_VECTOR_SET(tm, 8, scm_from_int(t->tm_isdst));
-%#ifdef HAVE_STRUCT_TM_GMTOFF
-        SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(t->tm_gmtoff));
-        SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string(t->tm_zone?t->tm_zone:"Unset"));
-%#else
-        SCM_SIMPLE_VECTOR_SET(tm, 9, scm_from_long(0));
-        SCM_SIMPLE_VECTOR_SET(tm, 10, scm_from_locale_string("GMT"));
-%#endif
-     }
- }
-
 %define GLIST_HELPER_INOUT(ListType, ElemSwigType)
 %typemap(in) ListType * {
   SCM list = $input;

commit 75f49aaec509d8feb2a272a19db5d8cfa40b0bb1
Author: Richard Cohen <richard at daijobu.co.uk>
Date:   Thu Jul 20 15:46:17 2023 +0100

    Valgrind: fix "definitely lost" memory in (gnc-mktime) - test-invoice-report-builtin-default
    
    ==158291== 6 bytes in 1 blocks are definitely lost in loss record 18 of 824
    ==158291==    at 0x4848C63: realloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==158291==    by 0x4A91473: scm_realloc (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
    ==158291==    by 0x4AFF26B: scm_to_stringn (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
    ==158291==    by 0x4CB473D: _wrap_gnc_mktime(scm_unused_struct*) (swig-engine.cpp:38703)
    ...

diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index fbae4c3e98..ebd1355d4d 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -69,7 +69,7 @@ typedef char gchar;
 %typemap(in) time64 * (time64 t) "t = scm_to_int64($input); $1 = &t;"
 %typemap(out) time64 * " $result = ($1) ? scm_from_int64(*($1)) : SCM_BOOL_F; "
 
-%typemap(in) struct tm * (struct tm t) {
+%typemap(in) struct tm * (struct tm t, char *tzone) {
     SCM tm = $input;
     t.tm_sec = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 0));
     t.tm_min = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 1));
@@ -83,10 +83,16 @@ typedef char gchar;
 %#ifdef HAVE_STRUCT_TM_GMTOFF
     t.tm_gmtoff = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 9));
     SCM zone = SCM_SIMPLE_VECTOR_REF(tm, 10);
-    t.tm_zone = SCM_UNBNDP(zone) ? NULL : scm_to_locale_string(zone);
+    tzone = SCM_UNBNDP(zone) ? NULL : scm_to_locale_string(zone);
+    t.tm_zone = tzone;
 %#endif
     $1 = &t;
  }
+%typemap(freearg) struct tm * {
+%#ifdef HAVE_STRUCT_TM_GMTOFF
+    free(tzone$argnum);
+%#endif
+}
 
 %typemap(out) struct tm * {
     SCM tm = scm_c_make_vector(11, SCM_UNDEFINED);

commit 9fe19d6cf98534ecf6e014231f56a80e13a2902d
Author: Richard Cohen <richard at daijobu.co.uk>
Date:   Fri Jul 7 11:53:24 2023 +0100

    Move potentially unused "SCM zone" variable into the #ifdef

diff --git a/common/base-typemaps.i b/common/base-typemaps.i
index 39f12638a6..fbae4c3e98 100644
--- a/common/base-typemaps.i
+++ b/common/base-typemaps.i
@@ -71,7 +71,6 @@ typedef char gchar;
 
 %typemap(in) struct tm * (struct tm t) {
     SCM tm = $input;
-    SCM zone;
     t.tm_sec = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 0));
     t.tm_min = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 1));
     t.tm_hour = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 2));
@@ -83,7 +82,7 @@ typedef char gchar;
     t.tm_isdst = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 8));
 %#ifdef HAVE_STRUCT_TM_GMTOFF
     t.tm_gmtoff = scm_to_int(SCM_SIMPLE_VECTOR_REF(tm, 9));
-    zone = SCM_SIMPLE_VECTOR_REF(tm, 10);
+    SCM zone = SCM_SIMPLE_VECTOR_REF(tm, 10);
     t.tm_zone = SCM_UNBNDP(zone) ? NULL : scm_to_locale_string(zone);
 %#endif
     $1 = &t;



Summary of changes:
 common/base-typemaps.i | 37 +++++++++----------------------------
 1 file changed, 9 insertions(+), 28 deletions(-)



More information about the gnucash-changes mailing list