summaryrefslogtreecommitdiffstatshomepage
path: root/unix/modffi.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-06-15 11:54:41 +1000
committerDamien George <damien.p.george@gmail.com>2017-06-15 11:54:41 +1000
commit48d867b4a68e53901aac87c2ff0f2a7e65f735c7 (patch)
tree178bfc0dc13bcb3b9d77c8a99652e9a9dc057e7d /unix/modffi.c
parent1e70fda69fcb4991eb60ed43e610f664ea1319e6 (diff)
downloadmicropython-48d867b4a68e53901aac87c2ff0f2a7e65f735c7.tar.gz
micropython-48d867b4a68e53901aac87c2ff0f2a7e65f735c7.zip
all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers.
Diffstat (limited to 'unix/modffi.c')
-rw-r--r--unix/modffi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/unix/modffi.c b/unix/modffi.c
index 7a35d61ef4..8b392f1c38 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -134,7 +134,7 @@ STATIC ffi_type *get_ffi_type(mp_obj_t o_in)
}
// TODO: Support actual libffi type objects
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "Unknown type"));
+ mp_raise_TypeError("Unknown type");
}
STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
@@ -203,7 +203,7 @@ STATIC mp_obj_t make_func(mp_obj_t rettype_in, void *func, mp_obj_t argtypes_in)
int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
if (res != FFI_OK) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
+ mp_raise_ValueError("Error in ffi_prep_cif");
}
return MP_OBJ_FROM_PTR(o);
@@ -261,12 +261,12 @@ STATIC mp_obj_t mod_ffi_callback(mp_obj_t rettype_in, mp_obj_t func_in, mp_obj_t
int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
if (res != FFI_OK) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
+ mp_raise_ValueError("Error in ffi_prep_cif");
}
res = ffi_prep_closure_loc(o->clo, &o->cif, call_py_func, MP_OBJ_TO_PTR(func_in), o->func);
if (res != FFI_OK) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "ffi_prep_closure_loc"));
+ mp_raise_ValueError("ffi_prep_closure_loc");
}
return MP_OBJ_FROM_PTR(o);