From f4059dcc0c5251256a53fcb49f56fdda6e879341 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Tue, 24 Oct 2017 22:39:36 +1100
Subject: [PATCH] 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.
---
 extmod/modlwip.c             | 2 +-
 extmod/modussl_axtls.c       | 2 +-
 extmod/modutimeq.c           | 2 +-
 extmod/modwebrepl.c          | 2 +-
 ports/esp8266/machine_hspi.c | 2 +-
 ports/esp8266/machine_wdt.c  | 2 +-
 ports/unix/modjni.c          | 2 +-
 py/objarray.c                | 2 +-
 py/objlist.c                 | 4 ++--
 9 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/extmod/modlwip.c b/extmod/modlwip.c
index f7e776af9..bbb01b5d7 100644
--- a/extmod/modlwip.c
+++ b/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;
     }
 
diff --git a/extmod/modussl_axtls.c b/extmod/modussl_axtls.c
index 88a89a23d..719a65cd1 100644
--- a/extmod/modussl_axtls.c
+++ b/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;
 }
diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c
index 94cbd20d2..620e7484b 100644
--- a/extmod/modutimeq.c
+++ b/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];
diff --git a/extmod/modwebrepl.c b/extmod/modwebrepl.c
index 4ff282aac..3aba5c0f1 100644
--- a/extmod/modwebrepl.c
+++ b/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;
diff --git a/ports/esp8266/machine_hspi.c b/ports/esp8266/machine_hspi.c
index eaabbab7e..9fd0f4868 100644
--- a/ports/esp8266/machine_hspi.c
+++ b/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);
diff --git a/ports/esp8266/machine_wdt.c b/ports/esp8266/machine_wdt.c
index 04b42782e..4432297fa 100644
--- a/ports/esp8266/machine_wdt.c
+++ b/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);
     }
 }
 
diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c
index 15b6d9cd7..f29c095cf 100644
--- a/ports/unix/modjni.c
+++ b/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)) {
diff --git a/py/objarray.c b/py/objarray.c
index 8a3e7faad..7003ec9e7 100644
--- a/py/objarray.c
+++ b/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;
diff --git a/py/objlist.c b/py/objlist.c
index bc22d9fc3..1a18f937d 100644
--- a/py/objlist.c
+++ b/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);
-- 
GitLab