diff options
author | Tomohiro Kusumi <[email protected]> | 2018-03-10 06:47:32 +0900 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-09 13:47:32 -0800 |
commit | 6b8655ad3fe070089b690b95d8485e41b3e7e67e (patch) | |
tree | ca4fd02a8cf16797f47cbe61e23e8acf6385f960 /lib/libzfs | |
parent | cf63739191b6cac629d053930a4aea592bca3819 (diff) |
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 <[email protected]>
Signed-off-by: Tomohiro Kusumi <[email protected]>
Closes #7285
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_crypto.c | 2 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 4 |
2 files changed, 3 insertions, 3 deletions
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) { |