[librsvg: 6/14] rsvg_xml_space_normalize(): Don't copy the incoming string



commit 4852538426ad71291dac72c24c727f01ed4c1c09
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jan 24 11:17:06 2018 -0600

    rsvg_xml_space_normalize(): Don't copy the incoming string

 rust/src/space.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/space.rs b/rust/src/space.rs
index 788d57f..afbcd87 100644
--- a/rust/src/space.rs
+++ b/rust/src/space.rs
@@ -1,6 +1,7 @@
 use libc;
 use glib::translate::*;
 use itertools::Itertools;
+use util::utf8_cstr;
 
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq, Eq)]
@@ -68,9 +69,9 @@ fn normalize_preserve(s: &str) -> String {
 
 #[no_mangle]
 pub extern fn rsvg_xml_space_normalize(mode: XmlSpace, s: *const libc::c_char) -> *const libc::c_char {
-    let rs = unsafe { String::from_glib_none (s) };
+    let rs = unsafe { utf8_cstr(s) };
 
-    xml_space_normalize(mode, &rs).to_glib_full()
+    xml_space_normalize(mode, rs).to_glib_full()
 }
 
 #[cfg(test)]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]