[librsvg/wip/aruiz/rust-pixbuf-loader] pixbuf-loader: Avoid extra copy by turning slice into Bytes without to_vec()



commit 6fca02a9cd28227c14e2988447b5402040af6427
Author: Alberto Ruiz <aruiz redhat com>
Date:   Fri Aug 5 23:40:04 2022 +0100

    pixbuf-loader: Avoid extra copy by turning slice into Bytes without to_vec()

 gdk-pixbuf-loader/src/lib.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gdk-pixbuf-loader/src/lib.rs b/gdk-pixbuf-loader/src/lib.rs
index af94e6612..f1579ef26 100644
--- a/gdk-pixbuf-loader/src/lib.rs
+++ b/gdk-pixbuf-loader/src/lib.rs
@@ -64,8 +64,7 @@ unsafe extern "C" fn load_increment(
     let ctx = user_data as *mut SvgContext;
 
     let data = std::slice::from_raw_parts(buffer, size as usize);
-    let data = data.to_vec();
-    (&*ctx).stream.add_bytes(&Bytes::from_owned(data));
+    (&*ctx).stream.add_bytes(&Bytes::from(data));
     true.into_glib()
 }
 


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