Skip to content

Commit

Permalink
db-ctl-base: remove ctl_get_all_commands() function
Browse files Browse the repository at this point in the history
all_commands currently is some times accessed directly, some times via
a function call. Change to always access it directly.

Signed-off-by: Andy Zhou <[email protected]>
  • Loading branch information
azhou-nicira committed Jul 17, 2015
1 parent 21a93e0 commit a35da17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
14 changes: 4 additions & 10 deletions lib/db-ctl-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ ctl_add_cmd_options(struct option **options_p, size_t *n_options_p,
const struct shash_node *node;
size_t n_existing_options = *n_options_p;

SHASH_FOR_EACH (node, ctl_get_all_commands()) {
SHASH_FOR_EACH (node, &all_commands) {
const struct ctl_command_syntax *p = node->data;

if (p->options[0]) {
Expand Down Expand Up @@ -1852,7 +1852,7 @@ ctl_print_commands(void)
{
const struct shash_node *node;

SHASH_FOR_EACH (node, ctl_get_all_commands()) {
SHASH_FOR_EACH (node, &all_commands) {
const struct ctl_command_syntax *p = node->data;
char *options = xstrdup(p->options);
char *options_begin = options;
Expand Down Expand Up @@ -1908,7 +1908,8 @@ bool
ctl_might_write_to_db(char **argv)
{
for (; *argv; argv++) {
const struct ctl_command_syntax *p = shash_find_data(&all_commands, *argv);
const struct ctl_command_syntax *p = shash_find_data(&all_commands,
*argv);
if (p && p->mode == RW) {
return true;
}
Expand Down Expand Up @@ -1997,13 +1998,6 @@ ctl_init(const struct ctl_table_class tables_[])
ctl_register_commands(db_ctl_commands);
}

/* Returns 'all_commands'. */
const struct shash *
ctl_get_all_commands(void)
{
return &all_commands;
}

/* Returns the text for the database commands usage. */
const char *
ctl_get_db_cmd_usage(void)
Expand Down
1 change: 0 additions & 1 deletion lib/db-ctl-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ void ctl_print_options(const struct option *);
void ctl_add_cmd_options(struct option **, size_t *n_options_p,
size_t *allocated_options_p, int opt_val);
void ctl_register_commands(const struct ctl_command_syntax *);
const struct shash *ctl_get_all_commands(void);
struct ctl_command *ctl_parse_commands(int argc, char *argv[],
struct shash *local_options,
size_t *n_commandsp);
Expand Down

0 comments on commit a35da17

Please sign in to comment.