(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / posix / regex.c
blob7a4f304cddc586157ba60e4cfc54d63f5c4f40e0
1 /* Extended regular expression matching and search library.
2 Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifdef HAVE_CONFIG_H
22 #include "config.h"
23 #endif
25 #ifdef _AIX
26 #pragma alloca
27 #else
28 # ifndef allocax /* predefined by HP cc +Olibcalls */
29 # ifdef __GNUC__
30 # define alloca(size) __builtin_alloca (size)
31 # else
32 # if HAVE_ALLOCA_H
33 # include <alloca.h>
34 # else
35 # ifdef __hpux
36 void *alloca ();
37 # else
38 # if !defined __OS2__ && !defined WIN32
39 char *alloca ();
40 # else
41 # include <malloc.h> /* OS/2 defines alloca in here */
42 # endif
43 # endif
44 # endif
45 # endif
46 # endif
47 #endif
49 #ifdef _LIBC
50 /* We have to keep the namespace clean. */
51 # define regfree(preg) __regfree (preg)
52 # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
53 # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
54 # define regerror(errcode, preg, errbuf, errbuf_size) \
55 __regerror(errcode, preg, errbuf, errbuf_size)
56 # define re_set_registers(bu, re, nu, st, en) \
57 __re_set_registers (bu, re, nu, st, en)
58 # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
59 __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
60 # define re_match(bufp, string, size, pos, regs) \
61 __re_match (bufp, string, size, pos, regs)
62 # define re_search(bufp, string, size, startpos, range, regs) \
63 __re_search (bufp, string, size, startpos, range, regs)
64 # define re_compile_pattern(pattern, length, bufp) \
65 __re_compile_pattern (pattern, length, bufp)
66 # define re_set_syntax(syntax) __re_set_syntax (syntax)
67 # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
68 __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
69 # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
71 # include "../locale/localeinfo.h"
72 #endif
74 /* POSIX says that <sys/types.h> must be included (by the caller) before
75 <regex.h>. */
76 #include <sys/types.h>
78 /* On some systems, limits.h sets RE_DUP_MAX to a lower value than
79 GNU regex allows. Include it before <regex.h>, which correctly
80 #undefs RE_DUP_MAX and sets it to the right value. */
81 #include <limits.h>
83 #include <regex.h>
84 #include "regex_internal.h"
86 #include "regex_internal.c"
87 #include "regcomp.c"
88 #include "regexec.c"
90 /* Binary backward compatibility. */
91 #if _LIBC
92 # include <shlib-compat.h>
93 # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
94 link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
95 int re_max_failures = 2000;
96 # endif
97 #endif