1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 07:00:23 +02:00
Commit graph

16 commits

Author SHA1 Message Date
Ludovic Courtès
3ae3166b23 Fix sloppy bound checking in `string-{ref,set!}' with the empty string.
* libguile/strings.c (scm_string_ref): Add proper range checking for the
  empty string.
  (scm_string_set_x): Likewise.
  Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.

* test-suite/tests/strings.test ("string-ref"): New test prefix.
  ("string-set!")["empty string", "empty string and non-zero index",
  "out of range", "negative index", "regular string"]: New tests.

* NEWS: Update.
2008-12-02 19:52:13 +01:00
Ludovic Courtès
45a9f43049 Revert "Make literal strings (i.e., returned by `read') read-only."
This reverts commit fb2f8886c4.

The rationale is that `read' must return mutable strings, as reported
by szgyg <szgyg@ludens.elte.hu>.
2008-10-09 22:21:33 +02:00
Ludovic Courtès
fb2f8886c4 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.
2008-09-23 18:45:27 +02:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Kevin Ryde
50e20a6061 (string-split): Try splitting on an 8-bit char. 2005-06-05 21:33:33 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
b144a33c42 (string-set!): Explicitely construct read-only string. String
literals are not yet read-only.
2004-09-30 11:58:26 +00:00
Marius Vollmer
d7e4c2da23 * tests/ports.test ("string ports"): Copy string literal so that
it can be modified.
* tests/srfi-13.test ("string-copy!"): Likewise.
* tests/strings.test ("substring/shared"): Likewise.
2004-09-22 14:32:47 +00:00
Marius Vollmer
7aa29a87f9 Two more tests for double indirect substring modification. 2004-08-24 22:14:57 +00:00
Marius Vollmer
1c17f6b0c8 Two tests for substring/shared. Also, use (test-suite lib). 2004-08-19 22:23:23 +00:00
Dirk Herrmann
049fa4495b * Extracted tests from exceptions.test into strings.test and symbols.test.
* Added some tests to strings.test.
2001-03-01 17:57:50 +00:00
Dirk Herrmann
6b4113afc5 * Provide and use new convenience macros to test for exceptions. 2001-02-28 11:25:40 +00:00
Dirk Herrmann
b3b8952a94 * Reflect the fact that string=? is fixed in the test-suite. 2000-10-30 17:32:55 +00:00
Dirk Herrmann
548b925289 * Remember that string=? and friends need fixing. 2000-09-26 20:39:03 +00:00
Jim Blandy
0bfcc6e0d4 * tests/strings.test: Add test for substring-move! argument checking. 1999-09-11 18:46:48 +00:00
Jim Blandy
9aa2c79671 * tests/strings.test: New test file. 1999-08-30 07:46:01 +00:00