From 4e32c704d4e78948649283633c09d17cd19b1ef4 Mon Sep 17 00:00:00 2001 From: Marcin Radomski Date: Mon, 20 Jan 2025 13:10:13 +0000 Subject: [PATCH] Add __android_log_is_loggable_len A variant of __android_log_is_loggable that allows passing non-null-terminated tag, avoiding the need for allocating a temporary buffer when called from android_logger. The function is available since Android API 30 [1], the same as __android_log_write_log_message that's already present in the code. [1] https://cs.android.com/android/platform/superproject/main/+/main:system/logging/liblog/include/android/log.h;l=358 --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b648ed5..05edf83 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,6 +13,8 @@ pub type c_va_list = raw::c_void; pub type c_int = raw::c_int; #[allow(non_camel_case_types)] pub type c_char = raw::c_char; +#[allow(non_camel_case_types)] +pub type c_size_t = raw::c_ulong; // automatically generated by rust-bindgen @@ -89,5 +91,10 @@ extern "C" { tag: *const c_char, default_prio: c_int) -> c_int; + pub fn __android_log_is_loggable_len(prio: c_int, + tag: *const c_char, + size: c_size_t, + default_prio: c_int) + -> c_int; pub fn __android_log_write_log_message(log_message: *mut __android_log_message); }