mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
7c999bb032
Remove some warnings Docs/manual.texi: Solaris and gcc include/ft_global.h: Remove warnings include/myisam.h: Query cache include/myisammrg.h: Query cache include/mysql_com.h: Query cache libmysqld/lib_sql.cc: Query cache myisam/ft_boolean_search.c: Remove warnings myisam/ft_dump.c: Remove warnings myisam/ft_parser.c: Remove warnings myisam/ft_static.c: Remove warnings myisam/ft_update.c: Remove warnings myisam/ftdefs.h: Remove warnings myisam/mi_delete.c: Query cache myisam/mi_locking.c: Query cache myisam/mi_update.c: Query cache myisam/myisamdef.h: Optimize for Ia64 myisammrg/myrg_extra.c: Query cache mysys/mf_keycache.c: DBUG statements regex/cclass.h: Remove warnings regex/cname.h: Remove warnings regex/main.c: Remove warnings regex/regcomp.c: Remove warnings regex/regcomp.ih: Remove warnings regex/regerror.c: Remove warnings regex/reginit.c: Remove warnings regex/split.c: Remove warnings sql-bench/test-connect.sh: Make tests query-cache safe. sql-bench/test-transactions.sh: Fix for old perl versions sql/convert.cc: Query cache sql/ha_myisammrg.cc: Query cache sql/ha_myisammrg.h: Query cache sql/handler.cc: Query cache sql/item_create.cc: Query cache sql/item_func.cc: Remove warnings sql/item_func.h: Remove warnings sql/lex.h: Query cache sql/mysql_priv.h: Query cache sql/mysqld.cc: Query cache sql/net_serv.cc: Query cache sql/sql_cache.cc: Query cache sql/sql_class.cc: Query cache sql/sql_class.h: Query cache sql/sql_db.cc: Query cache sql/sql_delete.cc: Query cache sql/sql_insert.cc: Query cache sql/sql_parse.cc: Query cache sql/sql_select.cc: Query cache sql/sql_table.cc: Query cache sql/sql_update.cc: Query cache sql/sql_yacc.yy: Query cache
71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
/* Init cclasses array from ctypes */
|
|
|
|
#include <my_global.h>
|
|
#include <m_ctype.h>
|
|
#include <m_string.h>
|
|
#include "cclass.h"
|
|
|
|
static bool regex_inited=0;
|
|
|
|
void regex_init()
|
|
{
|
|
char buff[CCLASS_LAST][256];
|
|
int count[CCLASS_LAST];
|
|
uint i;
|
|
|
|
if (!regex_inited)
|
|
{
|
|
regex_inited=1;
|
|
bzero((gptr) &count,sizeof(count));
|
|
|
|
for (i=1 ; i<= 255; i++)
|
|
{
|
|
if (isalnum(i))
|
|
buff[CCLASS_ALNUM][count[CCLASS_ALNUM]++]=(char) i;
|
|
if (isalpha(i))
|
|
buff[CCLASS_ALPHA][count[CCLASS_ALPHA]++]=(char) i;
|
|
if (iscntrl(i))
|
|
buff[CCLASS_CNTRL][count[CCLASS_CNTRL]++]=(char) i;
|
|
if (isdigit(i))
|
|
buff[CCLASS_DIGIT][count[CCLASS_DIGIT]++]=(char) i;
|
|
if (isgraph(i))
|
|
buff[CCLASS_GRAPH][count[CCLASS_GRAPH]++]=(char) i;
|
|
if (islower(i))
|
|
buff[CCLASS_LOWER][count[CCLASS_LOWER]++]=(char) i;
|
|
if (isprint(i))
|
|
buff[CCLASS_PRINT][count[CCLASS_PRINT]++]=(char) i;
|
|
if (ispunct(i))
|
|
buff[CCLASS_PUNCT][count[CCLASS_PUNCT]++]=(char) i;
|
|
if (isspace(i))
|
|
buff[CCLASS_SPACE][count[CCLASS_SPACE]++]=(char) i;
|
|
if (isupper(i))
|
|
buff[CCLASS_UPPER][count[CCLASS_UPPER]++]=(char) i;
|
|
if (isxdigit(i))
|
|
buff[CCLASS_XDIGIT][count[CCLASS_XDIGIT]++]=(char) i;
|
|
}
|
|
buff[CCLASS_BLANK][0]=' ';
|
|
buff[CCLASS_BLANK][1]='\t';
|
|
count[CCLASS_BLANK]=2;
|
|
for (i=0; i < CCLASS_LAST ; i++)
|
|
{
|
|
char *tmp=(char*) malloc(count[i]+1);
|
|
memcpy(tmp,buff[i],count[i]*sizeof(char));
|
|
tmp[count[i]]=0;
|
|
cclasses[i].chars=tmp;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
void regex_end()
|
|
{
|
|
if (regex_inited)
|
|
{
|
|
int i;
|
|
for (i=0; i < CCLASS_LAST ; i++)
|
|
free((char*) cclasses[i].chars);
|
|
regex_inited=0;
|
|
}
|
|
}
|
|
|
|
|