Bruce Korb bk...@gnu.org writes:
On 01/07/12 08:38, Mark H Weaver wrote:
* Add checks to all string mutation functions: if the range is empty,
then avoid calling `scm_i_string_start_writing'.
Yes. All of them. All four.
For the record, there were 7 string mutation functions to fix :-P
I wrote:
3. Make scm_nullstr into a mutable string. After all, it can't be
changed anyway, and the _only_ reference to it is from
scm_from_stringn, so the result should always be mutable.
For the record: my statement above was in error; scm_nullstr is actually
used in several files.
Bruce Korb bk...@gnu.org writes:
On 01/06/12 15:11, Mark H Weaver wrote:
Bruce Korbbk...@gnu.org writes:
scm_from_locale_stringn() makes an optimization when the length is zero.
It returns an immutable string of length zero.
Good catch!
Two possible fixes:
1. remove the optimization
From: Mark H Weaver m...@netris.org
I wrote:
3. Make scm_nullstr into a mutable string. After all, it can't be
changed anyway, and the _only_ reference to it is from
scm_from_stringn, so the result should always be mutable.
For the record: my statement above was in error;
On 01/07/12 07:00, Mark H Weaver wrote:
I think you are presuming that that is the only source of zero length
immutable strings. Are you completely certain?
Empty string literals () in the program text are still immutable, so
(string-upcase! ) still throws an error.
I admit that this is an
Mark H Weaver m...@netris.org writes:
Empty string literals () in the program text are still immutable, so
(string-upcase! ) still throws an error.
I admit that this is an arguable point. Section 3.4 (Storage model) of
the R5RS (and the R7RS draft) says It is an error to attempt to store a
Bruce Korb bk...@gnu.org writes:
On 01/07/12 07:00, Mark H Weaver wrote:
The right place to fix this would probably be in
`scm_i_string_start_writing' (strings.c).
I think it too much effort for that function. I looked at it.
The problem is that you'd have to pass it the start and end
David Kastrup d...@gnu.org writes:
Mutating list operations are allowed on '() (and do not change it).
'(), the empty list structure, is eq? to itself regardless how you
arrived at it.
Excellent point. The R5RS says that `list' returns a newly allocated
list, but that's obviously not true for
On 01/07/12 08:38, Mark H Weaver wrote:
* Modify the interface to `scm_i_string_start_writing' to give it the
`start' and `end' indices.
* Add checks to all string mutation functions: if the range is empty,
then avoid calling `scm_i_string_start_writing'.
Yes. All of them. All four.
Hi,
Mark H Weaver m...@netris.org skribis:
I wrote:
3. Make scm_nullstr into a mutable string. After all, it can't be
changed anyway, and the _only_ reference to it is from
scm_from_stringn, so the result should always be mutable.
For the record: my statement above was in error;
scm_from_locale_stringn() makes an optimization when the length is zero.
It returns an immutable string of length zero. For reasons I no longer
remember, I had my own ag_scm_string_upcase that called
scm_string_upcase_x, presuming that scm_from_locale_stringn had returned
a writable string.
11 matches
Mail list logo