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

Function yaml_validate_key

src/cli/config_yaml_edit.c:287–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287static int yaml_validate_key(const char *key, size_t *out_len) {
288 size_t len = 0;
289 if (yaml_bounded_strlen(key, YAML_KEY_MAX, &len) != 0 || len == 0U) {
290 return YAML_ERROR;
291 }
292 for (size_t i = 0; i < len; i++) {
293 unsigned char c = (unsigned char)key[i];
294 if (!(isalnum(c) || c == '_' || c == '-' || c == '.')) {
295 return YAML_ERROR;
296 }
297 }
298 *out_len = len;
299 return 0;
300}
301
302static int yaml_validate_text_bytes_from(const char *data, size_t len, size_t from);
303

Calls 1

yaml_bounded_strlenFunction · 0.85

Tested by

no test coverage detected