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

Function dump_map

ccan/ccan/cdump/tools/cdump-enumstr.c:5–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <ccan/err/err.h>
4
5static bool dump_map(const char *name, struct cdump_type *t, void *unused)
6{
7 size_t i;
8
9 printf("struct {\n"
10 " enum %s v;\n"
11 " const char *name;\n"
12 "} enum_%s_names[] = {\n", name, name);
13
14 for (i = 0; i < tal_count(t->u.enum_vals); i++)
15 printf(" { %s, \"%s\" },\n",
16 t->u.enum_vals[i].name,
17 t->u.enum_vals[i].name);
18 printf(" { 0, NULL } };\n");
19 return true;
20}
21
22int main(int argc, char *argv[])
23{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected