[librsvg: 1/3] Drop temporary values earlier in SpecifiedValues::to_computed_values()




commit 9d4e465c750bfcaf0fb88d57cc9a8d4a9db16005
Author: Sebastian Dröge <sebastian centricular com>
Date:   Thu Feb 25 21:24:57 2021 +0200

    Drop temporary values earlier in SpecifiedValues::to_computed_values()
    
    The `prop_val` in each of the `compute!` expansions would previously
    only be dropped at the end of the function although it's only used
    inside the macro. To prevent that, add a new block inside the macro to
    have it dropped at the end of each macro expansion.
    
    Maybe fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/686

 src/properties.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/properties.rs b/src/properties.rs
index aeb153d2..a0cc2886 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -549,7 +549,7 @@ impl SpecifiedValues {
 
     pub fn to_computed_values(&self, computed: &mut ComputedValues) {
         macro_rules! compute {
-            ($name:ident, $field:ident) => {
+            ($name:ident, $field:ident) => {{
                 let prop_val = self.get_property(PropertyId::$name);
                 if let ParsedProperty::$name(s) = prop_val {
                     computed.set_value(ComputedValue::$name(
@@ -558,7 +558,7 @@ impl SpecifiedValues {
                 } else {
                     unreachable!();
                 }
-            };
+            }};
         }
 
         // First, compute font_size.  It needs to be done before everything


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