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
commit33cd4b10aca2e097e1d03fe4d5ee725f4f207131 (patch)
tree4afcc3dea5837d2aac1bf6dde5ab800d6576356f
parent54fae92333dc3ba9ff4a069c319a63fcc74e84d0 (diff)
downloadtxr-33cd4b10aca2e097e1d03fe4d5ee725f4f207131.tar.gz
txr-33cd4b10aca2e097e1d03fe4d5ee725f4f207131.tar.bz2
txr-33cd4b10aca2e097e1d03fe4d5ee725f4f207131.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>