py/nlrsetjmp: Use MP_NLR_JUMP_HEAD macro to simplify code.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
a61d40e5e8
commit
24aa81e1da
@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* The MIT License (MIT)
|
* The MIT License (MIT)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2017 Damien P. George
|
* Copyright (c) 2013-2023 Damien P. George
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -29,14 +29,7 @@
|
|||||||
#if MICROPY_NLR_SETJMP
|
#if MICROPY_NLR_SETJMP
|
||||||
|
|
||||||
void nlr_jump(void *val) {
|
void nlr_jump(void *val) {
|
||||||
nlr_buf_t **top_ptr = &MP_STATE_THREAD(nlr_top);
|
MP_NLR_JUMP_HEAD(val, top);
|
||||||
nlr_buf_t *top = *top_ptr;
|
|
||||||
if (top == NULL) {
|
|
||||||
nlr_jump_fail(val);
|
|
||||||
}
|
|
||||||
top->ret_val = val;
|
|
||||||
MP_NLR_RESTORE_PYSTACK(top);
|
|
||||||
*top_ptr = top->prev;
|
|
||||||
longjmp(top->jmpbuf, 1);
|
longjmp(top->jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user