1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/utils/conf_debug.c
Simon Tatham 964890f1a1 Stringify all the CONF_foo identifiers, for debugging.
When dumping out the contents of a Conf, it's useful not to have to
guess what the integer indices mean.

By putting these identifiers in a separate array in its own library
module, I should avoid them getting linked in to production binaries
to take up space, as long as conf_id() is only called from inside
debug() statements. And to enforce _that_, it isn't even declared in a
header file unless you #define DEBUG.
2024-09-23 16:49:29 +01:00

16 lines
313 B
C

#include "putty.h"
#define CONF_OPTION(id, ...) "CONF_" #id,
static const char *const conf_debug_identifiers[] = {
#include "conf.h"
};
const char *conf_id(int key)
{
size_t i = key;
if (i < lenof(conf_debug_identifiers))
return conf_debug_identifiers[i];
return "CONF_!outofrange!";
}