]> Dogcows Code - chaz/openbox/blobdiff - obrender/color.c
Merge branch 'master' into chaz
[chaz/openbox] / obrender / color.c
index 5e3f2169bad9a1d6ace43eb649ba4cbf4413d058..221ebc40302153eb7a92d4eb938206dad6b68604 100644 (file)
@@ -81,7 +81,7 @@ RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b)
         xcol.green = (g << 8) | g;
         xcol.blue = (b << 8) | b;
         if (XAllocColor(RrDisplay(inst), RrColormap(inst), &xcol)) {
-            out = g_new(RrColor, 1);
+            out = g_slice_new(RrColor);
             out->inst = inst;
             out->r = xcol.red >> 8;
             out->g = xcol.green >> 8;
@@ -101,6 +101,11 @@ RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b)
     return out;
 }
 
+RrColor *RrColorCopy(RrColor* c)
+{
+    return RrColorNew(c->inst, c->r, c->g, c->b);
+}
+
 void RrColorFree(RrColor *c)
 {
     if (c) {
@@ -112,7 +117,7 @@ void RrColorFree(RrColor *c)
             if (c->pixel) XFreeColors(RrDisplay(c->inst), RrColormap(c->inst),
                                       &c->pixel, 1, 0);
             if (c->gc) XFreeGC(RrDisplay(c->inst), c->gc);
-            g_free(c);
+            g_slice_free(RrColor, c);
         }
     }
 }
This page took 0.028808 seconds and 4 git commands to generate.