Skip to content

Commit

Permalink
Remove some dead assignments
Browse files Browse the repository at this point in the history
Found by the clang static analyzer.
  • Loading branch information
MasterDuke17 committed Dec 7, 2020
1 parent 110af6d commit eda9326
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/6model/serialization.c
Expand Up @@ -2208,7 +2208,6 @@ static void resolve_dependencies(MVMThreadContext *tc, MVMSerializationReader *r
else {
cdesc = "<unknown>";
}
if (!desc) desc = handle;
fail_deserialize(tc, waste, reader,
"Missing or wrong version of dependency '%s' (from '%s')",
cname,
Expand Down
5 changes: 1 addition & 4 deletions src/instrument/line_coverage.c
Expand Up @@ -26,7 +26,6 @@ static void instrument_graph_with_breakpoints(MVMThreadContext *tc, MVMSpeshGrap
filename_string_index = bbba->filename_string_heap_index;
MVM_free(bbba);
} else {
line_number = -1;
bb = bb->linear_next;
continue;
}
Expand Down Expand Up @@ -147,7 +146,6 @@ static void instrument_graph(MVMThreadContext *tc, MVMSpeshGraph *g) {
filename_string_index = bbba->filename_string_heap_index;
MVM_free(bbba);
} else {
line_number = -1;
bb = bb->linear_next;
continue;
}
Expand Down Expand Up @@ -308,12 +306,11 @@ void MVM_line_coverage_report(MVMThreadContext *tc, MVMString *filename, MVMuint
if (tc->instance->coverage_control == 2 || (!tc->instance->coverage_control && cache[cache_slot] == 0)) {
char *encoded_filename;
char composed_line[256];
size_t length;

cache[cache_slot] = 1;

encoded_filename = MVM_string_utf8_encode_C_string(tc, filename);
if ((length = snprintf(composed_line, 255, "HIT %s %d\n", encoded_filename, line_number)) > 0) {
if (snprintf(composed_line, 255, "HIT %s %d\n", encoded_filename, line_number) > 0) {
fputs(composed_line, tc->instance->coverage_log_fh);
}
MVM_free(encoded_filename);
Expand Down
3 changes: 1 addition & 2 deletions src/platform/random.c
Expand Up @@ -71,8 +71,7 @@
#include <unistd.h>
MVMint32 MVM_getrandom_urandom (MVMThreadContext *tc, void *out, size_t size) {
int fd = MVM_platform_open("/dev/urandom", O_RDONLY);
ssize_t num_read = 0;
if (fd < 0 || (num_read = read(fd, out, size) <= 0)) {
if (fd < 0 || read(fd, out, size) <= 0) {
if (fd) close(fd);
/* If using /dev/urandom fails (maybe we're in a chroot), on BSD's
* use arc4random, which is likely seeded from the system's random
Expand Down
6 changes: 0 additions & 6 deletions src/strings/ops.c
Expand Up @@ -2329,9 +2329,6 @@ MVMString * MVM_string_flip(MVMThreadContext *tc, MVMString *s) {
while (spos_l < s->body.num_graphs)
rbuffer[--rpos_l] = s->body.storage.blob_8[spos_l++];

spos += sgraphs - spos;
rpos -= sgraphs - spos;

MVMROOT(tc, s, {
res = (MVMString *)MVM_repr_alloc_init(tc, tc->instance->VMString);
});
Expand All @@ -2348,9 +2345,6 @@ MVMString * MVM_string_flip(MVMThreadContext *tc, MVMString *s) {
MVM_VECTORIZE_LOOP
while (spos_l < s->body.num_graphs)
rbuffer[--rpos_l] = s->body.storage.blob_32[spos_l++];

spos += sgraphs - spos;
rpos -= sgraphs - spos;
}
else
for (; spos < sgraphs; spos++)
Expand Down
1 change: 0 additions & 1 deletion src/strings/utf8_c8.c
Expand Up @@ -426,7 +426,6 @@ MVMuint32 MVM_string_utf8_c8_decodestream(MVMThreadContext *tc, MVMDecodeStream
/* If there's no buffers, we're done. */
if (!ds->bytes_head)
return 0;
last_accept_pos = ds->bytes_head_pos;

/* If we're asked for zero chars, also done. */
if (stopper_chars && *stopper_chars == 0)
Expand Down

0 comments on commit eda9326

Please sign in to comment.