From: Taylor R Campbell Date: Tue, 11 Dec 2018 15:32:34 +0000 (+0000) Subject: Tweak fasdumper to null-terminate bytevectors too. X-Git-Tag: mit-scheme-pucked-10.1.9~3^2~35^2~45 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a7b62778411df682e228b7989f93a0afebe9117e;p=mit-scheme.git Tweak fasdumper to null-terminate bytevectors too. find_primitive relies on symbol names (which were formerly `strings', i.e. `vector-8b' or TC_CHARACTER_STRING, and are now `bytevectors') to be null-terminated. Rather than try to figure out which ones are primitive names and which ones are not, we'll just null-terminate all of them. We can undo this if we change find_primitive. (We need to change the compile-time tool findprim.c anyway because its strcmp_ci misuses islower/toupper.) --- diff --git a/src/compiler/base/fasdump.scm b/src/compiler/base/fasdump.scm index 3b6411a4b..e4228902d 100644 --- a/src/compiler/base/fasdump.scm +++ b/src/compiler/base/fasdump.scm @@ -443,7 +443,10 @@ USA. (define (fasdump-bytevector-n-words format bytevector) (let ((n-bytes (bytevector-length bytevector))) - (quotient (+ n-bytes (- (format.bytes-per-word format) 1)) + ;; Add a terminating null byte. Bytevectors don't actually require + ;; this in general -- but the bytevectors that are symbol names do. + ;; This is pretty kludgey. + (quotient (+ 1 n-bytes (- (format.bytes-per-word format) 1)) (format.bytes-per-word format)))) (define (fasdump-bytevector state bytevector)