[master] ad57d5f Minor nits spotted by PC-Lint-Plus test version

Poul-Henning Kamp phk at FreeBSD.org
Wed Aug 30 09:12:06 CEST 2017


commit ad57d5f87df99068ecaffa7b3608403548486ffe
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 30 07:10:57 2017 +0000

    Minor nits spotted by PC-Lint-Plus test version

diff --git a/bin/varnishd/mgt/mgt_param.h b/bin/varnishd/mgt/mgt_param.h
index 855ba58..f4362ca 100644
--- a/bin/varnishd/mgt/mgt_param.h
+++ b/bin/varnishd/mgt/mgt_param.h
@@ -62,7 +62,6 @@ tweak_t tweak_poolparam;
 tweak_t tweak_string;
 tweak_t tweak_timeout;
 tweak_t tweak_uint;
-tweak_t tweak_waiter;
 tweak_t tweak_vsl_buffer;
 tweak_t tweak_vsl_reclen;
 
diff --git a/bin/varnishd/storage/storage_persistent.h b/bin/varnishd/storage/storage_persistent.h
index f7af273..0383567 100644
--- a/bin/varnishd/storage/storage_persistent.h
+++ b/bin/varnishd/storage/storage_persistent.h
@@ -274,9 +274,7 @@ struct smp_sc {
 /*--------------------------------------------------------------------*/
 
 /* Pointer round up/down & assert */
-#define PRNDN(sc, x)	((void*)RDN2((uintptr_t)(x), sc->align))
 #define PRNUP(sc, x)	((void*)RUP2((uintptr_t)(x), sc->align))
-#define PASSERTALIGN(sc, x)	assert(PRNDN(sc, x) == (x))
 
 /* Integer round up/down & assert */
 #define IRNDN(sc, x)	RDN2(x, sc->align)
@@ -319,19 +317,14 @@ obj_event_f smp_oc_event;
 void smp_def_sign(const struct smp_sc *sc, struct smp_signctx *ctx,
     uint64_t off, const char *id);
 int smp_chk_sign(struct smp_signctx *ctx);
-void smp_append_sign(struct smp_signctx *ctx, const void *ptr, uint32_t len);
 void smp_reset_sign(struct smp_signctx *ctx);
 void smp_sync_sign(const struct smp_signctx *ctx);
 
-void smp_def_signspace(const struct smp_sc *sc, struct smp_signspace *spc,
-		       uint64_t off, uint64_t size, const char *id);
 int smp_chk_signspace(struct smp_signspace *spc);
 void smp_append_signspace(struct smp_signspace *spc, uint32_t len);
 void smp_reset_signspace(struct smp_signspace *spc);
 void smp_copy_signspace(struct smp_signspace *dst,
 			const struct smp_signspace *src);
-void smp_trunc_signspace(struct smp_signspace *spc, uint32_t len);
-void smp_msync(void *addr, size_t length);
 
 void smp_newsilo(struct smp_sc *sc);
 int smp_valid_silo(struct smp_sc *sc);
diff --git a/bin/varnishd/storage/storage_persistent_subr.c b/bin/varnishd/storage/storage_persistent_subr.c
index 25f0af6..767e4cc 100644
--- a/bin/varnishd/storage/storage_persistent_subr.c
+++ b/bin/varnishd/storage/storage_persistent_subr.c
@@ -49,6 +49,8 @@
 
 #include "storage/storage_persistent.h"
 
+static void smp_msync(void *addr, size_t length);
+
 /*--------------------------------------------------------------------
  * SIGNATURE functions
  * The signature is SHA256 over:
@@ -114,7 +116,7 @@ smp_chk_sign(struct smp_signctx *ctx)
 /*--------------------------------------------------------------------
  * Append data to a signature
  */
-void
+static void
 smp_append_sign(struct smp_signctx *ctx, const void *ptr, uint32_t len)
 {
 	struct SHA256Context cx;
@@ -176,7 +178,7 @@ smp_new_sign(const struct smp_sc *sc, struct smp_signctx *ctx,
  * Define a signature space by location, size and identifier
  */
 
-void
+static void
 smp_def_signspace(const struct smp_sc *sc, struct smp_signspace *spc,
 		  uint64_t off, uint64_t size, const char *id)
 {
@@ -233,22 +235,6 @@ smp_copy_signspace(struct smp_signspace *dst, const struct smp_signspace *src)
 }
 
 /*--------------------------------------------------------------------
- * Reapplies the sign over the len first bytes of the
- * signspace. Prepares for appending.
- */
-
-void
-smp_trunc_signspace(struct smp_signspace *spc, uint32_t len)
-{
-	assert(len <= SIGNSPACE_LEN(spc));
-	spc->ctx.ss->length = 0;
-	SHA256_Init(&spc->ctx.ctx);
-	SHA256_Update(&spc->ctx.ctx, spc->ctx.ss,
-		      offsetof(struct smp_sign, length));
-	smp_append_signspace(spc, len);
-}
-
-/*--------------------------------------------------------------------
  * Create a new signature space and force the signature to backing store.
  */
 
@@ -266,7 +252,7 @@ smp_new_signspace(const struct smp_sc *sc, struct smp_signspace *spc,
  * the backing store.
  */
 
-void
+static void
 smp_msync(void *addr, size_t length)
 {
 	uintptr_t start, end, pagesize;
diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index b33b55e..27afddc 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -134,8 +134,8 @@ static void
 update(void)
 {
 	char t[VTIM_FORMAT_SIZE];
-	unsigned w = COLS / hist_range;
-	unsigned n = w * hist_range;
+	const unsigned w = COLS / hist_range;
+	const unsigned n = w * hist_range;
 	unsigned bm[n], bh[n];
 	unsigned max;
 	unsigned i, j, scale;
@@ -176,14 +176,14 @@ update(void)
 	if (vsl_t0 > 0) {
 		VTIM_format(vsl_ts, t);
 
-		mvprintw(0, 0, "1:%d, n = %d, d = %g @ %s x %g",
+		mvprintw(0, 0, "1:%u, n = %u, d = %g @ %s x %g",
 		    scale, nhist, delay, t, timebend);
 	} else
-		mvprintw(0, 0, "1:%d, n = %d, d = %g",
+		mvprintw(0, 0, "1:%u, n = %u, d = %g",
 		    scale, nhist, delay);
 
 	for (j = 2; j < LINES - 3; j += 5)
-		mvprintw(j, 0, "%d_", (LINES - 3 - j) * scale);
+		mvprintw(j, 0, "%u_", (LINES - 3 - j) * scale);
 
 	/* show them */
 	for (i = 0; i < n; ++i) {
@@ -215,7 +215,7 @@ upd_vsl_ts(const char *p)
 		vsl_ts = t;
 }
 
-static int /*__match_proto__ (VSLQ_dispatch_f)*/
+static int __match_proto__ (VSLQ_dispatch_f)
 accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
     void *priv)
 {
@@ -371,7 +371,7 @@ sighup(void)
 	return (1);
 }
 
-static void *
+static void * __match_proto__(pthread_t)
 do_curses(void *arg)
 {
 	int ch;



More information about the varnish-commit mailing list