~akopytov/percona-xtrabackup/bug1210266-2.1

244.4.1 by Alexey Kopytov
Added initial support for Windows builds:
1
/******************************************************
391.64.6 by Alexey Kopytov
s/Percona Inc/Percona Ireland Ltd/g
2
Copyright (c) 2011-2012 Percona Ireland Ltd.
244.4.1 by Alexey Kopytov
Added initial support for Windows builds:
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
7
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
GNU General Public License for more details.
12
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17
*******************************************************/
18
19
/* This file is required to abstract away regex(3) calls so that
20
my_regex is used on Windows and native calls are used on POSIX platforms. */
21
22
#ifndef XB_REGEX_H
23
#define XB_REGEX_H
24
25
#ifdef _WIN32
26
27
#include <my_regex.h>
28
29
typedef my_regex_t xb_regex_t;
30
typedef my_regmatch_t xb_regmatch_t;
31
32
#define xb_regex_init() my_regex_init(&my_charset_latin1)
33
34
#define xb_regexec(preg,string,nmatch,pmatch,eflags) \
35
	my_regexec(preg, string, nmatch, pmatch, eflags)
36
37
#define xb_regerror(errcode,preg,errbuf,errbuf_size) \
38
	my_regerror(errcode, preg, errbuf, errbuf_size)
39
40
#define xb_regcomp(preg,regex,cflags) \
41
	my_regcomp(preg, regex, cflags, &my_charset_latin1)
42
43
#define xb_regfree(preg) my_regfree(preg)
44
45
#define xb_regex_end() my_regex_end()
46
47
#else /* ! _WIN32 */
48
49
#include <regex.h>
50
51
typedef regex_t xb_regex_t;
52
typedef regmatch_t xb_regmatch_t;
53
54
#define xb_regex_init() do { } while(0)
55
56
#define xb_regexec(preg,string,nmatch,pmatch,eflags)	\
57
	regexec(preg, string, nmatch, pmatch, eflags)
58
59
#define xb_regerror(errcode,preg,errbuf,errbuf_size)	\
60
	regerror(errcode, preg, errbuf, errbuf_size)
61
62
#define xb_regcomp(preg,regex,cflags)				\
63
	regcomp(preg, regex, cflags)
64
65
#define xb_regfree(preg) regfree(preg)
66
67
#define xb_regex_end() do { } while (0)
68
69
#endif /* _WIN32 */
70
71
#endif /* XB_REGEX_H */