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.
pull/3333/merge
Damien George 2017-10-24 22:39:36 +11:00
rodzic cfff12612f
commit f4059dcc0c
9 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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 // Currently supports only blocking mode
(void)self_in; (void)self_in;
if (!mp_obj_is_true(flag_in)) { if (!mp_obj_is_true(flag_in)) {
mp_raise_NotImplementedError(""); mp_raise_NotImplementedError(NULL);
} }
return mp_const_none; return mp_const_none;
} }

Wyświetl plik

@ -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); mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref);
if (!MP_OBJ_IS_TYPE(list_ref, &mp_type_list) || ret->len < 3) { 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]; struct qentry *item = &heap->items[0];

Wyświetl plik

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

Wyświetl plik

@ -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 // args[0] holds the id of the peripheral
if (args[0] != MP_OBJ_NEW_SMALL_INT(1)) { if (args[0] != MP_OBJ_NEW_SMALL_INT(1)) {
// FlashROM is on SPI0, so far we don't support its usage // 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); machine_hspi_obj_t *self = m_new_obj(machine_hspi_obj_t);

Wyświetl plik

@ -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: case 0:
return &wdt_default; return &wdt_default;
default: default:
mp_raise_ValueError(""); mp_raise_ValueError(NULL);
} }
} }

Wyświetl plik

@ -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; return mp_const_none;
} }
} }
mp_raise_NotImplementedError(""); mp_raise_NotImplementedError(NULL);
} }
if (!JJ(IsInstanceOf, self->obj, List_class)) { if (!JJ(IsInstanceOf, self->obj, List_class)) {

Wyświetl plik

@ -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 // 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)) { if (MP_OBJ_IS_INT(rhs_in) || mp_obj_is_float(rhs_in)) {
mp_raise_NotImplementedError(""); mp_raise_NotImplementedError(NULL);
} }
return mp_const_false; return mp_const_false;

Wyświetl plik

@ -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_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_bound_slice_t slice; mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &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; 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_obj_get_array(value, &value_len, &value_items);
mp_bound_slice_t slice_out; mp_bound_slice_t slice_out;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &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); mp_int_t len_adj = value_len - (slice_out.stop - slice_out.start);
//printf("Len adj: %d\n", len_adj); //printf("Len adj: %d\n", len_adj);