|
|
|
@ -729,6 +729,10 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
@@ -729,6 +729,10 @@ static struct api_data *api_add_data_full(struct api_data *root, char *name, enu
|
|
|
|
|
api_data->data = (void *)malloc(sizeof(uint32_t)); |
|
|
|
|
*((uint32_t *)(api_data->data)) = *((uint32_t *)data); |
|
|
|
|
break; |
|
|
|
|
case API_HEX32: |
|
|
|
|
api_data->data = (void *)malloc(sizeof(uint32_t)); |
|
|
|
|
*((uint32_t *)(api_data->data)) = *((uint32_t *)data); |
|
|
|
|
break; |
|
|
|
|
case API_UINT64: |
|
|
|
|
api_data->data = (void *)malloc(sizeof(uint64_t)); |
|
|
|
|
*((uint64_t *)(api_data->data)) = *((uint64_t *)data); |
|
|
|
@ -815,6 +819,11 @@ struct api_data *api_add_uint32(struct api_data *root, char *name, uint32_t *dat
@@ -815,6 +819,11 @@ struct api_data *api_add_uint32(struct api_data *root, char *name, uint32_t *dat
|
|
|
|
|
return api_add_data_full(root, name, API_UINT32, (void *)data, copy_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct api_data *api_add_hex32(struct api_data *root, char *name, uint32_t *data, bool copy_data) |
|
|
|
|
{ |
|
|
|
|
return api_add_data_full(root, name, API_HEX32, (void *)data, copy_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
struct api_data *api_add_uint64(struct api_data *root, char *name, uint64_t *data, bool copy_data) |
|
|
|
|
{ |
|
|
|
|
return api_add_data_full(root, name, API_UINT64, (void *)data, copy_data); |
|
|
|
@ -958,6 +967,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
@@ -958,6 +967,9 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
|
|
|
|
|
case API_UINT32: |
|
|
|
|
sprintf(buf, "%"PRIu32, *((uint32_t *)(root->data))); |
|
|
|
|
break; |
|
|
|
|
case API_HEX32: |
|
|
|
|
snprintf(buf, sizeof(buf), "0x%08x", *((uint32_t *)(root->data))); |
|
|
|
|
break; |
|
|
|
|
case API_UINT64: |
|
|
|
|
sprintf(buf, "%"PRIu64, *((uint64_t *)(root->data))); |
|
|
|
|
break; |
|
|
|
|