[ovs-dev] [appctl 1/7] ovs-appctl: Print command arguments for "help".

Ben Pfaff blp at nicira.com
Thu Sep 29 22:42:13 UTC 2011


On Thu, Sep 29, 2011 at 03:34:37PM -0700, Justin Pettit wrote:
> @@ -85,23 +86,19 @@ unixctl_help(struct unixctl_conn *conn, const char *args OVS_UNUSED,
>               void *aux OVS_UNUSED)
>  {
>      struct ds ds = DS_EMPTY_INITIALIZER;
> -    struct shash_node *node;
> -    struct svec names;
> -    const char *name;
> +    const struct shash_node **nodes = shash_sort(&commands);
>      size_t i;
>  
>      ds_put_cstr(&ds, "The available commands are:\n");
>  
> -    svec_init(&names);
> -    SHASH_FOR_EACH (node, &commands) {
> -        svec_add(&names, node->name);
> +    for (i=0; i < shash_count(&commands); i++) {

Common OVS style is to put spaces around binary operators: "i = 0;"

> +        const struct shash_node *node = nodes[i];
> +        const struct unixctl_command *command;
> +        
> +        command = (struct unixctl_command *)node->data;

The cast is unnecessary here.

Otherwise this is a nice improvement, thank you.



More information about the dev mailing list