From a458b821e66bbb4336ad92b26a3645557a2dc98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 22 Nov 2016 14:35:57 +0100 Subject: vis: populate :set option map at startup --- sam.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sam.c') diff --git a/sam.c b/sam.c index 641f653..1f2e061 100644 --- a/sam.c +++ b/sam.c @@ -375,6 +375,14 @@ bool sam_init(Vis *vis) { bool ret = true; for (const CommandDef *cmd = cmds; cmd && cmd->name; cmd++) ret &= map_put(vis->cmds, cmd->name, cmd); + + if (!(vis->options = map_new())) + return false; + for (int i = 0; i < LENGTH(options); i++) { + for (const char *const *name = options[i].names; *name; name++) + ret &= map_put(vis->options, *name, &options[i]); + } + return ret; } -- cgit v1.2.3