summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-18 08:41:01 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-18 08:41:01 (GMT)
commit40ce1eb4035de0707549bcf2c7210b2ef11359ef (patch)
treee3d5f388eb207b8754c8055d9c18421ff294a495 /regparse.c
parent02f802f2cef1bdde8dae8cfe47a8ba06ea018491 (diff)
warning: no indirect flag
* regparse.c (is_onechar_cclass): remove "found" indirect flag to suppress warnings by gcc 4.7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/regparse.c b/regparse.c
index e2504bd..460cba7 100644
--- a/regparse.c
+++ b/regparse.c
@@ -5684,8 +5684,8 @@ countbits(unsigned int bits)
static int
is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
{
- OnigCodePoint c; /* c is used iff found == 1 */
- int found = 0;
+ const OnigCodePoint not_found = (OnigCodePoint)-1;
+ OnigCodePoint c = not_found;
int i;
BBuf *bbuf = cc->mbuf;
@@ -5699,9 +5699,9 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
if ((n == 1) && (data[0] == data[1])) {
/* only one char found in the bbuf, save the code point. */
c = data[0];
- if ((c >= SINGLE_BYTE_SIZE) || !BITSET_AT(cc->bs, c)) {
- /* set found=1 if c is not included in the bitset */
- found = 1;
+ if (((c < SINGLE_BYTE_SIZE) && BITSET_AT(cc->bs, c))) {
+ /* skip if c is included in the bitset */
+ c = not_found;
}
}
else {
@@ -5713,8 +5713,7 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
for (i = 0; i < (int )BITSET_SIZE; i++) {
Bits b1 = cc->bs[i];
if (b1 != 0) {
- if (((b1 & (b1 - 1)) == 0) && (found == 0)) {
- found = 1;
+ if (((b1 & (b1 - 1)) == 0) && (c == not_found)) {
c = BITS_IN_ROOM * i + countbits(b1 - 1);
} else {
return 0; /* the character class contains multiple chars */
@@ -5722,7 +5721,7 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
}
}
- if (found) {
+ if (c != not_found) {
*code = c;
return 1;
}