Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
656b0cc1
Commit
656b0cc1
authored
Sep 29, 2005
by
kent@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
6e10a589
844d964f
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
228 additions
and
193 deletions
+228
-193
client/mysqltest.c
client/mysqltest.c
+10
-9
mysql-test/lib/mtr_process.pl
mysql-test/lib/mtr_process.pl
+2
-1
mysql-test/mysql-test-run.pl
mysql-test/mysql-test-run.pl
+129
-96
os2/MySQL-Source.icc
os2/MySQL-Source.icc
+2
-2
regex/Makefile.am
regex/Makefile.am
+1
-1
regex/debug.c
regex/debug.c
+3
-2
regex/debug.ih
regex/debug.ih
+1
-1
regex/engine.c
regex/engine.c
+4
-4
regex/engine.ih
regex/engine.ih
+1
-1
regex/main.c
regex/main.c
+26
-26
regex/main.ih
regex/main.ih
+1
-1
regex/my_regex.h
regex/my_regex.h
+8
-8
regex/regcomp.c
regex/regcomp.c
+5
-5
regex/regerror.c
regex/regerror.c
+3
-3
regex/regerror.ih
regex/regerror.ih
+1
-1
regex/regexec.c
regex/regexec.c
+4
-5
regex/regfree.c
regex/regfree.c
+3
-3
regex/reginit.c
regex/reginit.c
+2
-2
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+16
-16
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+2
-2
sql/mysqld.cc
sql/mysqld.cc
+4
-4
No files found.
client/mysqltest.c
View file @
656b0cc1
...
...
@@ -59,7 +59,7 @@
#include <stdarg.h>
#include <sys/stat.h>
#include <violite.h>
#include
<regex.h>
/* Our own version of lib */
#include
"my_regex.h"
/* Our own version of lib */
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
...
...
@@ -212,7 +212,7 @@ static int got_end_timer= FALSE;
static
void
timer_output
(
void
);
static
ulonglong
timer_now
(
void
);
static
regex_t
ps_re
;
/* Holds precompiled re for valid PS statements */
static
my_
regex_t
ps_re
;
/* Holds precompiled re for valid PS statements */
static
void
ps_init_re
(
void
);
static
int
ps_match_re
(
char
*
);
static
char
*
ps_eprint
(
int
);
...
...
@@ -3767,12 +3767,13 @@ static void ps_init_re(void)
"[[:space:]]*UPDATE[[:space:]]+MULTI[[:space:]]|"
"[[:space:]]*INSERT[[:space:]]+SELECT[[:space:]])"
;
int
err
=
regcomp
(
&
ps_re
,
ps_re_str
,
(
REG_EXTENDED
|
REG_ICASE
|
REG_NOSUB
),
&
my_charset_latin1
);
int
err
=
my_regcomp
(
&
ps_re
,
ps_re_str
,
(
REG_EXTENDED
|
REG_ICASE
|
REG_NOSUB
),
&
my_charset_latin1
);
if
(
err
)
{
char
erbuf
[
100
];
int
len
=
regerror
(
err
,
&
ps_re
,
erbuf
,
sizeof
(
erbuf
));
int
len
=
my_
regerror
(
err
,
&
ps_re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"error %s, %d/%d `%s'
\n
"
,
ps_eprint
(
err
),
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
exit
(
1
);
...
...
@@ -3782,7 +3783,7 @@ static void ps_init_re(void)
static
int
ps_match_re
(
char
*
stmt_str
)
{
int
err
=
regexec
(
&
ps_re
,
stmt_str
,
(
size_t
)
0
,
NULL
,
0
);
int
err
=
my_
regexec
(
&
ps_re
,
stmt_str
,
(
size_t
)
0
,
NULL
,
0
);
if
(
err
==
0
)
return
1
;
...
...
@@ -3791,7 +3792,7 @@ static int ps_match_re(char *stmt_str)
else
{
char
erbuf
[
100
];
int
len
=
regerror
(
err
,
&
ps_re
,
erbuf
,
sizeof
(
erbuf
));
int
len
=
my_
regerror
(
err
,
&
ps_re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"error %s, %d/%d `%s'
\n
"
,
ps_eprint
(
err
),
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
exit
(
1
);
...
...
@@ -3801,7 +3802,7 @@ static int ps_match_re(char *stmt_str)
static
char
*
ps_eprint
(
int
err
)
{
static
char
epbuf
[
100
];
size_t
len
=
regerror
(
REG_ITOA
|
err
,
(
regex_t
*
)
NULL
,
epbuf
,
sizeof
(
epbuf
));
size_t
len
=
my_regerror
(
REG_ITOA
|
err
,
(
my_
regex_t
*
)
NULL
,
epbuf
,
sizeof
(
epbuf
));
assert
(
len
<=
sizeof
(
epbuf
));
return
(
epbuf
);
}
...
...
@@ -3809,7 +3810,7 @@ static char *ps_eprint(int err)
static
void
ps_free_reg
(
void
)
{
regfree
(
&
ps_re
);
my_
regfree
(
&
ps_re
);
}
/****************************************************************************/
...
...
mysql-test/lib/mtr_process.pl
View file @
656b0cc1
...
...
@@ -680,7 +680,8 @@ sub mtr_mysqladmin_shutdown {
mtr_add_arg
(
$args
,
"
shutdown
");
# We don't wait for termination of mysqladmin
my
$pid
=
mtr_spawn
(
$::exe_mysqladmin
,
$args
,
"",
$::path_manager_log
,
$::path_manager_log
,
"");
"",
$::path_manager_log
,
$::path_manager_log
,
"",
{
append_log_file
=>
1
});
$mysql_admin_pids
{
$pid
}
=
1
;
}
...
...
mysql-test/mysql-test-run.pl
View file @
656b0cc1
This diff is collapsed.
Click to expand it.
os2/MySQL-Source.icc
View file @
656b0cc1
...
...
@@ -12,7 +12,7 @@ group client_global_pch =
'm_ctype.h', 'mysqld_error.h',
'my_list.h', 'my_sys.h', 'my_net.h',
'myisam.h', 'myisampack.h', '.\myisam\myisamdef.h',
'.\regex\regex.h'
'.\regex\
my_
regex.h'
group server_global_pch =
'os2.h',
...
...
@@ -38,7 +38,7 @@ group server_global_pch =
'my_tree.h', '..\mysys\my_static.h', 'netdb.h',
'thr_alarm.h', 'heap.h', '..\myisam\fulltext.h',
'..\myisam\ftdefs.h', 'myisammrg.h',
'.\regex\regex.h'
'.\regex\
my_
regex.h'
group server_pch =
'ha_heap.h', 'ha_myisammrg.h', 'opt_ft.h',
...
...
regex/Makefile.am
View file @
656b0cc1
...
...
@@ -18,7 +18,7 @@
INCLUDES
=
-I
$(top_builddir)
/include
-I
$(top_srcdir)
/include
noinst_LIBRARIES
=
libregex.a
LDADD
=
libregex.a
$(top_builddir)
/strings/libmystrings.a
noinst_HEADERS
=
cclass.h cname.h regex2.h utils.h engine.c regex.h
noinst_HEADERS
=
cclass.h cname.h regex2.h utils.h engine.c
my_
regex.h
libregex_a_SOURCES
=
regerror.c regcomp.c regexec.c regfree.c reginit.c
noinst_PROGRAMS
=
re
re_SOURCES
=
split.c debug.c main.c
...
...
regex/debug.c
View file @
656b0cc1
...
...
@@ -2,7 +2,8 @@
#include <m_ctype.h>
#include <m_string.h>
#include <sys/types.h>
#include <regex.h>
#include "my_regex.h"
#include "utils.h"
#include "regex2.h"
#include "debug.ih"
...
...
@@ -15,7 +16,7 @@
*/
void
regprint
(
r
,
d
)
regex_t
*
r
;
my_
regex_t
*
r
;
FILE
*
d
;
{
register
struct
re_guts
*
g
=
r
->
re_g
;
...
...
regex/debug.ih
View file @
656b0cc1
...
...
@@ -4,7 +4,7 @@ extern "C" {
#endif
/* === debug.c === */
void regprint(regex_t *r, FILE *d);
void regprint(
my_
regex_t *r, FILE *d);
static void s_print(CHARSET_INFO *charset, register struct re_guts *g, FILE *d);
static char *regchar(CHARSET_INFO *charset, int ch,char *buf);
...
...
regex/engine.c
View file @
656b0cc1
...
...
@@ -32,7 +32,7 @@
struct
match
{
struct
re_guts
*
g
;
int
eflags
;
regmatch_t
*
pmatch
;
/* [nsub+1] (0 element unused) */
my_
regmatch_t
*
pmatch
;
/* [nsub+1] (0 element unused) */
char
*
offp
;
/* offsets work from here */
char
*
beginp
;
/* start of string -- virtual NUL precedes */
char
*
endp
;
/* end of string -- virtual NUL here */
...
...
@@ -68,7 +68,7 @@ CHARSET_INFO *charset;
register
struct
re_guts
*
g
;
char
*
str
;
size_t
nmatch
;
regmatch_t
pmatch
[];
my_
regmatch_t
pmatch
[];
int
eflags
;
{
register
char
*
endp
;
...
...
@@ -148,8 +148,8 @@ int eflags;
/* oh my, he wants the subexpressions... */
if
(
m
->
pmatch
==
NULL
)
m
->
pmatch
=
(
regmatch_t
*
)
malloc
((
m
->
g
->
nsub
+
1
)
*
sizeof
(
regmatch_t
));
m
->
pmatch
=
(
my_
regmatch_t
*
)
malloc
((
m
->
g
->
nsub
+
1
)
*
sizeof
(
my_
regmatch_t
));
if
(
m
->
pmatch
==
NULL
)
{
if
(
m
->
lastpos
!=
NULL
)
free
((
char
*
)
m
->
lastpos
);
...
...
regex/engine.ih
View file @
656b0cc1
...
...
@@ -4,7 +4,7 @@ extern "C" {
#endif
/* === engine.c === */
static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
static int matcher(CHARSET_INFO *charset,register struct re_guts *g, char *string, size_t nmatch,
my_
regmatch_t pmatch[], int eflags);
static char *dissect(CHARSET_INFO *charset,register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
static char *backref(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
static char *fast(CHARSET_INFO *charset, register struct match *m, char *start, char *stop, sopno startst, sopno stopst);
...
...
regex/main.c
View file @
656b0cc1
#include <my_global.h>
#include <m_string.h>
#include <sys/types.h>
#include <regex.h>
#include <assert.h>
#include "my_regex.h"
#include "main.ih"
char
*
progname
;
...
...
@@ -27,9 +27,9 @@ int main(argc, argv)
int
argc
;
char
*
argv
[];
{
regex_t
re
;
my_
regex_t
re
;
# define NS 10
regmatch_t
subs
[
NS
];
my_
regmatch_t
subs
[
NS
];
char
erbuf
[
100
];
int
err
;
size_t
len
;
...
...
@@ -74,9 +74,9 @@ char *argv[];
exit
(
status
);
}
err
=
regcomp
(
&
re
,
argv
[
optind
++
],
copts
,
&
my_charset_latin1
);
err
=
my_
regcomp
(
&
re
,
argv
[
optind
++
],
copts
,
&
my_charset_latin1
);
if
(
err
)
{
len
=
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
len
=
my_
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"error %s, %d/%d `%s'
\n
"
,
eprint
(
err
),
(
int
)
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
exit
(
status
);
...
...
@@ -84,7 +84,7 @@ char *argv[];
regprint
(
&
re
,
stdout
);
if
(
optind
>=
argc
)
{
regfree
(
&
re
);
my_
regfree
(
&
re
);
exit
(
status
);
}
...
...
@@ -92,9 +92,9 @@ char *argv[];
subs
[
0
].
rm_so
=
startoff
;
subs
[
0
].
rm_eo
=
strlen
(
argv
[
optind
])
-
endoff
;
}
err
=
regexec
(
&
re
,
argv
[
optind
],
(
size_t
)
NS
,
subs
,
eopts
);
err
=
my_
regexec
(
&
re
,
argv
[
optind
],
(
size_t
)
NS
,
subs
,
eopts
);
if
(
err
)
{
len
=
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
len
=
my_
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"error %s, %d/%d `%s'
\n
"
,
eprint
(
err
),
(
int
)
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
exit
(
status
);
...
...
@@ -136,7 +136,7 @@ FILE *in;
const
char
*
badpat
=
"invalid regular expression"
;
# define SHORT 10
const
char
*
bpname
=
"REG_BADPAT"
;
regex_t
re
;
my_
regex_t
re
;
while
(
fgets
(
inbuf
,
sizeof
(
inbuf
),
in
)
!=
NULL
)
{
line
++
;
...
...
@@ -163,27 +163,27 @@ FILE *in;
options
(
'c'
,
f
[
1
])
&~
REG_EXTENDED
);
}
ne
=
regerror
(
REG_BADPAT
,
(
regex_t
*
)
NULL
,
erbuf
,
sizeof
(
erbuf
));
ne
=
my_regerror
(
REG_BADPAT
,
(
my_
regex_t
*
)
NULL
,
erbuf
,
sizeof
(
erbuf
));
if
(
strcmp
(
erbuf
,
badpat
)
!=
0
||
ne
!=
strlen
(
badpat
)
+
1
)
{
fprintf
(
stderr
,
"end: regerror() test gave `%s' not `%s'
\n
"
,
erbuf
,
badpat
);
status
=
1
;
}
ne
=
regerror
(
REG_BADPAT
,
(
regex_t
*
)
NULL
,
erbuf
,
(
size_t
)
SHORT
);
ne
=
my_regerror
(
REG_BADPAT
,
(
my_
regex_t
*
)
NULL
,
erbuf
,
(
size_t
)
SHORT
);
if
(
strncmp
(
erbuf
,
badpat
,
SHORT
-
1
)
!=
0
||
erbuf
[
SHORT
-
1
]
!=
'\0'
||
ne
!=
strlen
(
badpat
)
+
1
)
{
fprintf
(
stderr
,
"end: regerror() short test gave `%s' not `%.*s'
\n
"
,
erbuf
,
SHORT
-
1
,
badpat
);
status
=
1
;
}
ne
=
regerror
(
REG_ITOA
|
REG_BADPAT
,
(
regex_t
*
)
NULL
,
erbuf
,
sizeof
(
erbuf
));
ne
=
my_regerror
(
REG_ITOA
|
REG_BADPAT
,
(
my_
regex_t
*
)
NULL
,
erbuf
,
sizeof
(
erbuf
));
if
(
strcmp
(
erbuf
,
bpname
)
!=
0
||
ne
!=
strlen
(
bpname
)
+
1
)
{
fprintf
(
stderr
,
"end: regerror() ITOA test gave `%s' not `%s'
\n
"
,
erbuf
,
bpname
);
status
=
1
;
}
re
.
re_endp
=
bpname
;
ne
=
regerror
(
REG_ATOI
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
ne
=
my_
regerror
(
REG_ATOI
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
if
(
atoi
(
erbuf
)
!=
(
int
)
REG_BADPAT
)
{
fprintf
(
stderr
,
"end: regerror() ATOI test gave `%s' not `%ld'
\n
"
,
erbuf
,
(
long
)
REG_BADPAT
);
...
...
@@ -208,9 +208,9 @@ char *f3;
char
*
f4
;
int
opts
;
/* may not match f1 */
{
regex_t
re
;
my_
regex_t
re
;
# define NSUBS 10
regmatch_t
subs
[
NSUBS
];
my_
regmatch_t
subs
[
NSUBS
];
# define NSHOULD 15
char
*
should
[
NSHOULD
];
int
nshould
;
...
...
@@ -226,10 +226,10 @@ int opts; /* may not match f1 */
strcpy
(
f0copy
,
f0
);
re
.
re_endp
=
(
opts
&
REG_PEND
)
?
f0copy
+
strlen
(
f0copy
)
:
NULL
;
fixstr
(
f0copy
);
err
=
regcomp
(
&
re
,
f0copy
,
opts
,
&
my_charset_latin1
);
err
=
my_
regcomp
(
&
re
,
f0copy
,
opts
,
&
my_charset_latin1
);
if
(
err
!=
0
&&
(
!
opt
(
'C'
,
f1
)
||
err
!=
efind
(
f2
)))
{
/* unexpected error or wrong error */
len
=
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
len
=
my_
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"%d: %s error %s, %d/%d `%s'
\n
"
,
line
,
type
,
eprint
(
err
),
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
...
...
@@ -243,7 +243,7 @@ int opts; /* may not match f1 */
}
if
(
err
!=
0
)
{
regfree
(
&
re
);
my_
regfree
(
&
re
);
return
;
}
...
...
@@ -256,11 +256,11 @@ int opts; /* may not match f1 */
subs
[
0
].
rm_so
=
strchr
(
f2
,
'('
)
-
f2
+
1
;
subs
[
0
].
rm_eo
=
strchr
(
f2
,
')'
)
-
f2
;
}
err
=
regexec
(
&
re
,
f2copy
,
NSUBS
,
subs
,
options
(
'e'
,
f1
));
err
=
my_
regexec
(
&
re
,
f2copy
,
NSUBS
,
subs
,
options
(
'e'
,
f1
));
if
(
err
!=
0
&&
(
f3
!=
NULL
||
err
!=
REG_NOMATCH
))
{
/* unexpected error or wrong error */
len
=
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
len
=
my_
regerror
(
err
,
&
re
,
erbuf
,
sizeof
(
erbuf
));
fprintf
(
stderr
,
"%d: %s exec error %s, %d/%d `%s'
\n
"
,
line
,
type
,
eprint
(
err
),
len
,
(
int
)
sizeof
(
erbuf
),
erbuf
);
...
...
@@ -282,7 +282,7 @@ int opts; /* may not match f1 */
}
if
(
err
!=
0
||
f4
==
NULL
)
{
regfree
(
&
re
);
my_
regfree
(
&
re
);
return
;
}
...
...
@@ -303,7 +303,7 @@ int opts; /* may not match f1 */
}
}
regfree
(
&
re
);
my_
regfree
(
&
re
);
}
/*
...
...
@@ -404,7 +404,7 @@ register char *p;
char
*
/* NULL or complaint */
check
(
str
,
sub
,
should
)
char
*
str
;
regmatch_t
sub
;
my_
regmatch_t
sub
;
char
*
should
;
{
register
int
len
;
...
...
@@ -485,7 +485,7 @@ int err;
static
char
epbuf
[
100
];
size_t
len
;
len
=
regerror
(
REG_ITOA
|
err
,
(
regex_t
*
)
NULL
,
epbuf
,
sizeof
(
epbuf
));
len
=
my_regerror
(
REG_ITOA
|
err
,
(
my_
regex_t
*
)
NULL
,
epbuf
,
sizeof
(
epbuf
));
assert
(
len
<=
sizeof
(
epbuf
));
return
(
epbuf
);
}
...
...
@@ -499,11 +499,11 @@ efind(name)
char
*
name
;
{
static
char
efbuf
[
100
];
regex_t
re
;
my_
regex_t
re
;
sprintf
(
efbuf
,
"REG_%s"
,
name
);
assert
(
strlen
(
efbuf
)
<
sizeof
(
efbuf
));
re
.
re_endp
=
efbuf
;
(
void
)
regerror
(
REG_ATOI
,
&
re
,
efbuf
,
sizeof
(
efbuf
));
(
void
)
my_
regerror
(
REG_ATOI
,
&
re
,
efbuf
,
sizeof
(
efbuf
));
return
(
atoi
(
efbuf
));
}
regex/main.ih
View file @
656b0cc1
...
...
@@ -9,7 +9,7 @@ void rx_try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
int options(int type, char *s);
int opt(int c, char *s);
void fixstr(register char *p);
char *check(char *str, regmatch_t sub, char *should);
char *check(char *str,
my_
regmatch_t sub, char *should);
static char *eprint(int err);
static int efind(char *name);
...
...
regex/regex.h
→
regex/
my_
regex.h
View file @
656b0cc1
...
...
@@ -20,15 +20,15 @@ typedef struct {
const
char
*
re_endp
;
/* end pointer for REG_PEND */
struct
re_guts
*
re_g
;
/* none of your business :-) */
CHARSET_INFO
*
charset
;
/* For ctype things */
}
regex_t
;
}
my_
regex_t
;
typedef
struct
{
regoff_t
rm_so
;
/* start of match */
regoff_t
rm_eo
;
/* end of match */
}
regmatch_t
;
}
my_
regmatch_t
;
/* === regcomp.c === */
extern
int
regcomp
(
regex_t
*
,
const
char
*
,
int
,
CHARSET_INFO
*
charset
);
extern
int
my_regcomp
(
my_
regex_t
*
,
const
char
*
,
int
,
CHARSET_INFO
*
charset
);
#define REG_BASIC 0000
#define REG_EXTENDED 0001
#define REG_ICASE 0002
...
...
@@ -58,11 +58,11 @@ extern int regcomp(regex_t *, const char *, int, CHARSET_INFO *charset);
#define REG_INVARG 16
#define REG_ATOI 255
/* convert name to number (!) */
#define REG_ITOA 0400
/* convert number to name (!) */
extern
size_t
regerror
(
int
,
const
regex_t
*
,
char
*
,
size_t
);
extern
size_t
my_regerror
(
int
,
const
my_
regex_t
*
,
char
*
,
size_t
);
/* === regexec.c === */
extern
int
regexec
(
const
regex_t
*
,
const
char
*
,
size_t
,
regmatch_t
[],
int
);
extern
int
my_regexec
(
const
my_regex_t
*
,
const
char
*
,
size_t
,
my_
regmatch_t
[],
int
);
#define REG_NOTBOL 00001
#define REG_NOTEOL 00002
#define REG_STARTEND 00004
...
...
@@ -72,12 +72,12 @@ extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
/* === regfree.c === */
extern
void
regfree
(
regex_t
*
);
extern
void
my_regfree
(
my_
regex_t
*
);
/* === reginit.c === */
extern
void
regex_init
(
CHARSET_INFO
*
cs
);
/* Should be called for multithread progs */
extern
void
regex_end
(
void
);
/* If one wants a clean end */
extern
void
my_
regex_init
(
CHARSET_INFO
*
cs
);
/* Should be called for multithread progs */
extern
void
my_
regex_end
(
void
);
/* If one wants a clean end */
#ifdef __cplusplus
}
...
...
regex/regcomp.c
View file @
656b0cc1
#include <my_global.h>
#include <m_string.h>
#include <m_ctype.h>
#include <regex.h>
#ifdef __WIN__
#include <limits.h>
#endif
#include "my_regex.h"
#include "utils.h"
#include "regex2.h"
...
...
@@ -100,8 +100,8 @@ static int never = 0; /* for use in asserts; shuts lint up */
= #define REG_DUMP 0200
*/
int
/* 0 success, otherwise REG_something */
regcomp
(
preg
,
pattern
,
cflags
,
charset
)
regex_t
*
preg
;
my_
regcomp
(
preg
,
pattern
,
cflags
,
charset
)
my_
regex_t
*
preg
;
const
char
*
pattern
;
int
cflags
;
CHARSET_INFO
*
charset
;
...
...
@@ -117,7 +117,7 @@ CHARSET_INFO *charset;
# define GOODFLAGS(f) ((f)&~REG_DUMP)
#endif
regex_init
(
charset
);
/* Init cclass if neaded */
my_
regex_init
(
charset
);
/* Init cclass if neaded */
preg
->
charset
=
charset
;
cflags
=
GOODFLAGS
(
cflags
);
if
((
cflags
&
REG_EXTENDED
)
&&
(
cflags
&
REG_NOSPEC
))
...
...
@@ -199,7 +199,7 @@ CHARSET_INFO *charset;
/* win or lose, we're done */
if
(
p
->
error
!=
0
)
/* lose */
regfree
(
preg
);
my_
regfree
(
preg
);
return
(
p
->
error
);
}
...
...
regex/regerror.c
View file @
656b0cc1
#include <my_global.h>
#include <m_string.h>
#include <m_ctype.h>
#include <regex.h>
#include "my_regex.h"
#include "utils.h"
#include "regerror.ih"
...
...
@@ -56,7 +56,7 @@ static struct rerr {
*/
/* ARGSUSED */
size_t
regerror
(
int
errcode
,
const
regex_t
*
preg
,
char
*
errbuf
,
size_t
errbuf_size
)
my_regerror
(
int
errcode
,
const
my_
regex_t
*
preg
,
char
*
errbuf
,
size_t
errbuf_size
)
{
register
struct
rerr
*
r
;
register
size_t
len
;
...
...
@@ -101,7 +101,7 @@ regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
*/
static
char
*
regatoi
(
preg
,
localbuf
)
const
regex_t
*
preg
;
const
my_
regex_t
*
preg
;
char
*
localbuf
;
{
register
struct
rerr
*
r
;
...
...
regex/regerror.ih
View file @
656b0cc1
...
...
@@ -4,7 +4,7 @@ extern "C" {
#endif
/* === regerror.c === */
static char *regatoi(const regex_t *preg, char *localbuf);
static char *regatoi(const
my_
regex_t *preg, char *localbuf);
#ifdef __cplusplus
}
...
...
regex/regexec.c
View file @
656b0cc1
...
...
@@ -8,11 +8,10 @@
#include <my_global.h>
#include <m_string.h>
#include <m_ctype.h>
#include <regex.h>
#ifdef __WIN__
#include <limits.h>
#endif
#include "my_regex.h"
#include "utils.h"
#include "regex2.h"
...
...
@@ -110,11 +109,11 @@ static int nope = 0; /* for use in asserts; shuts lint up */
* have been prototyped.
*/
int
/* 0 success, REG_NOMATCH failure */
regexec
(
preg
,
str
,
nmatch
,
pmatch
,
eflags
)
const
regex_t
*
preg
;
my_
regexec
(
preg
,
str
,
nmatch
,
pmatch
,
eflags
)
const
my_
regex_t
*
preg
;
const
char
*
str
;
size_t
nmatch
;
regmatch_t
pmatch
[];
my_
regmatch_t
pmatch
[];
int
eflags
;
{
register
struct
re_guts
*
g
=
preg
->
re_g
;
...
...
regex/regfree.c
View file @
656b0cc1
...
...
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include
<regex.h>
#include
"my_regex.h"
#include "utils.h"
#include "regex2.h"
...
...
@@ -12,8 +12,8 @@
= extern void regfree(regex_t *);
*/
void
regfree
(
preg
)
regex_t
*
preg
;
my_
regfree
(
preg
)
my_
regex_t
*
preg
;
{
register
struct
re_guts
*
g
;
...
...
regex/reginit.c
View file @
656b0cc1
...
...
@@ -7,7 +7,7 @@
static
bool
regex_inited
=
0
;
void
regex_init
(
CHARSET_INFO
*
cs
)
void
my_
regex_init
(
CHARSET_INFO
*
cs
)
{
char
buff
[
CCLASS_LAST
][
256
];
int
count
[
CCLASS_LAST
];
...
...
@@ -67,7 +67,7 @@ void regex_init(CHARSET_INFO *cs)
return
;
}
void
regex_end
()
void
my_
regex_end
()
{
if
(
regex_inited
)
{
...
...
sql/item_cmpfunc.cc
View file @
656b0cc1
...
...
@@ -3072,14 +3072,14 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
return
FALSE
;
}
int
error
;
if
((
error
=
regcomp
(
&
preg
,
res
->
c_ptr
(),
((
cmp_collation
.
collation
->
state
&
(
MY_CS_BINSORT
|
MY_CS_CSSORT
))
?
REG_EXTENDED
|
REG_NOSUB
:
REG_EXTENDED
|
REG_NOSUB
|
REG_ICASE
),
cmp_collation
.
collation
)))
if
((
error
=
my_
regcomp
(
&
preg
,
res
->
c_ptr
(),
((
cmp_collation
.
collation
->
state
&
(
MY_CS_BINSORT
|
MY_CS_CSSORT
))
?
REG_EXTENDED
|
REG_NOSUB
:
REG_EXTENDED
|
REG_NOSUB
|
REG_ICASE
),
cmp_collation
.
collation
)))
{
(
void
)
regerror
(
error
,
&
preg
,
buff
,
sizeof
(
buff
));
(
void
)
my_
regerror
(
error
,
&
preg
,
buff
,
sizeof
(
buff
));
my_error
(
ER_REGEXP_ERROR
,
MYF
(
0
),
buff
);
return
TRUE
;
}
...
...
@@ -3121,15 +3121,15 @@ longlong Item_func_regex::val_int()
prev_regexp
.
copy
(
*
res2
);
if
(
regex_compiled
)
{
regfree
(
&
preg
);
my_
regfree
(
&
preg
);
regex_compiled
=
0
;
}
if
(
regcomp
(
&
preg
,
res2
->
c_ptr_safe
(),
((
cmp_collation
.
collation
->
state
&
(
MY_CS_BINSORT
|
MY_CS_CSSORT
))
?
REG_EXTENDED
|
REG_NOSUB
:
REG_EXTENDED
|
REG_NOSUB
|
REG_ICASE
),
cmp_collation
.
collation
))
if
(
my_
regcomp
(
&
preg
,
res2
->
c_ptr_safe
(),
((
cmp_collation
.
collation
->
state
&
(
MY_CS_BINSORT
|
MY_CS_CSSORT
))
?
REG_EXTENDED
|
REG_NOSUB
:
REG_EXTENDED
|
REG_NOSUB
|
REG_ICASE
),
cmp_collation
.
collation
))
{
null_value
=
1
;
return
0
;
...
...
@@ -3138,7 +3138,7 @@ longlong Item_func_regex::val_int()
}
}
null_value
=
0
;
return
regexec
(
&
preg
,
res
->
c_ptr
(),
0
,(
regmatch_t
*
)
0
,
0
)
?
0
:
1
;
return
my_regexec
(
&
preg
,
res
->
c_ptr
(),
0
,(
my_
regmatch_t
*
)
0
,
0
)
?
0
:
1
;
}
...
...
@@ -3148,7 +3148,7 @@ void Item_func_regex::cleanup()
Item_bool_func
::
cleanup
();
if
(
regex_compiled
)
{
regfree
(
&
preg
);
my_
regfree
(
&
preg
);
regex_compiled
=
0
;
}
DBUG_VOID_RETURN
;
...
...
sql/item_cmpfunc.h
View file @
656b0cc1
...
...
@@ -1002,11 +1002,11 @@ class Item_func_like :public Item_bool_func2
#ifdef USE_REGEX
#include
<regex.h>
#include
"my_regex.h"
class
Item_func_regex
:
public
Item_bool_func
{
regex_t
preg
;
my_
regex_t
preg
;
bool
regex_compiled
;
bool
regex_is_const
;
String
prev_regexp
;
...
...
sql/mysqld.cc
View file @
656b0cc1
...
...
@@ -1098,7 +1098,7 @@ void clean_up(bool print_message)
my_free
((
gptr
)
ssl_acceptor_fd
,
MYF
(
MY_ALLOW_ZERO_PTR
));
#endif
/* HAVE_OPENSSL */
#ifdef USE_REGEX
regex_end
();
my_
regex_end
();
#endif
if
(
print_message
&&
errmesg
)
...
...
@@ -2605,7 +2605,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
set_var_init
();
mysys_uses_curses
=
0
;
#ifdef USE_REGEX
regex_init
(
&
my_charset_latin1
);
my_
regex_init
(
&
my_charset_latin1
);
#endif
if
(
!
(
default_charset_info
=
get_charset_by_csname
(
default_character_set_name
,
MY_CS_PRIMARY
,
...
...
@@ -6219,7 +6219,7 @@ static void mysql_init_variables(void)
#else
have_openssl
=
SHOW_OPTION_NO
;
#endif
#if
def HAVE_BROKEN_REALPATH
#if
!defined(HAVE_REALPATH) || defined(HAVE_BROKEN_REALPATH)
have_symlink
=
SHOW_OPTION_NO
;
#else
have_symlink
=
SHOW_OPTION_YES
;
...
...
@@ -6916,7 +6916,7 @@ static void get_options(int argc,char **argv)
usage
();
exit
(
0
);
}
#if defined(HAVE_BROKEN_REALPATH)
#if
!defined(HAVE_REALPATH) ||
defined(HAVE_BROKEN_REALPATH)
my_use_symdir
=
0
;
my_disable_symlinks
=
1
;
have_symlink
=
SHOW_OPTION_NO
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment