]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4841: Let Scheme_hash_table::get return SCM_UNDEFINED for unknown keys
authorDavid Kastrup <dak@gnu.org>
Tue, 3 May 2016 18:39:48 +0000 (20:39 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 8 May 2016 15:17:00 +0000 (17:17 +0200)
lily/scm-hash.cc

index 3eb40ada7bfe929576fc50cb1c081d368951b488..97af8f6cd5f97ab742aafc029d7a87785d4fd18b 100644 (file)
@@ -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