From: David Kastrup Date: Tue, 3 May 2016 18:39:48 +0000 (+0200) Subject: Issue 4841: Let Scheme_hash_table::get return SCM_UNDEFINED for unknown keys X-Git-Tag: release/2.19.42-1~16 X-Git-Url: https://git.donarmstrong.com/lilypond.git?p=lilypond.git;a=commitdiff_plain;h=6465569a518aa2bf3ce93e5934a58eec2e6a69b1 Issue 4841: Let Scheme_hash_table::get return SCM_UNDEFINED for unknown keys --- diff --git a/lily/scm-hash.cc b/lily/scm-hash.cc index 3eb40ada7b..97af8f6cd5 100644 --- a/lily/scm-hash.cc +++ b/lily/scm-hash.cc @@ -69,9 +69,13 @@ Scheme_hash_table::set (SCM k, SCM v) SCM Scheme_hash_table::get (SCM k) const { - /* SCM_UNSPECIFIED will stick out like a sore thumb, hopefully. + /* SCM_UNDEFINED is the default for unset elements, but + scm_hashq_ref cannot return it, so we do it a bit more awkwardly. */ - return scm_hashq_ref (hash_tab (), k, SCM_UNSPECIFIED); + SCM handle = scm_hashq_get_handle (hash_tab (), k); + if (scm_is_pair (handle)) + return scm_cdr (handle); + return SCM_UNDEFINED; } void