[cairo-commit] test/show-glyphs-many.c

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Tue Feb 10 09:03:31 PST 2009


 test/show-glyphs-many.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit fe40d3bdb0d0cb93169b935e44d14b15e014fa6d
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date:   Mon Feb 9 23:43:04 2009 -0500

    [test] Allocate glyph array with malloc
    
    Keeping it on the stack causes a stack overflow of Window's
    default 1mb stack.

diff --git a/test/show-glyphs-many.c b/test/show-glyphs-many.c
index 7276b07..497db58 100644
--- a/test/show-glyphs-many.c
+++ b/test/show-glyphs-many.c
@@ -109,7 +109,7 @@ get_glyph (cairo_t *cr, const char *utf8, cairo_glyph_t *glyph)
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
-    cairo_glyph_t glyphs[NUM_GLYPHS];
+    cairo_glyph_t *glyphs = malloc(NUM_GLYPHS * sizeof(cairo_glyph_t));
     const char *characters[] = { /* try to exercise different widths of index */
 	"m", /* Latin letter m, index=0x50 */
 	"μ", /* Greek letter mu, index=0x349 */
@@ -156,6 +156,8 @@ draw (cairo_t *cr, int width, int height)
 	glyphs[j] = glyphs[i];
 
     cairo_show_glyphs (cr, glyphs, NUM_GLYPHS);
+    
+    free(glyphs);
 
     return CAIRO_TEST_SUCCESS;
 }


More information about the cairo-commit mailing list