From 60a9414cad23b6e8cc6b13e37675826ed05f7709 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 13 May 2011 20:57:01 +0200 Subject: fix "variable 'foo' set but not used" warnings Signed-off-by: Denys Vlasenko --- archival/libarchive/bz/compress.c | 7 +------ e2fsprogs/fsck.c | 3 +-- editors/vi.c | 2 -- libbb/dump.c | 7 ++----- miscutils/last_fancy.c | 3 +-- networking/ftpgetput.c | 7 +++---- procps/powertop.c | 2 -- runit/sv.c | 3 +-- shell/hush.c | 4 ++-- 9 files changed, 11 insertions(+), 27 deletions(-) diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c index 6f1c70a08..f93671742 100644 --- a/archival/libarchive/bz/compress.c +++ b/archival/libarchive/bz/compress.c @@ -251,7 +251,7 @@ void sendMTFValues(EState* s) { int32_t v, t, i, j, gs, ge, totc, bt, bc, iter; int32_t nSelectors, alphaSize, minLen, maxLen, selCtr; - int32_t nGroups, nBytes; + int32_t nGroups; /* * uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; @@ -512,7 +512,6 @@ void sendMTFValues(EState* s) } } - nBytes = s->numZ; bsW(s, 16, inUse16); inUse16 <<= (sizeof(int)*8 - 16); /* move 15th bit into sign bit */ @@ -528,7 +527,6 @@ void sendMTFValues(EState* s) } /*--- Now the selectors. ---*/ - nBytes = s->numZ; bsW(s, 3, nGroups); bsW(s, 15, nSelectors); for (i = 0; i < nSelectors; i++) { @@ -538,8 +536,6 @@ void sendMTFValues(EState* s) } /*--- Now the coding tables. ---*/ - nBytes = s->numZ; - for (t = 0; t < nGroups; t++) { int32_t curr = s->len[t][0]; bsW(s, 5, curr); @@ -551,7 +547,6 @@ void sendMTFValues(EState* s) } /*--- And finally, the block data proper ---*/ - nBytes = s->numZ; selCtr = 0; gs = 0; while (1) { diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index b4257a2ad..fcbdb5989 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -317,7 +317,6 @@ static void load_fs_info(const char *filename) { FILE *fstab; struct mntent mte; - struct fs_info *fs; fstab = setmntent(filename, "r"); if (!fstab) { @@ -330,7 +329,7 @@ static void load_fs_info(const char *filename) //bb_info_msg("CREATE[%s][%s][%s][%s][%d]", mte.mnt_fsname, mte.mnt_dir, // mte.mnt_type, mte.mnt_opts, // mte.mnt_passno); - fs = create_fs_device(mte.mnt_fsname, mte.mnt_dir, + create_fs_device(mte.mnt_fsname, mte.mnt_dir, mte.mnt_type, mte.mnt_opts, mte.mnt_passno); } diff --git a/editors/vi.c b/editors/vi.c index fd8bd0f78..638b3b733 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -536,7 +536,6 @@ static void edit_file(char *fn) #define cur_line edit_file__cur_line #endif int c; - int size; #if ENABLE_FEATURE_VI_USE_SIGNALS int sig; #endif @@ -545,7 +544,6 @@ static void edit_file(char *fn) rawmode(); rows = 24; columns = 80; - size = 0; IF_FEATURE_VI_ASK_TERMINAL(G.get_rowcol_error =) query_screen_dimensions(); #if ENABLE_FEATURE_VI_ASK_TERMINAL if (G.get_rowcol_error /* TODO? && no input on stdin */) { diff --git a/libbb/dump.c b/libbb/dump.c index 1b1d03a66..919fe135c 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -99,7 +99,7 @@ static NOINLINE int bb_dump_size(FS *fs) static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs) { enum { NOTOKAY, USEBCNT, USEPREC } sokay; - PR *pr, **nextpr = NULL; + PR *pr; FU *fu; char *p1, *p2, *p3; char savech, *fmtp; @@ -111,15 +111,12 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs) * break each format unit into print units; each * conversion character gets its own. */ - for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) { + for (nconv = 0, fmtp = fu->fmt; *fmtp; ) { /* NOSTRICT */ /* DBU:[dvae@cray.com] zalloc so that forward ptrs start out NULL*/ pr = xzalloc(sizeof(PR)); if (!fu->nextpr) fu->nextpr = pr; - /* ignore nextpr -- its unused inside the loop and is - * uninitialized 1st time through. - */ /* skip preceding text and up to the next % sign */ for (p1 = fmtp; *p1 && *p1 != '%'; ++p1) diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c index 7e61b7691..dc09b65fb 100644 --- a/miscutils/last_fancy.c +++ b/miscutils/last_fancy.c @@ -161,11 +161,10 @@ int last_main(int argc UNUSED_PARAM, char **argv) time_t boot_time; time_t down_time; int file; - unsigned opt; smallint going_down; smallint boot_down; - opt = getopt32(argv, "Wf:" /* "H" */, &filename); + /*opt =*/ getopt32(argv, "Wf:" /* "H" */, &filename); #ifdef BUT_UTIL_LINUX_LAST_HAS_NO_SUCH_OPT if (opt & LAST_OPT_H) { /* Print header line */ diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 66316e21f..f63df55f4 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -60,7 +60,7 @@ struct globals { FILE *control_stream; int verbose_flag; int do_continue; - char buf[1]; /* actually [BUFSZ] */ + char buf[4]; /* actually [BUFSZ] */ } FIX_ALIASING; #define G (*(struct globals*)&bb_common_bufsiz1) enum { BUFSZ = COMMON_BUFSIZE - offsetof(struct globals, buf) }; @@ -105,7 +105,7 @@ static int ftpcmd(const char *s1, const char *s2) } do { - strcpy(buf, "EOF"); + strcpy(buf, "EOF"); /* for ftp_die */ if (fgets(buf, BUFSZ - 2, control_stream) == NULL) { ftp_die(NULL); } @@ -316,7 +316,6 @@ static const char ftpgetput_longopts[] ALIGN1 = int ftpgetput_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ftpgetput_main(int argc UNUSED_PARAM, char **argv) { - unsigned opt; const char *port = "ftp"; /* socket to ftp server */ @@ -345,7 +344,7 @@ int ftpgetput_main(int argc UNUSED_PARAM, char **argv) applet_long_options = ftpgetput_longopts; #endif opt_complementary = "-2:vv:cc"; /* must have 2 to 3 params; -v and -c count */ - opt = getopt32(argv, "cvu:p:P:", &user, &password, &port, + getopt32(argv, "cvu:p:P:", &user, &password, &port, &verbose_flag, &do_continue); argv += optind; diff --git a/procps/powertop.c b/procps/powertop.c index bfe5a9568..008cdfca4 100644 --- a/procps/powertop.c +++ b/procps/powertop.c @@ -393,11 +393,9 @@ static NOINLINE int process_timer_stats(void) char buf[128]; char line[15 + 3 + 128]; int n; - ullong totalticks; FILE *fp; buf[0] = '\0'; - totalticks = 0; n = 0; fp = NULL; diff --git a/runit/sv.c b/runit/sv.c index 322688a36..5b01c875c 100644 --- a/runit/sv.c +++ b/runit/sv.c @@ -437,7 +437,6 @@ static int control(const char *a) int sv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int sv_main(int argc UNUSED_PARAM, char **argv) { - unsigned opt; char *x; char *action; const char *varservice = CONFIG_SV_DEFAULT_SERVICE_DIR; @@ -458,7 +457,7 @@ int sv_main(int argc UNUSED_PARAM, char **argv) if (x) waitsec = xatou(x); opt_complementary = "w+:vv"; /* -w N, -v is a counter */ - opt = getopt32(argv, "w:v", &waitsec, &verbose); + getopt32(argv, "w:v", &waitsec, &verbose); argv += optind; action = *argv++; if (!action || !*argv) bb_show_usage(); diff --git a/shell/hush.c b/shell/hush.c index 4c348ec2b..9cc86fa9a 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -4517,11 +4517,11 @@ static struct pipe *parse_stream(char **pstring, break; #if ENABLE_HUSH_TICK case '`': { - unsigned pos; + USE_FOR_NOMMU(unsigned pos;) o_addchr(&dest, SPECIAL_VAR_SYMBOL); o_addchr(&dest, '`'); - pos = dest.length; + USE_FOR_NOMMU(pos = dest.length;) if (!add_till_backquote(&dest, input, /*in_dquote:*/ 0)) goto parse_error; # if !BB_MMU -- cgit v1.2.3