From: Marius Vollmer <mvo@zagadka.de>
Cc: guile-devel@gnu.org
Subject: Re: srfi-13 bug
Date: Wed, 22 Sep 2004 03:15:33 +0200 [thread overview]
Message-ID: <87d60faytm.fsf@zagadka.ping.de> (raw)
In-Reply-To: <87oekam2lf.fsf_-_@peder.flower> (Jan Nieuwenhuizen's message of "Mon, 13 Sep 2004 20:43:40 +0200")
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
Jan Nieuwenhuizen <janneke@gnu.org> writes:
> Found it. It turns out that
>
> guile -c '(string-contains "" "a")'
>
> hangs with guile CVS. See fix below.
Thanks, excellent! What about the variant below? It is more
'logical' I think, immediately returning false when s1 is shorter than
s2.
[-- Attachment #2: Type: text/plain, Size: 2015 bytes --]
Index: libguile/srfi-13.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/srfi-13.c,v
retrieving revision 1.6
diff -u -r1.6 srfi-13.c
--- libguile/srfi-13.c 20 Sep 2004 22:50:31 -0000 1.6
+++ libguile/srfi-13.c 22 Sep 2004 01:13:38 -0000
@@ -2253,22 +2253,23 @@
5, start2, cstart2,
6, end2, cend2);
len2 = cend2 - cstart2;
- while (cstart1 <= cend1 - len2 && cend1 >= len2)
- {
- i = cstart1;
- j = cstart2;
- while (i < cend1 && j < cend2 && cs1[i] == cs2[j])
- {
- i++;
- j++;
- }
- if (j == cend2)
- {
- scm_remember_upto_here_2 (s1, s2);
- return scm_from_size_t (cstart1);
- }
- cstart1++;
- }
+ if (cend1 - cstart1 >= len2)
+ while (cstart1 <= cend1 - len2)
+ {
+ i = cstart1;
+ j = cstart2;
+ while (i < cend1 && j < cend2 && cs1[i] == cs2[j])
+ {
+ i++;
+ j++;
+ }
+ if (j == cend2)
+ {
+ scm_remember_upto_here_2 (s1, s2);
+ return scm_from_size_t (cstart1);
+ }
+ cstart1++;
+ }
scm_remember_upto_here_2 (s1, s2);
return SCM_BOOL_F;
@@ -2299,23 +2300,24 @@
5, start2, cstart2,
6, end2, cend2);
len2 = cend2 - cstart2;
- while (cstart1 <= cend1 - len2 && cend1 >= len2)
- {
- i = cstart1;
- j = cstart2;
- while (i < cend1 && j < cend2 &&
- scm_c_downcase (cs1[i]) == scm_c_downcase (cs2[j]))
- {
- i++;
- j++;
- }
- if (j == cend2)
- {
- scm_remember_upto_here_2 (s1, s2);
- return scm_from_size_t (cstart1);
- }
- cstart1++;
- }
+ if (cend1 - cstart1 >= len2)
+ while (cstart1 <= cend1 - len2)
+ {
+ i = cstart1;
+ j = cstart2;
+ while (i < cend1 && j < cend2 &&
+ scm_c_downcase (cs1[i]) == scm_c_downcase (cs2[j]))
+ {
+ i++;
+ j++;
+ }
+ if (j == cend2)
+ {
+ scm_remember_upto_here_2 (s1, s2);
+ return scm_from_size_t (cstart1);
+ }
+ cstart1++;
+ }
scm_remember_upto_here_2 (s1, s2);
return SCM_BOOL_F;
[-- Attachment #3: Type: text/plain, Size: 72 bytes --]
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
[-- Attachment #4: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-09-22 1:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1094681451.3785.368.camel@localhost>
[not found] ` <87isan90sd.fsf@peder.flower>
2004-09-13 18:43 ` srfi-13 bug [WAS: guile-gnome-glib 2.3.993] Jan Nieuwenhuizen
2004-09-13 19:30 ` srfi-13 bug2 Jan Nieuwenhuizen
2004-09-22 1:15 ` Marius Vollmer [this message]
2004-09-22 20:22 ` srfi-13 bug Jan Nieuwenhuizen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d60faytm.fsf@zagadka.ping.de \
--to=mvo@zagadka.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).