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 <behlendorf1@llnl.gov>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
Closes #7285
This commit is contained in:
Tomohiro Kusumi
2018-03-10 06:47:32 +09:00
committed by Brian Behlendorf
parent cf63739191
commit 6b8655ad3f
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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) {
+2 -2
View File
@@ -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) {