[lvm-devel] [PATCH 19/24] Use cleaner const * pointer

Zdenek Kabelac zkabelac at redhat.com
Sun Jan 30 12:57:42 UTC 2011


Now it's warning free -
Const cast in _string_disp() is not even needed,
but it's more readable conversion.

Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
 lib/report/report.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/report/report.c b/lib/report/report.c
index 136ad4c..f470840 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -44,7 +44,7 @@ static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
 			struct dm_report_field *field,
 			const void *data, void *private __attribute__((unused)))
 {
-	return dm_report_field_string(rh, field, (const char **) data);
+	return dm_report_field_string(rh, field, (const char * const *) data);
 }
 
 static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
@@ -307,10 +307,8 @@ static int _lvname_disp(struct dm_report *rh, struct dm_pool *mem,
 	char *repstr, *lvname;
 	size_t len;
 
-	if (lv_is_visible(lv)) {
-		repstr = lv->name;
-		return dm_report_field_string(rh, field, (const char **) &repstr);
-	}
+	if (lv_is_visible(lv))
+		return dm_report_field_string(rh, field, &lv->name);
 
 	len = strlen(lv->name) + 3;
 	if (!(repstr = dm_pool_zalloc(mem, len))) {
-- 
1.7.3.5




More information about the lvm-devel mailing list