| 737 | } |
| 738 | |
| 739 | cs_error_t icmap_get_string_r(icmap_map_t map, const char *key_name, char **str) |
| 740 | { |
| 741 | cs_error_t res; |
| 742 | size_t str_len; |
| 743 | icmap_value_types_t type; |
| 744 | |
| 745 | res = icmap_get_r(map, key_name, NULL, &str_len, &type); |
| 746 | if (res != CS_OK || type != ICMAP_VALUETYPE_STRING) { |
| 747 | if (res == CS_OK) { |
| 748 | res = CS_ERR_INVALID_PARAM; |
| 749 | } |
| 750 | |
| 751 | goto return_error; |
| 752 | } |
| 753 | |
| 754 | *str = malloc(str_len); |
| 755 | if (*str == NULL) { |
| 756 | res = CS_ERR_NO_MEMORY; |
| 757 | |
| 758 | goto return_error; |
| 759 | } |
| 760 | |
| 761 | res = icmap_get_r(map, key_name, *str, &str_len, &type); |
| 762 | if (res != CS_OK) { |
| 763 | free(*str); |
| 764 | goto return_error; |
| 765 | } |
| 766 | |
| 767 | return (CS_OK); |
| 768 | |
| 769 | return_error: |
| 770 | return (res); |
| 771 | } |
| 772 | |
| 773 | static cs_error_t icmap_get_int_r( |
| 774 | const icmap_map_t map, |
no test coverage detected