diff options
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/command.c b/lib/command.c index 24095de4f0..d1b0867372 100644 --- a/lib/command.c +++ b/lib/command.c @@ -43,6 +43,7 @@ #include "qobj.h" #include "defaults.h" #include "libfrr.h" +#include "jhash.h" DEFINE_MTYPE(LIB, HOST, "Host config") DEFINE_MTYPE(LIB, STRVEC, "String vector") @@ -278,7 +279,9 @@ int argv_find(struct cmd_token **argv, int argc, const char *text, int *index) static unsigned int cmd_hash_key(void *p) { - return (uintptr_t)p; + int size = sizeof(p); + + return jhash(p, size, 0); } static int cmd_hash_cmp(const void *a, const void *b) @@ -298,7 +301,9 @@ void install_node(struct cmd_node *node, int (*func)(struct vty *)) 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(cmd_hash_key, cmd_hash_cmp, NULL); + node->cmd_hash = hash_create_size(16, cmd_hash_key, + cmd_hash_cmp, + "Command Hash"); } /** @@ -1770,11 +1775,11 @@ int cmd_domainname_set(const char *domainname) } /* Hostname configuration */ -DEFUN (config_domainname, - domainname_cmd, - "domainname WORD", - "Set system's domain name\n" - "This system's domain name\n") +DEFUN(config_domainname, + domainname_cmd, + "domainname WORD", + "Set system's domain name\n" + "This system's domain name\n") { struct cmd_token *word = argv[1]; @@ -1786,12 +1791,12 @@ DEFUN (config_domainname, return cmd_domainname_set(word->arg); } -DEFUN (config_no_domainname, - no_domainname_cmd, - "no domainname [DOMAINNAME]", - NO_STR - "Reset system's domain name\n" - "domain name of this router\n") +DEFUN(config_no_domainname, + no_domainname_cmd, + "no domainname [DOMAINNAME]", + NO_STR + "Reset system's domain name\n" + "domain name of this router\n") { return cmd_domainname_set(NULL); } |
