From 00a283400d6b4480673370037ac208cc8265f193 Mon Sep 17 00:00:00 2001 From: zhanghuanhuan Date: Tue, 10 Oct 2023 15:19:19 +0800 Subject: [PATCH 1/2] called func bind_variable_internal and enter next loop --- bash-5.1/r_variables/src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bash-5.1/r_variables/src/lib.rs b/bash-5.1/r_variables/src/lib.rs index 3023ddb..53d9e40 100644 --- a/bash-5.1/r_variables/src/lib.rs +++ b/bash-5.1/r_variables/src/lib.rs @@ -98,6 +98,17 @@ pub unsafe extern "C" fn bind_variable( ); } } + + vc = (*vc).down; + } + + return bind_variable_internal( + name, + value, + (*global_variables).table, + 0 as libc::c_int, + flags, + ); } #[derive(Copy, Clone)] -- Gitee From 1c41e92d74a2d68b37468959e3d42e759e65c2b3 Mon Sep 17 00:00:00 2001 From: zhanghuanhuan Date: Tue, 10 Oct 2023 15:22:48 +0800 Subject: [PATCH 2/2] define static var last_table_searched and add func atoi --- bash-5.1/r_variables/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bash-5.1/r_variables/src/lib.rs b/bash-5.1/r_variables/src/lib.rs index 53d9e40..f8b02fd 100644 --- a/bash-5.1/r_variables/src/lib.rs +++ b/bash-5.1/r_variables/src/lib.rs @@ -132,3 +132,15 @@ macro_rules! vc_istempenv { ((*$vc).flags & VC_TEMPFLAGS as libc::c_int) == VC_TEMPFLAGS as libc::c_int } } + +static mut last_table_searched: *mut HASH_TABLE = 0 as *const HASH_TABLE + as *mut HASH_TABLE; + +#[inline] +unsafe extern "C" fn atoi(mut __nptr: *const libc::c_char) -> libc::c_int { + return strtol( + __nptr, + 0 as *mut libc::c_void as *mut *mut libc::c_char, + 10 as libc::c_int, + ) as libc::c_int; +} -- Gitee