Remove null string optimization from scm_from_stringn
authorMark H Weaver <mhw@netris.org>
Mon, 9 Jan 2012 23:24:22 +0000 (18:24 -0500)
committerMark H Weaver <mhw@netris.org>
Mon, 9 Jan 2012 23:24:22 +0000 (18:24 -0500)
* libguile/strings.c (scm_from_stringn): Always return a freshly
  allocated string from scm_from_stringn, even when asked to construct
  the null string, in accordance with the R5RS.  Previously, we
  optimized the null string case by returning a reference to a global
  null string object (scm_nullstr).

libguile/strings.c

index 6e1f9c8..73c0a5c 100644 (file)
@@ -1472,8 +1472,6 @@ scm_from_stringn (const char *str, size_t len, const char *encoding,
     scm_misc_error ("scm_from_stringn", "NULL string pointer", SCM_EOL);
   if (len == (size_t) -1)
     len = strlen (str);
-  if (len == 0)
-    return scm_nullstr;
 
   if (encoding == NULL)
     {