names.h/names.c: wrappers to get name for states/inputs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-01-22 06:41:46 +10:30
parent e6dfff3ba8
commit caa27f1d93
4 changed files with 33 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ static bool record_input_mapping(int b);
do { if (record_input_mapping(b)) return false; } while(0)
#include "state.h"
#include "gen_state_names.h"
#include "names.c"
static bool quick = false;
static bool dot_simplify = false;
@@ -448,26 +448,6 @@ static bool fail(const struct peer *peer, enum failure which_fail)
return false;
}
static const char *state_name(enum state s)
{
size_t i;
for (i = 0; enum_state_names[i].name; i++)
if (enum_state_names[i].v == s)
return enum_state_names[i].name;
return "unknown";
}
static const char *input_name(enum state_input in)
{
size_t i;
for (i = 0; enum_state_input_names[i].name; i++)
if (enum_state_input_names[i].v == in)
return enum_state_input_names[i].name;
return "unknown";
}
static enum state_input input_by_name(const char *name)
{
size_t i;