changeset 40650:ded4aa3c81b2

(re_wctype): Try to fix some warnings. (regcomp, regexec): Don't forget the __restrict.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 02 Nov 2001 16:06:54 +0000
parents 9ceb55408927
children 96973a484b73
files src/regex.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/regex.c	Fri Nov 02 07:14:24 2001 +0000
+++ b/src/regex.c	Fri Nov 02 16:06:54 2001 +0000
@@ -1327,7 +1327,8 @@
 /* Roughly the maximum number of failure points on the stack.  Would be
    exactly that if always used TYPICAL_FAILURE_SIZE items each time we failed.
    This is a variable only so users of regex can assign to it; we never
-   change it ourselves.  */
+   change it ourselves.  We always multiply it by TYPICAL_FAILURE_SIZE
+   before using it, so it should probably be a byte-count instead.  */
 # if defined MATCH_MAY_ALLOCATE
 /* Note that 4400 was enough to cause a crash on Alpha OSF/1,
    whose default stack limit is 2mb.  In order for a larger
@@ -1579,7 +1580,7 @@
 /* Estimate the size of data pushed by a typical failure stack entry.
    An estimate is all we need, because all we use this for
    is to choose a limit for how big to make the failure stack.  */
-
+/* BEWARE, the value `20' is hard-coded in emacs.c:main().  */
 #define TYPICAL_FAILURE_SIZE 20
 
 /* How many items can still be added to the stack without overflowing it.  */
@@ -1966,9 +1967,10 @@
 
 /* Map a string to the char class it names (if any).  */
 static re_wctype_t
-re_wctype (string)
-     re_char *string;
+re_wctype (str)
+     re_char *str;
 {
+  const char *string = str;
   if      (STREQ (string, "alnum"))	return RECC_ALNUM;
   else if (STREQ (string, "alpha"))	return RECC_ALPHA;
   else if (STREQ (string, "word"))	return RECC_WORD;
@@ -5837,8 +5839,8 @@
 
 int
 regcomp (preg, pattern, cflags)
-    regex_t *preg;
-    const char *pattern;
+    regex_t *__restrict preg;
+    const char *__restrict pattern;
     int cflags;
 {
   reg_errcode_t ret;
@@ -5922,8 +5924,8 @@
 
 int
 regexec (preg, string, nmatch, pmatch, eflags)
-    const regex_t *preg;
-    const char *string;
+    const regex_t *__restrict preg;
+    const char *__restrict string;
     size_t nmatch;
     regmatch_t pmatch[];
     int eflags;