From 82b7eda88f43969ba9540c19d2246da377787a09 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Fri, 31 May 2024 10:33:45 +0800 Subject: [PATCH] add expr_unwind function --- utshell-0.5/r_expr/src/lib.rs | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/utshell-0.5/r_expr/src/lib.rs b/utshell-0.5/r_expr/src/lib.rs index 8ebfebac..42acca54 100644 --- a/utshell-0.5/r_expr/src/lib.rs +++ b/utshell-0.5/r_expr/src/lib.rs @@ -1604,6 +1604,44 @@ unsafe extern "C" fn subexpr(mut expr: *mut libc::c_char) -> intmax_t { } +#[no_mangle] +unsafe extern "C" fn expr_unwind() { + loop { + expr_depth -= 1; + if !(expr_depth > 0 as libc::c_int) { + break; + } + if !((**expr_stack.offset(expr_depth as isize)).tokstr).is_null() { + sh_xfree( + (**expr_stack.offset(expr_depth as isize)).tokstr as *mut libc::c_void, + b"../expr.c\0" as *const u8 as *const libc::c_char, + 308 as libc::c_int, + ); + } + if !((**expr_stack.offset(expr_depth as isize)).expression).is_null() { + sh_xfree( + (**expr_stack.offset(expr_depth as isize)).expression as *mut libc::c_void, + b"../expr.c\0" as *const u8 as *const libc::c_char, + 311 as libc::c_int, + ); + } + sh_xfree( + *expr_stack.offset(expr_depth as isize) as *mut libc::c_void, + b"../expr.c\0" as *const u8 as *const libc::c_char, + 313 as libc::c_int, + ); + } + if expr_depth == 0 as libc::c_int { + sh_xfree( + *expr_stack.offset(expr_depth as isize) as *mut libc::c_void, + b"../expr.c\0" as *const u8 as *const libc::c_char, + 316 as libc::c_int, + ); + } + noeval = 0 as libc::c_int; +} + + #[no_mangle] unsafe extern "C" fn expr_unwind() { loop { -- Gitee