summaryrefslogtreecommitdiff
path: root/dselect/pkgcmds.cc
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2019-08-29 01:35:57 +0200
committerGuillem Jover <guillem@debian.org>2019-10-30 22:02:44 +0100
commitc50756c96e726b9b776fabedc1694084dbcbd636 (patch)
treedb411b7d6a517580898d5208484fcbfb4c6c4c0e /dselect/pkgcmds.cc
parent45f004ea979e12dea12043558629efe5aa377bf2 (diff)
downloaddpkg-c50756c96e726b9b776fabedc1694084dbcbd636.tar.gz
dselect: Reduce scope of variable
The variable was being assigned in one side of an if branch, but the result never used. Let's reduce the scope to the if branch that actually assigns and uses it. Warned-by: cppcheck
Diffstat (limited to 'dselect/pkgcmds.cc')
-rw-r--r--dselect/pkgcmds.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc
index 340c60a06..78f549138 100644
--- a/dselect/pkgcmds.cc
+++ b/dselect/pkgcmds.cc
@@ -104,7 +104,7 @@ packagelist::reallywant(pkgwant nwarg, struct perpackagestate *pkgstate)
void
packagelist::setwant(pkgwant nwarg)
{
- int index, top, bot;
+ int index, bot;
pkgwant nw;
if (modstatdb_get_status() == msdbrw_readonly) {
@@ -116,9 +116,10 @@ packagelist::setwant(pkgwant nwarg)
redrawitemsrange(cursorline,cursorline+1);
table[cursorline]->selected= reallywant(nwarg,table[cursorline]);
redraw1item(cursorline);
- top= cursorline;
bot= cursorline+1;
} else {
+ int top;
+
packagelist *sub = new packagelist(bindings, nullptr);
affectedrange(&top,&bot);