| 725 | } |
| 726 | |
| 727 | cs_error_t cmap_get_string(cmap_handle_t handle, const char *key_name, char **str) |
| 728 | { |
| 729 | cs_error_t res; |
| 730 | size_t str_len; |
| 731 | cmap_value_types_t type; |
| 732 | |
| 733 | res = cmap_get(handle, key_name, NULL, &str_len, &type); |
| 734 | |
| 735 | if (res != CS_OK || type != CMAP_VALUETYPE_STRING) { |
| 736 | if (res == CS_OK) { |
| 737 | res = CS_ERR_INVALID_PARAM; |
| 738 | } |
| 739 | |
| 740 | goto return_error; |
| 741 | } |
| 742 | |
| 743 | *str = malloc(str_len); |
| 744 | if (*str == NULL) { |
| 745 | res = CS_ERR_NO_MEMORY; |
| 746 | |
| 747 | goto return_error; |
| 748 | } |
| 749 | |
| 750 | res = cmap_get(handle, key_name, *str, &str_len, &type); |
| 751 | if (res != CS_OK) { |
| 752 | free(*str); |
| 753 | |
| 754 | goto return_error; |
| 755 | } |
| 756 | |
| 757 | return (CS_OK); |
| 758 | |
| 759 | return_error: |
| 760 | return (res); |
| 761 | } |
| 762 | |
| 763 | static cs_error_t cmap_adjust_int(cmap_handle_t handle, const char *key_name, int32_t step) |
| 764 | { |