[librsvg: 6/7] rsvg_css_parse_number_list(): Copy the array with copy_from_slice(), not manually



commit 23fb47e93335ce885187be7fcc0e884c8c5bfc7e
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 20 18:00:24 2017 -0500

    rsvg_css_parse_number_list(): Copy the array with copy_from_slice(), not manually

 rust/src/parsers.rs |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/rust/src/parsers.rs b/rust/src/parsers.rs
index 548936e..1d84709 100644
--- a/rust/src/parsers.rs
+++ b/rust/src/parsers.rs
@@ -286,9 +286,7 @@ pub extern fn rsvg_css_parse_number_list (in_str:   *const libc::c_char,
 
             let mut array = unsafe { slice::from_raw_parts_mut (c_array, num_elems) };
 
-            for (i, v) in number_list.into_iter ().enumerate () {
-                array[i] = v;
-            }
+            array.copy_from_slice (&number_list);
 
             unsafe {
                 *out_list = c_array;


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