summaryrefslogtreecommitdiffstats
path: root/lib/command.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas.abraitis@gmail.com>2021-06-29 10:47:16 +0200
committerGitHub <noreply@github.com>2021-06-29 10:47:16 +0200
commit7702d0b720114a33804068c0bd54fdb2f3530dad (patch)
treecf991300a5dde2015d776f725819b1b661f7d430 /lib/command.c
parentMerge pull request #8850 from opensourcerouting/ospf6-checksum-json (diff)
parentlib: Add some hash name differentiation for Command Hash's (diff)
downloadfrr-7702d0b720114a33804068c0bd54fdb2f3530dad.tar.xz
frr-7702d0b720114a33804068c0bd54fdb2f3530dad.zip
Merge pull request #8911 from donaldsharp/command_node
lib: Add some hash name differentiation for Command Hash's
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/command.c b/lib/command.c
index e00d84a05..560d4a09f 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -255,6 +255,9 @@ static bool cmd_hash_cmp(const void *a, const void *b)
/* Install top node of command vector. */
void install_node(struct cmd_node *node)
{
+#define CMD_HASH_STR_SIZE 256
+ char hash_name[CMD_HASH_STR_SIZE];
+
vector_set_index(cmdvec, node->node, node);
node->cmdgraph = graph_new();
node->cmd_vector = vector_init(VECTOR_MIN_SIZE);
@@ -263,8 +266,10 @@ void install_node(struct cmd_node *node)
cmd_token_new(START_TKN, CMD_ATTR_NORMAL, NULL, NULL);
graph_new_node(node->cmdgraph, token,
(void (*)(void *)) & cmd_token_del);
- node->cmd_hash = hash_create_size(16, cmd_hash_key, cmd_hash_cmp,
- "Command Hash");
+
+ snprintf(hash_name, sizeof(hash_name), "Command Hash: %s", node->name);
+ node->cmd_hash =
+ hash_create_size(16, cmd_hash_key, cmd_hash_cmp, hash_name);
}
/* Return prompt character of specified node. */