diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-09-22 23:03:20 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-23 18:45:27 +0200 |
commit | fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4 (patch) | |
tree | 16d6bbddb4c7ef0078f727dfb991e23fda94a79a /libguile/strings.h | |
parent | fd2b17b9cb7aaa6b550ad9b6a3efe3c53c94ccce (diff) | |
download | guile-fb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4.tar.gz |
Make literal strings (i.e., returned by `read') read-only.
* libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to
return a read-only string, as mandated by R5RS. Reported by Bill
Schottstaedt <bil@ccrma.Stanford.EDU>.
* libguile/strings.c (scm_i_make_read_only_string): New function.
(scm_i_shared_substring_read_only): Special-case the empty string
so that the read-only and read-write empty strings are `eq?'. This
optimization is relied on by the `substring/shared' `empty string'
test case in `srfi-13.test'.
* libguile/strings.h (scm_i_make_read_only_string): New declaration.
* test-suite/tests/strings.test ("string-set!")["literal string"]: New test.
* NEWS: Update.
Diffstat (limited to 'libguile/strings.h')
-rw-r--r-- | libguile/strings.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libguile/strings.h b/libguile/strings.h index ca5f52cd2..cf5862803 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -152,6 +152,7 @@ SCM_INTERNAL void scm_i_get_substring_spec (size_t len, SCM start, size_t *cstart, SCM end, size_t *cend); SCM_INTERNAL SCM scm_i_take_stringbufn (char *str, size_t len); +SCM_INTERNAL SCM scm_i_make_read_only_string (SCM str); /* deprecated stuff */ |