1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

(scm_string_filter, scm_string_delete): Partial revert

last change, use plain copy-on-write substrings, the individual
descriptions in the srfi don't mention shared storage (only the
introduction does).
This commit is contained in:
Kevin Ryde 2005-06-24 21:53:10 +00:00
parent 48ddf0d9a9
commit 8230ee411d

View file

@ -3283,10 +3283,12 @@ SCM_DEFINE (scm_string_filter, "string-filter", 2, 2, 0,
if (cstr[idx] == chr) if (cstr[idx] == chr)
count++; count++;
/* if whole of start to end kept then return substring, including /* if whole of start to end kept then return substring */
possibly s itself */
if (count == cend - cstart) if (count == cend - cstart)
result = scm_i_substring_shared (s, cstart, cend); {
result_substring:
result = scm_i_substring (s, cstart, cend);
}
else else
result = scm_c_make_string (count, char_pred); result = scm_c_make_string (count, char_pred);
} }
@ -3300,10 +3302,9 @@ SCM_DEFINE (scm_string_filter, "string-filter", 2, 2, 0,
if (SCM_CHARSET_GET (char_pred, cstr[idx])) if (SCM_CHARSET_GET (char_pred, cstr[idx]))
count++; count++;
/* if whole of start to end kept then return substring, including /* if whole of start to end kept then return substring */
possibly s itself */
if (count == cend - cstart) if (count == cend - cstart)
result = scm_i_substring_shared (s, cstart, cend); goto result_substring;
else else
{ {
char *dst; char *dst;
@ -3380,12 +3381,11 @@ SCM_DEFINE (scm_string_delete, "string-delete", 2, 2, 0,
if (cstr[idx] != chr) if (cstr[idx] != chr)
count++; count++;
/* if whole of start to end kept then return substring, including /* if whole of start to end kept then return substring */
possibly s itself */
if (count == cend - cstart) if (count == cend - cstart)
{ {
result_substring: result_substring:
result = scm_i_substring_shared (s, cstart, cend); result = scm_i_substring (s, cstart, cend);
} }
else else
{ {