C-peek-cstringp! now returns () at NULL on end of a strvec.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 11 Aug 2011 00:14:51 +0000 (17:14 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 11 Aug 2011 00:14:51 +0000 (17:14 -0700)
src/microcode/pruxffi.c

index 26fc706f2c1a26855c0338cbf2cd701c5533e915..805d6eb40ca1292e22ec702b5eee0dddfde9c702 100644 (file)
@@ -185,9 +185,16 @@ DEFINE_PRIMITIVE ("C-PEEK-CSTRINGP!", Prim_peek_cstringp_bang, 2, 2, 0)
   PRIMITIVE_HEADER (2);
   {
     char ** ptr = (ALIEN_ADDRESS_LOC (char *));
-    SCM string = char_pointer_to_string (*ptr);
-    set_alien_address ((ARG_REF (1)), (ptr + 1)); /* No more aborts! */
-    PRIMITIVE_RETURN (string);
+    if (*ptr == NULL)
+      {
+       PRIMITIVE_RETURN (SHARP_F);
+      }
+    else
+      {
+       SCM string = char_pointer_to_string (*ptr);
+       set_alien_address ((ARG_REF (1)), (ptr + 1)); /* No more aborts! */
+       PRIMITIVE_RETURN (string);
+      }
   }
 }