guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/02: 'hash' behaves like 'hashq' for tc7s without an '


From: Ludovic Courtès
Subject: [Guile-commits] 01/02: 'hash' behaves like 'hashq' for tc7s without an 'equal?' implementation.
Date: Fri, 6 Mar 2020 11:18:53 -0500 (EST)

civodul pushed a commit to branch master
in repository guile.

commit c5d3b45c9f903cc9726b4bd7e3c13db56bafd587
Author: Ludovic Courtès <address@hidden>
AuthorDate: Fri Mar 6 17:15:45 2020 +0100

    'hash' behaves like 'hashq' for tc7s without an 'equal?' implementation.
    
    Fixes <https://bugs.gnu.org/39634>.
    
    * libguile/hash.c (scm_raw_ihash): Add cases for scm_tc7 values that
    were not explicitly listed.
---
 libguile/hash.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libguile/hash.c b/libguile/hash.c
index c51a794..9cb8fce 100644
--- a/libguile/hash.c
+++ b/libguile/hash.c
@@ -1,4 +1,4 @@
-/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018
+/* Copyright 1995-1997,2000-2001,2003-2004,2006,2008-2015,2017-2018,2020
      Free Software Foundation, Inc.
 
    This file is part of Guile.
@@ -331,6 +331,22 @@ scm_raw_ihash (SCM obj, size_t depth)
         h ^= scm_raw_ihash (scm_syntax_module (obj), depth);
         return h;
       }
+
+      /* The following tc7s have no 'equal?' implementation.  Thus, just
+         fall back to 'hashq'.  */
+    case scm_tc7_variable:
+    case scm_tc7_hashtable:
+    case scm_tc7_fluid:
+    case scm_tc7_dynamic_state:
+    case scm_tc7_frame:
+    case scm_tc7_atomic_box:
+    case scm_tc7_program:
+    case scm_tc7_vm_cont:
+    case scm_tc7_weak_set:
+    case scm_tc7_weak_table:
+    case scm_tc7_port:
+      return scm_raw_ihashq (SCM_UNPACK (obj));
+
     case scm_tcs_cons_imcar: 
     case scm_tcs_cons_nimcar:
       if (depth)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]