Unoptimize 'read' to return freshly allocated empty strings
* libguile/read.c (scm_read_string): Return a freshly allocated string every time, even for empty strings. The motivation is to allow source properties to be added to all strings. Previously, the shared global 'scm_nullstr' was returned for empty strings. Note that empty strings still share a common global 'null_stringbuf'. * test-suite/tests/srfi-13.test (substring/shared): Fix tests to reflect the fact that empty string literals are no longer guaranteed to be 'eq?' to each other.
This commit is contained in:
parent
d5b75b6c80
commit
043850d984
2 changed files with 9 additions and 13 deletions
|
|
@ -580,13 +580,7 @@ scm_read_string (int chr, SCM port)
|
|||
scm_i_string_set_x (str, c_str_len++, c);
|
||||
scm_i_string_stop_writing ();
|
||||
}
|
||||
|
||||
if (c_str_len > 0)
|
||||
{
|
||||
return scm_i_substring_copy (str, 0, c_str_len);
|
||||
}
|
||||
|
||||
return scm_nullstr;
|
||||
return scm_i_substring_copy (str, 0, c_str_len);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue