gnucash maint: [c-interface] Deprecate gnc:make-string-database
Christopher Lam
clam at code.gnucash.org
Wed Dec 23 10:58:38 EST 2020
Updated via https://github.com/Gnucash/gnucash/commit/bf671d4f (commit)
from https://github.com/Gnucash/gnucash/commit/a0a234d4 (commit)
commit bf671d4fc7e344a643460f464fdbcb31be1786c7
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Wed Dec 23 23:44:51 2020 +0800
[c-interface] Deprecate gnc:make-string-database
It's only used by date-utilities.scm
This removes the date-utilities -> c-interface dependency.
diff --git a/libgnucash/app-utils/c-interface.scm b/libgnucash/app-utils/c-interface.scm
index 650b871cc..4a1df47e9 100644
--- a/libgnucash/app-utils/c-interface.scm
+++ b/libgnucash/app-utils/c-interface.scm
@@ -88,6 +88,8 @@
;; strings. Strings that are returned by the lookup function are
;; translated with gettext.
(define (gnc:make-string-database)
+ (issue-deprecation-warning "gnc:make-string-database is deprecated. It \
+will be removed in GnuCash 5.x")
(define string-hash (make-hash-table))
(lambda args
(match args
diff --git a/libgnucash/app-utils/date-utilities.scm b/libgnucash/app-utils/date-utilities.scm
index 84c570697..77b84afad 100644
--- a/libgnucash/app-utils/date-utilities.scm
+++ b/libgnucash/app-utils/date-utilities.scm
@@ -30,7 +30,6 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash utilities))
(use-modules (sw_app_utils))
-(use-modules (gnucash app-utils c-interface))
(use-modules (ice-9 match))
(export gnc:reldate-list)
@@ -891,7 +890,15 @@ Defaulting to today."))
;;one-month-ago three-months-ago six-months-ago one-year-ago
;;start-cur-fin-year start-prev-fin-year end-prev-fin-year
-(define gnc:reldate-string-db (gnc:make-string-database))
+
+(define (make-string-database)
+ (define string-hash (make-hash-table))
+ (match-lambda*
+ (('lookup key) (G_ (hash-ref string-hash key)))
+ (('store key string) (hash-set! string-hash key string))
+ (_ (gnc:warn "string-database: bad action"))))
+
+(define gnc:reldate-string-db (make-string-database))
(define gnc:relative-date-values #f)
(unless gnc:relative-date-hash
(gnc:reldate-string-db
Summary of changes:
libgnucash/app-utils/c-interface.scm | 2 ++
libgnucash/app-utils/date-utilities.scm | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
More information about the gnucash-changes
mailing list