[ovs-dev] [PATCH 3/4] db-ctl-base: remove ctl_get_all_commands() function
Alex Wang
alexw at nicira.com
Thu Jul 16 17:15:28 UTC 2015
Thx for making it consistent,
Acked-by: Alex Wang <alexw at nicira.com>
On Mon, Jul 13, 2015 at 11:48 PM, Andy Zhou <azhou at nicira.com> wrote:
> 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 <azhou at nicira.com>
> ---
> lib/db-ctl-base.c | 14 ++++----------
> lib/db-ctl-base.h | 1 -
> 2 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
> index b0f6fd5..e3ba0c5 100644
> --- a/lib/db-ctl-base.c
> +++ b/lib/db-ctl-base.c
> @@ -1776,7 +1776,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]) {
> @@ -1866,7 +1866,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;
> @@ -1922,7 +1922,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;
> }
> @@ -2013,13 +2014,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)
> diff --git a/lib/db-ctl-base.h b/lib/db-ctl-base.h
> index a361b50..e750599 100644
> --- a/lib/db-ctl-base.h
> +++ b/lib/db-ctl-base.h
> @@ -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);
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
More information about the dev
mailing list