diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-08-22 21:03:12 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-08-22 21:03:12 -0700 |
commit | 33cd4b10aca2e097e1d03fe4d5ee725f4f207131 (patch) | |
tree | 4afcc3dea5837d2aac1bf6dde5ab800d6576356f | |
parent | 54fae92333dc3ba9ff4a069c319a63fcc74e84d0 (diff) | |
download | txr-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.txr | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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> |