This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Sorry, I lost my path to guile-bug mailing list. Found a bug in libguile/regex-posix.c: guile> (use-modules (ice-9 regex)) guile> (define r (make-regexp "void (([A-Z]+)|([a-z]+))")) guile> (define str "0void FOO") guile> (define m (regexp-exec r str 1)) guile> m #("0void FOO" (1 . 9) (6 . 9) (6 . 9) (0 . 0)) Here the last pair should be (-1 . -1). As a consequence: guile> (match:substring m 2) "FOO" guile> (match:substring m 3) "" The last should return #f insteed. Here is a tiny patch. Charbel. --- regex-posix.c.buggy Mon Oct 12 16:53:56 1998 +++ regex-posix.c Thu Oct 15 01:34:55 1998 @@ -252,8 +252,10 @@ mvec = scm_make_vector (SCM_MAKINUM (nmatches + 1), SCM_UNSPECIFIED); SCM_VELTS(mvec)[0] = str; for (i = 0; i < nmatches; ++i) - SCM_VELTS(mvec)[i+1] = scm_cons(SCM_MAKINUM(matches[i].rm_so + offset), - SCM_MAKINUM(matches[i].rm_eo + offset)); + SCM_VELTS(mvec)[i+1] = scm_cons(SCM_MAKINUM((matches[i].rm_so == -1) ? + -1 : matches[i].rm_so + offset), + SCM_MAKINUM((matches[i].rm_eo == -1) ? + -1 : matches[i].rm_eo + offset)); } scm_must_free ((char *) matches); SCM_ALLOW_INTS;