summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-27 04:47:30 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-05-27 04:47:30 +0000
commit18477557236646240da157ed7d53da4998d3fc35 (patch)
tree50deda162b31005be9c4e63461a4d7bc009f6952
parente6300774896d943115b3f51fa3489d3051f61eb4 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/final.rb2
-rw-r--r--lib/mkmf.rb2
-rw-r--r--lib/observer.rb8
-rw-r--r--regex.c27
4 files changed, 16 insertions, 23 deletions
diff --git a/lib/final.rb b/lib/final.rb
index fc17dce2899..cdffd941e75 100644
--- a/lib/final.rb
+++ b/lib/final.rb
@@ -2,7 +2,7 @@
# $Id$
# Copyright (C) 1998 Yukihiro Matsumoto. All rights reserved.
-# The ObjectSpace extention:
+# The ObjectSpace extension:
#
# ObjectSpace.define_finalizer(obj, proc=lambda())
#
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 72f0bfa8b85..8ef5bfd79bf 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -1,4 +1,4 @@
-# module to create Makefile for extention modules
+# module to create Makefile for extension modules
# invoke like: ruby -r mkmf extconf.rb
require 'rbconfig'
diff --git a/lib/observer.rb b/lib/observer.rb
index b802dac6333..5928367a7d6 100644
--- a/lib/observer.rb
+++ b/lib/observer.rb
@@ -30,9 +30,11 @@ module Observable
@observer_state
end
def notify_observers(*arg)
- if @observer_peers and @observer_state
- for i in @observer_peers
- i.update(*arg)
+ if @observer_state
+ if @observer_peers
+ for i in @observer_peers
+ i.update(*arg)
+ end
end
@observer_state = FALSE
end
diff --git a/regex.c b/regex.c
index 082ce4fd9df..a7a158e1fd9 100644
--- a/regex.c
+++ b/regex.c
@@ -380,6 +380,7 @@ long re_syntax_options = 0;
/* Macros for re_compile_pattern, which is found below these definitions. */
#define TRANSLATE_P() ((options&RE_OPTION_IGNORECASE) && translate)
+#define TRY_TRANSLATE() ((bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE)) && translate)
/* Fetch the next character in the uncompiled pattern---translating it
if necessary. Also cast from a signed character in the constant
string passed to us by the user to an unsigned char that we can use
@@ -2228,17 +2229,13 @@ re_compile_fastmap(bufp)
{
case exactn:
if (p[1] == 0xff) {
- if (TRANSLATE_P()) {
+ if (TRANSLATE_P())
fastmap[translate[p[2]]] = 2;
- bufp->options |= RE_MAY_IGNORECASE;
- }
else
fastmap[p[2]] = 2;
}
- else if (TRANSLATE_P()) {
+ else if (TRANSLATE_P())
fastmap[translate[p[1]]] = 1;
- bufp->options |= RE_MAY_IGNORECASE;
- }
else
fastmap[p[1]] = 1;
break;
@@ -2260,10 +2257,8 @@ re_compile_fastmap(bufp)
continue;
case endline:
- if (TRANSLATE_P()) {
+ if (TRANSLATE_P())
fastmap[translate['\n']] = 1;
- bufp->options |= RE_MAY_IGNORECASE;
- }
else
fastmap['\n'] = 1;
@@ -2386,10 +2381,8 @@ re_compile_fastmap(bufp)
for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
{
- if (TRANSLATE_P()) {
+ if (TRANSLATE_P())
fastmap[translate[j]] = 1;
- bufp->options |= RE_MAY_IGNORECASE;
- }
else
fastmap[j] = 1;
}
@@ -2545,8 +2538,7 @@ re_search(bufp, string, size, startpos, range, regs)
&& bufp->must
&& !must_instr(bufp->must+1, bufp->must[0],
string+startpos, size-startpos,
- (bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE))?
- translate:0)) {
+ TRY_TRANSLATE()?translate:0)) {
return -1;
}
@@ -2584,8 +2576,7 @@ re_search(bufp, string, size, startpos, range, regs)
break;
}
else
- if (fastmap[(bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE))?
- translate[c] : c])
+ if (fastmap[TRY_TRANSLATE() ? translate[c] : c])
break;
range--;
}
@@ -2597,8 +2588,7 @@ re_search(bufp, string, size, startpos, range, regs)
c = string[startpos];
c &= 0xff;
- if ((bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE)) ?
- !fastmap[translate[c]] : !fastmap[c])
+ if (TRY_TRANSLATE() ? !fastmap[translate[c]] : !fastmap[c])
goto advance;
}
}
@@ -3394,6 +3384,7 @@ re_match(bufp, string_arg, size, pos, regs)
continue;
case casefold_on:
+ bufp->options |= RE_MAY_IGNORECASE;
options |= RE_OPTION_IGNORECASE;
continue;