MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_fieldname

Function check_fieldname

ccan/ccan/json_out/json_out.c:129–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static void check_fieldname(const struct json_out *jout,
130 const char *fieldname)
131{
132#ifdef CCAN_JSON_OUT_DEBUG
133 /* We don't escape this for you */
134 assert(!fieldname || !json_escape_needed(fieldname, strlen(fieldname)));
135
136 /* Can't check anything else if we ran out of memory. */
137 if (jout->wrapping) {
138 size_t n = tal_count(jout->wrapping);
139 if (n == 0)
140 /* Can't have a fieldname if not in anything! */
141 assert(!fieldname);
142 else if (jout->wrapping[n-1] == '[')
143 /* No fieldnames in arrays. */
144 assert(!fieldname);
145 else {
146 /* Must have fieldnames in objects. */
147 assert(fieldname);
148 }
149 }
150#endif
151}
152
153char *json_out_member_direct(struct json_out *jout,
154 const char *fieldname, size_t extra)

Callers 1

json_out_member_directFunction · 0.85

Calls 1

json_escape_neededFunction · 0.85

Tested by

no test coverage detected