summaryrefslogtreecommitdiffstats
path: root/lib/libc/regex/regcomp.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-04-17 17:39:29 +0000
committertedu <tedu@openbsd.org>2013-04-17 17:39:29 +0000
commit2be36617bb6be3f60e44cb636fdb1fa78531d399 (patch)
tree368c866377d5c958c50b0fc4fe319d8dbdeb6f92 /lib/libc/regex/regcomp.c
parentpretty (diff)
downloadwireguard-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/regex/regcomp.c')
-rw-r--r--lib/libc/regex/regcomp.c7
1 files changed, 3 insertions, 4 deletions
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 */