On Mon, Feb 15, 2016 at 04:20:51PM +0100, Quentin Monnet wrote:
> OVS_COLORS environment variable is parsed to extract user-defined
> preferences regarding colors (this is used to set up a color theme, not
> to replace the `--color` option for activating color output).
> 
> The string should be of a format similar to LS_COLORS or GREP_COLORS,
> with available colors being as follows:
> 
> * ac: action field
> * dr: drop keyword
> * le: learn keyword
> * pm: parameters receiving attributes
> * pr: keyword having parenthesis
> * sp: some special keywords
> * vl: lone values with no parameter name
> 
> For color whose idendifier does not appear in the string, the default
> hardcoded value is used instead.
> 
> As an example, setting OVS_COLORS to the following string is equivalent
> to using the default values:
> 
>     OVS_COLORS="ac:01;31:dr=34:le=31:pm=36:pr=35:sp=33:vl=32"
> 
> Signed-off-by: Quentin Monnet <quentin.mon...@6wind.com>

Thank you for working on this.

"sparse" says the following.  It's pointing out that it's odd for a
global symbol to be defined without a previous "extern" declaration.  I
agree:

    ../lib/colors.h:21:12: warning: symbol 'actions_color' was not declared. 
Should it be static?
    ../lib/colors.h:22:12: warning: symbol 'drop_color' was not declared. 
Should it be static?
    ../lib/colors.h:23:12: warning: symbol 'learn_color' was not declared. 
Should it be static?
    ../lib/colors.h:24:12: warning: symbol 'param_color' was not declared. 
Should it be static?
    ../lib/colors.h:25:12: warning: symbol 'paren_color' was not declared. 
Should it be static?
    ../lib/colors.h:26:12: warning: symbol 'special_color' was not declared. 
Should it be static?
    ../lib/colors.h:27:12: warning: symbol 'value_color' was not declared. 
Should it be static?
    ../lib/colors.h:21:12: warning: symbol 'actions_color' was not declared. 
Should it be static?
    ../lib/colors.h:22:12: warning: symbol 'drop_color' was not declared. 
Should it be static?
    ../lib/colors.h:23:12: warning: symbol 'learn_color' was not declared. 
Should it be static?
    ../lib/colors.h:24:12: warning: symbol 'param_color' was not declared. 
Should it be static?
    ../lib/colors.h:25:12: warning: symbol 'paren_color' was not declared. 
Should it be static?
    ../lib/colors.h:26:12: warning: symbol 'special_color' was not declared. 
Should it be static?
    ../lib/colors.h:27:12: warning: symbol 'value_color' was not declared. 
Should it be static?

GCC and Clang also complain about the "static" strings in that header
file:

In file included from ../lib/colors.c:24:0:
../lib/colors.h:31:20: error: 'sgr_start' defined but not used 
[-Werror=unused-variable]
 static const char *sgr_start = "\33[%sm\33[K";
                    ^
../lib/colors.h:32:20: error: 'sgr_end' defined but not used 
[-Werror=unused-variable]
 static const char *sgr_end   = "\33[m\33[K";
                    ^

The adherence to coding style is pretty sketchy in colors.c.  Most
notably, please indent 4 spaces per level (not 2).

In colors_parse_from_env(), please use xstrdup() instead of strdup().

In color_identification(), please put a space before } as well as after
{, e.g.:
  { "ac", &actions_color },
not
  { "ac", &actions_color},
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to