From be6639289c38a69b5edbb4d40d0bc3c56360379c Mon Sep 17 00:00:00 2001 From: tedu Date: Wed, 5 Oct 2016 17:36:53 +0000 Subject: [PATCH] as a result of the env rework, arraylen() is only used in parse.y. move it there and make it static. --- doas.c | 14 -------------- doas.h | 2 -- parse.y | 12 ++++++++++++ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/doas.c b/doas.c index 7feaafc..6c1b14d 100644 --- 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 index 5de73cc..0f96d1e 100644 --- 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 index 5e77679..e89fb1c 100644 --- 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 -- 2.39.2