From: Chris Hanson Date: Wed, 11 Jan 2017 20:09:59 +0000 (-0800) Subject: Fix bug: STRING_P was being passed arguments with side effects. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~146^2~1 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=7e65f395a7faf460817b12d47034d5ee26a37da6;p=mit-scheme.git Fix bug: STRING_P was being passed arguments with side effects. --- diff --git a/src/microcode/object.h b/src/microcode/object.h index edfe3c7ef..bb5fc5714 100644 --- a/src/microcode/object.h +++ b/src/microcode/object.h @@ -193,8 +193,8 @@ extern SCHEME_OBJECT * memory_base; #define RETURN_CODE_P(object) ((OBJECT_TYPE (object)) == TC_RETURN_CODE) #define EPHEMERON_P(object) ((OBJECT_TYPE (object)) == TC_EPHEMERON) -#define STRING_P(object) \ - ((BYTEVECTOR_P (object)) || (LEGACY_STRING_P (object))) +#define STRING_P string_p +extern bool string_p (SCHEME_OBJECT); #define NON_MARKED_VECTOR_P(object) \ ((OBJECT_TYPE (object)) == TC_NON_MARKED_VECTOR) diff --git a/src/microcode/string.c b/src/microcode/string.c index 3f1319d9e..0cc0d084f 100644 --- a/src/microcode/string.c +++ b/src/microcode/string.c @@ -29,6 +29,13 @@ USA. #include "scheme.h" #include "prims.h" +// TODO(cph): remove when LEGACY_STRING_P is removed. +bool +string_p (SCHEME_OBJECT object) +{ + return ((LEGACY_STRING_P (object)) || (BYTEVECTOR_P (object))); +} + SCHEME_OBJECT allocate_string (unsigned long nbytes) {