Remove some dead stores signalled by clang analyzer

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2020-06-06 19:03:03 +02:00 committed by eboasson
parent ece3a78211
commit f08b4e0c5d
3 changed files with 5 additions and 6 deletions

View file

@ -328,13 +328,12 @@ MPT_ProcessEntry (rw_publisher,
static void wait_for_done (dds_entity_t rd, const char *userdata) static void wait_for_done (dds_entity_t rd, const char *userdata)
{ {
int32_t n;
void *raw = NULL; void *raw = NULL;
dds_sample_info_t si; dds_sample_info_t si;
bool done = false; bool done = false;
while (!done) while (!done)
{ {
while (!done && (n = dds_take (rd, &raw, &si, 1, 1)) == 1) while (!done && dds_take (rd, &raw, &si, 1, 1) == 1)
{ {
const dds_builtintopic_participant_t *sample = raw; const dds_builtintopic_participant_t *sample = raw;
void *ud = NULL; void *ud = NULL;

View file

@ -562,7 +562,7 @@ static uint32_t pubthread (void *varg)
{ {
int result; int result;
dds_instance_handle_t *ihs; dds_instance_handle_t *ihs;
dds_time_t ntot = 0, tfirst, tfirst0; dds_time_t ntot = 0, tfirst;
union data data; union data data;
uint64_t timeouts = 0; uint64_t timeouts = 0;
void *baggage = NULL; void *baggage = NULL;
@ -584,7 +584,7 @@ static uint32_t pubthread (void *varg)
} }
data.seq_keyval.keyval = 0; data.seq_keyval.keyval = 0;
tfirst0 = tfirst = dds_time(); tfirst = dds_time();
uint32_t bi = 0; uint32_t bi = 0;
while (!ddsrt_atomic_ld32 (&termflag)) while (!ddsrt_atomic_ld32 (&termflag))
@ -623,7 +623,7 @@ static uint32_t pubthread (void *varg)
if (++bi == burstsize) if (++bi == burstsize)
{ {
/* FIXME: should average rate over a short-ish period, rather than over the entire run */ /* FIXME: should average rate over a short-ish period, rather than over the entire run */
while (((double) (ntot / burstsize) / ((double) (t - tfirst0) / 1e9 + 5e-3)) > pub_rate && !ddsrt_atomic_ld32 (&termflag)) while (((double) (ntot / burstsize) / ((double) (t - tfirst) / 1e9 + 5e-3)) > pub_rate && !ddsrt_atomic_ld32 (&termflag))
{ {
/* FIXME: flushing manually because batching is not yet implemented properly */ /* FIXME: flushing manually because batching is not yet implemented properly */
dds_write_flush (wr_data); dds_write_flush (wr_data);

View file

@ -1980,7 +1980,7 @@ static char *read_line_from_textfile(FILE *fp) {
str[n++] = (char)c; str[n++] = (char)c;
} }
if (c != EOF || n > 0) { if (c != EOF || n > 0) {
if (n == sz) str = dds_realloc(str, sz += 1); if (n == sz) str = dds_realloc(str, sz + 1);
str[n] = 0; str[n] = 0;
} else if (ferror(fp)) { } else if (ferror(fp)) {
error_exit("error reading file, errno = %d\n", errno); error_exit("error reading file, errno = %d\n", errno);