mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
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:
parent
cf63739191
commit
6b8655ad3f
@ -1654,7 +1654,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
|
||||
char *vname;
|
||||
uint64_t notpresent;
|
||||
spare_cbdata_t spare_cb;
|
||||
char *state;
|
||||
const char *state;
|
||||
char *path = NULL;
|
||||
|
||||
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
|
||||
|
@ -233,7 +233,7 @@ extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *);
|
||||
extern void zpool_close(zpool_handle_t *);
|
||||
extern const char *zpool_get_name(zpool_handle_t *);
|
||||
extern int zpool_get_state(zpool_handle_t *);
|
||||
extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
|
||||
extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
|
||||
extern const char *zpool_pool_state_to_name(pool_state_t);
|
||||
extern void zpool_free_handles(libzfs_handle_t *);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user