]> Dogcows Code - chaz/openbox/commitdiff
initialize texture to NULL if theres no textures. use g_memdup to copy it
authorDana Jansens <danakj@orodu.net>
Wed, 19 Mar 2003 07:58:39 +0000 (07:58 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 19 Mar 2003 07:58:39 +0000 (07:58 +0000)
render/render.c

index 51c3a9beb4a8134b7e0466dae6692da10e552c5a..b048bcecd0448ae77372a042bc06220757811c39 100644 (file)
@@ -141,6 +141,7 @@ Appearance *appearance_new(SurfaceType type, int numtex)
   out->textures = numtex;
   out->xftdraw = NULL;
   if (numtex) out->texture = g_new(Texture, numtex);
+  else out->texture = NULL;
   out->pixmap = None;
 
   switch (type) {
@@ -191,10 +192,8 @@ Appearance *appearance_copy(Appearance *orig)
     break;
     }
     copy->textures = orig->textures;
-    if (orig->textures) {
-        copy->texture = malloc(orig->textures * sizeof(Texture));
-        memcpy(copy->texture, orig->texture, orig->textures * sizeof(Texture));
-    } else copy->texture = NULL;
+    copy->texture = g_memdup(orig->texture,
+                             orig->textures * sizeof(Texture));
     copy->pixmap = None;
     copy->xftdraw = NULL;
     return copy;
This page took 0.028219 seconds and 4 git commands to generate.