diff --git a/glib/src/regex.rs b/glib/src/regex.rs index 910f45e5156f..f5cac2d73809 100644 --- a/glib/src/regex.rs +++ b/glib/src/regex.rs @@ -12,13 +12,12 @@ impl Regex { replacement: &str, match_options: RegexMatchFlags, ) -> Result { - let string_len = string.len() as _; unsafe { let mut error = ptr::null_mut(); let ret = ffi::g_regex_replace( self.to_glib_none().0, - string.to_glib_none().0, - string_len, + string.as_ptr() as *const _, + string.len() as _, start_position, replacement.to_glib_none().0, match_options.into_glib(), @@ -39,14 +38,13 @@ impl Regex { start_position: i32, match_options: RegexMatchFlags, ) -> Result { - let string_len = string.len() as _; unsafe { let mut match_info = ptr::null_mut(); let mut error = ptr::null_mut(); let is_ok = ffi::g_regex_match_all_full( self.to_glib_none().0, - string.to_glib_none().0, - string_len, + string.as_ptr() as *const _, + string.len() as _, start_position, match_options.into_glib(), &mut match_info, @@ -68,14 +66,13 @@ impl Regex { start_position: i32, match_options: RegexMatchFlags, ) -> Result { - let string_len = string.len() as _; unsafe { let mut match_info = ptr::null_mut(); let mut error = ptr::null_mut(); let is_ok = ffi::g_regex_match_full( self.to_glib_none().0, - string.to_glib_none().0, - string_len, + string.as_ptr() as *const _, + string.len() as _, start_position, match_options.into_glib(), &mut match_info, @@ -98,13 +95,12 @@ impl Regex { replacement: &str, match_options: RegexMatchFlags, ) -> Result { - let string_len = string.len() as _; unsafe { let mut error = ptr::null_mut(); let ret = ffi::g_regex_replace_literal( self.to_glib_none().0, - string.to_glib_none().0, - string_len, + string.as_ptr() as *const _, + string.len() as _, start_position, replacement.to_glib_none().0, match_options.into_glib(), @@ -126,13 +122,12 @@ impl Regex { match_options: RegexMatchFlags, max_tokens: i32, ) -> Result, crate::Error> { - let string_len = string.len() as _; unsafe { let mut error = ptr::null_mut(); let ret = ffi::g_regex_split_full( self.to_glib_none().0, - string.to_glib_none().0, - string_len, + string.as_ptr() as *const _, + string.len() as _, start_position, match_options.into_glib(), max_tokens,