Browse Source

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 7 years ago
parent
commit
f4059dcc0c
  1. 2
      extmod/modlwip.c
  2. 2
      extmod/modussl_axtls.c
  3. 2
      extmod/modutimeq.c
  4. 2
      extmod/modwebrepl.c
  5. 2
      ports/esp8266/machine_hspi.c
  6. 2
      ports/esp8266/machine_wdt.c
  7. 2
      ports/unix/modjni.c
  8. 2
      py/objarray.c
  9. 4
      py/objlist.c

2
extmod/modlwip.c

@ -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;
}

2
extmod/modussl_axtls.c

@ -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;
}

2
extmod/modutimeq.c

@ -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];

2
extmod/modwebrepl.c

@ -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;

2
ports/esp8266/machine_hspi.c

@ -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);

2
ports/esp8266/machine_wdt.c

@ -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);
}
}

2
ports/unix/modjni.c

@ -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)) {

2
py/objarray.c

@ -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;

4
py/objlist.c

@ -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);

Loading…
Cancel
Save