Fix bug: STRING_P was being passed arguments with side effects.
authorChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 20:09:59 +0000 (12:09 -0800)
committerChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 20:09:59 +0000 (12:09 -0800)
src/microcode/object.h
src/microcode/string.c

index edfe3c7ef21977ffb65bd938e6d36d70a31d6517..bb5fc57148743ba884ecc373d2d83814ef6403d3 100644 (file)
@@ -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)
index 3f1319d9e88be4d161f4fd0ad4f501dabc1e34a5..0cc0d084f573431e584a2f5bc95603e77a4de9cc 100644 (file)
@@ -29,6 +29,13 @@ USA.
 #include "scheme.h"
 #include "prims.h"
 \f
+// 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)
 {