summaryrefslogtreecommitdiff
path: root/extmod/machine_mem.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-11 11:48:28 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-13 11:52:40 +1100
commitad7213d3c31bccb26a3f54f7492ccf4b0cc920f3 (patch)
tree2ab64a805c05d790579052f557a8168061afcebe /extmod/machine_mem.c
parent97eca38c4f03e76bd464fb25974544a043af2a9e (diff)
py: Add mp_raise_msg_varg helper and use it where appropriate.
This commit adds mp_raise_msg_varg(type, fmt, ...) as a helper for nlr_raise(mp_obj_new_exception_msg_varg(type, fmt, ...)). It makes the C-level API for raising exceptions more consistent, and reduces code size on most ports: bare-arm: +28 +0.042% minimal x86: +100 +0.067% unix x64: -56 -0.011% unix nanbox: -300 -0.068% stm32: -204 -0.054% PYBV10 cc3200: +0 +0.000% esp8266: -64 -0.010% GENERIC esp32: -104 -0.007% GENERIC nrf: -136 -0.094% pca10040 samd: +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
Diffstat (limited to 'extmod/machine_mem.c')
-rw-r--r--extmod/machine_mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/machine_mem.c b/extmod/machine_mem.c
index b9f16507c..c00dba3e7 100644
--- a/extmod/machine_mem.c
+++ b/extmod/machine_mem.c
@@ -42,7 +42,7 @@
STATIC uintptr_t machine_mem_get_addr(mp_obj_t addr_o, uint align) {
uintptr_t addr = mp_obj_int_get_truncated(addr_o);
if ((addr & (align - 1)) != 0) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "address %08x is not aligned to %d bytes", addr, align));
+ mp_raise_msg_varg(&mp_type_ValueError, "address %08x is not aligned to %d bytes", addr, align);
}
return addr;
}