[master] c5d0a9559 FlexeLinting: 'oper' is an incredibly bad global name.

Poul-Henning Kamp phk at FreeBSD.org
Tue Aug 6 09:15:11 UTC 2019


commit c5d0a9559835c639ceef54d8c6a99834ebbefe74
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Aug 6 08:16:56 2019 +0000

    FlexeLinting: 'oper' is an incredibly bad global name.

diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 16e9351d7..dc4751d2c 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -70,8 +70,6 @@ static const char * const arg_name[BAN_ARGARRSZ + 1] = {
 	[BAN_ARGARRSZ] = NULL
 };
 
-extern const char * const oper[BAN_OPERARRSZ + 1];
-
 /*--------------------------------------------------------------------
  * Storage handling of bans
  */
@@ -806,7 +804,7 @@ ban_render(struct cli *cli, const uint8_t *bs, int quote)
 		else
 			VCLI_Out(cli, "%s", arg_name[BAN_ARGIDX(bt.arg1)]);
 
-		VCLI_Out(cli, " %s ", oper[BAN_OPERIDX(bt.oper)]);
+		VCLI_Out(cli, " %s ", ban_oper[BAN_OPERIDX(bt.oper)]);
 
 		if (BANS_HAS_ARG2_DOUBLE(bt.arg1)) {
 			vdur_render(buf, bt.arg2_double);
diff --git a/bin/varnishd/cache/cache_ban.h b/bin/varnishd/cache/cache_ban.h
index c4d04fa23..cd82aad38 100644
--- a/bin/varnishd/cache/cache_ban.h
+++ b/bin/varnishd/cache/cache_ban.h
@@ -145,6 +145,7 @@ extern struct ban * volatile ban_start;
 extern pthread_cond_t	ban_lurker_cond;
 extern uint64_t bans_persisted_bytes;
 extern uint64_t bans_persisted_fragmentation;
+extern const char * const ban_oper[BAN_OPERARRSZ + 1];
 
 void ban_mark_completed(struct ban *);
 unsigned ban_len(const uint8_t *banspec);
diff --git a/bin/varnishd/cache/cache_ban_build.c b/bin/varnishd/cache/cache_ban_build.c
index 228d18c4b..4c08fd639 100644
--- a/bin/varnishd/cache/cache_ban_build.c
+++ b/bin/varnishd/cache/cache_ban_build.c
@@ -76,7 +76,7 @@ static const unsigned arg_opervalid[BAN_ARGARRSZ + 1] = {
 static const char *arg_operhelp[BAN_ARGARRSZ + 1];
 
 // operators
-const char * const oper[BAN_OPERARRSZ + 1] = {
+const char * const ban_oper[BAN_OPERARRSZ + 1] = {
 #define OPER(op, str) [BAN_OPERIDX(op)] = (str),
 #include "tbl/ban_oper.h"
 	[BAN_OPERARRSZ] = NULL
@@ -205,7 +205,7 @@ ban_parse_oper(const char *p)
 	int i;
 
 	for (i = 0; i < BAN_OPERARRSZ; i++) {
-		if (!strcmp(p, oper[i]))
+		if (!strcmp(p, ban_oper[i]))
 			return (_BANS_OPER_OFF + i);
 	}
 	return (-1);
@@ -396,14 +396,14 @@ ban_build_arg_operhelp(struct vsb *vsb, int arg)
 		if ((mask & (1U << i)) == 0)
 			continue;
 		if (p == NULL)
-			p = oper[i];
+			p = ban_oper[i];
 		else if (n == NULL)
-			n = oper[i];
+			n = ban_oper[i];
 		else {
 			VSB_cat(vsb, p);
 			VSB_cat(vsb, ", ");
 			p = n;
-			n = oper[i];
+			n = ban_oper[i];
 		}
 	}
 


More information about the varnish-commit mailing list