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

Function init_tablemap

plugins/sql.c:2036–2069  ·  view source on GitHub ↗

plugin is NULL if we're just doing --print-docs */

Source from the content-addressed store, hash-verified

2034
2035/* plugin is NULL if we're just doing --print-docs */
2036static void init_tablemap(struct plugin *plugin, tablemap *tablemap)
2037{
2038 const jsmntok_t *toks, *t;
2039 const tal_t *ctx;
2040 size_t i;
2041
2042 if (plugin)
2043 ctx = plugin;
2044 else
2045 ctx = tmpctx;
2046
2047 strmap_init(tablemap);
2048
2049 toks = json_parse_simple(tmpctx, schemas, strlen(schemas));
2050 json_for_each_obj(i, t, toks) {
2051 struct table_desc *td;
2052 const jsmntok_t *cmd, *items, *type;
2053
2054 /* First member of properties object is command. */
2055 cmd = json_get_member(schemas, t+1, "properties") + 1;
2056
2057 /* We assume it's an object containing an array of objects */
2058 items = json_get_member(schemas, cmd + 1, "items");
2059 type = json_get_member(schemas, items, "type");
2060 assert(json_tok_streq(schemas, type, "object"));
2061
2062 td = new_table_desc(ctx, tablemap, NULL, t, cmd, false);
2063 add_table_object(tablemap, td, items);
2064 td->has_created_index = find_column(td, "created_index");
2065
2066 if (plugin)
2067 finish_td(plugin, td);
2068 }
2069}
2070
2071static void memleak_mark_tablemap(struct plugin *p, struct htable *memtable)
2072{

Callers 2

initFunction · 0.85
mainFunction · 0.85

Calls 7

json_parse_simpleFunction · 0.85
json_get_memberFunction · 0.85
json_tok_streqFunction · 0.85
new_table_descFunction · 0.85
add_table_objectFunction · 0.85
find_columnFunction · 0.85
finish_tdFunction · 0.85

Tested by

no test coverage detected