[LEDE-DEV] [PATCH] ubox: Initialize conditionally uninitialized variabled

John Crispin john at phrozen.org
Mon Dec 19 00:27:13 PST 2016



On 18/12/2016 01:48, Rosen Penev wrote:
> -Wconditional-uninitialized in clang

the warning are false positives. please check this next time and add the
information to the commit description. also a description is expected to
be a sentence or two and not a few words.

	John

> 
> Signed-off by: Rosen Penev <rosenp at gmail.com>
> ---
>  validate/validate.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/validate/validate.c b/validate/validate.c
> index 5bc3bc4..d5f9a55 100644
> --- a/validate/validate.c
> +++ b/validate/validate.c
> @@ -198,7 +198,8 @@ dt_type_list(struct dt_state *s, int nargs)
>  static bool
>  dt_type_min(struct dt_state *s, int nargs)
>  {
> -	int n, min;
> +	int n;
> +	int min = 0;
>  	char *e;
>  
>  	if (dt_getint(0, min))
> @@ -213,7 +214,8 @@ dt_type_min(struct dt_state *s, int nargs)
>  static bool
>  dt_type_max(struct dt_state *s, int nargs)
>  {
> -	int n, max;
> +	int n;
> +	int max = 0;
>  	char *e;
>  
>  	if (dt_getint(0, max))
> @@ -228,7 +230,9 @@ dt_type_max(struct dt_state *s, int nargs)
>  static bool
>  dt_type_range(struct dt_state *s, int nargs)
>  {
> -	int n, min, max;
> +	int n;
> +	int min = 0;
> +	int max = 0;
>  	char *e;
>  
>  	if (dt_getint(0, min) && dt_getint(1, max))
> @@ -243,7 +247,7 @@ dt_type_range(struct dt_state *s, int nargs)
>  static bool
>  dt_type_minlen(struct dt_state *s, int nargs)
>  {
> -	int min;
> +	int min = 0;
>  
>  	if (dt_getint(0, min))
>  		return (strlen(s->value) >= min);
> @@ -254,7 +258,7 @@ dt_type_minlen(struct dt_state *s, int nargs)
>  static bool
>  dt_type_maxlen(struct dt_state *s, int nargs)
>  {
> -	int max;
> +	int max = 0;
>  
>  	if (dt_getint(0, max))
>  		return (strlen(s->value) <= max);
> @@ -265,7 +269,8 @@ dt_type_maxlen(struct dt_state *s, int nargs)
>  static bool
>  dt_type_rangelen(struct dt_state *s, int nargs)
>  {
> -	int min, max;
> +	int min = 0;
> +	int max = 0;
>  	int len = strlen(s->value);
>  
>  	if (dt_getint(0, min) && dt_getint(1, max))
> @@ -344,7 +349,8 @@ dt_type_bool(struct dt_state *s, int nargs)
>  static bool
>  dt_type_string(struct dt_state *s, int nargs)
>  {
> -	int min, max;
> +	int min = 0;
> +	int max = 0;
>  	int len = strlen(s->value);
>  
>  	if (dt_getint(0, min) && (len < min))
> @@ -359,7 +365,8 @@ dt_type_string(struct dt_state *s, int nargs)
>  static bool
>  dt_type_hexstring(struct dt_state *s, int nargs)
>  {
> -	int min, max;
> +	int min = 0;
> +	int max = 0;
>  	int len = strlen(s->value);
>  	const char *p;
>  
> 



More information about the Lede-dev mailing list