Skip to content

Commit

Permalink
[c-interface] Deprecate gnc:make-string-database
Browse files Browse the repository at this point in the history
It's only used by date-utilities.scm

This removes the date-utilities -> c-interface dependency.
  • Loading branch information
christopherlam committed Dec 23, 2020
1 parent a0a234d commit bf671d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libgnucash/app-utils/c-interface.scm
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions libgnucash/app-utils/date-utilities.scm
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bf671d4

Please sign in to comment.