summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-25 04:38:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-25 04:38:42 +0000
commit43601a1d171333cccea5d656e0f18b77cb1ff987 (patch)
tree380e68c3277b995f38e425e54c31424cfc6224d3
parent651f324a278e133a1cb809ec8ba9b0ff9e69d1d9 (diff)
* re.c (rb_reg_options_m): use rb_reg_options() to mask internal
flags. * re.c (rb_reg_initialize_m): allow nil as third argument and ignore, and mask code flags if the argument is given. [ruby-dev:20885] * re.c (rb_reg_options): get common flags directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog25
-rw-r--r--re.c17
2 files changed, 26 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 369597c9e7..9a1b38f3a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,17 @@
+Fri Jul 25 13:38:38 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * re.c (rb_reg_options_m): use rb_reg_options() to mask internal
+ flags.
+
+ * re.c (rb_reg_initialize_m): allow nil as third argument and
+ ignore, and mask code flags if the argument is given.
+ [ruby-dev:20885]
+
+ * re.c (rb_reg_options): get common flags directly.
+
Fri Jul 25 03:52:21 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
- * lib/yaml/dbm.rb: replace indexes with values_at.
+ * lib/yaml/dbm.rb: replace indexes with values_at.
Fri Jul 25 02:55:59 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
@@ -10,14 +21,14 @@ Fri Jul 25 02:55:59 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
Fri Jul 25 01:27:59 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
- * ext/syck/emitter.c (syck_emitter_flush): accepts count
- of bytes to flush. anchor offsets now functional.
+ * ext/syck/emitter.c (syck_emitter_flush): accepts count
+ of bytes to flush. anchor offsets now functional.
- * ext/syck/syck.h (syck_emitter_flush): ditto.
+ * ext/syck/syck.h (syck_emitter_flush): ditto.
- * ext/syck/rubyext.c: ditto.
+ * ext/syck/rubyext.c: ditto.
- * ext/syck/token.c: URI escaping now supported.
+ * ext/syck/token.c: URI escaping now supported.
Thu Jul 24 16:41:31 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
@@ -23276,4 +23287,6 @@ add-log-time-format: (lambda ()
(lo (% diff 65536))
(hi (+ (car time) (/ diff 65536))))
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
+indent-tabs-mode: t
+tab-width: 8
end:
diff --git a/re.c b/re.c
index 16b4c5e295..e81b093a3e 100644
--- a/re.c
+++ b/re.c
@@ -502,8 +502,8 @@ static VALUE
rb_reg_options_m(re)
VALUE re;
{
- rb_reg_check(re);
- return INT2NUM(RREGEXP(re)->ptr->options);
+ int options = rb_reg_options(re);
+ return INT2NUM(options);
}
static VALUE
@@ -1303,9 +1303,10 @@ rb_reg_initialize_m(argc, argv, self)
if (FIXNUM_P(argv[1])) flags = FIX2INT(argv[1]);
else if (RTEST(argv[1])) flags = RE_OPTION_IGNORECASE;
}
- if (argc == 3) {
+ if (argc == 3 && !NIL_P(argv[2])) {
char *kcode = StringValuePtr(argv[2]);
+ flags &= ~0x70;
switch (kcode[0]) {
case 'n': case 'N':
flags |= 16;
@@ -1471,15 +1472,11 @@ int
rb_reg_options(re)
VALUE re;
{
- int options = 0;
+ int options;
rb_reg_check(re);
- if (RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)
- options |= RE_OPTION_IGNORECASE;
- if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
- options |= RE_OPTION_MULTILINE;
- if (RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED)
- options |= RE_OPTION_EXTENDED;
+ options = RREGEXP(re)->ptr->options &
+ (RE_OPTION_IGNORECASE|RE_OPTION_MULTILINE|RE_OPTION_EXTENDED);
if (FL_TEST(re, KCODE_FIXED)) {
options |= rb_reg_get_kcode(re);
}