summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-07 14:09:59 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-07 14:09:59 +1100
commit016dba0e988352015bcbf43ec84f3b67e2244dc4 (patch)
tree466edac8f50a8e1d0ee025c243860e0359e388e4
parent503089ea9d6b358f1a06ad1f164561b7cf11c742 (diff)
downloadmicropython-016dba0e988352015bcbf43ec84f3b67e2244dc4.tar.gz
micropython-016dba0e988352015bcbf43ec84f3b67e2244dc4.zip
unix: Use common RAISE_ERRNO macro from mphalport.h.
-rw-r--r--unix/modos.c5
-rw-r--r--unix/modsocket.c5
-rw-r--r--unix/modtermios.c6
3 files changed, 3 insertions, 13 deletions
diff --git a/unix/modos.c b/unix/modos.c
index b29805269d..36945720d1 100644
--- a/unix/modos.c
+++ b/unix/modos.c
@@ -37,6 +37,7 @@
#include "py/nlr.h"
#include "py/runtime.h"
#include "py/objtuple.h"
+#include "py/mphal.h"
#include "extmod/misc.h"
// Can't include this, as FATFS structure definition is required,
@@ -51,10 +52,6 @@ extern const mp_obj_type_t mp_fat_vfs_type;
#define USE_STATFS 1
#endif
-#define RAISE_ERRNO(err_flag, error_val) \
- { if (err_flag == -1) \
- { mp_raise_OSError(error_val); } }
-
STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) {
struct stat sb;
mp_uint_t len;
diff --git a/unix/modsocket.c b/unix/modsocket.c
index dc4dc4c881..74d22eb731 100644
--- a/unix/modsocket.c
+++ b/unix/modsocket.c
@@ -44,6 +44,7 @@
#include "py/runtime.h"
#include "py/stream.h"
#include "py/builtin.h"
+#include "py/mphal.h"
/*
The idea of this module is to implement reasonable minimum of
@@ -72,10 +73,6 @@ typedef struct _mp_obj_socket_t {
const mp_obj_type_t mp_type_socket;
// Helper functions
-#define RAISE_ERRNO(err_flag, error_val) \
- { if (err_flag == -1) \
- { mp_raise_OSError(error_val); } }
-
static inline mp_obj_t mp_obj_from_sockaddr(const struct sockaddr *addr, socklen_t len) {
return mp_obj_new_bytes((const byte *)addr, len);
}
diff --git a/unix/modtermios.c b/unix/modtermios.c
index 2fef4f223c..2cb5f26df5 100644
--- a/unix/modtermios.c
+++ b/unix/modtermios.c
@@ -29,13 +29,9 @@
#include <unistd.h>
#include <errno.h>
-#include "py/nlr.h"
#include "py/objlist.h"
#include "py/runtime.h"
-
-#define RAISE_ERRNO(err_flag, error_val) \
- { if (err_flag == -1) \
- { mp_raise_OSError(error_val); } }
+#include "py/mphal.h"
STATIC mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
struct termios term;