json: Drop problematic casts in nvlist_to_json()

The NVP_NAME() macro requires its argument to be castable to char *.
The compiler complains if const char * is provided instead.
This commit is contained in:
Mateusz Piotrowski 2023-06-22 16:17:09 +00:00 committed by Geoff Amey
parent a7d67aed05
commit 95d6d8d32f
1 changed files with 2 additions and 2 deletions

View File

@ -203,7 +203,7 @@ static void
nvlist_to_json(nvlist_t *nvl, jprint_t *jp, nvj_filter_t f) nvlist_to_json(nvlist_t *nvl, jprint_t *jp, nvj_filter_t f)
{ {
const nvpriv_t *priv; const nvpriv_t *priv;
const i_nvp_t *curr; i_nvp_t *curr;
uint64_t *u = NULL; uint64_t *u = NULL;
nvlist_t **a = NULL; nvlist_t **a = NULL;
@ -214,7 +214,7 @@ nvlist_to_json(nvlist_t *nvl, jprint_t *jp, nvj_filter_t f)
return; return;
for (curr = priv->nvp_list; curr != NULL; curr = curr->nvi_next) { for (curr = priv->nvp_list; curr != NULL; curr = curr->nvi_next) {
const nvpair_t *nvp = &curr->nvi_nvp; nvpair_t *nvp = &curr->nvi_nvp;
const char *name = (const char *)NVP_NAME(nvp); const char *name = (const char *)NVP_NAME(nvp);
data_type_t type = NVP_TYPE(nvp); data_type_t type = NVP_TYPE(nvp);
void *p = NVP_VALUE(nvp); void *p = NVP_VALUE(nvp);