Skip to content

Commit

Permalink
db-ctl-base: Fix compilation warnings.
Browse files Browse the repository at this point in the history
This commit fixes uninitialized variable warnings in functions
cmd_create() and cmd_get() when compiling with gcc 6.3.1 and -Werror
by initializing variables 'symbol' and 'new' to NULL.

Cc: Alex Wang <[email protected]>
Fixes: 07ff77c ("db-ctl-base: Make common database command code into library.")
Signed-off-by: Ian Stokes <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
istokes authored and blp committed Jul 5, 2018
1 parent 9b7dde9 commit 165c1f0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/db-ctl-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ cmd_get(struct ctl_context *ctx)
}

if (id) {
struct ovsdb_symbol *symbol;
bool new;
struct ovsdb_symbol *symbol = NULL;
bool new = NULL;

ctx->error = create_symbol(ctx->symtab, id, &symbol, &new);
if (ctx->error) {
Expand Down Expand Up @@ -1698,15 +1698,15 @@ cmd_create(struct ctl_context *ctx)
const char *table_name = ctx->argv[1];
const struct ovsdb_idl_table_class *table;
const struct ovsdb_idl_row *row;
const struct uuid *uuid;
const struct uuid *uuid = NULL;
int i;

ctx->error = get_table(table_name, &table);
if (ctx->error) {
return;
}
if (id) {
struct ovsdb_symbol *symbol;
struct ovsdb_symbol *symbol = NULL;

ctx->error = create_symbol(ctx->symtab, id, &symbol, NULL);
if (ctx->error) {
Expand All @@ -1719,8 +1719,6 @@ cmd_create(struct ctl_context *ctx)
symbol->strong_ref = true;
}
uuid = &symbol->uuid;
} else {
uuid = NULL;
}

row = ovsdb_idl_txn_insert(ctx->txn, table, uuid);
Expand Down

0 comments on commit 165c1f0

Please sign in to comment.