From: Dana Jansens Date: Sat, 19 May 2007 20:14:19 +0000 (+0000) Subject: save some malloc when possible X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=34ad5b92b4498e2f5de87d67e3b0a0e3eb67b4fb;p=chaz%2Fopenbox save some malloc when possible --- diff --git a/render/render.c b/render/render.c index b357f8a3..82e6f96e 100644 --- a/render/render.c +++ b/render/render.c @@ -42,7 +42,7 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) { gint i, transferred = 0, sw, sh, partial_w, partial_h; RrPixel32 *source, *dest; - Pixmap oldp; + Pixmap oldp = None; RrRect tarea; /* area in which to draw textures */ gboolean resized; @@ -77,8 +77,10 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) RrVisual(a->inst), RrColormap(a->inst)); g_assert(a->xftdraw != NULL); - g_free(a->surface.pixel_data); - a->surface.pixel_data = g_new(RrPixel32, w * h); + if (resized) { + g_free(a->surface.pixel_data); + a->surface.pixel_data = g_new(RrPixel32, w * h); + } if (a->surface.grad == RR_SURFACE_PARENTREL) { g_assert (a->surface.parent);