]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
debug: use const void * for ul_debugobj()
authorIgor Gnatenko <i.gnatenko.brain@gmail.com>
Wed, 21 Sep 2016 06:22:35 +0000 (08:22 +0200)
committerIgor Gnatenko <i.gnatenko.brain@gmail.com>
Wed, 21 Sep 2016 06:22:35 +0000 (08:22 +0200)
We don't modify data it's pointing out and we should not modify it.

Also remove casting to void * as gcc will do it automatically (before
we had to cast it explicitly to avoid warning on discarding 'const'
qualifier).

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
include/debug.h
libfdisk/src/parttype.c
libsmartcols/src/cell.c
libsmartcols/src/column.c

index 45c1caadea42bcf74509e0f23f911dcc528d0641..97c0e1f086a6cd4c3a01a1c6c89b74c3855e238c 100644 (file)
@@ -105,7 +105,7 @@ ul_debug(const char *mesg, ...)
 }
 
 static inline void __attribute__ ((__format__ (__printf__, 2, 3)))
-ul_debugobj(void *handler, const char *mesg, ...)
+ul_debugobj(const void *handler, const char *mesg, ...)
 {
        va_list ap;
 
index 8c36fdf3b7e879290c3d9c1de9e071fe1301abf0..d894cf90d84b2b2af1ab9a08211d11882bbccef8 100644 (file)
@@ -310,7 +310,7 @@ struct fdisk_parttype *fdisk_label_parse_parttype(
        if (!lb->nparttypes)
                return NULL;
 
-       DBG(LABEL, ul_debugobj((void *) lb, "parsing '%s' (%s) partition type",
+       DBG(LABEL, ul_debugobj(lb, "parsing '%s' (%s) partition type",
                                str, lb->name));
        types = lb->parttypes;
 
@@ -321,7 +321,7 @@ struct fdisk_parttype *fdisk_label_parse_parttype(
                code = strtol(str, &end, 16);
 
                if (errno || *end != '\0') {
-                       DBG(LABEL, ul_debugobj((void *) lb, "parsing failed: %m"));
+                       DBG(LABEL, ul_debugobj(lb, "parsing failed: %m"));
                        return NULL;
                }
                ret = fdisk_label_get_parttype_from_code(lb, code);
index f2525cc4c528b6056f9657f4cb5afbed546becc1..b887940c9437caf55e6b7a1794b6b01fbe269992 100644 (file)
@@ -234,6 +234,6 @@ int scols_cell_copy_content(struct libscols_cell *dest,
        if (!rc)
                dest->userdata = src->userdata;
 
-       DBG(CELL, ul_debugobj((void *) src, "copy into %p", dest));
+       DBG(CELL, ul_debugobj(src, "copy into %p", dest));
        return rc;
 }
index 6a3b69bf189867e587e8fb4cdb561fe792fcd6e8..cdc87e9b7a0fa5c0000bc057587dc4fd591bc1d2 100644 (file)
@@ -93,7 +93,7 @@ struct libscols_column *scols_copy_column(const struct libscols_column *cl)
        if (!ret)
                return NULL;
 
-       DBG(COL, ul_debugobj((void *) cl, "copy to %p", ret));
+       DBG(COL, ul_debugobj(cl, "copy to %p", ret));
 
        if (scols_column_set_color(ret, cl->color))
                goto err;