From: Igor Gnatenko Date: Wed, 21 Sep 2016 06:22:35 +0000 (+0200) Subject: debug: use const void * for ul_debugobj() X-Git-Tag: v2.29-rc1~37^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e0943c15b173015c3ff9475085bd064204f9c74;p=thirdparty%2Futil-linux.git debug: use const void * for ul_debugobj() 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 --- diff --git a/include/debug.h b/include/debug.h index 45c1caadea..97c0e1f086 100644 --- a/include/debug.h +++ b/include/debug.h @@ -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; diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c index 8c36fdf3b7..d894cf90d8 100644 --- a/libfdisk/src/parttype.c +++ b/libfdisk/src/parttype.c @@ -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); diff --git a/libsmartcols/src/cell.c b/libsmartcols/src/cell.c index f2525cc4c5..b887940c94 100644 --- a/libsmartcols/src/cell.c +++ b/libsmartcols/src/cell.c @@ -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; } diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c index 6a3b69bf18..cdc87e9b7a 100644 --- a/libsmartcols/src/column.c +++ b/libsmartcols/src/column.c @@ -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;