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

Function json_truthy

src/ui/layout3d.c:60–76  ·  view source on GitHub ↗

Truthy across the representations properties_json may use (JSON bool, the * integer 1 sqlite/json_extract emits, or a "true"/"1" string). */

Source from the content-addressed store, hash-verified

58/* Truthy across the representations properties_json may use (JSON bool, the
59 * integer 1 sqlite/json_extract emits, or a "true"/"1" string). */
60static bool json_truthy(yyjson_val *v) {
61 if (!v)
62 return false;
63 if (yyjson_is_bool(v))
64 return yyjson_get_bool(v);
65 if (yyjson_is_int(v))
66 return yyjson_get_int(v) != 0;
67 if (yyjson_is_uint(v))
68 return yyjson_get_uint(v) != 0;
69 if (yyjson_is_real(v))
70 return yyjson_get_real(v) != 0.0;
71 if (yyjson_is_str(v)) {
72 const char *s = yyjson_get_str(v);
73 return s && s[0] && strcmp(s, "0") != 0 && strcmp(s, "false") != 0;
74 }
75 return false;
76}
77
78static node_flags_t parse_node_flags(const char *props_json) {
79 node_flags_t f = {false, false, false, false};

Callers 1

parse_node_flagsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected