diff options
author | 2013-04-17 17:39:29 +0000 | |
---|---|---|
committer | 2013-04-17 17:39:29 +0000 | |
commit | 2be36617bb6be3f60e44cb636fdb1fa78531d399 (patch) | |
tree | 368c866377d5c958c50b0fc4fe319d8dbdeb6f92 /lib/libc | |
parent | pretty (diff) | |
download | wireguard-openbsd-2be36617bb6be3f60e44cb636fdb1fa78531d399.tar.xz wireguard-openbsd-2be36617bb6be3f60e44cb636fdb1fa78531d399.zip |
silence some warnings by adding prototypes, casts, and headers as
appropriate. in regex, stop using the struct hack for a fixed size array
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/regex/engine.c | 3 | ||||
-rw-r--r-- | lib/libc/regex/regcomp.c | 7 | ||||
-rw-r--r-- | lib/libc/regex/regex2.h | 4 | ||||
-rw-r--r-- | lib/libc/regex/regexec.c | 8 | ||||
-rw-r--r-- | lib/libc/regex/regfree.c | 3 |
5 files changed, 14 insertions, 11 deletions
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index 024c4ea3844..3f3a68d7af1 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.15 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.16 2013/04/17 17:39:29 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. @@ -662,6 +662,7 @@ backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, /* "can't happen" */ assert(nope); /* NOTREACHED */ + return NULL; } /* diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index bcca6aafb8f..b8e5853ec34 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regcomp.c,v 1.21 2011/11/07 09:58:27 otto Exp $ */ +/* $OpenBSD: regcomp.c,v 1.22 2013/04/17 17:39:29 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -171,8 +171,7 @@ regcomp(regex_t *preg, const char *pattern, int cflags) len = strlen((char *)pattern); /* do the mallocs early so failure handling is easy */ - g = (struct re_guts *)malloc(sizeof(struct re_guts) + - (NC-1)*sizeof(cat_t)); + g = (struct re_guts *)malloc(sizeof(struct re_guts)); if (g == NULL) return(REG_ESPACE); p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */ @@ -206,7 +205,7 @@ regcomp(regex_t *preg, const char *pattern, int cflags) g->nsub = 0; g->ncategories = 1; /* category 0 is "everything else" */ g->categories = &g->catspace[-(CHAR_MIN)]; - (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t)); + memset(g->catspace, 0, sizeof(g->catspace)); g->backrefs = 0; /* do it */ diff --git a/lib/libc/regex/regex2.h b/lib/libc/regex/regex2.h index 15e15bc924d..7484ba26b5a 100644 --- a/lib/libc/regex/regex2.h +++ b/lib/libc/regex/regex2.h @@ -1,4 +1,4 @@ -/* $OpenBSD: regex2.h,v 1.7 2004/11/30 17:04:23 otto Exp $ */ +/* $OpenBSD: regex2.h,v 1.8 2013/04/17 17:39:29 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. @@ -149,7 +149,7 @@ struct re_guts { int backrefs; /* does it use back references? */ sopno nplus; /* how deep does it nest +s? */ /* catspace must be last */ - cat_t catspace[1]; /* actually [NC] */ + cat_t catspace[NC]; /* actually [NC] */ }; /* misc utilities */ diff --git a/lib/libc/regex/regexec.c b/lib/libc/regex/regexec.c index 7b3bfc7a0b1..5e986f34c3c 100644 --- a/lib/libc/regex/regexec.c +++ b/lib/libc/regex/regexec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regexec.c,v 1.11 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: regexec.c,v 1.12 2013/04/17 17:39:29 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -140,6 +140,8 @@ regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { struct re_guts *g = preg->re_g; + char *s = (char *)string; /* XXX fucking gcc XXX */ + #ifdef REDEBUG # define GOODFLAGS(f) (f) #else @@ -154,7 +156,7 @@ regexec(const regex_t *preg, const char *string, size_t nmatch, eflags = GOODFLAGS(eflags); if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) - return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); + return(smatcher(g, s, nmatch, pmatch, eflags)); else - return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); + return(lmatcher(g, s, nmatch, pmatch, eflags)); } diff --git a/lib/libc/regex/regfree.c b/lib/libc/regex/regfree.c index a57eba3c1f0..42506cec7fc 100644 --- a/lib/libc/regex/regfree.c +++ b/lib/libc/regex/regfree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: regfree.c,v 1.7 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: regfree.c,v 1.8 2013/04/17 17:39:29 tedu Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -38,6 +38,7 @@ #include <stdio.h> #include <stdlib.h> #include <regex.h> +#include <limits.h> #include "utils.h" #include "regex2.h" |