]> git.saurik.com Git - apple/libc.git/blobdiff - regex/FreeBSD/regerror.c
Libc-1439.100.3.tar.gz
[apple/libc.git] / regex / FreeBSD / regerror.c
index 4e43f3dd5045b6f299b176f2a9347d3366f1b300..a22066c6e4c4102f129e6a165a561dc5663f9370 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -41,7 +37,7 @@
 static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.9 2004/07/12 06:07:26 tjr Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.11 2007/06/11 03:05:54 delphij Exp $");
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -85,10 +81,10 @@ static char *regatoi(const regex_t *preg, char *localbuf);
  = #define     REG_ATOI        255     // convert name to number (!)
  = #define     REG_ITOA        0400    // convert number to name (!)
  */
-static struct rerr {
+static const struct rerr {
        int code;
-       char *name;
-       char *explain;
+       const char *name;
+       const char *explain;
 } rerrs[] = {
        {REG_NOMATCH,   "REG_NOMATCH",  "regexec() failed to match"},
        {REG_BADPAT,    "REG_BADPAT",   "invalid regular expression"},
@@ -116,16 +112,15 @@ static struct rerr {
  */
 /* ARGSUSED */
 size_t
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t * __restrict preg;
-char * __restrict errbuf;
-size_t errbuf_size;
+regerror(int errcode,
+        const regex_t * __restrict preg,
+        char * __restrict errbuf,
+        size_t errbuf_size)
 {
-       struct rerr *r;
+       const struct rerr *r;
        size_t len;
        int target = errcode &~ REG_ITOA;
-       char *s;
+       const char *s;
        char convbuf[50];
 
        if (errcode == REG_ATOI)
@@ -164,11 +159,9 @@ size_t errbuf_size;
  == static char *regatoi(const regex_t *preg, char *localbuf);
  */
 static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
+regatoi(const regex_t *preg, char *localbuf)
 {
-       struct rerr *r;
+       const struct rerr *r;
 
        for (r = rerrs; r->code != 0; r++)
                if (strcmp(r->name, preg->re_endp) == 0)