MCPcopy Create free account
hub / github.com/cretz/stackparam / get_stack_trace_depth

Function get_stack_trace_depth

src/native.rs:324–342  ·  view source on GitHub ↗
(jni_env: *mut JNIEnv, this: jobject)

Source from the content-addressed store, hash-verified

322}
323
324unsafe fn get_stack_trace_depth(jni_env: *mut JNIEnv, this: jobject) -> Result<jint, String> {
325 static mut STACK_DEPTH_METH: jmethodID = 0 as jmethodID;
326 static ONCE: Once = ONCE_INIT;
327 ONCE.call_once(|| {
328 let throwable_class = get_throwable_class(jni_env).unwrap_or(ptr::null_mut());
329 if !throwable_class.is_null() {
330 // We swallow exceptions in here on purpose
331 let meth_name_str = CString::new("getStackTraceDepth").unwrap();
332 let meth_sig_str = CString::new("()I").unwrap();
333 STACK_DEPTH_METH = (**jni_env).GetMethodID.unwrap()(jni_env,
334 throwable_class,
335 meth_name_str.as_ptr(),
336 meth_sig_str.as_ptr());
337 let _ = util::result_or_jni_ex((), jni_env);
338 }
339 });
340 if STACK_DEPTH_METH.is_null() { return Result::Err("No getStackTraceDepth method".to_string()); }
341 return util::result_or_jni_ex((**jni_env).CallIntMethod.unwrap()(jni_env, this, STACK_DEPTH_METH), jni_env)
342}
343
344#[no_mangle]
345#[allow(non_snake_case)]

Callers 1

populate_stack_paramsFunction · 0.85

Calls 2

get_throwable_classFunction · 0.85
result_or_jni_exFunction · 0.85

Tested by

no test coverage detected