1
/* Init cclasses array from ctypes */
9
static my_bool regex_inited=0;
11
void my_regex_init(CHARSET_INFO *cs)
13
char buff[CCLASS_LAST][256];
14
int count[CCLASS_LAST];
20
bzero((uchar*) &count,sizeof(count));
22
for (i=1 ; i<= 255; i++)
25
buff[CCLASS_ALNUM][count[CCLASS_ALNUM]++]=(char) i;
27
buff[CCLASS_ALPHA][count[CCLASS_ALPHA]++]=(char) i;
29
buff[CCLASS_CNTRL][count[CCLASS_CNTRL]++]=(char) i;
31
buff[CCLASS_DIGIT][count[CCLASS_DIGIT]++]=(char) i;
33
buff[CCLASS_GRAPH][count[CCLASS_GRAPH]++]=(char) i;
35
buff[CCLASS_LOWER][count[CCLASS_LOWER]++]=(char) i;
37
buff[CCLASS_PRINT][count[CCLASS_PRINT]++]=(char) i;
39
buff[CCLASS_PUNCT][count[CCLASS_PUNCT]++]=(char) i;
41
buff[CCLASS_SPACE][count[CCLASS_SPACE]++]=(char) i;
43
buff[CCLASS_UPPER][count[CCLASS_UPPER]++]=(char) i;
44
if (my_isxdigit(cs,i))
45
buff[CCLASS_XDIGIT][count[CCLASS_XDIGIT]++]=(char) i;
47
buff[CCLASS_BLANK][0]=' ';
48
buff[CCLASS_BLANK][1]='\t';
49
count[CCLASS_BLANK]=2;
50
for (i=0; i < CCLASS_LAST ; i++)
52
char *tmp=(char*) malloc(count[i]+1);
56
This is very unlikely to happen as this function is called once
60
"Fatal error: Can't allocate memory in regex_init\n");
63
memcpy(tmp,buff[i],count[i]*sizeof(char));
65
cclasses[i].chars=tmp;
76
for (i=0; i < CCLASS_LAST ; i++)
77
free((char*) cclasses[i].chars);