[librsvg] Make a couple of unsafe calls nicer
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Make a couple of unsafe calls nicer
- Date: Fri, 28 Dec 2018 03:06:51 +0000 (UTC)
commit 83c9e5016fcfc650406fa5dc17b7df43e61a1877
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Dec 27 21:00:59 2018 -0600
Make a couple of unsafe calls nicer
Thanks to Sebastian Dröge for the suggestion.
rsvg_internals/src/handle.rs | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/rsvg_internals/src/handle.rs b/rsvg_internals/src/handle.rs
index fc8f7cd7..ece4cb41 100644
--- a/rsvg_internals/src/handle.rs
+++ b/rsvg_internals/src/handle.rs
@@ -234,11 +234,11 @@ impl Handle {
handle: *mut RsvgHandle,
node: &RsvgNode,
) -> Result<(RsvgRectangle, RsvgRectangle), ()> {
- let mut dimensions = unsafe { mem::zeroed() };
-
- unsafe {
+ let dimensions = unsafe {
+ let mut dimensions = mem::zeroed();
rsvg_handle_get_dimensions(handle, &mut dimensions);
- }
+ dimensions
+ };
if dimensions.width == 0 || dimensions.height == 0 {
return Err(());
@@ -397,11 +397,11 @@ impl Handle {
None
};
- let mut dimensions = unsafe { mem::zeroed() };
-
- unsafe {
+ let dimensions = unsafe {
+ let mut dimensions = mem::zeroed();
rsvg_handle_get_dimensions(handle, &mut dimensions);
- }
+ dimensions
+ };
if dimensions.width == 0 || dimensions.height == 0 {
return Err(RenderingError::SvgHasNoSize);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]