Browse Source

devtools/create-gossipstore: fix false cppcheck warning.

[devtools/create-gossipstore.c:153]: (error) Uninitialized variable: scidsats

scidsats access is gated by csvfile, which means this warning is a false
positive.  However, it's cleaner to gate scidsts on itself, rather than
the cmdline option which caused it to be populated, so do that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
htlc_accepted_hook
Rusty Russell 6 years ago
parent
commit
78ef30b5ff
  1. 7
      devtools/create-gossipstore.c

7
devtools/create-gossipstore.c

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
bool verbose = false; bool verbose = false;
char *infile = NULL, *outfile = NULL, *csvfile = NULL, *csat = NULL; char *infile = NULL, *outfile = NULL, *csvfile = NULL, *csat = NULL;
int infd, outfd, scidi = 0, channels = 0, nodes = 0, updates = 0; int infd, outfd, scidi = 0, channels = 0, nodes = 0, updates = 0;
struct scidsat *scidsats; struct scidsat *scidsats = NULL;
unsigned max = -1U; unsigned max = -1U;
setup_locale(); setup_locale();
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
switch (fromwire_peektype(inmsg)) { switch (fromwire_peektype(inmsg)) {
case WIRE_CHANNEL_ANNOUNCEMENT: case WIRE_CHANNEL_ANNOUNCEMENT:
if (csvfile) { if (scidsats) {
struct short_channel_id scid; struct short_channel_id scid;
/* We ignore these; we just want scid */ /* We ignore these; we just want scid */
secp256k1_ecdsa_signature sig; secp256k1_ecdsa_signature sig;
@ -187,7 +187,6 @@ int main(int argc, char *argv[])
break; break;
} }
fprintf(stderr, "channels %d, updates %d, nodes %d\n", channels, updates, nodes); fprintf(stderr, "channels %d, updates %d, nodes %d\n", channels, updates, nodes);
if (csvfile) tal_free(scidsats);
tal_free(scidsats);
return 0; return 0;
} }

Loading…
Cancel
Save