Selaa lähdekoodia

db_berkeley: fix compilation warning

> CC (clang) [M db_berkeley.so]		db_berkeley.o
> db_berkeley.c:916:5: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>         if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) {
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> db_berkeley.c:966:5: note: uninitialized use occurs here
>         if(dbcp)
>            ^~~~
> db_berkeley.c:916:2: note: remove the 'if' if its condition is always false
>         if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) {
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> db_berkeley.c:901:6: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>                 if(!lkey) {
>                    ^~~~~
> db_berkeley.c:966:5: note: uninitialized use occurs here
>         if(dbcp)
>            ^~~~
> db_berkeley.c:901:3: note: remove the 'if' if its condition is always false
>                 if(!lkey) {
>                 ^~~~~~~~~~~
> db_berkeley.c:875:11: note: initialize the variable 'dbcp' to silence this warning
>         DBC *dbcp;
>                  ^
>                   = NULL
> 2 warnings generated.
Victor Seva 6 vuotta sitten
vanhempi
commit
93e0b7e7bc
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      src/modules/db_berkeley/db_berkeley.c

+ 1 - 1
src/modules/db_berkeley/db_berkeley.c

@@ -872,7 +872,7 @@ int _bdb_delete_cursor(
 	int ret, klen = MAX_ROW_SIZE;
 	DBT key, data;
 	DB *db;
-	DBC *dbcp;
+	DBC *dbcp = NULL;
 	int *lkey = NULL;
 
 	ret = 0;