Index | Thread | Search

From:
Walter Alejandro Iglesias <wai@roquesor.com>
Subject:
vi(1), removing unused variables
To:
tech@openbsd.org
Date:
Mon, 20 Apr 2026 09:33:47 +0200

Download raw body.

Thread
I'm tired of seeing those warning messages each time I compile.


Index: cl/cl_funcs.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/cl/cl_funcs.c,v
diff -u -p -u -p -r1.23 cl_funcs.c
--- cl/cl_funcs.c	26 Dec 2022 19:16:03 -0000	1.23
+++ cl/cl_funcs.c	13 Apr 2026 11:20:13 -0000
@@ -429,10 +429,6 @@ cl_move(SCR *sp, size_t lno, size_t cno)
 int
 cl_refresh(SCR *sp, int repaint)
 {
-	CL_PRIVATE *clp;
-
-	clp = CLP(sp);
-
 	/*
 	 * If we received a killer signal, we're done, there's no point
 	 * in refreshing the screen.
Index: common/recover.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/recover.c,v
diff -u -p -u -p -r1.32 recover.c
--- common/recover.c	20 Feb 2022 19:45:51 -0000	1.32
+++ common/recover.c	13 Apr 2026 11:20:13 -0000
@@ -317,7 +317,6 @@ static int
 rcv_mailfile(SCR *sp, int issync, char *cp_path)
 {
 	EXF *ep;
-	GS *gp;
 	struct passwd *pw;
 	size_t len;
 	time_t now;
@@ -327,7 +326,6 @@ rcv_mailfile(SCR *sp, int issync, char *
 	char *t1, *t2, *t3;
 	char host[HOST_NAME_MAX+1];
 
-	gp = sp->gp;
 	if ((pw = getpwuid(uid = getuid())) == NULL) {
 		msgq(sp, M_ERR,
 		    "Information on user id %u not found", uid);
Index: ex/ex_append.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_append.c,v
diff -u -p -u -p -r1.14 ex_append.c
--- ex/ex_append.c	27 May 2016 09:18:12 -0000	1.14
+++ ex/ex_append.c	13 Apr 2026 11:20:13 -0000
@@ -75,7 +75,7 @@ ex_aci(SCR *sp, EXCMD *cmdp, enum which 
 	GS *gp;
 	TEXT *tp;
 	TEXTH tiq;
-	recno_t cnt, lno;
+	recno_t lno;
 	size_t len;
 	u_int32_t flags;
 	int need_newline;
@@ -247,12 +247,9 @@ ex_aci(SCR *sp, EXCMD *cmdp, enum which 
 	if (ex_txt(sp, &tiq, 0, flags))
 		return (1);
 
-	cnt = 0;
-	TAILQ_FOREACH(tp, &tiq, q) {
+	TAILQ_FOREACH(tp, &tiq, q)
 		if (db_append(sp, 1, lno++, tp->lb, tp->len))
 			return (1);
-		cnt++;
-	}
 
 	/*
 	 * Set sp->lno to the final line number value (correcting for a
Index: ex/ex_bang.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_bang.c,v
diff -u -p -u -p -r1.13 ex_bang.c
--- ex/ex_bang.c	30 Jul 2025 22:19:13 -0000	1.13
+++ ex/ex_bang.c	13 Apr 2026 11:20:13 -0000
@@ -52,7 +52,6 @@ ex_bang(SCR *sp, EXCMD *cmdp)
 	EX_PRIVATE *exp;
 	MARK rm;
 	recno_t lno;
-	int rval;
 	const char *msg;
 
 	ap = cmdp->argv[0];
@@ -145,7 +144,7 @@ ex_bang(SCR *sp, EXCMD *cmdp)
 				ftype = FILTER_RBANG;
 			}
 		}
-		rval = ex_filter(sp, cmdp,
+		ex_filter(sp, cmdp,
 		    &cmdp->addr1, &cmdp->addr2, &rm, ap->bp, ftype);
 
 		/*
Index: ex/ex_global.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_global.c,v
diff -u -p -u -p -r1.17 ex_global.c
--- ex/ex_global.c	27 May 2016 09:18:12 -0000	1.17
+++ ex/ex_global.c	13 Apr 2026 11:20:13 -0000
@@ -67,7 +67,6 @@ ex_g_setup(SCR *sp, EXCMD *cmdp, enum wh
 	RANGE *rp;
 	busy_t btype;
 	recno_t start, end;
-	regex_t *re;
 	regmatch_t match[1];
 	size_t len;
 	int cnt, delim, eval;
@@ -146,7 +145,6 @@ usage:		ex_emsg(sp, cmdp->cmd->usage, EX
 		 */
 		sp->searchdir = FORWARD;
 	}
-	re = &sp->re_c;
 
 	/* The global commands always set the previous context mark. */
 	abs_mark.lno = sp->lno;
Index: vi/vs_split.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/vs_split.c,v
diff -u -p -u -p -r1.16 vs_split.c
--- vi/vs_split.c	27 May 2016 09:18:12 -0000	1.16
+++ vi/vs_split.c	13 Apr 2026 11:20:13 -0000
@@ -458,11 +458,8 @@ vs_swap(SCR *sp, SCR **nspp, char *name)
 int
 vs_resize(SCR *sp, long count, adj_t adj)
 {
-	GS *gp;
 	SCR *g, *s;
 	size_t g_off, s_off;
-
-	gp = sp->gp;
 
 	/*
 	 * Figure out which screens will grow, which will shrink, and


-- 
Walter