[librsvg: 10/14] rsvg_css_parse_number_optional_number(): Don't copy the incoming string
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 10/14] rsvg_css_parse_number_optional_number(): Don't copy the incoming string
- Date: Wed, 24 Jan 2018 19:08:01 +0000 (UTC)
commit adb2e83b2af16655efdf0d40eefa72d7ea2e04d5
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jan 24 12:22:40 2018 -0600
rsvg_css_parse_number_optional_number(): Don't copy the incoming string
rust/src/parsers.rs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/rust/src/parsers.rs b/rust/src/parsers.rs
index 61c6c11..11b2899 100644
--- a/rust/src/parsers.rs
+++ b/rust/src/parsers.rs
@@ -9,6 +9,8 @@ use std::ptr;
use std::slice;
use std::str;
+use util::utf8_cstr;
+
#[derive(Debug, Clone, PartialEq)]
pub struct ParseError {
pub display: String
@@ -112,9 +114,9 @@ pub extern fn rsvg_css_parse_number_optional_number (s: *const libc::c_char,
assert! (!out_x.is_null ());
assert! (!out_y.is_null ());
- let string = unsafe { String::from_glib_none (s) };
+ let string = unsafe { utf8_cstr(s) };
- match number_optional_number (&string) {
+ match number_optional_number (string) {
Ok ((x, y)) => {
unsafe {
*out_x = x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]