[librsvg] rsvg-filter.c: Avoid VLA Usage



commit 741b8d9e41520e0d6717ace0a36c4ca4a768b97b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Aug 12 18:04:36 2015 +0800

    rsvg-filter.c: Avoid VLA Usage
    
    In order to support building under Visual Studio and other C89 compilers,
    we need to avoid using VLAs, especially that VLAs are:
    
    -Most probably not going to be supported under any Visual Studio
    -It is now optional under C11, and there are concerns regarding its
     implementations in other C99-capable compilers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753555

 rsvg-filter.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/rsvg-filter.c b/rsvg-filter.c
index dfcdc20..83dcb4f 100644
--- a/rsvg-filter.c
+++ b/rsvg-filter.c
@@ -1336,8 +1336,9 @@ box_blur_line (gint box_width, gint even_offset,
     gint  output;  /* This marks the center of the kernel                    */
     gint  trail;   /* This marks the pixel BEHIND the last 1 in the
                       kernel; it's the pixel to remove from the accumulator. */
-    gint  ac[bpp]; /* Accumulator for each channel                           */
+    gint  *ac;     /* Accumulator for each channel                           */
 
+    ac = (gint *) g_malloc (sizeof (gint) * bpp);
 
     /* The algorithm differs for even and odd-sized kernels.
      * With the output at the center,
@@ -1452,6 +1453,8 @@ box_blur_line (gint box_width, gint even_offset,
         output++;
         trail++;
     }
+
+    g_free (ac);
 }
 
 static gint


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