commit be6639289c38a69b5edbb4d40d0bc3c56360379c
parent b7e6671371e489fb6607f9ab883ddeb03895e51d
Author: tedu <tedu>
Date: Wed, 5 Oct 2016 17:36:53 +0000
as a result of the env rework, arraylen() is only used in parse.y. move it there and make it static.
Diffstat:
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/doas.c b/doas.c
@@ -55,20 +55,6 @@ usage(void)
exit(1);
}
-size_t
-arraylen(const char **arr)
-{
- size_t cnt = 0;
-
- if (arr) {
- while (*arr) {
- cnt++;
- arr++;
- }
- }
- return cnt;
-}
-
static int
parseuid(const char *s, uid_t *uid)
{
diff --git a/doas.h b/doas.h
@@ -29,8 +29,6 @@ extern struct rule **rules;
extern int nrules;
extern int parse_errors;
-size_t arraylen(const char **);
-
char **prepenv(struct rule *);
int yyparse(void);
diff --git a/parse.y b/parse.y
@@ -58,6 +58,18 @@ static int obsolete_warned = 0;
static void yyerror(const char *, ...);
static int yylex(void);
+static size_t
+arraylen(const char **arr)
+{
+ size_t cnt = 0;
+
+ while (*arr) {
+ cnt++;
+ arr++;
+ }
+ return cnt;
+}
+
%}
%token TPERMIT TDENY TAS TCMD TARGS