aboutsummaryrefslogtreecommitdiffstats
path: root/src/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c48
1 files changed, 13 insertions, 35 deletions
diff --git a/src/regex.c b/src/regex.c
index 17158552a95..31f188efa99 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -196,18 +196,14 @@
196 even if config.h says that we can. */ 196 even if config.h says that we can. */
197# undef REL_ALLOC 197# undef REL_ALLOC
198 198
199# if defined STDC_HEADERS || defined _LIBC 199# ifdef HAVE_UNISTD_H
200# include <stdlib.h> 200# include <unistd.h>
201# else
202char *malloc ();
203char *realloc ();
204# endif 201# endif
205 202
206/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ 203/* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
207 204
208void * 205void *
209xmalloc (size) 206xmalloc (size_t size)
210 size_t size;
211{ 207{
212 register void *val; 208 register void *val;
213 val = (void *) malloc (size); 209 val = (void *) malloc (size);
@@ -220,9 +216,7 @@ xmalloc (size)
220} 216}
221 217
222void * 218void *
223xrealloc (block, size) 219xrealloc (void *block, size_t size)
224 void *block;
225 size_t size;
226{ 220{
227 register void *val; 221 register void *val;
228 /* We must call malloc explicitly when BLOCK is 0, since some 222 /* We must call malloc explicitly when BLOCK is 0, since some
@@ -435,7 +429,7 @@ extern char *re_syntax_table;
435static char re_syntax_table[CHAR_SET_SIZE]; 429static char re_syntax_table[CHAR_SET_SIZE];
436 430
437static void 431static void
438init_syntax_once () 432init_syntax_once (void)
439{ 433{
440 register int c; 434 register int c;
441 static int done = 0; 435 static int done = 0;
@@ -4978,11 +4972,8 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r
4978/* re_match is like re_match_2 except it takes only a single string. */ 4972/* re_match is like re_match_2 except it takes only a single string. */
4979 4973
4980int 4974int
4981re_match (bufp, string, size, pos, regs) 4975re_match (struct re_pattern_buffer *bufp, const char *string,
4982 struct re_pattern_buffer *bufp; 4976 int size, int pos, struct re_registers *regs)
4983 const char *string;
4984 int size, pos;
4985 struct re_registers *regs;
4986{ 4977{
4987 int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, 4978 int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size,
4988 pos, regs, size); 4979 pos, regs, size);
@@ -6534,10 +6525,8 @@ re_exec (s)
6534 the return codes and their meanings.) */ 6525 the return codes and their meanings.) */
6535 6526
6536int 6527int
6537regcomp (preg, pattern, cflags) 6528regcomp (regex_t *__restrict preg, const char *__restrict pattern,
6538 regex_t *__restrict preg; 6529 int cflags)
6539 const char *__restrict pattern;
6540 int cflags;
6541{ 6530{
6542 reg_errcode_t ret; 6531 reg_errcode_t ret;
6543 reg_syntax_t syntax 6532 reg_syntax_t syntax
@@ -6619,12 +6608,8 @@ WEAK_ALIAS (__regcomp, regcomp)
6619 We return 0 if we find a match and REG_NOMATCH if not. */ 6608 We return 0 if we find a match and REG_NOMATCH if not. */
6620 6609
6621int 6610int
6622regexec (preg, string, nmatch, pmatch, eflags) 6611regexec (const regex_t *__restrict preg, const char *__restrict string,
6623 const regex_t *__restrict preg; 6612 size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags)
6624 const char *__restrict string;
6625 size_t nmatch;
6626 regmatch_t pmatch[__restrict_arr];
6627 int eflags;
6628{ 6613{
6629 int ret; 6614 int ret;
6630 struct re_registers regs; 6615 struct re_registers regs;
@@ -6696,11 +6681,7 @@ WEAK_ALIAS (__regexec, regexec)
6696 error with msvc8 compiler. */ 6681 error with msvc8 compiler. */
6697 6682
6698size_t 6683size_t
6699regerror (err_code, preg, errbuf, errbuf_size) 6684regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size)
6700 int err_code;
6701 const regex_t *preg;
6702 char *errbuf;
6703 size_t errbuf_size;
6704{ 6685{
6705 const char *msg; 6686 const char *msg;
6706 size_t msg_size; 6687 size_t msg_size;
@@ -6736,8 +6717,7 @@ WEAK_ALIAS (__regerror, regerror)
6736/* Free dynamically allocated space used by PREG. */ 6717/* Free dynamically allocated space used by PREG. */
6737 6718
6738void 6719void
6739regfree (preg) 6720regfree (regex_t *preg)
6740 regex_t *preg;
6741{ 6721{
6742 free (preg->buffer); 6722 free (preg->buffer);
6743 preg->buffer = NULL; 6723 preg->buffer = NULL;
@@ -6756,5 +6736,3 @@ WEAK_ALIAS (__regfree, regfree)
6756 6736
6757#endif /* not emacs */ 6737#endif /* not emacs */
6758 6738
6759/* arch-tag: 4ffd68ba-2a9e-435b-a21a-018990f9eeb2
6760 (do not change this comment) */