Explorar o código

dispatcher: fix compiler warning #612

> CC (gcc) [M dispatcher.so]      dispatch.o
> dispatch.c: In function 'ds_set_attrs':
> dispatch.c:263:8: warning: 'tmp_rweight' may be used uninitialized in this function [-Wmaybe-uninitialized]
>     int tmp_rweight;
>         ^
> make[3]: 'libkmi.so.1.0' is up to date.
Victor Seva %!s(int64=9) %!d(string=hai) anos
pai
achega
6dd4b1f83c
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      modules/dispatcher/dispatch.c

+ 2 - 1
modules/dispatcher/dispatch.c

@@ -225,6 +225,7 @@ int ds_set_attrs(ds_dest_t *dest, str *attrs)
 	param_hooks_t phooks;
 	param_t *pit=NULL;
 	str param;
+	int tmp_rweight = 0;
 
 	if(attrs==NULL || attrs->len<=0)
 		return 0;
@@ -260,7 +261,7 @@ int ds_set_attrs(ds_dest_t *dest, str *attrs)
 			dest->attrs.socket = pit->body;
 		}else if(pit->name.len==7
 				&& strncasecmp(pit->name.s, "rweight", 7)==0) {
-			int tmp_rweight;
+			tmp_rweight = 0;
 			str2sint(&pit->body, &tmp_rweight);
 			if ( tmp_rweight>=1 && tmp_rweight<=100 ) {
 				dest->attrs.rweight = tmp_rweight;