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
This commit is contained in:
nobu 2012-07-18 08:41:01 +00:00
parent 02f802f2ce
commit 40ce1eb403

View File

@ -5684,8 +5684,8 @@ countbits(unsigned int bits)
static int static int
is_onechar_cclass(CClassNode* cc, OnigCodePoint* code) is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
{ {
OnigCodePoint c; /* c is used iff found == 1 */ const OnigCodePoint not_found = (OnigCodePoint)-1;
int found = 0; OnigCodePoint c = not_found;
int i; int i;
BBuf *bbuf = cc->mbuf; BBuf *bbuf = cc->mbuf;
@ -5699,9 +5699,9 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
if ((n == 1) && (data[0] == data[1])) { if ((n == 1) && (data[0] == data[1])) {
/* only one char found in the bbuf, save the code point. */ /* only one char found in the bbuf, save the code point. */
c = data[0]; c = data[0];
if ((c >= SINGLE_BYTE_SIZE) || !BITSET_AT(cc->bs, c)) { if (((c < SINGLE_BYTE_SIZE) && BITSET_AT(cc->bs, c))) {
/* set found=1 if c is not included in the bitset */ /* skip if c is included in the bitset */
found = 1; c = not_found;
} }
} }
else { else {
@ -5713,8 +5713,7 @@ is_onechar_cclass(CClassNode* cc, OnigCodePoint* code)
for (i = 0; i < (int )BITSET_SIZE; i++) { for (i = 0; i < (int )BITSET_SIZE; i++) {
Bits b1 = cc->bs[i]; Bits b1 = cc->bs[i];
if (b1 != 0) { if (b1 != 0) {
if (((b1 & (b1 - 1)) == 0) && (found == 0)) { if (((b1 & (b1 - 1)) == 0) && (c == not_found)) {
found = 1;
c = BITS_IN_ROOM * i + countbits(b1 - 1); c = BITS_IN_ROOM * i + countbits(b1 - 1);
} else { } else {
return 0; /* the character class contains multiple chars */ 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; *code = c;
return 1; return 1;
} }