1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2003-07-25 04:38:42 +00:00
parent 651f324a27
commit 43601a1d17
2 changed files with 26 additions and 16 deletions

View file

@ -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> 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> 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> Fri Jul 25 01:27:59 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
* ext/syck/emitter.c (syck_emitter_flush): accepts count * ext/syck/emitter.c (syck_emitter_flush): accepts count
of bytes to flush. anchor offsets now functional. 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> 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)) (lo (% diff 65536))
(hi (+ (car time) (/ diff 65536)))) (hi (+ (car time) (/ diff 65536))))
(format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t))) (format-time-string "%a %b %e %H:%M:%S %Y" (list hi lo) t)))
indent-tabs-mode: t
tab-width: 8
end: end:

17
re.c
View file

@ -502,8 +502,8 @@ static VALUE
rb_reg_options_m(re) rb_reg_options_m(re)
VALUE re; VALUE re;
{ {
rb_reg_check(re); int options = rb_reg_options(re);
return INT2NUM(RREGEXP(re)->ptr->options); return INT2NUM(options);
} }
static VALUE static VALUE
@ -1303,9 +1303,10 @@ rb_reg_initialize_m(argc, argv, self)
if (FIXNUM_P(argv[1])) flags = FIX2INT(argv[1]); if (FIXNUM_P(argv[1])) flags = FIX2INT(argv[1]);
else if (RTEST(argv[1])) flags = RE_OPTION_IGNORECASE; else if (RTEST(argv[1])) flags = RE_OPTION_IGNORECASE;
} }
if (argc == 3) { if (argc == 3 && !NIL_P(argv[2])) {
char *kcode = StringValuePtr(argv[2]); char *kcode = StringValuePtr(argv[2]);
flags &= ~0x70;
switch (kcode[0]) { switch (kcode[0]) {
case 'n': case 'N': case 'n': case 'N':
flags |= 16; flags |= 16;
@ -1471,15 +1472,11 @@ int
rb_reg_options(re) rb_reg_options(re)
VALUE re; VALUE re;
{ {
int options = 0; int options;
rb_reg_check(re); rb_reg_check(re);
if (RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE) options = RREGEXP(re)->ptr->options &
options |= RE_OPTION_IGNORECASE; (RE_OPTION_IGNORECASE|RE_OPTION_MULTILINE|RE_OPTION_EXTENDED);
if (RREGEXP(re)->ptr->options & RE_OPTION_MULTILINE)
options |= RE_OPTION_MULTILINE;
if (RREGEXP(re)->ptr->options & RE_OPTION_EXTENDED)
options |= RE_OPTION_EXTENDED;
if (FL_TEST(re, KCODE_FIXED)) { if (FL_TEST(re, KCODE_FIXED)) {
options |= rb_reg_get_kcode(re); options |= rb_reg_get_kcode(re);
} }