various: fix variable and function declarations [smatch scan]

disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-04-08 20:32:49 +01:00 committed by Karel Zak
parent a6f5836264
commit 3acc206d39
9 changed files with 32 additions and 30 deletions

View File

@ -507,11 +507,12 @@ write_super_block(void) {
static void
write_tables(void) {
write_super_block();
unsigned long buffsz = get_inode_buffer_size();
unsigned long imaps = get_nimaps();
unsigned long zmaps = get_nzmaps();
write_super_block();
if (write_all(IN, inode_map, imaps * MINIX_BLOCK_SIZE))
die(_("Unable to write inode map"));

View File

@ -977,10 +977,10 @@ out_roundup_size(int width, unsigned long long n, unsigned long unit) {
static struct geometry
get_fdisk_geometry_one(struct part_desc *p) {
struct geometry G;
memset(&G, 0, sizeof(struct geometry));
chs b = p->p.end_chs;
longchs bb = chs_to_longchs(b);
memset(&G, 0, sizeof(struct geometry));
G.heads = bb.h + 1;
G.sectors = bb.s;
G.cylindersize = G.heads * G.sectors;
@ -1167,6 +1167,7 @@ static int
partitions_ok(int fd, struct disk_desc *z) {
struct part_desc *partitions = &(z->partitions[0]), *p, *q;
int partno = z->partno;
int sector_size;
#define PNO(p) pnumber(p, z)
@ -1251,7 +1252,6 @@ partitions_ok(int fd, struct disk_desc *z) {
}
}
int sector_size;
if (blkdev_get_sector_size(fd, &sector_size) == -1)
sector_size = DEFAULT_SECTOR_SIZE;
@ -1538,6 +1538,7 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
struct part_desc *partitions = &(z->partitions[0]);
int pno = z->partno;
int bsd_later = 1;
unsigned short sig, magic;
#ifdef __linux__
bsd_later = (get_linux_version() >= KERNEL_VERSION(2, 3, 40));
#endif
@ -1561,7 +1562,6 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
return 0;
}
unsigned short sig, magic;
memcpy(&sig, s->data + 2, sizeof(sig));
if (sig <= 0x1ae) {
memcpy(&magic, s->data + sig, sizeof(magic));

View File

@ -173,7 +173,7 @@ mbsalign (const char *src, char *dest, size_t dest_size,
const char *str_to_print = src;
size_t n_cols = src_size - 1;
size_t n_used_bytes = n_cols; /* Not including NUL */
size_t n_spaces = 0;
size_t n_spaces = 0, space_left;
bool conversion = false;
bool wc_enabled = false;
@ -276,7 +276,7 @@ mbsalign_unibyte:
}
dest = mbs_align_pad (dest, dest_end, start_spaces);
size_t space_left = dest_end - dest;
space_left = dest_end - dest;
dest = mempcpy (dest, str_to_print, min (n_used_bytes, space_left));
mbs_align_pad (dest, dest_end, end_spaces);
}

View File

@ -371,12 +371,12 @@ ubi_probe_all(blkid_cache cache, int only_if_new)
const char **dirname;
for (dirname = dirlist; *dirname; dirname++) {
DBG(DEVNAME, blkid_debug("probing UBI volumes under %s",
*dirname));
DIR *dir;
struct dirent *iter;
DBG(DEVNAME, blkid_debug("probing UBI volumes under %s",
*dirname));
dir = opendir(*dirname);
if (dir == NULL)
continue ;

View File

@ -212,12 +212,13 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
int fdisk_discover_topology(struct fdisk_context *cxt)
{
#ifdef HAVE_LIBBLKID
blkid_probe pr;
#endif
assert(cxt);
assert(cxt->sector_size == 0);
#ifdef HAVE_LIBBLKID
blkid_probe pr;
DBG(TOPOLOGY, dbgprint("initialize libblkid prober"));
pr = blkid_new_probe();

View File

@ -103,11 +103,6 @@ main(int argc, char **argv) {
size_t mbufsize;
unsigned timeout = WRITE_TIME_OUT;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
static const struct option longopts[] = {
{ "nobanner", no_argument, 0, 'n' },
{ "timeout", required_argument, 0, 't' },
@ -116,6 +111,11 @@ main(int argc, char **argv) {
{ NULL, 0, 0, 0 }
};
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
while ((ch = getopt_long(argc, argv, "nt:Vh", longopts, NULL)) != -1) {
switch (ch) {
case 'n':

View File

@ -415,7 +415,7 @@ void flush_lines(int nflush)
* is the number of half line feeds, otherwise it is the number of whole line
* feeds.
*/
void flush_blanks()
void flush_blanks(void)
{
int half, i, nb;
@ -550,7 +550,7 @@ void flush_line(LINE *l)
static LINE *line_freelist;
LINE *
alloc_line()
alloc_line(void)
{
LINE *l;
int i;

View File

@ -94,6 +94,12 @@ int main(int argc, char *argv[])
FILE *fp = stdin;
int ch, rval = EXIT_SUCCESS;
static const struct option longopts[] = {
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' },
{ NULL, 0, 0, 0 }
};
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
@ -102,12 +108,6 @@ int main(int argc, char *argv[])
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
static const struct option longopts[] = {
{ "version", no_argument, 0, 'V' },
{ "help", no_argument, 0, 'h' },
{ NULL, 0, 0, 0 }
};
while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch(ch) {
case 'V':

View File

@ -237,11 +237,6 @@ int main(int argc, char **argv)
struct stat st;
off_t size = 0;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
static const struct option longopts[] = {
{ "lines", required_argument, 0, 'n' },
{ "version", no_argument, 0, 'V' },
@ -249,6 +244,11 @@ int main(int argc, char **argv)
{ NULL, 0, 0, 0 }
};
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
atexit(close_stdout);
lines = old_style_option(&argc, argv);
if (lines < 0)
lines = DEFAULT_LINES;