Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b389df3

Browse files
author
Fredrik Lundh
committed
- renamed "tolower" hook (it happened to work with
my compiler, but not on guido's box...)
1 parent 6fc9f8e commit b389df3

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

Modules/_sre.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static char sre_char_info[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 2,
9494
0, 0, 16, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
9595
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0 };
9696

97-
static char sre_char_tolower[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
97+
static char sre_char_lower[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
9898
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
9999
27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
100100
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
@@ -104,9 +104,9 @@ static char sre_char_tolower[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
104104
106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
105105
120, 121, 122, 123, 124, 125, 126, 127 };
106106

107-
static unsigned int sre_tolower(unsigned int ch)
107+
static unsigned int sre_lower(unsigned int ch)
108108
{
109-
return ((ch) < 128 ? sre_char_tolower[ch] : ch);
109+
return ((ch) < 128 ? sre_char_lower[ch] : ch);
110110
}
111111

112112
#define SRE_IS_DIGIT(ch)\
@@ -122,7 +122,7 @@ static unsigned int sre_tolower(unsigned int ch)
122122

123123
/* locale-specific character predicates */
124124

125-
static unsigned int sre_tolower_locale(unsigned int ch)
125+
static unsigned int sre_lower_locale(unsigned int ch)
126126
{
127127
return ((ch) < 256 ? tolower((ch)) : ch);
128128
}
@@ -135,7 +135,7 @@ static unsigned int sre_tolower_locale(unsigned int ch)
135135
/* unicode-specific character predicates */
136136

137137
#if defined(HAVE_UNICODE)
138-
static unsigned int sre_tolower_unicode(unsigned int ch)
138+
static unsigned int sre_lower_unicode(unsigned int ch)
139139
{
140140
return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch));
141141
}
@@ -497,7 +497,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
497497
goto failure;
498498
while (p < e) {
499499
if (ptr >= end ||
500-
state->tolower(*ptr) != state->tolower(*p))
500+
state->lower(*ptr) != state->lower(*p))
501501
goto failure;
502502
p++; ptr++;
503503
}
@@ -508,7 +508,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
508508
case SRE_OP_LITERAL_IGNORE:
509509
TRACE(("%8d: literal lower(%c)\n", PTR(ptr), (SRE_CHAR) *pattern));
510510
if (ptr >= end ||
511-
state->tolower(*ptr) != state->tolower(*pattern))
511+
state->lower(*ptr) != state->lower(*pattern))
512512
goto failure;
513513
pattern++;
514514
ptr++;
@@ -518,7 +518,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
518518
TRACE(("%8d: literal not lower(%c)\n", PTR(ptr),
519519
(SRE_CHAR) *pattern));
520520
if (ptr >= end ||
521-
state->tolower(*ptr) == state->tolower(*pattern))
521+
state->lower(*ptr) == state->lower(*pattern))
522522
goto failure;
523523
pattern++;
524524
ptr++;
@@ -527,7 +527,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
527527
case SRE_OP_IN_IGNORE:
528528
TRACE(("%8d: set lower(%c)\n", PTR(ptr), *ptr));
529529
if (ptr >= end
530-
|| !SRE_MEMBER(pattern+1, (SRE_CHAR) state->tolower(*ptr)))
530+
|| !SRE_MEMBER(pattern+1, (SRE_CHAR) state->lower(*ptr)))
531531
goto failure;
532532
pattern += pattern[0];
533533
ptr++;
@@ -611,7 +611,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
611611
/* repeated literal */
612612
SRE_CHAR chr = (SRE_CHAR) pattern[4];
613613
while (count < (int) pattern[2]) {
614-
if (ptr >= end || (SRE_CHAR) state->tolower(*ptr) != chr)
614+
if (ptr >= end || (SRE_CHAR) state->lower(*ptr) != chr)
615615
break;
616616
ptr++;
617617
count++;
@@ -631,7 +631,7 @@ SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)
631631
/* repeated non-literal */
632632
SRE_CHAR chr = (SRE_CHAR) pattern[4];
633633
while (count < (int) pattern[2]) {
634-
if (ptr >= end || (SRE_CHAR) state->tolower(*ptr) == chr)
634+
if (ptr >= end || (SRE_CHAR) state->lower(*ptr) == chr)
635635
break;
636636
ptr++;
637637
count++;
@@ -1001,18 +1001,18 @@ sre_codesize(PyObject* self, PyObject* args)
10011001
}
10021002

10031003
static PyObject *
1004-
sre_lower(PyObject* self, PyObject* args)
1004+
sre_getlower(PyObject* self, PyObject* args)
10051005
{
10061006
int character, flags;
10071007
if (!PyArg_ParseTuple(args, "ii", &character, &flags))
10081008
return NULL;
10091009
if (flags & SRE_FLAG_LOCALE)
1010-
return Py_BuildValue("i", sre_tolower_locale(character));
1010+
return Py_BuildValue("i", sre_lower_locale(character));
10111011
#if defined(HAVE_UNICODE)
10121012
if (flags & SRE_FLAG_UNICODE)
1013-
return Py_BuildValue("i", sre_tolower_unicode(character));
1013+
return Py_BuildValue("i", sre_lower_unicode(character));
10141014
#endif
1015-
return Py_BuildValue("i", sre_tolower(character));
1015+
return Py_BuildValue("i", sre_lower(character));
10161016
}
10171017

10181018
LOCAL(PyObject*)
@@ -1082,13 +1082,13 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* args)
10821082
state->stacksize = 0;
10831083

10841084
if (pattern->flags & SRE_FLAG_LOCALE)
1085-
state->tolower = sre_tolower_locale;
1085+
state->lower = sre_lower_locale;
10861086
#if defined(HAVE_UNICODE)
10871087
else if (pattern->flags & SRE_FLAG_UNICODE)
1088-
state->tolower = sre_tolower_unicode;
1088+
state->lower = sre_lower_unicode;
10891089
#endif
10901090
else
1091-
state->tolower = sre_tolower;
1091+
state->lower = sre_lower;
10921092

10931093
return string;
10941094
}
@@ -1876,7 +1876,7 @@ statichere PyTypeObject Cursor_Type = {
18761876
static PyMethodDef _functions[] = {
18771877
{"compile", _compile, 1},
18781878
{"getcodesize", sre_codesize, 1},
1879-
{"getlower", sre_lower, 1},
1879+
{"getlower", sre_getlower, 1},
18801880
{NULL, NULL}
18811881
};
18821882

Modules/sre.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef struct {
6262
int stacksize;
6363
int stackbase;
6464
/* hooks */
65-
SRE_TOLOWER_HOOK tolower;
65+
SRE_TOLOWER_HOOK lower;
6666
} SRE_STATE;
6767

6868
typedef struct {

0 commit comments

Comments
 (0)