8000 unix: Use common RAISE_ERRNO macro from mphalport.h. · ladyada/circuitpython@016dba0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 016dba0

Browse files
committed
unix: Use common RAISE_ERRNO macro from mphalport.h.
1 parent 503089e commit 016dba0

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

unix/modos.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "py/nlr.h"
3838
#include "py/runtime.h"
3939
#include "py/objtuple.h"
40+
#include "py/mphal.h"
4041
#include "extmod/misc.h"
4142

4243
// Can't include this, as FATFS structure definition is required,
@@ -51,10 +52,6 @@ extern const mp_obj_type_t mp_fat_vfs_type;
5152
#define USE_STATFS 1
5253
#endif
5354

54-
#define RAISE_ERRNO(err_flag, error_val) \
55-
{ if (err_flag == -1) \
56-
{ mp_raise_OSError(error_val); } }
57-
5855
STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) {
5956
struct stat sb;
6057
mp_uint_t len;

unix/modsocket.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "py/runtime.h"
4545
#include "py/stream.h"
4646
#include "py/builtin.h"
47+
#include "py/mphal.h"
4748

4849
/*
4950
The idea of this module is to implement reasonable minimum of
@@ -72,10 +73,6 @@ typedef struct _mp_obj_socket_t {
7273
const mp_obj_type_t mp_type_socket;
7374

7475
// Helper functions
75-
#define RAISE_ERRNO(err_flag, error_val) \
76-
{ if (err_flag == -1) \
77-
{ mp_raise_OSError(error_val); } }
78-
7976
static inline mp_obj_t mp_obj_from_sockaddr(const struct sockaddr *addr, socklen_t len) {
8077
return mp_obj_new_bytes((const byte *)addr, len);
8178
}

unix/modtermios.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@
2929
#include <unistd.h>
3030
#include <errno.h>
3131

32-
#include "py/nlr.h"
3332
#include "py/objlist.h"
3433
#include "py/runtime.h"
35-
36-
#define RAISE_ERRNO(err_flag, error_val) \
37-
{ if (err_flag == -1) \
38-
{ mp_raise_OSError(error_val); } }
34+
#include "py/mphal.h"
3935

4036
STATIC mp_obj_t mod_termios_tcgetattr(mp_obj_t fd_in) {
4137
struct termios term;

0 commit comments

Comments
 (0)
0