[librsvg: 8/14] rsvg_length_parse(): Don't copy the incoming string
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 8/14] rsvg_length_parse(): Don't copy the incoming string
- Date: Wed, 24 Jan 2018 19:07:51 +0000 (UTC)
commit 2ce259f973dbbfc73d5cdc6a9cb22dabd6d7294d
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jan 24 12:09:46 2018 -0600
rsvg_length_parse(): Don't copy the incoming string
rust/src/length.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/rust/src/length.rs b/rust/src/length.rs
index 54cf65b..63ad411 100644
--- a/rust/src/length.rs
+++ b/rust/src/length.rs
@@ -9,6 +9,7 @@ use drawing_ctx::RsvgDrawingCtx;
use parsers::Parse;
use parsers::ParseError;
use error::*;
+use util::utf8_cstr;
/* Keep this in sync with ../../rsvg-private.h:LengthUnit */
#[repr(C)]
@@ -79,7 +80,7 @@ fn compute_named_size (name: &str) -> f64 {
#[no_mangle]
pub extern fn rsvg_length_parse (string: *const libc::c_char, dir: LengthDir) -> RsvgLength {
- let my_string = unsafe { &String::from_glib_none (string) };
+ let my_string = unsafe { utf8_cstr(string) };
// FIXME: this ignores errors; propagate them upstream
RsvgLength::parse (my_string, dir).unwrap_or_else(|_| {RsvgLength::default ()})
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]