Skip to content

Fix several trivial problems found by clang 7's scan-build #2205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py/binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ long long mp_binary_get_int(mp_uint_t size, bool is_signed, bool big_endian, con
val = -1;
}
for (uint i = 0; i < size; i++) {
val <<= 8;
val *= 256;
val |= *src;
src += delta;
}
Expand Down
1 change: 0 additions & 1 deletion py/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ void *gc_alloc(size_t n_bytes, bool has_finaliser, bool long_lived) {
gc_collect();
collected = 1;
GC_ENTER();
collected = true;
}
#endif

Expand Down
6 changes: 4 additions & 2 deletions py/objtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,10 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, cons
mp_obj_t *args2 = m_new(mp_obj_t, 1 + n_args + 2 * n_kw);
args2[0] = MP_OBJ_FROM_PTR(self);
memcpy(args2 + 1, args, n_args * sizeof(mp_obj_t));
// copy in kwargs
memcpy(args2 + 1 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t));
if (kw_args) {
// copy in kwargs
memcpy(args2 + 1 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t));
}
new_ret = mp_call_function_n_kw(init_fn[0], n_args + 1, n_kw, args2);
m_del(mp_obj_t, args2, 1 + n_args + 2 * n_kw);
}
Expand Down
2 changes: 1 addition & 1 deletion py/showbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const byte *mp_bytecode_print_str(const byte *ip) {
num--;
}
do {
num = (num << 7) | (*ip & 0x7f);
num = (num * 128) | (*ip & 0x7f);
} while ((*ip++ & 0x80) != 0);
printf("LOAD_CONST_SMALL_INT " INT_FMT, num);
break;
Expand Down