summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-08-22 21:03:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-08-22 21:03:12 -0700
commiteca0623d17eef9b62617437cf99102b8d14b112f (patch)
tree4afcc3dea5837d2aac1bf6dde5ab800d6576356f
parent25665439a909ae9d4b3408adc1894ba4f2453126 (diff)
downloadtxr-eca0623d17eef9b62617437cf99102b8d14b112f.tar.gz
txr-eca0623d17eef9b62617437cf99102b8d14b112f.tar.bz2
txr-eca0623d17eef9b62617437cf99102b8d14b112f.zip
genman: guard against symbol hash collisions.
* genman.txr (process-ambiguities): Keep track of calculated hashes and error out when there is a duplicate. When the time comes, we will have to resolve those somehow, and also change the doc function to do it the same way.
-rw-r--r--genman.txr16
1 files changed, 10 insertions, 6 deletions
diff --git a/genman.txr b/genman.txr
index d1593cfb..6ef0404b 100644
--- a/genman.txr
+++ b/genman.txr
@@ -42,12 +42,16 @@
`TOC-@sec`)
(defun process-ambiguities (hash)
- (dohash (sym tags hash)
- (let ((shash (fmt "S-~,08X" (crc32 sym))))
- (set [hash sym] shash)
- (if (null (cdr tags))
- (push shash [direct (car tags)])
- (set [disamb shash] (reverse tags)))))))
+ (let ((rhash (hash)))
+ (dohash (sym tags hash)
+ (let ((shash (fmt "S-~,08X" (crc32 sym))))
+ (if [rhash shash]
+ (error "~a ~a hash collision" sym [rhash shash])
+ (set [rhash shash] sym))
+ (set [hash sym] shash)
+ (if (null (cdr tags))
+ (push shash [direct (car tags)])
+ (set [disamb shash] (reverse tags))))))))
Content-type: text/html
@(skip 15)
<h1>TXR</h1>