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

Function ui_log_copy_field

src/ui/http_server.c:832–847  ·  view source on GitHub ↗

Copy a text field under a cap, cutting on a UTF-8 boundary and saying so. */

Source from the content-addressed store, hash-verified

830
831/* Copy a text field under a cap, cutting on a UTF-8 boundary and saying so. */
832static void ui_log_copy_field(char *out, size_t outsz, const char *in, size_t cap) {
833 size_t n = strlen(in);
834 bool cut = false;
835 if (n > cap) {
836 n = cap;
837 cut = true;
838 while (n > 0 && ((unsigned char)in[n] & 0xC0) == 0x80)
839 n--;
840 }
841 if (n >= outsz)
842 n = outsz - 1;
843 memcpy(out, in, n);
844 out[n] = '\0';
845 if (cut)
846 snprintf(out + n, outsz - n, " [cut at %d]", (int)cap);
847}
848
849static const char *ui_log_level_name(yyjson_val *v) {
850 static const char *const known[] = {"debug", "log", "info", "warn", "error"};

Callers 2

ui_log_add_strFunction · 0.85
handle_ui_log_postFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected