Change string hash tables to support unicode strings.
authorChris Hanson <org/chris-hanson/cph>
Fri, 27 Jan 2017 03:44:32 +0000 (19:44 -0800)
committerChris Hanson <org/chris-hanson/cph>
Fri, 27 Jan 2017 03:44:32 +0000 (19:44 -0800)
src/runtime/hashtb.scm

index 8ac880948d034bf74ec9666f3b5a52ec61e1db0b..cde06dd939e0a5205bba5c69bd71384acf0a73a0 100644 (file)
@@ -1024,9 +1024,9 @@ USA.
        ((%ratnum? key) (%ratnum->nonneg-int key))
        ((flo:flonum? key) (%flonum->nonneg-int key))
        ((%recnum? key) (%recnum->nonneg-int key))
-       ((string? key) (string-hash key))
+       ((ustring? key) (ustring-hash key))
        ((bit-string? key) (bit-string->unsigned-integer key))
-       ((pathname? key) (string-hash (->namestring key)))
+       ((pathname? key) (ustring-hash (->namestring key)))
        (else (eq-hash key))))
 \f
 (define-integrable (%bignum? object)
@@ -1223,7 +1223,7 @@ USA.
      (set! key-ephemeral-eqv-hash-table-type
           (make eqv-hash-mod eqv? #t hash-table-entry-type:key-ephemeral))
      (set! string-hash-table-type
-          (make string-hash-mod string=? #t hash-table-entry-type:strong))
+          (make ustring-hash ustring=? #t hash-table-entry-type:strong))
      (set! strong-eq-hash-table-type   ;Open-coded
           (open-type! eq-hash-mod eq? #t hash-table-entry-type:strong))
      (set! strong-eqv-hash-table-type
@@ -1286,9 +1286,11 @@ USA.
   (make-hash-table-type key-hash
                        key=?
                        (if (and (or (eq? key=? string=?)
-                                    (eq? key=? string-ci=?))
+                                    (eq? key=? string-ci=?)
+                                    (eq? key=? ustring=?))
                                 (or (eq? key-hash string-hash-mod)
                                     (eq? key-hash string-hash)
+                                    (eq? key-hash ustring-hash)
                                     (eq? key-hash hash)
                                     (eq? key-hash string-ci-hash)))
                            #f          ;No rehash needed after GC