Mercurial > hg > xemacs-beta
changeset 1377:19738a2a5138
[xemacs-hg @ 2003-03-24 15:01:47 by stephent]
don't use DB_AUTO_COMMIT <87ptog3j6t.fsf@tleepslib.sk.tsukuba.ac.jp>
fix word boundary code in regex.c <87smtc3jfv.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 24 Mar 2003 15:01:50 +0000 |
parents | 2e0147538471 |
children | 69a674f5861f |
files | src/ChangeLog src/database.c src/regex.c |
diffstat | 3 files changed, 61 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Mar 24 14:51:46 2003 +0000 +++ b/src/ChangeLog Mon Mar 24 15:01:50 2003 +0000 @@ -1,3 +1,13 @@ +2003-03-22 Stephen J. Turnbull <stephen@xemacs.org> + + * database.c (Fopen_database): DB_AUTO_COMMIT is invalid in + Berkeley db 4.1 unless you have a transaction environment. + +2003-03-21 Stephen J. Turnbull <stephen@xemacs.org> + + * regex.c (re_match_2_internal): Fix matching degenerate word + boundaries. + 2003-03-09 Ben Wing <ben@xemacs.org> * file-coding.c:
--- a/src/database.c Mon Mar 24 14:51:46 2003 +0000 +++ b/src/database.c Mon Mar 24 15:01:50 2003 +0000 @@ -713,8 +713,9 @@ status = dbase->open (dbase, filename, NULL, real_subtype, accessmask, modemask); #else /* DB_VERSION >= 4.1 */ + /* You can't use DB_AUTO_COMMIT unless you have a txn environment. */ status = dbase->open (dbase, NULL, filename, NULL, real_subtype, - accessmask | DB_AUTO_COMMIT, modemask); + accessmask, modemask); #endif /* DB_VERSION < 4.1 */ if (status) {
--- a/src/regex.c Mon Mar 24 14:51:46 2003 +0000 +++ b/src/regex.c Mon Mar 24 15:01:50 2003 +0000 @@ -6070,43 +6070,63 @@ matchwordbound: { /* XEmacs change */ - int result; - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - result = 1; + /* Straightforward and (I hope) correct implementation. + Probably should be optimized by arranging to compute + pos only once. */ + /* emch1 is the character before d, syn1 is the syntax of + emch1, emch2 is the character at d, and syn2 is the + syntax of emch2. */ + Ichar emch1, emch2; + int syn1, syn2; + re_char *d_before, *d_after; + int result, + at_beg = AT_STRINGS_BEG (d), + at_end = AT_STRINGS_END (d); +#ifdef emacs + Charxpos pos; +#endif + + if (at_beg && at_end) + { + result = 0; + } else { - re_char *d_before = POS_BEFORE_GAP_UNSAFE (d); - re_char *d_after = POS_AFTER_GAP_UNSAFE (d); - - /* emch1 is the character before d, syn1 is the syntax of - emch1, emch2 is the character at d, and syn2 is the - syntax of emch2. */ - Ichar emch1, emch2; - int syn1, syn2; + if (!at_beg) + { + d_before = POS_BEFORE_GAP_UNSAFE (d); + DEC_IBYTEPTR_FMT (d_before, fmt); + emch1 = itext_ichar_fmt (d_before, fmt, lispobj); #ifdef emacs - Charxpos pos_before; + pos = offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)) - 1; + BEGIN_REGEX_MALLOC_OK (); + UPDATE_SYNTAX_CACHE (scache, pos); #endif - - DEC_IBYTEPTR_FMT (d_before, fmt); - emch1 = itext_ichar_fmt (d_before, fmt, lispobj); - emch2 = itext_ichar_fmt (d_after, fmt, lispobj); - + syn1 = SYNTAX_FROM_CACHE (scache, emch1); + END_REGEX_MALLOC_OK (); + } + if (!at_end) + { + d_after = POS_AFTER_GAP_UNSAFE (d); + emch2 = itext_ichar_fmt (d_after, fmt, lispobj); #ifdef emacs - pos_before = - offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)) - 1; - BEGIN_REGEX_MALLOC_OK (); - UPDATE_SYNTAX_CACHE (scache, pos_before); + pos = offset_to_charxpos (lispobj, PTR_TO_OFFSET (d)); + BEGIN_REGEX_MALLOC_OK (); + UPDATE_SYNTAX_CACHE_FORWARD (scache, pos); #endif - syn1 = SYNTAX_FROM_CACHE (scache, emch1); -#ifdef emacs - UPDATE_SYNTAX_CACHE_FORWARD (scache, pos_before + 1); -#endif - syn2 = SYNTAX_FROM_CACHE (scache, emch2); - - result = ((syn1 == Sword) != (syn2 == Sword)); - END_REGEX_MALLOC_OK (); + syn2 = SYNTAX_FROM_CACHE (scache, emch2); + END_REGEX_MALLOC_OK (); + } RE_MATCH_RELOCATE_MOVEABLE_DATA_POINTERS (); + + if (at_beg) + result = (syn2 == Sword); + else if (at_end) + result = (syn1 == Sword); + else + result = ((syn1 == Sword) != (syn2 == Sword)); } + if (result == should_succeed) break; goto fail;