]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
various: fix mixing declarations and code compiler warnings [smatch]
authorSami Kerola <kerolasa@iki.fi>
Mon, 7 Oct 2013 22:04:23 +0000 (23:04 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 8 Oct 2013 13:47:59 +0000 (15:47 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libfdisk/src/dos.c
libmount/python/pylibmount.c
libmount/python/tab.c
term-utils/mesg.c

index 4340d35bd69f471d5331796c5220c5c16ae89857..06971de139ac05be48afcfc0c2be0fa144838fca 100644 (file)
@@ -1180,9 +1180,9 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
        }
 
        if (l->ext_offset) {
+               sector_t e_last;
                p = self_partition(cxt, l->ext_index);
-
-               sector_t e_last = dos_partition_get_start(p)
+               e_last = dos_partition_get_start(p)
                                  + dos_partition_get_size(p) - 1;
 
                for (i = 4; i < cxt->label->nparts_max; i++) {
@@ -1612,7 +1612,7 @@ static int dos_list_disklabel(struct fdisk_context *cxt)
        for (i = 0; i < cxt->label->nparts_max; i++) {
                struct pte *pe = self_pte(cxt, i);
                struct dos_partition *p = pe->pt_entry;
-               unsigned int psects, pblocks, podd = 0;;
+               unsigned int psects, pblocks, podd = 0;
                struct fdisk_parttype *type;
                struct tt_line *ln;
                char *str;
index 1403bfe3c48321d5d02f74d88e42c472cd7fa02c..c538bb5436db7c8c5087748dd5af87f8ada7a09d 100644 (file)
@@ -90,6 +90,7 @@ PyObject *PyObjectResultInt(int i)
 
 PyObject *PyObjectResultStr(const char *s)
 {
+       PyObject *result;
        if (!s)
                /* TODO: maybe lie about it and return "":
                 * which would allow for
@@ -97,7 +98,7 @@ PyObject *PyObjectResultStr(const char *s)
                 * fs.comment += "comment"
                return Py_BuildValue("s", ""); */
                Py_RETURN_NONE;
-       PyObject *result = Py_BuildValue("s", s);
+       result = Py_BuildValue("s", s);
        if (!result)
                PyErr_SetString(PyExc_RuntimeError, CONSTRUCT_ERR);
        return result;
index 9ea6924c0593fa4e27d4cb44a91a79ab806ba72b..6f255aef75c4b2a36c283b82fd4d9e608a9adc81 100644 (file)
@@ -600,9 +600,10 @@ static int Table_init(TableObject *self, PyObject *args, PyObject *kwds)
                self->iter = mnt_new_iter(MNT_ITER_FORWARD);
 
        if (errcb) {
+               PyObject *tmp;
                if (!PyCallable_Check(errcb))
                        return -1;
-               PyObject *tmp = self->errcb;
+               tmp = self->errcb;
                Py_INCREF(errcb);
                self->errcb = errcb;
                Py_XDECREF(tmp);
index 097fb9c932cea8fd198434dabee76e539c326090..12e4e0e8ca213ef8a5a1a955be7c38b5b60871fd 100644 (file)
@@ -88,11 +88,6 @@ int main(int argc, char *argv[])
        char *tty;
        int ch, verbose = FALSE;
 
-       setlocale(LC_ALL, "");
-       bindtextdomain(PACKAGE, LOCALEDIR);
-       textdomain(PACKAGE);
-       atexit(close_stdout);
-
        static const struct option longopts[] = {
                { "verbose",    no_argument,       0, 'v' },
                { "version",    no_argument,       0, 'V' },
@@ -100,6 +95,11 @@ int 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, "vVh", longopts, NULL)) != -1)
                switch (ch) {
                case 'v':