all: Use NULL instead of "" when calling mp_raise exception helpers.

This is the established way of doing it and reduces code size by a little
bit.
This commit is contained in:
Damien George 2017-10-24 22:39:36 +11:00
parent cfff12612f
commit f4059dcc0c
9 changed files with 10 additions and 10 deletions

View File

@ -1032,7 +1032,7 @@ STATIC mp_obj_t lwip_socket_sendall(mp_obj_t self_in, mp_obj_t buf_in) {
break;
}
case MOD_NETWORK_SOCK_DGRAM:
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
break;
}

View File

@ -152,7 +152,7 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
// Currently supports only blocking mode
(void)self_in;
if (!mp_obj_is_true(flag_in)) {
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
}
return mp_const_none;
}

View File

@ -146,7 +146,7 @@ STATIC mp_obj_t mod_utimeq_heappop(mp_obj_t heap_in, mp_obj_t list_ref) {
}
mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref);
if (!MP_OBJ_IS_TYPE(list_ref, &mp_type_list) || ret->len < 3) {
mp_raise_TypeError("");
mp_raise_TypeError(NULL);
}
struct qentry *item = &heap->items[0];

View File

@ -308,7 +308,7 @@ STATIC mp_obj_t webrepl_set_password(mp_obj_t passwd_in) {
size_t len;
const char *passwd = mp_obj_str_get_data(passwd_in, &len);
if (len > sizeof(webrepl_passwd) - 1) {
mp_raise_ValueError("");
mp_raise_ValueError(NULL);
}
strcpy(webrepl_passwd, passwd);
return mp_const_none;

View File

@ -149,7 +149,7 @@ mp_obj_t machine_hspi_make_new(const mp_obj_type_t *type, size_t n_args, size_t
// args[0] holds the id of the peripheral
if (args[0] != MP_OBJ_NEW_SMALL_INT(1)) {
// FlashROM is on SPI0, so far we don't support its usage
mp_raise_ValueError("");
mp_raise_ValueError(NULL);
}
machine_hspi_obj_t *self = m_new_obj(machine_hspi_obj_t);

View File

@ -51,7 +51,7 @@ STATIC mp_obj_t machine_wdt_make_new(const mp_obj_type_t *type_in, size_t n_args
case 0:
return &wdt_default;
default:
mp_raise_ValueError("");
mp_raise_ValueError(NULL);
}
}

View File

@ -266,7 +266,7 @@ STATIC mp_obj_t jobject_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value)
return mp_const_none;
}
}
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
}
if (!JJ(IsInstanceOf, self->obj, List_class)) {

View File

@ -286,7 +286,7 @@ STATIC mp_obj_t array_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs
// Otherwise, can only look for a scalar numeric value in an array
if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
}
return mp_const_false;

View File

@ -158,7 +158,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
}
mp_int_t len_adj = slice.start - slice.stop;
@ -198,7 +198,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_get_array(value, &value_len, &value_items);
mp_bound_slice_t slice_out;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice_out)) {
mp_raise_NotImplementedError("");
mp_raise_NotImplementedError(NULL);
}
mp_int_t len_adj = value_len - (slice_out.stop - slice_out.start);
//printf("Len adj: %d\n", len_adj);