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

Function ui_log_add_str

src/ui/http_server.c:861–871  ·  view source on GitHub ↗

Append `,"key":" "` for a string member, or nothing when the * member is absent or not a string (required ones are written empty). */

Source from the content-addressed store, hash-verified

859/* Append `,"key":"<escaped value>"` for a string member, or nothing when the
860 * member is absent or not a string (required ones are written empty). */
861static void ui_log_add_str(ui_log_scratch_t *s, int *pos, const char *key, yyjson_val *v,
862 bool required) {
863 if (!v || !yyjson_is_str(v)) {
864 if (required)
865 http_appendf(s->line, sizeof(s->line), pos, ",\"%s\":\"\"", key);
866 return;
867 }
868 ui_log_copy_field(s->field, sizeof(s->field), yyjson_get_str(v), UI_LOG_FIELD_MAX);
869 cbm_json_escape(s->esc, (int)sizeof(s->esc), s->field);
870 http_appendf(s->line, sizeof(s->line), pos, ",\"%s\":\"%s\"", key, s->esc);
871}
872
873static void ui_log_add_int(ui_log_scratch_t *s, int *pos, const char *key, yyjson_val *v) {
874 if (!v || !yyjson_is_num(v))

Callers 1

handle_ui_log_postFunction · 0.85

Calls 3

http_appendfFunction · 0.85
ui_log_copy_fieldFunction · 0.85
cbm_json_escapeFunction · 0.85

Tested by

no test coverage detected