MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / yaml_decode_scalar

Function yaml_decode_scalar

src/cli/config_yaml_edit.c:1732–1755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1730}
1731
1732static int yaml_decode_scalar(const char *data, size_t start, size_t end, char **out_value) {
1733 start = yaml_skip_spaces(data, start, end);
1734 end = yaml_trim_spaces_end(data, start, end);
1735 if (start == end || end - start > YAML_ITEM_MAX) {
1736 return YAML_ERROR;
1737 }
1738
1739 yaml_buf_t decoded = {0};
1740 int rc = 0;
1741 if (data[start] == '\'') {
1742 rc = yaml_decode_single_quoted(data, start, end, &decoded);
1743 } else if (data[start] == '"') {
1744 rc = yaml_decode_double_quoted(data, start, end, &decoded);
1745 } else {
1746 rc = yaml_decode_plain(data, start, end, &decoded);
1747 }
1748
1749 if (rc != 0 || decoded.len == 0U || yaml_validate_utf8(decoded.data, decoded.len) != 0) {
1750 yaml_buf_free(&decoded);
1751 return YAML_ERROR;
1752 }
1753 *out_value = decoded.data;
1754 return 0;
1755}
1756
1757static void yaml_item_vec_free(yaml_item_vec_t *items) {
1758 for (size_t i = 0; i < items->len; i++) {

Calls 7

yaml_skip_spacesFunction · 0.85
yaml_trim_spaces_endFunction · 0.85
yaml_decode_plainFunction · 0.85
yaml_validate_utf8Function · 0.85
yaml_buf_freeFunction · 0.85

Tested by

no test coverage detected