[librsvg: 9/14] rsvg_parse_transform(): Don't copy the incoming string



commit 10bad9ce83aabb5062a8003371802a0109c1bb2a
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jan 24 12:18:36 2018 -0600

    rsvg_parse_transform(): Don't copy the incoming string

 rust/src/transform.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/transform.rs b/rust/src/transform.rs
index 82038ce..edb4218 100644
--- a/rust/src/transform.rs
+++ b/rust/src/transform.rs
@@ -10,6 +10,7 @@ use cssparser::{Parser, ParserInput, Token, ParseError as CssParseError};
 
 use error::*;
 use parsers::{Parse, ParseError, optional_comma};
+use util::utf8_cstr;
 
 impl Parse for cairo::Matrix {
     type Data = ();
@@ -195,10 +196,10 @@ pub extern fn rsvg_parse_transform (out_matrix: *mut cairo::Matrix, s: *const li
     assert! (!out_matrix.is_null ());
     assert! (!s.is_null ());
 
-    let string = unsafe { String::from_glib_none (s) };
+    let string = unsafe { utf8_cstr(s) };
     let matrix: &mut cairo::Matrix = unsafe { &mut *out_matrix };
 
-    match parse_transform (&string) {
+    match parse_transform (string) {
         Ok (m) => {
             *matrix = m;
             true.to_glib ()


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