From 6b8655ad3fe070089b690b95d8485e41b3e7e67e Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Sat, 10 Mar 2018 06:47:32 +0900 Subject: Change functions which return literals to return `const char*` get_format_prompt_string() and zpool_state_to_name() return a string literal which is read-only, thus they should return `const char*`. zpool_get_prop_string() returns a non-const string after successful nv-lookup, and returns a string literal otherwise. Since this function is designed to be used for read-only purpose, the return type should also be `const char*`. Reviewed-by: Brian Behlendorf Signed-off-by: Tomohiro Kusumi Closes #7285 --- lib/libzfs/libzfs_crypto.c | 2 +- lib/libzfs/libzfs_pool.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libzfs') diff --git a/lib/libzfs/libzfs_crypto.c b/lib/libzfs/libzfs_crypto.c index 6ccee740f..9ad0fae7d 100644 --- a/lib/libzfs/libzfs_crypto.c +++ b/lib/libzfs/libzfs_crypto.c @@ -130,7 +130,7 @@ catch_signal(int sig) caught_interrupt = sig; } -static char * +static const char * get_format_prompt_string(zfs_keyformat_t format) { switch (format) { diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 5f1414271..cd14f2836 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -113,7 +113,7 @@ zpool_props_refresh(zpool_handle_t *zhp) return (0); } -static char * +static const char * zpool_get_prop_string(zpool_handle_t *zhp, zpool_prop_t prop, zprop_source_t *src) { @@ -181,7 +181,7 @@ zpool_get_prop_int(zpool_handle_t *zhp, zpool_prop_t prop, zprop_source_t *src) /* * Map VDEV STATE to printed strings. */ -char * +const char * zpool_state_to_name(vdev_state_t state, vdev_aux_t aux) { switch (state) { -- cgit v1.2.3