[cairo-commit] 2 commits - src/cairo-freelist.c src/cairo-freelist-private.h src/cairo-surface-wrapper.c

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Tue Sep 1 13:32:01 PDT 2009


 src/cairo-freelist-private.h |   29 +++++++++++++++++++++++++++--
 src/cairo-freelist.c         |   29 -----------------------------
 src/cairo-surface-wrapper.c  |    2 +-
 3 files changed, 28 insertions(+), 32 deletions(-)

New commits:
commit 5a3fa29b370816acb3a08d60e4031ed82c1e4c73
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Tue Sep 1 20:57:01 2009 +0100

    [freelist] Make _cairo_freepool_alloc_from_new_pool static inline.
    
    The xlib boilerplate includes a cairo private header to be able
    to disable usage of the render extension.  This indirectly includes
    cairo-freelist-private.h which contains a bunch of static inline
    functions which use the private _cairo_freepool_alloc_from_new_pool
    function, but since that is not inline also, it causes an undefined
    extern which cannot be resolved.  The binutils linker doesn't care
    since the freelist function aren't actually used in the boilerplate
    but the Solaris linker does.  By making the .._alloc_from_new_pool
    function inline no dangling references are created and linking
    succeeds.

diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h
index d48a720..420fa33 100644
--- a/src/cairo-freelist-private.h
+++ b/src/cairo-freelist-private.h
@@ -22,6 +22,7 @@
 #ifndef CAIRO_FREELIST_H
 #define CAIRO_FREELIST_H
 
+#include "cairoint.h"
 #include "cairo-types-private.h"
 #include "cairo-compiler-private.h"
 
@@ -96,8 +97,32 @@ _cairo_freepool_init (cairo_freepool_t *freepool, unsigned nodesize);
 cairo_private void
 _cairo_freepool_fini (cairo_freepool_t *freepool);
 
-cairo_private void *
-_cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool);
+static inline void *
+_cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool)
+{
+    cairo_freelist_pool_t *pool;
+    int poolsize;
+
+    if (freepool->pools != &freepool->embedded_pool)
+	poolsize = 2 * freepool->pools->size;
+    else
+	poolsize = (128 * freepool->nodesize + 8191) & -8192;
+    pool = malloc (sizeof (cairo_freelist_pool_t) + poolsize);
+    if (unlikely (pool == NULL))
+	return pool;
+
+    pool->next = freepool->pools;
+    freepool->pools = pool;
+
+    pool->size = poolsize;
+    pool->rem = poolsize - freepool->nodesize;
+    pool->data = (uint8_t *) (pool + 1) + freepool->nodesize;
+
+    VG (VALGRIND_MAKE_MEM_NOACCESS (pool->data, poolsize));
+    VG (VALGRIND_MAKE_MEM_UNDEFINED (pool->data, freepool->nodesize));
+
+    return pool + 1;
+}
 
 static inline void *
 _cairo_freepool_alloc_from_pool (cairo_freepool_t *freepool)
diff --git a/src/cairo-freelist.c b/src/cairo-freelist.c
index 6277f90..e7f3ac2 100644
--- a/src/cairo-freelist.c
+++ b/src/cairo-freelist.c
@@ -20,8 +20,6 @@
  * OF THIS SOFTWARE.
  */
 
-#include "cairoint.h"
-
 #include "cairo-freelist-private.h"
 
 void
@@ -111,30 +109,3 @@ _cairo_freepool_fini (cairo_freepool_t *freepool)
     }
     VG (VALGRIND_MAKE_MEM_NOACCESS (freepool, sizeof (freepool)));
 }
-
-void *
-_cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool)
-{
-    cairo_freelist_pool_t *pool;
-    int poolsize;
-
-    if (freepool->pools != &freepool->embedded_pool)
-	poolsize = 2 * freepool->pools->size;
-    else
-	poolsize = (128 * freepool->nodesize + 8191) & -8192;
-    pool = malloc (sizeof (cairo_freelist_pool_t) + poolsize);
-    if (unlikely (pool == NULL))
-	return pool;
-
-    pool->next = freepool->pools;
-    freepool->pools = pool;
-
-    pool->size = poolsize;
-    pool->rem = poolsize - freepool->nodesize;
-    pool->data = (uint8_t *) (pool + 1) + freepool->nodesize;
-
-    VG (VALGRIND_MAKE_MEM_NOACCESS (pool->data, poolsize));
-    VG (VALGRIND_MAKE_MEM_UNDEFINED (pool->data, freepool->nodesize));
-
-    return pool + 1;
-}
commit 68c8eb955d6d16872c2fa488f0960b974611865d
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Mon Aug 31 23:57:20 2009 +0100

    [wrapper] Avoid a void return gccism.
    
    Returning void using the pattern "return func_returning_void(...)"
    is a gccism not supported by Sun Studio 12.

diff --git a/src/cairo-surface-wrapper.c b/src/cairo-surface-wrapper.c
index 413ad3e..7cb08db 100644
--- a/src/cairo-surface-wrapper.c
+++ b/src/cairo-surface-wrapper.c
@@ -461,7 +461,7 @@ void
 _cairo_surface_wrapper_get_font_options (cairo_surface_wrapper_t    *wrapper,
 					 cairo_font_options_t	    *options)
 {
-    return cairo_surface_get_font_options (wrapper->target, options);
+    cairo_surface_get_font_options (wrapper->target, options);
 }
 
 cairo_surface_t *


More information about the cairo-commit mailing list