[cogl/wip/public-atlas-apis: 5/9] Tightly integrate ulib (was eglib)



commit 9b62c340d91d2796840e0877d6a60b8fb14d0744
Author: Robert Bragg <robert linux intel com>
Date:   Sat Feb 22 03:02:44 2014 +0000

    Tightly integrate ulib (was eglib)
    
    Instead of maintaining optional support for using deps/eglib instead of
    glib we now always use this code. This way the code is always being
    tested so we are less likely to break support for building Cogl without
    glib, and because the api no longer needs to be swappable we are free to
    make Cogl specific changes to the api.
    
    So that we can still support glib integration the eglib library has been
    renamed to ulib and symbols are prefixed with 'u_' or 'U_' so that they
    don't clash with glib.
    
    GLib integration for GError and GType continues to be supported.

 cogl-gst/Makefile.am                               |    5 +-
 cogl-gst/cogl-gst-video-sink.c                     |    4 +-
 cogl-pango/Makefile.am                             |    5 +-
 cogl-pango/cogl-pango-glyph-cache.c                |    4 +-
 cogl-pango/cogl-pango-render.c                     |    2 +-
 cogl-path/Makefile.am                              |    5 +-
 cogl-path/cogl-path-private.h                      |    2 +-
 cogl-path/cogl-path.c                              |   88 +-
 cogl-path/tesselator/memalloc.h                    |   12 +-
 cogl/Makefile.am                                   |    6 +-
 cogl/cogl-atlas-texture-private.h                  |    4 +-
 cogl/cogl-atlas-texture.c                          |   28 +-
 cogl/cogl-atlas.c                                  |   50 +-
 cogl/cogl-atlas.h                                  |   12 +-
 cogl/cogl-attribute-buffer.c                       |    4 +-
 cogl/cogl-attribute.c                              |   54 +-
 cogl/cogl-bitmap-conversion.c                      |   20 +-
 cogl/cogl-bitmap-packing.h                         |    4 +-
 cogl/cogl-bitmap-pixbuf.c                          |   14 +-
 cogl/cogl-bitmap-private.h                         |    4 +-
 cogl/cogl-bitmap.c                                 |   26 +-
 cogl/cogl-bitmask.c                                |  102 +-
 cogl/cogl-bitmask.h                                |   12 +-
 cogl/cogl-blend-string.c                           |   72 +-
 cogl/cogl-blend-string.h                           |    2 +-
 cogl/cogl-blit.c                                   |   16 +-
 cogl/cogl-blit.h                                   |    4 +-
 cogl/cogl-boxed-value.c                            |   18 +-
 cogl/cogl-boxed-value.h                            |    6 +-
 cogl/cogl-buffer-private.h                         |    2 +-
 cogl/cogl-buffer.c                                 |   22 +-
 cogl/cogl-clip-stack.c                             |   12 +-
 cogl/cogl-clip-stack.h                             |    2 +-
 cogl/cogl-closure-list-private.h                   |    8 +-
 cogl/cogl-closure-list.c                           |    6 +-
 cogl/cogl-clutter.c                                |    2 +-
 cogl/cogl-color-private.h                          |    2 +-
 cogl/cogl-color.c                                  |    8 +-
 cogl/cogl-color.h                                  |    4 +-
 cogl/cogl-config.c                                 |    8 +-
 cogl/cogl-context-private.h                        |   32 +-
 cogl/cogl-context.c                                |   82 +-
 cogl/cogl-debug.c                                  |   34 +-
 cogl/cogl-debug.h                                  |   20 +-
 cogl/cogl-display.c                                |    6 +-
 cogl/cogl-error-private.h                          |    8 +-
 cogl/cogl-error.c                                  |   41 +-
 cogl/cogl-error.h                                  |    4 +-
 cogl/cogl-euler.c                                  |    6 +-
 cogl/cogl-feature-private.c                        |   22 +-
 cogl/cogl-feature-private.h                        |    2 +-
 cogl/cogl-fence.c                                  |    6 +-
 cogl/cogl-flags.h                                  |   10 +-
 cogl/cogl-frame-info.c                             |    4 +-
 cogl/cogl-frame-info.h                             |    6 +-
 cogl/cogl-framebuffer-private.h                    |    4 +-
 cogl/cogl-framebuffer.c                            |   48 +-
 cogl/cogl-gles2-context-private.h                  |   12 +-
 cogl/cogl-gles2-context.c                          |  156 ++--
 cogl/cogl-glib-source.c                            |   24 +-
 cogl/cogl-glib-source.h                            |   10 +-
 cogl/cogl-glsl-shader.c                            |   24 +-
 cogl/cogl-glx-renderer-private.h                   |    6 +-
 cogl/cogl-gpu-info.c                               |   12 +-
 cogl/cogl-index-buffer.c                           |    6 +-
 cogl/cogl-indices.c                                |   18 +-
 cogl/cogl-journal-private.h                        |    4 +-
 cogl/cogl-journal.c                                |  154 ++--
 cogl/cogl-magazine-private.h                       |    4 +-
 cogl/cogl-magazine.c                               |    6 +-
 cogl/cogl-matrix-private.h                         |    6 +-
 cogl/cogl-matrix-stack.c                           |   58 +-
 cogl/cogl-matrix.c                                 |   16 +-
 cogl/cogl-memory-stack-private.h                   |    2 +-
 cogl/cogl-memory-stack.c                           |   16 +-
 cogl/cogl-object-private.h                         |   16 +-
 cogl/cogl-object.c                                 |   34 +-
 cogl/cogl-object.h                                 |    2 +-
 cogl/cogl-onscreen-private.h                       |    4 +-
 cogl/cogl-onscreen-template.c                      |    4 +-
 cogl/cogl-onscreen.c                               |   28 +-
 cogl/cogl-output.c                                 |   16 +-
 cogl/cogl-pipeline-cache.c                         |   24 +-
 cogl/cogl-pipeline-debug.c                         |   64 +-
 cogl/cogl-pipeline-hash-table.c                    |   42 +-
 cogl/cogl-pipeline-hash-table.h                    |    2 +-
 cogl/cogl-pipeline-layer-private.h                 |    2 +-
 cogl/cogl-pipeline-layer-state.c                   |   20 +-
 cogl/cogl-pipeline-layer.c                         |   34 +-
 cogl/cogl-pipeline-private.h                       |   12 +-
 cogl/cogl-pipeline-snippet-private.h               |    8 +-
 cogl/cogl-pipeline-snippet.c                       |   68 +-
 cogl/cogl-pipeline-state.c                         |   48 +-
 cogl/cogl-pipeline.c                               |  106 +-
 cogl/cogl-pixel-buffer-private.h                   |    2 +-
 cogl/cogl-pixel-buffer.c                           |    6 +-
 cogl/cogl-point-in-poly-private.h                  |    2 +-
 cogl/cogl-point-in-poly.c                          |    2 +-
 cogl/cogl-poll.c                                   |   34 +-
 cogl/cogl-primitive-texture.c                      |    2 +-
 cogl/cogl-primitive.c                              |   24 +-
 cogl/cogl-primitives-private.h                     |    2 +-
 cogl/cogl-primitives.c                             |    8 +-
 cogl/cogl-profile.c                                |   10 +-
 cogl/cogl-profile.h                                |   10 +-
 cogl/cogl-quaternion-private.h                     |    2 +-
 cogl/cogl-quaternion.c                             |   12 +-
 cogl/cogl-rectangle-map.c                          |   66 +-
 cogl/cogl-rectangle-map.h                          |    4 +-
 cogl/cogl-renderer-private.h                       |   14 +-
 cogl/cogl-renderer.c                               |   88 +-
 cogl/cogl-sampler-cache.c                          |   36 +-
 cogl/cogl-snippet-private.h                        |    2 +-
 cogl/cogl-snippet.c                                |   30 +-
 cogl/cogl-spans.c                                  |    4 +-
 cogl/cogl-sub-texture-private.h                    |    2 +-
 cogl/cogl-sub-texture.c                            |    2 +-
 cogl/cogl-texture-2d-sliced-private.h              |    8 +-
 cogl/cogl-texture-2d-sliced.c                      |  112 +-
 cogl/cogl-texture-2d.c                             |    4 +-
 cogl/cogl-texture-3d.c                             |    6 +-
 cogl/cogl-texture-private.h                        |    4 +-
 cogl/cogl-texture-rectangle.c                      |   12 +-
 cogl/cogl-texture.c                                |   28 +-
 cogl/cogl-util.c                                   |   22 +-
 cogl/cogl-util.h                                   |    8 +-
 cogl/cogl-vector.c                                 |   10 +-
 cogl/cogl-xlib-renderer.c                          |   44 +-
 cogl/cogl.c                                        |   10 +-
 cogl/driver/gl/cogl-attribute-gl.c                 |   12 +-
 cogl/driver/gl/cogl-buffer-gl.c                    |    4 +-
 cogl/driver/gl/cogl-clip-stack-gl.c                |    2 +-
 cogl/driver/gl/cogl-framebuffer-gl.c               |   38 +-
 cogl/driver/gl/cogl-pipeline-fragend-fixed.c       |   12 +-
 cogl/driver/gl/cogl-pipeline-fragend-glsl.c        |  182 ++--
 cogl/driver/gl/cogl-pipeline-opengl.c              |   66 +-
 cogl/driver/gl/cogl-pipeline-progend-fixed.c       |    2 +-
 cogl/driver/gl/cogl-pipeline-progend-glsl.c        |   72 +-
 cogl/driver/gl/cogl-pipeline-vertend-glsl.c        |   76 +-
 cogl/driver/gl/cogl-texture-2d-gl.c                |    8 +-
 cogl/driver/gl/cogl-util-gl-private.h              |   12 +-
 cogl/driver/gl/cogl-util-gl.c                      |    4 +-
 cogl/driver/gl/gl/cogl-driver-gl.c                 |   14 +-
 cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c    |  104 +-
 .../gl/gl/cogl-pipeline-progend-fixed-arbfp.c      |    2 +-
 cogl/driver/gl/gl/cogl-texture-driver-gl.c         |    2 +-
 cogl/driver/gl/gles/cogl-driver-gles.c             |   14 +-
 cogl/driver/gl/gles/cogl-texture-driver-gles.c     |    6 +-
 cogl/driver/nop/cogl-framebuffer-nop.c             |    2 +-
 cogl/winsys/cogl-texture-pixmap-x11.c              |   18 +-
 cogl/winsys/cogl-winsys-egl-android.c              |    8 +-
 cogl/winsys/cogl-winsys-egl-gdl.c                  |   10 +-
 cogl/winsys/cogl-winsys-egl-kms.c                  |  112 +-
 cogl/winsys/cogl-winsys-egl-null.c                 |    8 +-
 cogl/winsys/cogl-winsys-egl-wayland.c              |   26 +-
 cogl/winsys/cogl-winsys-egl-x11.c                  |   24 +-
 cogl/winsys/cogl-winsys-egl.c                      |   44 +-
 cogl/winsys/cogl-winsys-glx.c                      |   88 +-
 cogl/winsys/cogl-winsys-sdl.c                      |   14 +-
 cogl/winsys/cogl-winsys-sdl2.c                     |   30 +-
 cogl/winsys/cogl-winsys-stub.c                     |    8 +-
 cogl/winsys/cogl-winsys-wgl.c                      |   46 +-
 cogl/winsys/cogl-winsys.c                          |    4 +-
 configure.ac                                       |   14 +-
 deps/Makefile.am                                   |    6 +-
 deps/eglib/README                                  |   30 -
 deps/eglib/src/Makefile.am                         |   83 --
 deps/eglib/src/eglib-config.h.in                   |   19 -
 deps/eglib/src/eglib-config.hw                     |   76 --
 deps/eglib/src/glib.h                              | 1303 --------------------
 deps/eglib/src/gmodule.h                           |   37 -
 deps/eglib/test/endian.c                           |   38 -
 deps/eglib/test/list.c                             |  438 -------
 deps/eglib/test/unicode.c                          |   99 --
 deps/{eglib => ulib}/.gitignore                    |    0
 deps/{eglib => ulib}/Makefile.am                   |    0
 deps/{eglib => ulib}/src/.gitignore                |    0
 deps/ulib/src/Makefile.am                          |   83 ++
 deps/{eglib => ulib}/src/sort.frag.h               |   10 +-
 deps/{eglib/src/garray.c => ulib/src/uarray.c}     |  118 +-
 .../src/gbytearray.c => ulib/src/ubytearray.c}     |   36 +-
 .../src/gdate-unix.c => ulib/src/udate-unix.c}     |    8 +-
 .../src/gdate-win32.c => ulib/src/udate-win32.c}   |   10 +-
 .../src/gdebugkey.c => ulib/src/udebugkey.c}       |   26 +-
 .../src/gdir-unix.c => ulib/src/udir-unix.c}       |   54 +-
 .../src/gdir-win32.c => ulib/src/udir-win32.c}     |   74 +-
 deps/{eglib/src/gerror.c => ulib/src/uerror.c}     |   50 +-
 .../src/gfile-posix.c => ulib/src/ufile-posix.c}   |   80 +-
 .../src/gfile-unix.c => ulib/src/ufile-unix.c}     |   18 +-
 .../src/gfile-win32.c => ulib/src/ufile-win32.c}   |   28 +-
 deps/{eglib/src/gfile.c => ulib/src/ufile.c}       |   92 +-
 .../src/ghashtable.c => ulib/src/uhashtable.c}     |  314 +++---
 .../src/ghooklist.c => ulib/src/uhooklist.c}       |   52 +-
 deps/{eglib/src/giconv.c => ulib/src/uiconv.c}     |  342 +++---
 deps/ulib/src/ulib-config.h.in                     |   19 +
 deps/ulib/src/ulib-config.hw                       |   76 ++
 deps/ulib/src/ulib.h                               | 1285 +++++++++++++++++++
 deps/{eglib/src/glist.c => ulib/src/ulist.c}       |  160 ++--
 deps/{eglib/src/gmem.c => ulib/src/umem.c}         |   40 +-
 .../src/gmisc-unix.c => ulib/src/umisc-unix.c}     |   56 +-
 .../src/gmisc-win32.c => ulib/src/umisc-win32.c}   |   96 +-
 .../src/gmodule-unix.c => ulib/src/umodule-unix.c} |  156 ++--
 .../gmodule-win32.c => ulib/src/umodule-win32.c}   |   76 +-
 deps/ulib/src/umodule.h                            |   37 +
 deps/{eglib => ulib}/src/unicode-data.h            |   92 +-
 deps/{eglib/src/goutput.c => ulib/src/uoutput.c}   |   72 +-
 deps/{eglib/src/gpath.c => ulib/src/upath.c}       |  124 +-
 .../src/gptrarray.c => ulib/src/uptrarray.c}       |  142 ++--
 deps/{eglib/src/gqsort.c => ulib/src/uqsort.c}     |    4 +-
 deps/{eglib/src/gquark.c => ulib/src/uquark.c}     |   24 +-
 deps/{eglib/src/gqueue.c => ulib/src/uqueue.c}     |   92 +-
 deps/{eglib/src/gshell.c => ulib/src/ushell.c}     |  148 ++--
 deps/{eglib/src/gslist.c => ulib/src/uslist.c}     |  168 ++--
 deps/{eglib/src/gspawn.c => ulib/src/uspawn.c}     |  152 ++--
 deps/{eglib/src/gstr.c => ulib/src/ustr.c}         |  400 +++---
 deps/{eglib/src/gstring.c => ulib/src/ustring.c}   |  174 ++--
 .../src/gtimer-unix.c => ulib/src/utimer-unix.c}   |   36 +-
 .../src/gtimer-win32.c => ulib/src/utimer-win32.c} |   42 +-
 deps/{eglib/src/gunicode.c => ulib/src/uunicode.c} |  128 +-
 deps/{eglib/src/gutf8.c => ulib/src/uutf8.c}       |  116 +-
 deps/{eglib => ulib}/src/vasprintf.c               |    0
 deps/{eglib => ulib}/test/.gitignore               |    0
 deps/{eglib => ulib}/test/Makefile.am              |   14 +-
 deps/{eglib => ulib}/test/README                   |    2 +-
 deps/{eglib => ulib}/test/UTF-16BE.txt             |  Bin 15242 -> 15242 bytes
 deps/{eglib => ulib}/test/UTF-16LE.txt             |  Bin 15242 -> 15242 bytes
 deps/{eglib => ulib}/test/UTF-32BE.txt             |  Bin 30484 -> 30484 bytes
 deps/{eglib => ulib}/test/UTF-32LE.txt             |  Bin 30484 -> 30484 bytes
 deps/{eglib => ulib}/test/UTF-8.txt                |    0
 deps/{eglib => ulib}/test/array.c                  |   94 +-
 deps/{eglib => ulib}/test/dir.c                    |   30 +-
 deps/{eglib => ulib}/test/driver.c                 |   62 +-
 deps/ulib/test/endian.c                            |   38 +
 deps/{eglib => ulib}/test/fake.c                   |    0
 deps/{eglib => ulib}/test/file.c                   |  132 +-
 deps/{eglib => ulib}/test/hashtable.c              |  106 +-
 deps/ulib/test/list.c                              |  438 +++++++
 deps/{eglib => ulib}/test/memory.c                 |   24 +-
 deps/{eglib => ulib}/test/module.c                 |   26 +-
 deps/{eglib => ulib}/test/path.c                   |  226 ++--
 deps/{eglib => ulib}/test/ptrarray.c               |  182 ++--
 deps/{eglib => ulib}/test/queue.c                  |   64 +-
 deps/{eglib => ulib}/test/shell.c                  |  106 +-
 deps/{eglib => ulib}/test/sizes.c                  |   46 +-
 deps/{eglib => ulib}/test/slist.c                  |  190 ++--
 deps/{eglib => ulib}/test/spawn.c                  |   48 +-
 deps/{eglib => ulib}/test/string-util.c            |  322 +++---
 deps/{eglib => ulib}/test/string.c                 |  112 +-
 deps/{eglib => ulib}/test/test-both                |   10 +-
 deps/{eglib => ulib}/test/test.c                   |  100 +-
 deps/{eglib => ulib}/test/test.h                   |   24 +-
 deps/{eglib => ulib}/test/tests.h                  |    0
 deps/{eglib => ulib}/test/timer.c                  |   24 +-
 deps/ulib/test/unicode.c                           |   99 ++
 deps/{eglib => ulib}/test/utf8.c                   |  564 +++++-----
 deps/{eglib => ulib}/test/whats-implemented        |    0
 deps/{eglib => ulib}/winconfig.h                   |    0
 examples/Makefile.am                               |   11 +-
 examples/cogl-crate.c                              |    2 +-
 examples/cogl-point-sprites.c                      |    4 +-
 test-fixtures/Makefile.am                          |    6 +-
 test-fixtures/test-utils.h                         |    2 +-
 tests/conform/Makefile.am                          |    6 +-
 tests/conform/test-alpha-test.c                    |    2 +-
 tests/conform/test-alpha-textures.c                |    2 +-
 tests/conform/test-atlas-migration.c               |    6 +-
 tests/conform/test-backface-culling.c              |    4 +-
 tests/conform/test-blend-strings.c                 |   26 +-
 tests/conform/test-color-hsl.c                     |    2 +-
 tests/conform/test-color-mask.c                    |    2 +-
 tests/conform/test-conform-main.c                  |   10 +-
 tests/conform/test-copy-replace-texture.c          |    8 +-
 tests/conform/test-custom-attributes.c             |   18 +-
 tests/conform/test-depth-test.c                    |    2 +-
 tests/conform/test-euler-quaternion.c              |    2 +-
 tests/conform/test-fence.c                         |    2 +-
 tests/conform/test-gles2-context.c                 |   10 +-
 tests/conform/test-just-vertex-shader.c            |    2 +-
 tests/conform/test-layer-remove.c                  |    2 +-
 tests/conform/test-map-buffer-range.c              |    2 +-
 tests/conform/test-materials.c                     |    2 +-
 tests/conform/test-multitexture.c                  |    6 +-
 tests/conform/test-npot-texture.c                  |   12 +-
 tests/conform/test-object.c                        |    2 +-
 tests/conform/test-offscreen.c                     |    2 +-
 tests/conform/test-path-clip.c                     |    2 +-
 tests/conform/test-path.c                          |    2 +-
 tests/conform/test-pipeline-cache-unrefs-texture.c |    2 +-
 tests/conform/test-pipeline-uniforms.c             |    2 +-
 tests/conform/test-pixel-buffer.c                  |   10 +-
 tests/conform/test-point-size-attribute.c          |    6 +-
 tests/conform/test-point-size.c                    |    2 +-
 tests/conform/test-point-sprite.c                  |    2 +-
 tests/conform/test-premult.c                       |   32 +-
 tests/conform/test-primitive-and-journal.c         |    4 +-
 tests/conform/test-primitive.c                     |    4 +-
 tests/conform/test-read-texture-formats.c          |    2 +-
 tests/conform/test-readpixels.c                    |   10 +-
 tests/conform/test-snippets.c                      |    4 +-
 tests/conform/test-sparse-pipeline.c               |    2 +-
 tests/conform/test-sub-texture.c                   |   14 +-
 tests/conform/test-texture-3d.c                    |    8 +-
 tests/conform/test-texture-get-set-data.c          |    2 +-
 tests/conform/test-texture-mipmap-get-set.c        |    6 +-
 tests/conform/test-texture-mipmaps.c               |    4 +-
 tests/conform/test-texture-no-allocate.c           |    2 +-
 tests/conform/test-texture-pixmap-x11.c            |    6 +-
 tests/conform/test-texture-rectangle.c             |   10 +-
 tests/conform/test-version.c                       |    2 +-
 tests/conform/test-viewport.c                      |    6 +-
 tests/conform/test-wrap-modes.c                    |    8 +-
 tests/conform/test-write-texture-formats.c         |    2 +-
 tests/micro-perf/Makefile.am                       |    5 +-
 tests/micro-perf/test-journal.c                    |    2 +-
 tests/unit/Makefile.am                             |    6 +-
 tests/unit/test-unit-main.c                        |    4 +-
 316 files changed, 7304 insertions(+), 7332 deletions(-)
---
diff --git a/cogl-gst/Makefile.am b/cogl-gst/Makefile.am
index d5e49ae..b1409e7 100644
--- a/cogl-gst/Makefile.am
+++ b/cogl-gst/Makefile.am
@@ -20,7 +20,8 @@ lib_LTLIBRARIES = libcogl-gst.la
 
 libcogl_gst_la_SOURCES = $(source_c) $(source_h)
 libcogl_gst_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
-libcogl_gst_la_LIBADD = $(top_builddir)/cogl/libcogl2.la
+libcogl_gst_la_LIBADD = $(top_builddir)/deps/ulib/src/libulib.la
+libcogl_gst_la_LIBADD += $(top_builddir)/cogl/libcogl2.la
 libcogl_gst_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
 libcogl_gst_la_LDFLAGS = \
        -export-dynamic \
@@ -32,6 +33,8 @@ libcogl_gst_la_LDFLAGS = \
 AM_CPPFLAGS = \
        -DCOGL_COMPILATION              \
        -DG_LOG_DOMAIN=\"CoglGst\"      \
+       -I$(top_srcdir)/deps/ulib/src   \
+       -I$(top_builddir)/deps/ulib/src \
        -I$(top_srcdir)/cogl            \
        -I$(top_builddir)/cogl          \
        -I$(top_srcdir)/cogl/winsys     \
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 5db660f..dbbeb98 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -197,7 +197,7 @@ cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink,
   CoglGstVideoSinkPrivate *priv = sink->priv;
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (priv->frame); i++)
+  for (i = 0; i < U_N_ELEMENTS (priv->frame); i++)
     if (priv->frame[i] != NULL)
       cogl_pipeline_set_layer_texture (pln, i + priv->custom_start,
                                        priv->frame[i]);
@@ -407,7 +407,7 @@ clear_frame_textures (CoglGstVideoSink *sink)
   CoglGstVideoSinkPrivate *priv = sink->priv;
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (priv->frame); i++)
+  for (i = 0; i < U_N_ELEMENTS (priv->frame); i++)
     {
       if (priv->frame[i] == NULL)
         break;
diff --git a/cogl-pango/Makefile.am b/cogl-pango/Makefile.am
index fd3e9db..70bf362 100644
--- a/cogl-pango/Makefile.am
+++ b/cogl-pango/Makefile.am
@@ -28,7 +28,8 @@ lib_LTLIBRARIES = libcogl-pango2.la
 
 libcogl_pango2_la_SOURCES = $(source_c) $(source_h) $(source_h_priv)
 libcogl_pango2_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_PANGO_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) 
$(MAINTAINER_CFLAGS)
-libcogl_pango2_la_LIBADD = $(top_builddir)/cogl/libcogl2.la
+libcogl_pango2_la_LIBADD = $(top_builddir)/deps/ulib/src/libulib.la
+libcogl_pango2_la_LIBADD += $(top_builddir)/cogl/libcogl2.la
 libcogl_pango2_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_PANGO_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
 libcogl_pango2_la_LDFLAGS = \
        -export-dynamic \
@@ -39,6 +40,8 @@ libcogl_pango2_la_LDFLAGS = \
 AM_CPPFLAGS = \
        -DCOGL_COMPILATION              \
        -DG_LOG_DOMAIN=\"CoglPango\"    \
+       -I$(top_srcdir)/deps/ulib/src   \
+       -I$(top_builddir)/deps/ulib/src \
        -I$(top_srcdir)/cogl            \
        -I$(top_builddir)/cogl          \
        -I$(top_srcdir)/cogl/winsys     \
diff --git a/cogl-pango/cogl-pango-glyph-cache.c b/cogl-pango/cogl-pango-glyph-cache.c
index 6659ed2..04d1e45 100644
--- a/cogl-pango/cogl-pango-glyph-cache.c
+++ b/cogl-pango/cogl-pango-glyph-cache.c
@@ -132,8 +132,8 @@ cogl_pango_glyph_cache_new (CoglContext *ctx,
   cache->hash_table = g_hash_table_new_full
     (cogl_pango_glyph_cache_hash_func,
      cogl_pango_glyph_cache_equal_func,
-     (GDestroyNotify) cogl_pango_glyph_cache_key_free,
-     (GDestroyNotify) cogl_pango_glyph_cache_value_free);
+     (UDestroyNotify) cogl_pango_glyph_cache_key_free,
+     (UDestroyNotify) cogl_pango_glyph_cache_value_free);
 
   cache->atlases = NULL;
   g_hook_list_init (&cache->reorganize_callbacks, sizeof (GHook));
diff --git a/cogl-pango/cogl-pango-render.c b/cogl-pango/cogl-pango-render.c
index c290734..4cb9e41 100644
--- a/cogl-pango/cogl-pango-render.c
+++ b/cogl-pango/cogl-pango-render.c
@@ -384,7 +384,7 @@ cogl_pango_show_layout (CoglFramebuffer *fb,
       g_object_set_qdata_full (G_OBJECT (layout),
                                cogl_pango_layout_get_qdata_key (),
                                qdata,
-                               (GDestroyNotify)
+                               (UDestroyNotify)
                                cogl_pango_render_qdata_destroy);
     }
 
diff --git a/cogl-path/Makefile.am b/cogl-path/Makefile.am
index de7517e..b4d4f53 100644
--- a/cogl-path/Makefile.am
+++ b/cogl-path/Makefile.am
@@ -57,7 +57,8 @@ lib_LTLIBRARIES = libcogl-path.la
 
 libcogl_path_la_SOURCES = $(source_c) $(source_h)
 libcogl_path_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
-libcogl_path_la_LIBADD = $(top_builddir)/cogl/libcogl2.la
+libcogl_path_la_LIBADD = $(top_builddir)/deps/ulib/src/libulib.la
+libcogl_path_la_LIBADD += $(top_builddir)/cogl/libcogl2.la
 libcogl_path_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
 libcogl_path_la_LDFLAGS = \
        -export-dynamic \
@@ -69,6 +70,8 @@ libcogl_path_la_LDFLAGS = \
 AM_CPPFLAGS = \
        -DCOGL_COMPILATION              \
        -DG_LOG_DOMAIN=\"CoglPath\"     \
+       -I$(top_srcdir)/deps/ulib/src   \
+       -I$(top_builddir)/deps/ulib/src \
        -I$(srcdir)/tesselator          \
        -I$(top_srcdir)/cogl            \
        -I$(top_builddir)/cogl          \
diff --git a/cogl-path/cogl-path-private.h b/cogl-path/cogl-path-private.h
index a33cb89..c682869 100644
--- a/cogl-path/cogl-path-private.h
+++ b/cogl-path/cogl-path-private.h
@@ -81,7 +81,7 @@ struct _CoglPathData
 
   CoglPathFillRule     fill_rule;
 
-  GArray              *path_nodes;
+  UArray              *path_nodes;
 
   floatVec2            path_start;
   floatVec2            path_pen;
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index 37f344d..2555b42 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -34,7 +34,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 #include <string.h>
 #include <math.h>
@@ -94,7 +94,7 @@ _cogl_path_data_clear_vbos (CoglPathData *data)
       for (i = 0; i < data->stroke_n_attributes; i++)
         cogl_object_unref (data->stroke_attributes[i]);
 
-      g_free (data->stroke_attributes);
+      u_free (data->stroke_attributes);
 
       data->stroke_attribute_buffer = NULL;
     }
@@ -107,9 +107,9 @@ _cogl_path_data_unref (CoglPathData *data)
     {
       _cogl_path_data_clear_vbos (data);
 
-      g_array_free (data->path_nodes, TRUE);
+      u_array_free (data->path_nodes, TRUE);
 
-      g_slice_free (CoglPathData, data);
+      u_slice_free (CoglPathData, data);
     }
 }
 
@@ -125,10 +125,10 @@ _cogl_path_modify (CoglPath *path)
     {
       CoglPathData *old_data = path->data;
 
-      path->data = g_slice_dup (CoglPathData, old_data);
-      path->data->path_nodes = g_array_new (FALSE, FALSE,
+      path->data = u_slice_dup (CoglPathData, old_data);
+      path->data->path_nodes = u_array_new (FALSE, FALSE,
                                             sizeof (CoglPathNode));
-      g_array_append_vals (path->data->path_nodes,
+      u_array_append_vals (path->data->path_nodes,
                            old_data->path_nodes->data,
                            old_data->path_nodes->len);
 
@@ -186,9 +186,9 @@ _cogl_path_add_node (CoglPath *path,
   if (new_sub_path || data->path_nodes->len == 0)
     data->last_path = data->path_nodes->len;
 
-  g_array_append_val (data->path_nodes, new_node);
+  u_array_append_val (data->path_nodes, new_node);
 
-  g_array_index (data->path_nodes, CoglPathNode, data->last_path).path_size++;
+  u_array_index (data->path_nodes, CoglPathNode, data->last_path).path_size++;
 
   if (data->path_nodes->len == 1)
     {
@@ -248,7 +248,7 @@ cogl_path_stroke (CoglPath *path,
     {
       CoglPrimitive *primitive;
 
-      node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
+      node = &u_array_index (data->path_nodes, CoglPathNode, path_start);
 
       primitive =
         cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP,
@@ -302,7 +302,7 @@ _cogl_path_fill_nodes_with_clipped_rectangle (CoglPath *path,
 
       if (!seen_warning)
         {
-          g_warning ("Paths can not be filled using materials with "
+          u_warning ("Paths can not be filled using materials with "
                      "sliced textures unless there is a stencil "
                      "buffer");
           seen_warning = TRUE;
@@ -891,13 +891,13 @@ cogl_path_new (CoglContext *context)
   CoglPath *path;
   CoglPathData *data;
 
-  path = g_slice_new (CoglPath);
-  data = path->data = g_slice_new (CoglPathData);
+  path = u_slice_new (CoglPath);
+  data = path->data = u_slice_new (CoglPathData);
 
   data->ref_count = 1;
   data->context = context;
   data->fill_rule = COGL_PATH_FILL_RULE_EVEN_ODD;
-  data->path_nodes = g_array_new (FALSE, FALSE, sizeof (CoglPathNode));
+  data->path_nodes = u_array_new (FALSE, FALSE, sizeof (CoglPathNode));
   data->last_path = 0;
   data->fill_attribute_buffer = NULL;
   data->stroke_attribute_buffer = NULL;
@@ -914,7 +914,7 @@ cogl_path_copy (CoglPath *old_path)
 
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_path (old_path), NULL);
 
-  new_path = g_slice_new (CoglPath);
+  new_path = u_slice_new (CoglPath);
   new_path->data = old_path->data;
   new_path->data->ref_count++;
 
@@ -925,7 +925,7 @@ static void
 _cogl_path_free (CoglPath *path)
 {
   _cogl_path_data_unref (path->data);
-  g_slice_free (CoglPath, path);
+  u_slice_free (CoglPath, path);
 }
 
 /* If second order beziers were needed the following code could
@@ -1055,11 +1055,11 @@ struct _CoglPathTesselator
   int vertex_number;
   /* Array of CoglPathTesselatorVertex. This needs to grow when the
      combine callback is called */
-  GArray *vertices;
+  UArray *vertices;
   /* Array of integers for the indices into the vertices array. Each
      element will either be uint8_t, uint16_t or uint32_t depending on
      the number of vertices */
-  GArray *indices;
+  UArray *indices;
   CoglIndicesType indices_type;
   /* Indices used to split fans and strips */
   int index_a, index_b;
@@ -1074,7 +1074,7 @@ static void
 _cogl_path_tesselator_begin (GLenum type,
                              CoglPathTesselator *tess)
 {
-  g_assert (type == GL_TRIANGLES ||
+  u_assert (type == GL_TRIANGLES ||
             type == GL_TRIANGLE_FAN ||
             type == GL_TRIANGLE_STRIP);
 
@@ -1099,15 +1099,15 @@ _cogl_path_tesselator_allocate_indices_array (CoglPathTesselator *tess)
   switch (tess->indices_type)
     {
     case COGL_INDICES_TYPE_UNSIGNED_BYTE:
-      tess->indices = g_array_new (FALSE, FALSE, sizeof (uint8_t));
+      tess->indices = u_array_new (FALSE, FALSE, sizeof (uint8_t));
       break;
 
     case COGL_INDICES_TYPE_UNSIGNED_SHORT:
-      tess->indices = g_array_new (FALSE, FALSE, sizeof (uint16_t));
+      tess->indices = u_array_new (FALSE, FALSE, sizeof (uint16_t));
       break;
 
     case COGL_INDICES_TYPE_UNSIGNED_INT:
-      tess->indices = g_array_new (FALSE, FALSE, sizeof (uint32_t));
+      tess->indices = u_array_new (FALSE, FALSE, sizeof (uint32_t));
       break;
     }
 }
@@ -1120,21 +1120,21 @@ _cogl_path_tesselator_add_index (CoglPathTesselator *tess, int vertex_index)
     case COGL_INDICES_TYPE_UNSIGNED_BYTE:
       {
         uint8_t val = vertex_index;
-        g_array_append_val (tess->indices, val);
+        u_array_append_val (tess->indices, val);
       }
       break;
 
     case COGL_INDICES_TYPE_UNSIGNED_SHORT:
       {
         uint16_t val = vertex_index;
-        g_array_append_val (tess->indices, val);
+        u_array_append_val (tess->indices, val);
       }
       break;
 
     case COGL_INDICES_TYPE_UNSIGNED_INT:
       {
         uint32_t val = vertex_index;
-        g_array_append_val (tess->indices, val);
+        u_array_append_val (tess->indices, val);
       }
       break;
     }
@@ -1193,7 +1193,7 @@ _cogl_path_tesselator_vertex (void *vertex_data,
       break;
 
     default:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 
   tess->vertex_number++;
@@ -1217,8 +1217,8 @@ _cogl_path_tesselator_combine (double coords[3],
   int i;
 
   /* Add a new vertex to the array */
-  g_array_set_size (tess->vertices, tess->vertices->len + 1);
-  vertex = &g_array_index (tess->vertices,
+  u_array_set_size (tess->vertices, tess->vertices->len + 1);
+  vertex = &u_array_index (tess->vertices,
                            CoglPathTesselatorVertex,
                            tess->vertices->len - 1);
   /* The data is just the index to the vertex */
@@ -1233,7 +1233,7 @@ _cogl_path_tesselator_combine (double coords[3],
   for (i = 0; i < 4; i++)
     {
       CoglPathTesselatorVertex *old_vertex =
-        &g_array_index (tess->vertices, CoglPathTesselatorVertex,
+        &u_array_index (tess->vertices, CoglPathTesselatorVertex,
                         GPOINTER_TO_INT (vertex_data[i]));
       vertex->s += old_vertex->s * weight[i];
       vertex->t += old_vertex->t * weight[i];
@@ -1245,7 +1245,7 @@ _cogl_path_tesselator_combine (double coords[3],
   if (new_indices_type != tess->indices_type)
     {
       CoglIndicesType old_indices_type = new_indices_type;
-      GArray *old_vertices = tess->indices;
+      UArray *old_vertices = tess->indices;
 
       /* Copy the indices to an array of the new type */
       tess->indices_type = new_indices_type;
@@ -1256,26 +1256,26 @@ _cogl_path_tesselator_combine (double coords[3],
         case COGL_INDICES_TYPE_UNSIGNED_BYTE:
           for (i = 0; i < old_vertices->len; i++)
             _cogl_path_tesselator_add_index (tess,
-                                             g_array_index (old_vertices,
+                                             u_array_index (old_vertices,
                                                             uint8_t, i));
           break;
 
         case COGL_INDICES_TYPE_UNSIGNED_SHORT:
           for (i = 0; i < old_vertices->len; i++)
             _cogl_path_tesselator_add_index (tess,
-                                             g_array_index (old_vertices,
+                                             u_array_index (old_vertices,
                                                             uint16_t, i));
           break;
 
         case COGL_INDICES_TYPE_UNSIGNED_INT:
           for (i = 0; i < old_vertices->len; i++)
             _cogl_path_tesselator_add_index (tess,
-                                             g_array_index (old_vertices,
+                                             u_array_index (old_vertices,
                                                             uint32_t, i));
           break;
         }
 
-      g_array_free (old_vertices, TRUE);
+      u_array_free (old_vertices, TRUE);
     }
 }
 
@@ -1294,14 +1294,14 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
   tess.primitive_type = FALSE;
 
   /* Generate a vertex for each point on the path */
-  tess.vertices = g_array_new (FALSE, FALSE, sizeof (CoglPathTesselatorVertex));
-  g_array_set_size (tess.vertices, data->path_nodes->len);
+  tess.vertices = u_array_new (FALSE, FALSE, sizeof (CoglPathTesselatorVertex));
+  u_array_set_size (tess.vertices, data->path_nodes->len);
   for (i = 0; i < data->path_nodes->len; i++)
     {
       CoglPathNode *node =
-        &g_array_index (data->path_nodes, CoglPathNode, i);
+        &u_array_index (data->path_nodes, CoglPathNode, i);
       CoglPathTesselatorVertex *vertex =
-        &g_array_index (tess.vertices, CoglPathTesselatorVertex, i);
+        &u_array_index (tess.vertices, CoglPathTesselatorVertex, i);
 
       vertex->x = node->x;
       vertex->y = node->y;
@@ -1351,7 +1351,7 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
   while (path_start < data->path_nodes->len)
     {
       CoglPathNode *node =
-        &g_array_index (data->path_nodes, CoglPathNode, path_start);
+        &u_array_index (data->path_nodes, CoglPathNode, path_start);
 
       gluTessBeginContour (tess.glu_tess);
 
@@ -1376,7 +1376,7 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
                                sizeof (CoglPathTesselatorVertex) *
                                tess.vertices->len,
                                tess.vertices->data);
-  g_array_free (tess.vertices, TRUE);
+  u_array_free (tess.vertices, TRUE);
 
   data->fill_attributes[0] =
     cogl_attribute_new (data->fill_attribute_buffer,
@@ -1398,7 +1398,7 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
                                              tess.indices->data,
                                              tess.indices->len);
   data->fill_vbo_n_indices = tess.indices->len;
-  g_array_free (tess.indices, TRUE);
+  u_array_free (tess.indices, TRUE);
 }
 
 static CoglPrimitive *
@@ -1514,7 +1514,7 @@ _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
        path_start < data->path_nodes->len;
        path_start += node->path_size)
     {
-      node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
+      node = &u_array_index (data->path_nodes, CoglPathNode, path_start);
 
       for (i = 0; i < node->path_size; i++)
         {
@@ -1527,14 +1527,14 @@ _cogl_path_build_stroke_attribute_buffer (CoglPath *path)
 
   _cogl_buffer_unmap_for_fill_or_fallback (buffer);
 
-  data->stroke_attributes = g_new (CoglAttribute *, n_attributes);
+  data->stroke_attributes = u_new (CoglAttribute *, n_attributes);
 
   /* Now we can loop the sub paths again to create the attributes */
   for (i = 0, path_start = 0;
        path_start < data->path_nodes->len;
        i++, path_start += node->path_size)
     {
-      node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
+      node = &u_array_index (data->path_nodes, CoglPathNode, path_start);
 
       data->stroke_attributes[i] =
         cogl_attribute_new (data->stroke_attribute_buffer,
diff --git a/cogl-path/tesselator/memalloc.h b/cogl-path/tesselator/memalloc.h
index 7e19dff..82a954b 100644
--- a/cogl-path/tesselator/memalloc.h
+++ b/cogl-path/tesselator/memalloc.h
@@ -29,20 +29,20 @@
  */
 
 /* This is a simple replacement for memalloc from the SGI tesselator
-   code to force it to use glib's allocation instead */
+   code to force it to use ulib's allocation instead */
 
 #ifndef __MEMALLOC_H__
 #define __MEMALLOC_H__
 
-#include <glib.h>
+#include <ulib.h>
 
-#define memRealloc g_realloc
-#define memAlloc   g_malloc
-#define memFree    g_free
+#define memRealloc u_realloc
+#define memAlloc   u_malloc
+#define memFree    u_free
 #define memInit(x) 1
 
 /* tess.c defines TRUE and FALSE itself unconditionally so we need to
-   undefine it from the glib headers */
+   undefine it from the ulib headers */
 #undef TRUE
 #undef FALSE
 
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index a99ae04..ff6d373 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -22,6 +22,8 @@ AM_CPPFLAGS = \
        -I$(srcdir)/driver/gl                   \
        -I$(srcdir)/driver/gl/gl                \
        -I$(srcdir)/driver/gl/gles              \
+       -I$(top_srcdir)/deps/ulib/src           \
+       -I$(top_builddir)/deps/ulib/src         \
        $(NULL)
 
 AM_CPPFLAGS += \
@@ -485,9 +487,7 @@ endif
 lib_LTLIBRARIES += libcogl2.la
 
 libcogl2_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
-if !USE_GLIB
-libcogl2_la_LIBADD += $(top_builddir)/deps/eglib/src/libeglib.la
-endif
+libcogl2_la_LIBADD += $(top_builddir)/deps/ulib/src/libulib.la
 if UNIT_TESTS
 libcogl2_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
 endif
diff --git a/cogl/cogl-atlas-texture-private.h b/cogl/cogl-atlas-texture-private.h
index 427e9cc..6e47cc8 100644
--- a/cogl/cogl-atlas-texture-private.h
+++ b/cogl/cogl-atlas-texture-private.h
@@ -63,12 +63,12 @@ struct _CoglAtlasTexture
 
 void
 _cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
-                                             GHookFunc callback,
+                                             UHookFunc callback,
                                              void *user_data);
 
 void
 _cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
-                                                GHookFunc callback,
+                                                UHookFunc callback,
                                                 void *user_data);
 
 CoglBool
diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c
index a812a00..2eaeb3f 100644
--- a/cogl/cogl-atlas-texture.c
+++ b/cogl/cogl-atlas-texture.c
@@ -162,7 +162,7 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
       CoglAtlasTextureGetRectanglesData data;
       unsigned int i;
 
-      data.textures = g_new (CoglAtlasTexture *,
+      data.textures = u_new (CoglAtlasTexture *,
                              _cogl_rectangle_map_get_n_rectangles (atlas->map));
       data.n_textures = 0;
 
@@ -184,11 +184,11 @@ _cogl_atlas_texture_post_reorganize_cb (void *user_data)
             cogl_object_unref (data.textures[i]);
         }
 
-      g_free (data.textures);
+      u_free (data.textures);
     }
 
   /* Notify any listeners that an atlas has changed */
-  g_hook_list_invoke (&ctx->atlas_reorganize_callbacks, FALSE);
+  u_hook_list_invoke (&ctx->atlas_reorganize_callbacks, FALSE);
 }
 
 static void
@@ -197,7 +197,7 @@ _cogl_atlas_texture_atlas_destroyed_cb (void *user_data)
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
   /* Remove the atlas from the global list */
-  ctx->atlases = g_slist_remove (ctx->atlases, user_data);
+  ctx->atlases = u_slist_remove (ctx->atlases, user_data);
 }
 
 static CoglAtlas *
@@ -214,7 +214,7 @@ _cogl_atlas_texture_create_atlas (CoglContext *ctx)
                                        _cogl_atlas_texture_post_reorganize_cb,
                                        atlas);
 
-  ctx->atlases = g_slist_prepend (ctx->atlases, atlas);
+  ctx->atlases = u_slist_prepend (ctx->atlases, atlas);
 
   /* Set some data on the atlas so we can get notification when it is
      destroyed in order to remove it from the list. ctx->atlases
@@ -662,7 +662,7 @@ _cogl_atlas_texture_create_base (CoglContext *ctx,
 
   /* We need to allocate the texture now because we need the pointer
      to set as the data for the rectangle in the atlas */
-  atlas_tex = g_new0 (CoglAtlasTexture, 1);
+  atlas_tex = u_new0 (CoglAtlasTexture, 1);
   /* Mark it as having no atlas so we don't try to unref it in
      _cogl_atlas_texture_post_reorganize_cb */
   atlas_tex->atlas = NULL;
@@ -712,7 +712,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
   CoglTexture *tex = COGL_TEXTURE (atlas_tex);
   CoglContext *ctx = tex->context;
   CoglAtlas *atlas;
-  GSList *l;
+  USList *l;
 
   /* If the texture is in a strange format then we won't use it */
   if (!_cogl_atlas_texture_can_use_format (internal_format))
@@ -883,7 +883,7 @@ _cogl_atlas_texture_allocate (CoglTexture *tex,
       break;
     }
 
-  g_return_val_if_reached (FALSE);
+  u_return_val_if_reached (FALSE);
 }
 
 static CoglAtlasTexture *
@@ -976,27 +976,27 @@ cogl_atlas_texture_new_from_file (CoglContext *ctx,
 
 void
 _cogl_atlas_texture_add_reorganize_callback (CoglContext *ctx,
-                                             GHookFunc callback,
+                                             UHookFunc callback,
                                              void *user_data)
 {
-  GHook *hook = g_hook_alloc (&ctx->atlas_reorganize_callbacks);
+  UHook *hook = u_hook_alloc (&ctx->atlas_reorganize_callbacks);
   hook->func = callback;
   hook->data = user_data;
-  g_hook_prepend (&ctx->atlas_reorganize_callbacks, hook);
+  u_hook_prepend (&ctx->atlas_reorganize_callbacks, hook);
 }
 
 void
 _cogl_atlas_texture_remove_reorganize_callback (CoglContext *ctx,
-                                                GHookFunc callback,
+                                                UHookFunc callback,
                                                 void *user_data)
 {
-  GHook *hook = g_hook_find_func_data (&ctx->atlas_reorganize_callbacks,
+  UHook *hook = u_hook_find_func_data (&ctx->atlas_reorganize_callbacks,
                                        FALSE,
                                        callback,
                                        user_data);
 
   if (hook)
-    g_hook_destroy_link (&ctx->atlas_reorganize_callbacks, hook);
+    u_hook_destroy_link (&ctx->atlas_reorganize_callbacks, hook);
 }
 
 static CoglTextureType
diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c
index 57405da..fd5a316 100644
--- a/cogl/cogl-atlas.c
+++ b/cogl/cogl-atlas.c
@@ -57,15 +57,15 @@ _cogl_atlas_new (CoglPixelFormat texture_format,
                  CoglAtlasFlags flags,
                  CoglAtlasUpdatePositionCallback update_position_cb)
 {
-  CoglAtlas *atlas = g_new (CoglAtlas, 1);
+  CoglAtlas *atlas = u_new (CoglAtlas, 1);
 
   atlas->update_position_cb = update_position_cb;
   atlas->map = NULL;
   atlas->texture = NULL;
   atlas->flags = flags;
   atlas->texture_format = texture_format;
-  g_hook_list_init (&atlas->pre_reorganize_callbacks, sizeof (GHook));
-  g_hook_list_init (&atlas->post_reorganize_callbacks, sizeof (GHook));
+  u_hook_list_init (&atlas->pre_reorganize_callbacks, sizeof (UHook));
+  u_hook_list_init (&atlas->post_reorganize_callbacks, sizeof (UHook));
 
   return _cogl_atlas_object_new (atlas);
 }
@@ -80,10 +80,10 @@ _cogl_atlas_free (CoglAtlas *atlas)
   if (atlas->map)
     _cogl_rectangle_map_free (atlas->map);
 
-  g_hook_list_clear (&atlas->pre_reorganize_callbacks);
-  g_hook_list_clear (&atlas->post_reorganize_callbacks);
+  u_hook_list_clear (&atlas->pre_reorganize_callbacks);
+  u_hook_list_clear (&atlas->post_reorganize_callbacks);
 
-  g_free (atlas);
+  u_free (atlas);
 }
 
 typedef struct _CoglAtlasRepositionData
@@ -296,7 +296,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
       int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->texture_format);
 
       /* Create a buffer of zeroes to initially clear the texture */
-      clear_data = g_malloc0 (width * height * bpp);
+      clear_data = u_malloc0 (width * height * bpp);
       clear_bmp = cogl_bitmap_new_for_data (ctx,
                                             width,
                                             height,
@@ -318,7 +318,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
 
       cogl_object_unref (clear_bmp);
 
-      g_free (clear_data);
+      u_free (clear_data);
     }
   else
     {
@@ -355,13 +355,13 @@ _cogl_atlas_compare_size_cb (const void *a,
 static void
 _cogl_atlas_notify_pre_reorganize (CoglAtlas *atlas)
 {
-  g_hook_list_invoke (&atlas->pre_reorganize_callbacks, FALSE);
+  u_hook_list_invoke (&atlas->pre_reorganize_callbacks, FALSE);
 }
 
 static void
 _cogl_atlas_notify_post_reorganize (CoglAtlas *atlas)
 {
-  g_hook_list_invoke (&atlas->post_reorganize_callbacks, FALSE);
+  u_hook_list_invoke (&atlas->post_reorganize_callbacks, FALSE);
 }
 
 CoglBool
@@ -409,12 +409,12 @@ _cogl_atlas_reserve_space (CoglAtlas             *atlas,
   /* Get an array of all the textures currently in the atlas. */
   data.n_textures = 0;
   if (atlas->map == NULL)
-    data.textures = g_malloc (sizeof (CoglAtlasRepositionData));
+    data.textures = u_malloc (sizeof (CoglAtlasRepositionData));
   else
     {
       unsigned int n_rectangles =
         _cogl_rectangle_map_get_n_rectangles (atlas->map);
-      data.textures = g_malloc (sizeof (CoglAtlasRepositionData) *
+      data.textures = u_malloc (sizeof (CoglAtlasRepositionData) *
                                 (n_rectangles + 1));
       _cogl_rectangle_map_foreach (atlas->map,
                                    _cogl_atlas_get_rectangles_cb,
@@ -528,7 +528,7 @@ _cogl_atlas_reserve_space (CoglAtlas             *atlas,
       ret = TRUE;
     }
 
-  g_free (data.textures);
+  u_free (data.textures);
 
   _cogl_atlas_notify_post_reorganize (atlas);
 
@@ -643,48 +643,48 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
 
 void
 _cogl_atlas_add_reorganize_callback (CoglAtlas            *atlas,
-                                     GHookFunc             pre_callback,
-                                     GHookFunc             post_callback,
+                                     UHookFunc             pre_callback,
+                                     UHookFunc             post_callback,
                                      void                 *user_data)
 {
   if (pre_callback)
     {
-      GHook *hook = g_hook_alloc (&atlas->post_reorganize_callbacks);
+      UHook *hook = u_hook_alloc (&atlas->post_reorganize_callbacks);
       hook->func = pre_callback;
       hook->data = user_data;
-      g_hook_prepend (&atlas->pre_reorganize_callbacks, hook);
+      u_hook_prepend (&atlas->pre_reorganize_callbacks, hook);
     }
   if (post_callback)
     {
-      GHook *hook = g_hook_alloc (&atlas->pre_reorganize_callbacks);
+      UHook *hook = u_hook_alloc (&atlas->pre_reorganize_callbacks);
       hook->func = post_callback;
       hook->data = user_data;
-      g_hook_prepend (&atlas->post_reorganize_callbacks, hook);
+      u_hook_prepend (&atlas->post_reorganize_callbacks, hook);
     }
 }
 
 void
 _cogl_atlas_remove_reorganize_callback (CoglAtlas            *atlas,
-                                        GHookFunc             pre_callback,
-                                        GHookFunc             post_callback,
+                                        UHookFunc             pre_callback,
+                                        UHookFunc             post_callback,
                                         void                 *user_data)
 {
   if (pre_callback)
     {
-      GHook *hook = g_hook_find_func_data (&atlas->pre_reorganize_callbacks,
+      UHook *hook = u_hook_find_func_data (&atlas->pre_reorganize_callbacks,
                                            FALSE,
                                            pre_callback,
                                            user_data);
       if (hook)
-        g_hook_destroy_link (&atlas->pre_reorganize_callbacks, hook);
+        u_hook_destroy_link (&atlas->pre_reorganize_callbacks, hook);
     }
   if (post_callback)
     {
-      GHook *hook = g_hook_find_func_data (&atlas->post_reorganize_callbacks,
+      UHook *hook = u_hook_find_func_data (&atlas->post_reorganize_callbacks,
                                            FALSE,
                                            post_callback,
                                            user_data);
       if (hook)
-        g_hook_destroy_link (&atlas->post_reorganize_callbacks, hook);
+        u_hook_destroy_link (&atlas->post_reorganize_callbacks, hook);
     }
 }
diff --git a/cogl/cogl-atlas.h b/cogl/cogl-atlas.h
index e336cfb..5bba5e7 100644
--- a/cogl/cogl-atlas.h
+++ b/cogl/cogl-atlas.h
@@ -60,8 +60,8 @@ struct _CoglAtlas
 
   CoglAtlasUpdatePositionCallback update_position_cb;
 
-  GHookList pre_reorganize_callbacks;
-  GHookList post_reorganize_callbacks;
+  UHookList pre_reorganize_callbacks;
+  UHookList post_reorganize_callbacks;
 };
 
 CoglAtlas *
@@ -89,14 +89,14 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
 
 void
 _cogl_atlas_add_reorganize_callback (CoglAtlas            *atlas,
-                                     GHookFunc             pre_callback,
-                                     GHookFunc             post_callback,
+                                     UHookFunc             pre_callback,
+                                     UHookFunc             post_callback,
                                      void                 *user_data);
 
 void
 _cogl_atlas_remove_reorganize_callback (CoglAtlas            *atlas,
-                                        GHookFunc             pre_callback,
-                                        GHookFunc             post_callback,
+                                        UHookFunc             pre_callback,
+                                        UHookFunc             post_callback,
                                         void                 *user_data);
 
 CoglBool
diff --git a/cogl/cogl-attribute-buffer.c b/cogl/cogl-attribute-buffer.c
index 90e0326..c0aaa42 100644
--- a/cogl/cogl-attribute-buffer.c
+++ b/cogl/cogl-attribute-buffer.c
@@ -48,7 +48,7 @@ CoglAttributeBuffer *
 cogl_attribute_buffer_new_with_size (CoglContext *context,
                                      size_t bytes)
 {
-  CoglAttributeBuffer *buffer = g_slice_new (CoglAttributeBuffer);
+  CoglAttributeBuffer *buffer = u_slice_new (CoglAttributeBuffer);
 
   /* parent's constructor */
   _cogl_buffer_initialize (COGL_BUFFER (buffer),
@@ -96,6 +96,6 @@ _cogl_attribute_buffer_free (CoglAttributeBuffer *array)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (array));
 
-  g_slice_free (CoglAttributeBuffer, array);
+  u_slice_free (CoglAttributeBuffer, array);
 }
 
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index b6c2433..e172fbc 100644
--- a/cogl/cogl-attribute.c
+++ b/cogl/cogl-attribute.c
@@ -95,7 +95,7 @@ validate_cogl_attribute_name (const char *name,
       *layer_number = strtoul (name + 9, &endptr, 10);
       if (strcmp (endptr, "_in") != 0)
        {
-         g_warning ("Texture coordinate attributes should either be named "
+         u_warning ("Texture coordinate attributes should either be named "
                      "\"cogl_tex_coord_in\" or named with a texture unit index "
                      "like \"cogl_tex_coord2_in\"\n");
           return FALSE;
@@ -111,7 +111,7 @@ validate_cogl_attribute_name (const char *name,
     *name_id = COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY;
   else
     {
-      g_warning ("Unknown cogl_* attribute name cogl_%s\n", name);
+      u_warning ("Unknown cogl_* attribute name cogl_%s\n", name);
       return FALSE;
     }
 
@@ -122,9 +122,9 @@ CoglAttributeNameState *
 _cogl_attribute_register_attribute_name (CoglContext *context,
                                          const char *name)
 {
-  CoglAttributeNameState *name_state = g_new (CoglAttributeNameState, 1);
+  CoglAttributeNameState *name_state = u_new (CoglAttributeNameState, 1);
   int name_index = context->n_attribute_names++;
-  char *name_copy = g_strdup (name);
+  char *name_copy = u_strdup (name);
 
   name_state->name = NULL;
   name_state->name_index = name_index;
@@ -147,22 +147,22 @@ _cogl_attribute_register_attribute_name (CoglContext *context,
   if (name_state->name == NULL)
     name_state->name = name_copy;
 
-  g_hash_table_insert (context->attribute_name_states_hash,
+  u_hash_table_insert (context->attribute_name_states_hash,
                        name_copy, name_state);
 
-  if (G_UNLIKELY (context->attribute_name_index_map == NULL))
+  if (U_UNLIKELY (context->attribute_name_index_map == NULL))
     context->attribute_name_index_map =
-      g_array_new (FALSE, FALSE, sizeof (void *));
+      u_array_new (FALSE, FALSE, sizeof (void *));
 
-  g_array_set_size (context->attribute_name_index_map, name_index + 1);
+  u_array_set_size (context->attribute_name_index_map, name_index + 1);
 
-  g_array_index (context->attribute_name_index_map,
+  u_array_index (context->attribute_name_index_map,
                  CoglAttributeNameState *, name_index) = name_state;
 
   return name_state;
 
 error:
-  g_free (name_state);
+  u_free (name_state);
   return NULL;
 }
 
@@ -173,18 +173,18 @@ validate_n_components (const CoglAttributeNameState *name_state,
   switch (name_state->name_id)
     {
     case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
-      if (G_UNLIKELY (n_components == 1))
+      if (U_UNLIKELY (n_components == 1))
         {
-          g_critical ("glVertexPointer doesn't allow 1 component vertex "
+          u_critical ("glVertexPointer doesn't allow 1 component vertex "
                       "positions so we currently only support \"cogl_vertex\" "
                       "attributes where n_components == 2, 3 or 4");
           return FALSE;
         }
       break;
     case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
-      if (G_UNLIKELY (n_components != 3 && n_components != 4))
+      if (U_UNLIKELY (n_components != 3 && n_components != 4))
         {
-          g_critical ("glColorPointer expects 3 or 4 component colors so we "
+          u_critical ("glColorPointer expects 3 or 4 component colors so we "
                       "currently only support \"cogl_color\" attributes where "
                       "n_components == 3 or 4");
           return FALSE;
@@ -193,18 +193,18 @@ validate_n_components (const CoglAttributeNameState *name_state,
     case COGL_ATTRIBUTE_NAME_ID_TEXTURE_COORD_ARRAY:
       break;
     case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
-      if (G_UNLIKELY (n_components != 3))
+      if (U_UNLIKELY (n_components != 3))
         {
-          g_critical ("glNormalPointer expects 3 component normals so we "
+          u_critical ("glNormalPointer expects 3 component normals so we "
                       "currently only support \"cogl_normal\" attributes "
                       "where n_components == 3");
           return FALSE;
         }
       break;
     case COGL_ATTRIBUTE_NAME_ID_POINT_SIZE_ARRAY:
-      if (G_UNLIKELY (n_components != 1))
+      if (U_UNLIKELY (n_components != 1))
         {
-          g_critical ("The point size attribute can only have one "
+          u_critical ("The point size attribute can only have one "
                       "component");
           return FALSE;
         }
@@ -224,14 +224,14 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
                     int n_components,
                     CoglAttributeType type)
 {
-  CoglAttribute *attribute = g_slice_new (CoglAttribute);
+  CoglAttribute *attribute = u_slice_new (CoglAttribute);
   CoglBuffer *buffer = COGL_BUFFER (attribute_buffer);
   CoglContext *ctx = buffer->context;
 
   attribute->is_buffered = TRUE;
 
   attribute->name_state =
-    g_hash_table_lookup (ctx->attribute_name_states_hash, name);
+    u_hash_table_lookup (ctx->attribute_name_states_hash, name);
   if (!attribute->name_state)
     {
       CoglAttributeNameState *name_state =
@@ -274,10 +274,10 @@ _cogl_attribute_new_const (CoglContext *context,
                            CoglBool transpose,
                            const float *value)
 {
-  CoglAttribute *attribute = g_slice_new (CoglAttribute);
+  CoglAttribute *attribute = u_slice_new (CoglAttribute);
 
   attribute->name_state =
-    g_hash_table_lookup (context->attribute_name_states_hash, name);
+    u_hash_table_lookup (context->attribute_name_states_hash, name);
   if (!attribute->name_state)
     {
       CoglAttributeNameState *name_state =
@@ -480,7 +480,7 @@ warn_about_midscene_changes (void)
   static CoglBool seen = FALSE;
   if (!seen)
     {
-      g_warning ("Mid-scene modification of attributes has "
+      u_warning ("Mid-scene modification of attributes has "
                  "undefined results\n");
       seen = TRUE;
     }
@@ -492,7 +492,7 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
 {
   _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
 
-  if (G_UNLIKELY (attribute->immutable_ref))
+  if (U_UNLIKELY (attribute->immutable_ref))
     warn_about_midscene_changes ();
 
   attribute->normalized = normalized;
@@ -514,7 +514,7 @@ cogl_attribute_set_buffer (CoglAttribute *attribute,
   _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
   _COGL_RETURN_IF_FAIL (attribute->is_buffered);
 
-  if (G_UNLIKELY (attribute->immutable_ref))
+  if (U_UNLIKELY (attribute->immutable_ref))
     warn_about_midscene_changes ();
 
   cogl_object_ref (attribute_buffer);
@@ -555,7 +555,7 @@ _cogl_attribute_free (CoglAttribute *attribute)
   else
     _cogl_boxed_value_destroy (&attribute->d.constant.boxed);
 
-  g_slice_free (CoglAttribute, attribute);
+  u_slice_free (CoglAttribute, attribute);
 }
 
 static CoglBool
@@ -589,7 +589,7 @@ validate_layer_cb (CoglPipeline *pipeline,
 
   if (!_cogl_texture_can_hardware_repeat (texture))
     {
-      g_warning ("Disabling layer %d of the current source material, "
+      u_warning ("Disabling layer %d of the current source material, "
                  "because texturing with the vertex buffer API is not "
                  "currently supported using sliced textures, or textures "
                  "with waste\n", layer_index);
diff --git a/cogl/cogl-bitmap-conversion.c b/cogl/cogl-bitmap-conversion.c
index b6d9b14..93bb21b 100644
--- a/cogl/cogl-bitmap-conversion.c
+++ b/cogl/cogl-bitmap-conversion.c
@@ -99,10 +99,10 @@ _cogl_unpremult_alpha_first (uint8_t *dst)
  * is important for a == 255 - we want to get exactly c.
  */
 #define MULT(d,a,t)                             \
-  G_STMT_START {                                \
+  U_STMT_START {                                \
     t = d * a + 128;                            \
     d = ((t >> 8) + t) >> 8;                    \
-  } G_STMT_END
+  } U_STMT_END
 
 inline static void
 _cogl_premult_alpha_last (uint8_t *dst)
@@ -322,7 +322,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
     case COGL_PIXEL_FORMAT_DEPTH_32:
     case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
     case COGL_PIXEL_FORMAT_ANY:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
 
     case COGL_PIXEL_FORMAT_A_8:
     case COGL_PIXEL_FORMAT_RG_88:
@@ -354,7 +354,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
       return TRUE;
     }
 
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 }
 
 CoglBool
@@ -437,7 +437,7 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
   use_16 = _cogl_bitmap_needs_short_temp_buffer (dst_format);
 
   /* Allocate a buffer to hold a temporary RGBA row */
-  tmp_row = g_malloc (width *
+  tmp_row = u_malloc (width *
                       (use_16 ? sizeof (uint16_t) : sizeof (uint8_t)) * 4);
 
   /* FIXME: Optimize */
@@ -479,7 +479,7 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
   _cogl_bitmap_unmap (src_bmp);
   _cogl_bitmap_unmap (dst_bmp);
 
-  g_free (tmp_row);
+  u_free (tmp_row);
 
   return TRUE;
 }
@@ -642,7 +642,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
   if (_cogl_bitmap_can_fast_premult (format))
     tmp_row = NULL;
   else
-    tmp_row = g_malloc (sizeof (uint16_t) * 4 * width);
+    tmp_row = u_malloc (sizeof (uint16_t) * 4 * width);
 
   for (y = 0; y < height; y++)
     {
@@ -672,7 +672,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
         }
     }
 
-  g_free (tmp_row);
+  u_free (tmp_row);
 
   _cogl_bitmap_unmap (bmp);
 
@@ -709,7 +709,7 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
   if (_cogl_bitmap_can_fast_premult (format))
     tmp_row = NULL;
   else
-    tmp_row = g_malloc (sizeof (uint16_t) * 4 * width);
+    tmp_row = u_malloc (sizeof (uint16_t) * 4 * width);
 
   for (y = 0; y < height; y++)
     {
@@ -736,7 +736,7 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
         }
     }
 
-  g_free (tmp_row);
+  u_free (tmp_row);
 
   _cogl_bitmap_unmap (bmp);
 
diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h
index 4251f23..14e0734 100644
--- a/cogl/cogl-bitmap-packing.h
+++ b/cogl/cogl-bitmap-packing.h
@@ -376,7 +376,7 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
     case COGL_PIXEL_FORMAT_DEPTH_32:
     case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
     case COGL_PIXEL_FORMAT_ANY:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 }
 
@@ -715,6 +715,6 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
     case COGL_PIXEL_FORMAT_DEPTH_32:
     case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
     case COGL_PIXEL_FORMAT_ANY:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 }
diff --git a/cogl/cogl-bitmap-pixbuf.c b/cogl/cogl-bitmap-pixbuf.c
index fffa3d1..ab3a859 100644
--- a/cogl/cogl-bitmap-pixbuf.c
+++ b/cogl/cogl-bitmap-pixbuf.c
@@ -28,9 +28,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "cogl-util.h"
 #include "cogl-bitmap-private.h"
@@ -93,7 +91,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
       _cogl_set_error_literal (error,
                                COGL_BITMAP_ERROR,
                                COGL_BITMAP_ERROR_FAILED,
-                               g_strerror (save_errno));
+                               u_strerror (save_errno));
       return NULL;
     }
 
@@ -228,12 +226,12 @@ _cogl_bitmap_from_file (CoglContext *ctx,
 
   /* According to current docs this should be true and so
    * the translation to cogl pixel format below valid */
-  g_assert (bits_per_sample == 8);
+  u_assert (bits_per_sample == 8);
 
   if (has_alpha)
-    g_assert (n_channels == 4);
+    u_assert (n_channels == 4);
   else
-    g_assert (n_channels == 3);
+    u_assert (n_channels == 3);
 
   /* Translate to cogl pixel format */
   switch (color_space)
@@ -381,7 +379,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
       break;
 
     default:
-      g_warn_if_reached ();
+      u_warn_if_reached ();
       return NULL;
     }
 
diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h
index 4ef47a1..4041162 100644
--- a/cogl/cogl-bitmap-private.h
+++ b/cogl/cogl-bitmap-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_BITMAP_H
 #define __COGL_BITMAP_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-object-private.h"
 #include "cogl-buffer.h"
@@ -77,7 +77,7 @@ struct _CoglBitmap
  * @error: A #CoglError for catching exceptional errors or %NULL
  *
  * This is equivalent to cogl_bitmap_new_with_size() except that it
- * allocated the buffer using g_malloc() instead of creating a
+ * allocated the buffer using u_malloc() instead of creating a
  * #CoglPixelBuffer. The buffer will be automatically destroyed when
  * the bitmap is freed.
  *
diff --git a/cogl/cogl-bitmap.c b/cogl/cogl-bitmap.c
index 5b1fcf5..0002473 100644
--- a/cogl/cogl-bitmap.c
+++ b/cogl/cogl-bitmap.c
@@ -51,8 +51,8 @@ COGL_OBJECT_DEFINE (Bitmap, bitmap);
 static void
 _cogl_bitmap_free (CoglBitmap *bmp)
 {
-  g_assert (!bmp->mapped);
-  g_assert (!bmp->bound);
+  u_assert (!bmp->mapped);
+  u_assert (!bmp->bound);
 
   if (bmp->shared_bmp)
     cogl_object_unref (bmp->shared_bmp);
@@ -60,7 +60,7 @@ _cogl_bitmap_free (CoglBitmap *bmp)
   if (bmp->buffer)
     cogl_object_unref (bmp->buffer);
 
-  g_slice_free (CoglBitmap, bmp);
+  u_slice_free (CoglBitmap, bmp);
 }
 
 CoglBool
@@ -183,13 +183,13 @@ cogl_bitmap_new_for_data (CoglContext *context,
 {
   CoglBitmap *bmp;
 
-  g_return_val_if_fail (cogl_is_context (context), NULL);
+  u_return_val_if_fail (cogl_is_context (context), NULL);
 
   /* Rowstride from width if not given */
   if (rowstride == 0)
     rowstride = width * _cogl_pixel_format_get_bytes_per_pixel (format);
 
-  bmp = g_slice_new (CoglBitmap);
+  bmp = u_slice_new (CoglBitmap);
   bmp->context = context;
   bmp->format = format;
   bmp->width = width;
@@ -214,7 +214,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
   static CoglUserDataKey bitmap_free_key;
   int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
   int rowstride = ((width * bpp) + 3) & ~3;
-  uint8_t *data = g_try_malloc (rowstride * height);
+  uint8_t *data = u_try_malloc (rowstride * height);
   CoglBitmap *bitmap;
 
   if (!data)
@@ -234,7 +234,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
   cogl_object_set_user_data (COGL_OBJECT (bitmap),
                              &bitmap_free_key,
                              data,
-                             g_free);
+                             u_free);
 
   return bitmap;
 }
@@ -389,7 +389,7 @@ cogl_bitmap_get_buffer (CoglBitmap *bitmap)
 uint32_t
 cogl_bitmap_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-bitmap-error-quark");
+  return u_quark_from_static_string ("cogl-bitmap-error-quark");
 }
 
 uint8_t *
@@ -402,7 +402,7 @@ _cogl_bitmap_map (CoglBitmap *bitmap,
   if (bitmap->shared_bmp)
     return _cogl_bitmap_map (bitmap->shared_bmp, access, hints, error);
 
-  g_assert (!bitmap->mapped);
+  u_assert (!bitmap->mapped);
 
   if (bitmap->buffer)
     {
@@ -442,7 +442,7 @@ _cogl_bitmap_unmap (CoglBitmap *bitmap)
       return;
     }
 
-  g_assert (bitmap->mapped);
+  u_assert (bitmap->mapped);
   bitmap->mapped = FALSE;
 
   if (bitmap->buffer)
@@ -458,7 +458,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
   uint8_t *ptr;
   CoglError *internal_error = NULL;
 
-  g_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
+  u_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
                                   COGL_BUFFER_ACCESS_WRITE),
                         NULL);
 
@@ -489,7 +489,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
   else
     {
       ptr = NULL;
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       return NULL;
     }
 
@@ -518,7 +518,7 @@ _cogl_bitmap_gl_unbind (CoglBitmap *bitmap)
       return;
     }
 
-  g_assert (bitmap->bound);
+  u_assert (bitmap->bound);
   bitmap->bound = FALSE;
 
   /* If the bitmap wasn't created from a pixel array then the
diff --git a/cogl/cogl-bitmask.c b/cogl/cogl-bitmask.c
index f043927..a398490 100644
--- a/cogl/cogl-bitmask.c
+++ b/cogl/cogl-bitmask.c
@@ -33,7 +33,7 @@
 
 #include "config.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 #include <test-fixtures/test-unit.h>
@@ -60,29 +60,29 @@ CoglBool
 _cogl_bitmask_get_from_array (const CoglBitmask *bitmask,
                               unsigned int bit_num)
 {
-  GArray *array = (GArray *) *bitmask;
+  UArray *array = (UArray *) *bitmask;
 
   /* If the index is off the end of the array then assume the bit is
      not set */
   if (bit_num >= sizeof (unsigned long) * 8 * array->len)
     return FALSE;
   else
-    return !!(g_array_index (array, unsigned long, ARRAY_INDEX (bit_num)) &
+    return !!(u_array_index (array, unsigned long, ARRAY_INDEX (bit_num)) &
               BIT_MASK (bit_num));
 }
 
 static void
 _cogl_bitmask_convert_to_array (CoglBitmask *bitmask)
 {
-  GArray *array;
+  UArray *array;
   /* Fetch the old values */
   unsigned long old_values = _cogl_bitmask_to_bits (bitmask);
 
-  array = g_array_new (FALSE, /* not zero-terminated */
+  array = u_array_new (FALSE, /* not zero-terminated */
                        TRUE, /* do clear new entries */
                        sizeof (unsigned long));
   /* Copy the old values back in */
-  g_array_append_val (array, old_values);
+  u_array_append_val (array, old_values);
 
   *bitmask = (struct _CoglBitmaskImaginaryType *) array;
 }
@@ -92,7 +92,7 @@ _cogl_bitmask_set_in_array (CoglBitmask *bitmask,
                             unsigned int bit_num,
                             CoglBool value)
 {
-  GArray *array;
+  UArray *array;
   unsigned int array_index;
   unsigned long new_value_mask;
 
@@ -100,19 +100,19 @@ _cogl_bitmask_set_in_array (CoglBitmask *bitmask,
   if (!_cogl_bitmask_has_array (bitmask))
     _cogl_bitmask_convert_to_array (bitmask);
 
-  array = (GArray *) *bitmask;
+  array = (UArray *) *bitmask;
 
   array_index = ARRAY_INDEX (bit_num);
   /* Grow the array if necessary. This will clear the new data */
   if (array_index >= array->len)
-    g_array_set_size (array, array_index + 1);
+    u_array_set_size (array, array_index + 1);
 
   new_value_mask = BIT_MASK (bit_num);
 
   if (value)
-    g_array_index (array, unsigned long, array_index) |= new_value_mask;
+    u_array_index (array, unsigned long, array_index) |= new_value_mask;
   else
-    g_array_index (array, unsigned long, array_index) &= ~new_value_mask;
+    u_array_index (array, unsigned long, array_index) &= ~new_value_mask;
 }
 
 void
@@ -121,29 +121,29 @@ _cogl_bitmask_set_bits (CoglBitmask *dst,
 {
   if (_cogl_bitmask_has_array (src))
     {
-      GArray *src_array, *dst_array;
+      UArray *src_array, *dst_array;
       int i;
 
       if (!_cogl_bitmask_has_array (dst))
         _cogl_bitmask_convert_to_array (dst);
 
-      dst_array = (GArray *) *dst;
-      src_array = (GArray *) *src;
+      dst_array = (UArray *) *dst;
+      src_array = (UArray *) *src;
 
       if (dst_array->len < src_array->len)
-        g_array_set_size (dst_array, src_array->len);
+        u_array_set_size (dst_array, src_array->len);
 
       for (i = 0; i < src_array->len; i++)
-        g_array_index (dst_array, unsigned long, i) |=
-          g_array_index (src_array, unsigned long, i);
+        u_array_index (dst_array, unsigned long, i) |=
+          u_array_index (src_array, unsigned long, i);
     }
   else if (_cogl_bitmask_has_array (dst))
     {
-      GArray *dst_array;
+      UArray *dst_array;
 
-      dst_array = (GArray *) *dst;
+      dst_array = (UArray *) *dst;
 
-      g_array_index (dst_array, unsigned long, 0) |=
+      u_array_index (dst_array, unsigned long, 0) |=
         _cogl_bitmask_to_bits (src);
     }
   else
@@ -156,7 +156,7 @@ _cogl_bitmask_set_range_in_array (CoglBitmask *bitmask,
                                   unsigned int n_bits,
                                   CoglBool value)
 {
-  GArray *array;
+  UArray *array;
   unsigned int array_index, bit_index;
 
   if (n_bits == 0)
@@ -166,7 +166,7 @@ _cogl_bitmask_set_range_in_array (CoglBitmask *bitmask,
   if (!_cogl_bitmask_has_array (bitmask))
     _cogl_bitmask_convert_to_array (bitmask);
 
-  array = (GArray *) *bitmask;
+  array = (UArray *) *bitmask;
 
   /* Get the array index of the top most value that will be touched */
   array_index = ARRAY_INDEX (n_bits - 1);
@@ -174,12 +174,12 @@ _cogl_bitmask_set_range_in_array (CoglBitmask *bitmask,
   bit_index = BIT_INDEX (n_bits - 1);
   /* Grow the array if necessary. This will clear the new data */
   if (array_index >= array->len)
-    g_array_set_size (array, array_index + 1);
+    u_array_set_size (array, array_index + 1);
 
   if (value)
     {
       /* Set the bits that are touching this index */
-      g_array_index (array, unsigned long, array_index) |=
+      u_array_index (array, unsigned long, array_index) |=
         ~0UL >> (sizeof (unsigned long) * 8 - 1 - bit_index);
 
       /* Set all of the bits in any lesser indices */
@@ -188,7 +188,7 @@ _cogl_bitmask_set_range_in_array (CoglBitmask *bitmask,
   else
     {
       /* Clear the bits that are touching this index */
-      g_array_index (array, unsigned long, array_index) &= ~1UL << bit_index;
+      u_array_index (array, unsigned long, array_index) &= ~1UL << bit_index;
 
       /* Clear all of the bits in any lesser indices */
       memset (array->data, 0x00, sizeof (unsigned long) * array_index);
@@ -201,29 +201,29 @@ _cogl_bitmask_xor_bits (CoglBitmask *dst,
 {
   if (_cogl_bitmask_has_array (src))
     {
-      GArray *src_array, *dst_array;
+      UArray *src_array, *dst_array;
       int i;
 
       if (!_cogl_bitmask_has_array (dst))
         _cogl_bitmask_convert_to_array (dst);
 
-      dst_array = (GArray *) *dst;
-      src_array = (GArray *) *src;
+      dst_array = (UArray *) *dst;
+      src_array = (UArray *) *src;
 
       if (dst_array->len < src_array->len)
-        g_array_set_size (dst_array, src_array->len);
+        u_array_set_size (dst_array, src_array->len);
 
       for (i = 0; i < src_array->len; i++)
-        g_array_index (dst_array, unsigned long, i) ^=
-          g_array_index (src_array, unsigned long, i);
+        u_array_index (dst_array, unsigned long, i) ^=
+          u_array_index (src_array, unsigned long, i);
     }
   else if (_cogl_bitmask_has_array (dst))
     {
-      GArray *dst_array;
+      UArray *dst_array;
 
-      dst_array = (GArray *) *dst;
+      dst_array = (UArray *) *dst;
 
-      g_array_index (dst_array, unsigned long, 0) ^=
+      u_array_index (dst_array, unsigned long, 0) ^=
         _cogl_bitmask_to_bits (src);
     }
   else
@@ -234,7 +234,7 @@ _cogl_bitmask_xor_bits (CoglBitmask *dst,
 void
 _cogl_bitmask_clear_all_in_array (CoglBitmask *bitmask)
 {
-  GArray *array = (GArray *) *bitmask;
+  UArray *array = (UArray *) *bitmask;
 
   memset (array->data, 0, sizeof (unsigned long) * array->len);
 }
@@ -246,8 +246,8 @@ _cogl_bitmask_foreach (const CoglBitmask *bitmask,
 {
   if (_cogl_bitmask_has_array (bitmask))
     {
-      GArray *array = (GArray *) *bitmask;
-      const unsigned long *values = &g_array_index (array, unsigned long, 0);
+      UArray *array = (UArray *) *bitmask;
+      const unsigned long *values = &u_array_index (array, unsigned long, 0);
       int bit_num;
 
       COGL_FLAGS_FOREACH_START (values, array->len, bit_num)
@@ -275,22 +275,22 @@ void
 _cogl_bitmask_set_flags_array (const CoglBitmask *bitmask,
                                unsigned long *flags)
 {
-  const GArray *array = (const GArray *) *bitmask;
+  const UArray *array = (const UArray *) *bitmask;
   int i;
 
   for (i = 0; i < array->len; i++)
-    flags[i] |= g_array_index (array, unsigned long, i);
+    flags[i] |= u_array_index (array, unsigned long, i);
 }
 
 int
 _cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask)
 {
-  const GArray *array = (const GArray *) *bitmask;
+  const UArray *array = (const UArray *) *bitmask;
   int pop = 0;
   int i;
 
   for (i = 0; i < array->len; i++)
-    pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i));
+    pop += _cogl_util_popcountl (u_array_index (array, unsigned long, i));
 
   return pop;
 }
@@ -299,7 +299,7 @@ int
 _cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask,
                                       int upto)
 {
-  const GArray *array = (const GArray *) *bitmask;
+  const UArray *array = (const UArray *) *bitmask;
 
   if (upto >= array->len * sizeof (unsigned long) * 8)
     return _cogl_bitmask_popcount_in_array (bitmask);
@@ -312,9 +312,9 @@ _cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask,
       int i;
 
       for (i = 0; i < array_index; i++)
-        pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i));
+        pop += _cogl_util_popcountl (u_array_index (array, unsigned long, i));
 
-      top_mask = g_array_index (array, unsigned long, array_index);
+      top_mask = u_array_index (array, unsigned long, array_index);
 
       return pop + _cogl_util_popcountl (top_mask & ((1UL << bit_index) - 1));
     }
@@ -339,7 +339,7 @@ check_bit (int bit_num, void *user_data)
         return TRUE;
       }
 
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 
   return TRUE;
 }
@@ -367,9 +367,9 @@ verify_bits (const CoglBitmask *bitmask,
   _cogl_bitmask_foreach (bitmask, check_bit, &data);
 
   for (i = 0; i < data.n_bits; i++)
-    g_assert_cmpint (data.bits[i], ==, -1);
+    u_assert_cmpint (data.bits[i], ==, -1);
 
-  g_assert_cmpint (_cogl_bitmask_popcount (bitmask), ==, data.n_bits);
+  u_assert_cmpint (_cogl_bitmask_popcount (bitmask), ==, data.n_bits);
 
   for (i = 0; i < 1024; i++)
     {
@@ -382,7 +382,7 @@ verify_bits (const CoglBitmask *bitmask,
         if (va_arg (ap, int) < i)
           upto_popcount++;
 
-      g_assert_cmpint (_cogl_bitmask_popcount_upto (bitmask, i),
+      u_assert_cmpint (_cogl_bitmask_popcount_upto (bitmask, i),
                        ==,
                        upto_popcount);
 
@@ -392,7 +392,7 @@ verify_bits (const CoglBitmask *bitmask,
         if (va_arg (ap, int) == i)
           break;
 
-      g_assert_cmpint (_cogl_bitmask_get (bitmask, i), ==, (j < data.n_bits));
+      u_assert_cmpint (_cogl_bitmask_get (bitmask, i), ==, (j < data.n_bits));
     }
 }
 
@@ -475,7 +475,7 @@ UNIT_TEST (check_bitmask_api,
   _cogl_bitmask_xor_bits (&bitmask, &other_bitmask);
 
   for (i = 0; i < 1024; i++)
-    g_assert_cmpint (_cogl_bitmask_get (&bitmask, i),
+    u_assert_cmpint (_cogl_bitmask_get (&bitmask, i),
                      ==,
                      (i == 5 ? FALSE :
                       i < 400 ? TRUE :
@@ -485,5 +485,5 @@ UNIT_TEST (check_bitmask_api,
   _cogl_bitmask_set_bits (&bitmask, &other_bitmask);
 
   for (i = 0; i < 1024; i++)
-    g_assert_cmpint (_cogl_bitmask_get (&bitmask, i), ==, (i < 500));
+    u_assert_cmpint (_cogl_bitmask_get (&bitmask, i), ==, (i < 500));
 }
diff --git a/cogl/cogl-bitmask.h b/cogl/cogl-bitmask.h
index 0e65048..550b3dd 100644
--- a/cogl/cogl-bitmask.h
+++ b/cogl/cogl-bitmask.h
@@ -32,7 +32,7 @@
 #ifndef __COGL_BITMASK_H
 #define __COGL_BITMASK_H
 
-#include <glib.h>
+#include <ulib.h>
 #include "cogl-util.h"
 
 COGL_BEGIN_DECLS
@@ -47,8 +47,8 @@ COGL_BEGIN_DECLS
  *
  * Internally a CoglBitmask is a pointer. If the least significant bit
  * of the pointer is 1 then the rest of the bits are directly used as
- * part of the bitmask, otherwise it is a pointer to a GArray of
- * unsigned ints. This relies on the fact the g_malloc will return a
+ * part of the bitmask, otherwise it is a pointer to a UArray of
+ * unsigned ints. This relies on the fact the u_malloc will return a
  * pointer aligned to at least two bytes (so that the least
  * significant bit of the address is always 0). It also assumes that
  * the size of a pointer is always greater than or equal to the size
@@ -72,7 +72,7 @@ typedef struct _CoglBitmaskImaginaryType *CoglBitmask;
   ((void *) ((((unsigned long) (bits)) << 1UL) | 1UL))
 
 /* Internal helper macro to determine whether this bitmask has a
-   GArray allocated or whether the pointer is just used directly */
+   UArray allocated or whether the pointer is just used directly */
 #define _cogl_bitmask_has_array(bitmask) \
   (!(_cogl_bitmask_to_number (bitmask) & 1UL))
 
@@ -88,7 +88,7 @@ typedef struct _CoglBitmaskImaginaryType *CoglBitmask;
  * zero
  */
 #define _cogl_bitmask_init(bitmask) \
-  G_STMT_START { *(bitmask) = _cogl_bitmask_from_bits (0); } G_STMT_END
+  U_STMT_START { *(bitmask) = _cogl_bitmask_from_bits (0); } U_STMT_END
 
 CoglBool
 _cogl_bitmask_get_from_array (const CoglBitmask *bitmask,
@@ -232,7 +232,7 @@ static inline void
 _cogl_bitmask_destroy (CoglBitmask *bitmask)
 {
   if (_cogl_bitmask_has_array (bitmask))
-    g_array_free ((GArray *) *bitmask, TRUE);
+    u_array_free ((UArray *) *bitmask, TRUE);
 }
 
 /*
diff --git a/cogl/cogl-blend-string.c b/cogl/cogl-blend-string.c
index 8791d73..9db5f94 100644
--- a/cogl/cogl-blend-string.c
+++ b/cogl/cogl-blend-string.c
@@ -38,7 +38,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-context-private.h"
 #include "cogl-debug.h"
@@ -128,7 +128,7 @@ static CoglBlendStringFunctionInfo blend_functions[] = {
 uint32_t
 cogl_blend_string_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-blend-string-error-quark");
+  return u_quark_from_static_string ("cogl-blend-string-error-quark");
 }
 
 void
@@ -205,7 +205,7 @@ error:
 
   if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
     {
-      g_debug ("Invalid texture combine string: %s",
+      u_debug ("Invalid texture combine string: %s",
                error_string);
     }
   return FALSE;
@@ -315,7 +315,7 @@ error:
 
   if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
     {
-      g_debug ("Invalid %s string: %s",
+      u_debug ("Invalid %s string: %s",
                context == COGL_BLEND_STRING_CONTEXT_BLENDING ?
                "blend" : "texture combine",
                error_string);
@@ -333,30 +333,30 @@ print_argument (CoglBlendStringArgument *arg)
       "RGBA"
   };
 
-  g_print (" Arg:\n");
-  g_print ("  is zero = %s\n", arg->source.is_zero ? "yes" : "no");
+  u_print (" Arg:\n");
+  u_print ("  is zero = %s\n", arg->source.is_zero ? "yes" : "no");
   if (!arg->source.is_zero)
     {
-      g_print ("  color source = %s\n", arg->source.info->name);
-      g_print ("  one minus = %s\n", arg->source.one_minus ? "yes" : "no");
-      g_print ("  mask = %s\n", mask_names[arg->source.mask]);
-      g_print ("  texture = %d\n", arg->source.texture);
-      g_print ("\n");
-      g_print ("  factor is_one = %s\n", arg->factor.is_one ? "yes" : "no");
-      g_print ("  factor is_src_alpha_saturate = %s\n",
+      u_print ("  color source = %s\n", arg->source.info->name);
+      u_print ("  one minus = %s\n", arg->source.one_minus ? "yes" : "no");
+      u_print ("  mask = %s\n", mask_names[arg->source.mask]);
+      u_print ("  texture = %d\n", arg->source.texture);
+      u_print ("\n");
+      u_print ("  factor is_one = %s\n", arg->factor.is_one ? "yes" : "no");
+      u_print ("  factor is_src_alpha_saturate = %s\n",
                arg->factor.is_src_alpha_saturate ? "yes" : "no");
-      g_print ("  factor is_color = %s\n", arg->factor.is_color ? "yes" : "no");
+      u_print ("  factor is_color = %s\n", arg->factor.is_color ? "yes" : "no");
       if (arg->factor.is_color)
         {
-          g_print ("  factor color:is zero = %s\n",
+          u_print ("  factor color:is zero = %s\n",
                    arg->factor.source.is_zero ? "yes" : "no");
-          g_print ("  factor color:color source = %s\n",
+          u_print ("  factor color:color source = %s\n",
                    arg->factor.source.info->name);
-          g_print ("  factor color:one minus = %s\n",
+          u_print ("  factor color:one minus = %s\n",
                    arg->factor.source.one_minus ? "yes" : "no");
-          g_print ("  factor color:mask = %s\n",
+          u_print ("  factor color:mask = %s\n",
                    mask_names[arg->factor.source.mask]);
-          g_print ("  factor color:texture = %d\n",
+          u_print ("  factor color:texture = %d\n",
                    arg->factor.source.texture);
         }
     }
@@ -371,10 +371,10 @@ print_statement (int num, CoglBlendStringStatement *statement)
       "RGBA"
   };
   int i;
-  g_print ("Statement %d:\n", num);
-  g_print (" Destination channel mask = %s\n",
+  u_print ("Statement %d:\n", num);
+  u_print (" Destination channel mask = %s\n",
            mask_names[statement->mask]);
-  g_print (" Function = %s\n", statement->function->name);
+  u_print (" Function = %s\n", statement->function->name);
   for (i = 0; i < statement->function->argc; i++)
     print_argument (&statement->args[i]);
 }
@@ -392,12 +392,12 @@ get_function_info (const char *mark,
   if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
     {
       functions = blend_functions;
-      array_len = G_N_ELEMENTS (blend_functions);
+      array_len = U_N_ELEMENTS (blend_functions);
     }
   else
     {
       functions = tex_combine_functions;
-      array_len = G_N_ELEMENTS (tex_combine_functions);
+      array_len = U_N_ELEMENTS (tex_combine_functions);
     }
 
   for (i = 0; i < array_len; i++)
@@ -422,17 +422,17 @@ get_color_src_info (const char *mark,
   if (context == COGL_BLEND_STRING_CONTEXT_BLENDING)
     {
       sources = blending_color_sources;
-      array_len = G_N_ELEMENTS (blending_color_sources);
+      array_len = U_N_ELEMENTS (blending_color_sources);
     }
   else
     {
       sources = tex_combine_color_sources;
-      array_len = G_N_ELEMENTS (tex_combine_color_sources);
+      array_len = U_N_ELEMENTS (tex_combine_color_sources);
     }
 
   if (len >= 8 &&
       strncmp (mark, "TEXTURE_", 8) == 0 &&
-      g_ascii_isdigit (mark[8]))
+      u_ascii_isdigit (mark[8]))
     {
       return &tex_combine_texture_n_color_source;
     }
@@ -450,13 +450,13 @@ get_color_src_info (const char *mark,
 static CoglBool
 is_symbol_char (const char c)
 {
-  return (g_ascii_isalpha (c) || c == '_') ? TRUE : FALSE;
+  return (u_ascii_isalpha (c) || c == '_') ? TRUE : FALSE;
 }
 
 static CoglBool
 is_alphanum_char (const char c)
 {
-  return (g_ascii_isalnum (c) || c == '_') ? TRUE : FALSE;
+  return (u_ascii_isalnum (c) || c == '_') ? TRUE : FALSE;
 }
 
 static CoglBool
@@ -493,7 +493,7 @@ parse_argument (const char *string, /* original user string */
 
   do
     {
-      if (g_ascii_isspace (*p))
+      if (u_ascii_isspace (*p))
         continue;
 
       if (*p == '\0')
@@ -745,7 +745,7 @@ error:
 
     if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
       {
-        g_debug ("Syntax error for argument %d at offset %d: %s",
+        u_debug ("Syntax error for argument %d at offset %d: %s",
                  current_arg, offset, error_string);
       }
     return FALSE;
@@ -781,7 +781,7 @@ _cogl_blend_string_compile (const char *string,
 
   do
     {
-      if (g_ascii_isspace (*p))
+      if (u_ascii_isspace (*p))
         continue;
 
       if (*p == '\0')
@@ -925,7 +925,7 @@ error:
 
       if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
         {
-          g_debug ("Syntax error at offset %d: %s",
+          u_debug ("Syntax error at offset %d: %s",
                    offset, error_string);
         }
       return 0;
@@ -983,15 +983,15 @@ _cogl_blend_string_test (void)
                                               &error);
       if (!count)
         {
-          g_print ("Failed to parse string:\n%s\n%s\n",
+          u_print ("Failed to parse string:\n%s\n%s\n",
                    strings[i].string,
                    error->message);
           cogl_error_free (error);
           error = NULL;
           continue;
         }
-      g_print ("Original:\n");
-      g_print ("%s\n", strings[i].string);
+      u_print ("Original:\n");
+      u_print ("%s\n", strings[i].string);
       if (count > 0)
         print_statement (0, &statements[0]);
       if (count > 1)
diff --git a/cogl/cogl-blend-string.h b/cogl/cogl-blend-string.h
index 5b39991..32f1e64 100644
--- a/cogl/cogl-blend-string.h
+++ b/cogl/cogl-blend-string.h
@@ -35,7 +35,7 @@
 #define COGL_BLEND_STRING_H
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
 typedef enum _CoglBlendStringContext
 {
diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
index 0606cfd..248120e 100644
--- a/cogl/cogl-blit.c
+++ b/cogl/cogl-blit.c
@@ -276,7 +276,7 @@ _cogl_blit_get_tex_data_begin (CoglBlitData *data)
   data->format = _cogl_texture_get_format (data->src_tex);
   data->bpp = _cogl_pixel_format_get_bytes_per_pixel (data->format);
 
-  data->image_data = g_malloc (data->bpp * data->src_width *
+  data->image_data = u_malloc (data->bpp * data->src_width *
                                data->src_height);
   cogl_texture_get_data (data->src_tex, data->format,
                          data->src_width * data->bpp, data->image_data);
@@ -311,7 +311,7 @@ _cogl_blit_get_tex_data_blit (CoglBlitData *data,
 static void
 _cogl_blit_get_tex_data_end (CoglBlitData *data)
 {
-  g_free (data->image_data);
+  u_free (data->image_data);
 }
 
 /* These should be specified in order of preference */
@@ -361,18 +361,18 @@ _cogl_blit_begin (CoglBlitData *data,
          variable is named to be specific to the atlas code. If we
          want to use the code in other places we should create another
          environment variable for each specific use case */
-      if ((default_mode_string = g_getenv ("COGL_ATLAS_DEFAULT_BLIT_MODE")))
+      if ((default_mode_string = u_getenv ("COGL_ATLAS_DEFAULT_BLIT_MODE")))
         {
-          for (i = 0; i < G_N_ELEMENTS (_cogl_blit_modes); i++)
+          for (i = 0; i < U_N_ELEMENTS (_cogl_blit_modes); i++)
             if (!strcmp (_cogl_blit_modes[i].name, default_mode_string))
               {
                 _cogl_blit_default_mode = _cogl_blit_modes + i;
                 break;
               }
 
-          if (i >= G_N_ELEMENTS (_cogl_blit_modes))
+          if (i >= U_N_ELEMENTS (_cogl_blit_modes))
             {
-              g_warning ("Unknown blit mode %s", default_mode_string);
+              u_warning ("Unknown blit mode %s", default_mode_string);
               _cogl_blit_default_mode = _cogl_blit_modes;
             }
         }
@@ -396,7 +396,7 @@ _cogl_blit_begin (CoglBlitData *data,
                  _cogl_blit_default_mode->name);
 
       /* Try all of the other modes in order */
-      for (i = 0; i < G_N_ELEMENTS (_cogl_blit_modes); i++)
+      for (i = 0; i < U_N_ELEMENTS (_cogl_blit_modes); i++)
         if (_cogl_blit_modes + i != _cogl_blit_default_mode &&
             _cogl_blit_modes[i].begin_func (data))
           {
@@ -410,7 +410,7 @@ _cogl_blit_begin (CoglBlitData *data,
                      _cogl_blit_modes[i].name);
 
       /* The last blit mode can't fail so this should never happen */
-      _COGL_RETURN_IF_FAIL (i < G_N_ELEMENTS (_cogl_blit_modes));
+      _COGL_RETURN_IF_FAIL (i < U_N_ELEMENTS (_cogl_blit_modes));
     }
 
   data->blit_mode = _cogl_blit_default_mode;
diff --git a/cogl/cogl-blit.h b/cogl/cogl-blit.h
index 12eb434..16cfe08 100644
--- a/cogl/cogl-blit.h
+++ b/cogl/cogl-blit.h
@@ -29,7 +29,7 @@
 #ifndef __COGL_BLIT_H
 #define __COGL_BLIT_H
 
-#include <glib.h>
+#include <ulib.h>
 #include "cogl-object-private.h"
 #include "cogl-texture.h"
 #include "cogl-framebuffer.h"
@@ -69,7 +69,7 @@ struct _CoglBlitData
 
   const CoglBlitMode *blit_mode;
 
-  /* If we're not using an FBO then we g_malloc a buffer and copy the
+  /* If we're not using an FBO then we u_malloc a buffer and copy the
      complete texture data in */
   unsigned char *image_data;
   CoglPixelFormat format;
diff --git a/cogl/cogl-boxed-value.c b/cogl/cogl-boxed-value.c
index 19b285b..ef3dae9 100644
--- a/cogl/cogl-boxed-value.c
+++ b/cogl/cogl-boxed-value.c
@@ -106,7 +106,7 @@ _cogl_boxed_value_equal (const CoglBoxedValue *bva,
                       sizeof (float) * bva->size * bva->size * bva->count);
     }
 
-  g_warn_if_reached ();
+  u_warn_if_reached ();
 
   return FALSE;
 }
@@ -141,7 +141,7 @@ _cogl_boxed_value_set_x (CoglBoxedValue *bv,
   if (count == 1)
     {
       if (bv->count > 1)
-        g_free (bv->v.array);
+        u_free (bv->v.array);
 
       if (transpose)
         _cogl_boxed_value_tranpose (bv->v.float_value,
@@ -158,12 +158,12 @@ _cogl_boxed_value_set_x (CoglBoxedValue *bv,
               bv->size != size ||
               bv->type != type)
             {
-              g_free (bv->v.array);
-              bv->v.array = g_malloc (count * value_size);
+              u_free (bv->v.array);
+              bv->v.array = u_malloc (count * value_size);
             }
         }
       else
-        bv->v.array = g_malloc (count * value_size);
+        bv->v.array = u_malloc (count * value_size);
 
       if (transpose)
         {
@@ -256,19 +256,19 @@ _cogl_boxed_value_copy (CoglBoxedValue *dst,
           break;
 
         case COGL_BOXED_INT:
-          dst->v.int_array = g_memdup (src->v.int_array,
+          dst->v.int_array = u_memdup (src->v.int_array,
                                        src->size * src->count * sizeof (int));
           break;
 
         case COGL_BOXED_FLOAT:
-          dst->v.float_array = g_memdup (src->v.float_array,
+          dst->v.float_array = u_memdup (src->v.float_array,
                                          src->size *
                                          src->count *
                                          sizeof (float));
           break;
 
         case COGL_BOXED_MATRIX:
-          dst->v.float_array = g_memdup (src->v.float_array,
+          dst->v.float_array = u_memdup (src->v.float_array,
                                          src->size * src->size *
                                          src->count * sizeof (float));
           break;
@@ -280,7 +280,7 @@ void
 _cogl_boxed_value_destroy (CoglBoxedValue *bv)
 {
   if (bv->count > 1)
-    g_free (bv->v.array);
+    u_free (bv->v.array);
 }
 
 void
diff --git a/cogl/cogl-boxed-value.h b/cogl/cogl-boxed-value.h
index 845c076..f214b0d 100644
--- a/cogl/cogl-boxed-value.h
+++ b/cogl/cogl-boxed-value.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_BOXED_VALUE_H
 #define __COGL_BOXED_VALUE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-context.h"
 
@@ -58,11 +58,11 @@ typedef struct _CoglBoxedValue
 } CoglBoxedValue;
 
 #define _cogl_boxed_value_init(bv)              \
-  G_STMT_START {                                \
+  U_STMT_START {                                \
     CoglBoxedValue *_bv = (bv);                 \
     _bv->type = COGL_BOXED_NONE;                \
     _bv->count = 1;                             \
-  } G_STMT_END
+  } U_STMT_END
 
 CoglBool
 _cogl_boxed_value_equal (const CoglBoxedValue *bva,
diff --git a/cogl/cogl-buffer-private.h b/cogl/cogl-buffer-private.h
index 5170748..c48b757 100644
--- a/cogl/cogl-buffer-private.h
+++ b/cogl/cogl-buffer-private.h
@@ -35,7 +35,7 @@
 #ifndef __COGL_BUFFER_PRIVATE_H__
 #define __COGL_BUFFER_PRIVATE_H__
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-object-private.h"
 #include "cogl-buffer.h"
diff --git a/cogl/cogl-buffer.c b/cogl/cogl-buffer.c
index cff017d..9d7b264 100644
--- a/cogl/cogl-buffer.c
+++ b/cogl/cogl-buffer.c
@@ -43,7 +43,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-util.h"
 #include "cogl-context-private.h"
@@ -56,19 +56,19 @@
  * abstract class manually.
  */
 
-static GSList *_cogl_buffer_types;
+static USList *_cogl_buffer_types;
 
 void
 _cogl_buffer_register_buffer_type (const CoglObjectClass *klass)
 {
-  _cogl_buffer_types = g_slist_prepend (_cogl_buffer_types, (void *) klass);
+  _cogl_buffer_types = u_slist_prepend (_cogl_buffer_types, (void *) klass);
 }
 
 CoglBool
 cogl_is_buffer (void *object)
 {
   const CoglObject *obj = object;
-  GSList *l;
+  USList *l;
 
   if (object == NULL)
     return FALSE;
@@ -152,7 +152,7 @@ _cogl_buffer_initialize (CoglBuffer *buffer,
       buffer->vtable.unmap = malloc_unmap;
       buffer->vtable.set_data = malloc_set_data;
 
-      buffer->data = g_malloc (size);
+      buffer->data = u_malloc (size);
     }
   else
     {
@@ -175,7 +175,7 @@ _cogl_buffer_fini (CoglBuffer *buffer)
   if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
     buffer->context->driver_vtable->buffer_destroy (buffer);
   else
-    g_free (buffer->data);
+    u_free (buffer->data);
 }
 
 unsigned int
@@ -194,7 +194,7 @@ cogl_buffer_set_update_hint (CoglBuffer *buffer,
   if (!cogl_is_buffer (buffer))
     return;
 
-  if (G_UNLIKELY (hint > COGL_BUFFER_UPDATE_HINT_STREAM))
+  if (U_UNLIKELY (hint > COGL_BUFFER_UPDATE_HINT_STREAM))
     hint = COGL_BUFFER_UPDATE_HINT_STATIC;
 
   buffer->update_hint = hint;
@@ -215,7 +215,7 @@ warn_about_midscene_changes (void)
   static CoglBool seen = FALSE;
   if (!seen)
     {
-      g_warning ("Mid-scene modification of buffers has "
+      u_warning ("Mid-scene modification of buffers has "
                  "undefined results\n");
       seen = TRUE;
     }
@@ -243,7 +243,7 @@ cogl_buffer_map_range (CoglBuffer *buffer,
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
   _COGL_RETURN_VAL_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
 
-  if (G_UNLIKELY (buffer->immutable_ref))
+  if (U_UNLIKELY (buffer->immutable_ref))
     warn_about_midscene_changes ();
 
   buffer->data = buffer->vtable.map_range (buffer,
@@ -303,7 +303,7 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer,
      the data and then upload it using cogl_buffer_set_data when
      the buffer is unmapped. The temporary buffer is shared to
      avoid reallocating it every time */
-  g_byte_array_set_size (ctx->buffer_map_fallback_array, size);
+  u_byte_array_set_size (ctx->buffer_map_fallback_array, size);
   ctx->buffer_map_fallback_offset = offset;
 
   buffer->flags |= COGL_BUFFER_FLAG_MAPPED_FALLBACK;
@@ -357,7 +357,7 @@ cogl_buffer_set_data (CoglBuffer *buffer,
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE);
   _COGL_RETURN_VAL_IF_FAIL ((offset + size) <= buffer->size, FALSE);
 
-  if (G_UNLIKELY (buffer->immutable_ref))
+  if (U_UNLIKELY (buffer->immutable_ref))
     warn_about_midscene_changes ();
 
   return buffer->vtable.set_data (buffer, offset, data, size, error);
diff --git a/cogl/cogl-clip-stack.c b/cogl/cogl-clip-stack.c
index 34c9620..0920cb8 100644
--- a/cogl/cogl-clip-stack.c
+++ b/cogl/cogl-clip-stack.c
@@ -35,7 +35,7 @@
 #include <string.h>
 #include <math.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-clip-stack.h"
 #include "cogl-context-private.h"
@@ -58,7 +58,7 @@ _cogl_clip_stack_push_entry (CoglClipStack *clip_stack,
                              size_t size,
                              CoglClipStackType type)
 {
-  CoglClipStack *entry = g_slice_alloc (size);
+  CoglClipStack *entry = u_slice_alloc (size);
 
   /* The new entry starts with a ref count of 1 because the stack
      holds a reference to it as it is the top entry */
@@ -324,11 +324,11 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
           {
             CoglClipStackRect *rect = (CoglClipStackRect *) entry;
             cogl_matrix_entry_unref (rect->matrix_entry);
-            g_slice_free1 (sizeof (CoglClipStackRect), entry);
+            u_slice_free1 (sizeof (CoglClipStackRect), entry);
             break;
           }
         case COGL_CLIP_STACK_WINDOW_RECT:
-          g_slice_free1 (sizeof (CoglClipStackWindowRect), entry);
+          u_slice_free1 (sizeof (CoglClipStackWindowRect), entry);
           break;
         case COGL_CLIP_STACK_PRIMITIVE:
           {
@@ -336,11 +336,11 @@ _cogl_clip_stack_unref (CoglClipStack *entry)
               (CoglClipStackPrimitive *) entry;
             cogl_matrix_entry_unref (primitive_entry->matrix_entry);
             cogl_object_unref (primitive_entry->primitive);
-            g_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
+            u_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
             break;
           }
         default:
-          g_assert_not_reached ();
+          u_assert_not_reached ();
         }
 
       entry = parent;
diff --git a/cogl/cogl-clip-stack.h b/cogl/cogl-clip-stack.h
index ceaf5d8..f233da3 100644
--- a/cogl/cogl-clip-stack.h
+++ b/cogl/cogl-clip-stack.h
@@ -36,7 +36,7 @@
 #include "cogl-framebuffer.h"
 #include "cogl-matrix-stack.h"
 
-/* The clip stack works like a GSList where only a pointer to the top
+/* The clip stack works like a USList where only a pointer to the top
    of the stack is stored. The empty clip stack is represented simply
    by the NULL pointer. When an entry is added to or removed from the
    stack the new top of the stack is returned. When an entry is pushed
diff --git a/cogl/cogl-closure-list-private.h b/cogl/cogl-closure-list-private.h
index aea78f4..2e69191 100644
--- a/cogl/cogl-closure-list-private.h
+++ b/cogl/cogl-closure-list-private.h
@@ -94,7 +94,7 @@ _cogl_closure_list_add (CoglList *list,
  * manually iterate the list and invoke the callbacks yourself.
  */
 #define _cogl_closure_list_invoke(list, cb_type, ...)   \
-  G_STMT_START {                                        \
+  U_STMT_START {                                        \
     CoglClosure *_c, *_tmp;                             \
                                                         \
     _cogl_list_for_each_safe (_c, _tmp, (list), link)   \
@@ -102,10 +102,10 @@ _cogl_closure_list_add (CoglList *list,
         cb_type _cb = _c->function;                     \
         _cb (__VA_ARGS__, _c->user_data);               \
       }                                                 \
-  } G_STMT_END
+  } U_STMT_END
 
 #define _cogl_closure_list_invoke_no_args(list)         \
-  G_STMT_START {                                        \
+  U_STMT_START {                                        \
     CoglClosure *_c, *_tmp;                             \
                                                         \
     _cogl_list_for_each_safe (_c, _tmp, (list), link)   \
@@ -113,6 +113,6 @@ _cogl_closure_list_add (CoglList *list,
         void (*_cb)(void *) = _c->function;             \
         _cb (_c->user_data);                            \
       }                                                 \
-  } G_STMT_END
+  } U_STMT_END
 
 #endif /* _COGL_CLOSURE_LIST_PRIVATE_H_ */
diff --git a/cogl/cogl-closure-list.c b/cogl/cogl-closure-list.c
index cfc36f2..dd6aafe 100644
--- a/cogl/cogl-closure-list.c
+++ b/cogl/cogl-closure-list.c
@@ -29,7 +29,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-closure-list-private.h"
 
@@ -41,7 +41,7 @@ _cogl_closure_disconnect (CoglClosure *closure)
   if (closure->destroy_cb)
     closure->destroy_cb (closure->user_data);
 
-  g_slice_free (CoglClosure, closure);
+  u_slice_free (CoglClosure, closure);
 }
 
 void
@@ -59,7 +59,7 @@ _cogl_closure_list_add (CoglList *list,
                         void *user_data,
                         CoglUserDataDestroyCallback destroy_cb)
 {
-  CoglClosure *closure = g_slice_new (CoglClosure);
+  CoglClosure *closure = u_slice_new (CoglClosure);
 
   closure->function = function;
   closure->user_data = user_data;
diff --git a/cogl/cogl-clutter.c b/cogl/cogl-clutter.c
index c23785a..f14fd73 100644
--- a/cogl/cogl-clutter.c
+++ b/cogl/cogl-clutter.c
@@ -33,7 +33,7 @@
 #include "config.h"
 #endif
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 #include "cogl-util.h"
diff --git a/cogl/cogl-color-private.h b/cogl/cogl-color-private.h
index 5098ac6..38b71cf 100644
--- a/cogl/cogl-color-private.h
+++ b/cogl/cogl-color-private.h
@@ -36,7 +36,7 @@
 
 #include "cogl-color.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 /* cogl-pipeline.c wants to be able to hash CoglColor data so it needs
  * the exact data size to be able to avoid reading the padding bytes.
diff --git a/cogl/cogl-color.c b/cogl/cogl-color.c
index afe36bc..5205554 100644
--- a/cogl/cogl-color.c
+++ b/cogl/cogl-color.c
@@ -258,8 +258,8 @@ cogl_color_equal (const void *v1, const void *v2)
 CoglColor *
 cogl_color_copy (const CoglColor *color)
 {
-  if (G_LIKELY (color))
-    return g_slice_dup (CoglColor, color);
+  if (U_LIKELY (color))
+    return u_slice_dup (CoglColor, color);
 
   return NULL;
 }
@@ -267,8 +267,8 @@ cogl_color_copy (const CoglColor *color)
 void
 cogl_color_free (CoglColor *color)
 {
-  if (G_LIKELY (color))
-    g_slice_free (CoglColor, color);
+  if (U_LIKELY (color))
+    u_slice_free (CoglColor, color);
 }
 
 void
diff --git a/cogl/cogl-color.h b/cogl/cogl-color.h
index a5a1170..3e892a2 100644
--- a/cogl/cogl-color.h
+++ b/cogl/cogl-color.h
@@ -457,8 +457,8 @@ cogl_color_unpremultiply (CoglColor *color);
  *
  * Compares two #CoglColor<!-- -->s and checks if they are the same.
  *
- * This function can be passed to g_hash_table_new() as the @key_equal_func
- * parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
+ * This function can be passed to u_hash_table_new() as the @key_equal_func
+ * parameter, when using #CoglColor<!-- -->s as keys in a #UHashTable.
  *
  * Return value: %TRUE if the two colors are the same.
  *
diff --git a/cogl/cogl-config.c b/cogl/cogl-config.c
index bc0fc95..e76dc8f 100644
--- a/cogl/cogl-config.c
+++ b/cogl/cogl-config.c
@@ -30,14 +30,14 @@
  *   Robert Bragg <robert linux intel com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "cogl-debug.h"
 #include "cogl-config-private.h"
 
+#ifdef COGL_HAS_GLIB_SUPPORT
 #include <glib.h>
+#endif
 
 char *_cogl_config_driver;
 char *_cogl_config_renderer;
@@ -91,7 +91,7 @@ _cogl_config_process (GKeyFile *key_file)
       g_free (value);
     }
 
-  for (i = 0; i < G_N_ELEMENTS (cogl_config_string_options); i++)
+  for (i = 0; i < U_N_ELEMENTS (cogl_config_string_options); i++)
     {
       const char *conf_name = cogl_config_string_options[i].conf_name;
       char **variable = cogl_config_string_options[i].variable;
diff --git a/cogl/cogl-context-private.h b/cogl/cogl-context-private.h
index c5a125d..b89db26 100644
--- a/cogl/cogl-context-private.h
+++ b/cogl/cogl-context-private.h
@@ -108,8 +108,8 @@ struct _CoglContext
   CoglPipelineLayer *default_layer_n;
   CoglPipelineLayer *dummy_layer_dependant;
 
-  GHashTable *attribute_name_states_hash;
-  GArray *attribute_name_index_map;
+  UHashTable *attribute_name_states_hash;
+  UArray *attribute_name_index_map;
   int n_attribute_names;
 
   CoglBitmask       enabled_builtin_attributes;
@@ -144,13 +144,13 @@ struct _CoglContext
   CoglMatrixEntryCache builtin_flushed_projection;
   CoglMatrixEntryCache builtin_flushed_modelview;
 
-  GArray           *texture_units;
+  UArray           *texture_units;
   int               active_texture_unit;
 
   /* Pipelines */
   CoglPipeline     *opaque_color_pipeline; /* to check for simple pipelines */
-  GString          *codegen_header_buffer;
-  GString          *codegen_source_buffer;
+  UString          *codegen_header_buffer;
+  UString          *codegen_source_buffer;
 
   CoglPipelineCache *pipeline_cache;
 
@@ -161,11 +161,11 @@ struct _CoglContext
 
   /* Central list of all framebuffers so all journals can be flushed
    * at any time. */
-  GList            *framebuffers;
+  UList            *framebuffers;
 
   /* Global journal buffers */
-  GArray           *journal_flush_attributes_array;
-  GArray           *journal_clip_bounds;
+  UArray           *journal_flush_attributes_array;
+  UArray           *journal_clip_bounds;
 
   /* Some simple caching, to minimize state changes... */
   CoglPipeline     *current_pipeline;
@@ -198,7 +198,7 @@ struct _CoglContext
   CoglClosure *onscreen_dispatch_idle;
 
   CoglGLES2Context *current_gles2_context;
-  GQueue gles2_context_stack;
+  UQueue gles2_context_stack;
 
   /* Primitives */
   CoglPipeline     *stencil_pipeline;
@@ -212,8 +212,8 @@ struct _CoglContext
   CoglPipeline     *texture_download_pipeline;
   CoglPipeline     *blit_texture_pipeline;
 
-  GSList           *atlases;
-  GHookList         atlas_reorganize_callbacks;
+  USList           *atlases;
+  UHookList         atlas_reorganize_callbacks;
 
   /* This debugging variable is used to pick a colour for visually
      displaying the quad batches. It needs to be global so that it can
@@ -253,7 +253,7 @@ struct _CoglContext
   /* This is used as a temporary buffer to fill a CoglBuffer when
      cogl_buffer_map fails and we only want to map to fill it with new
      data */
-  GByteArray       *buffer_map_fallback_array;
+  UByteArray       *buffer_map_fallback_array;
   CoglBool          buffer_map_fallback_in_use;
   size_t            buffer_map_fallback_offset;
 
@@ -268,7 +268,7 @@ struct _CoglContext
 #ifdef COGL_HAS_XLIB_SUPPORT
   int damage_base;
   /* List of callback functions that will be given every Xlib event */
-  GSList *event_filters;
+  USList *event_filters;
   /* Current top of the XError trap state stack. The actual memory for
      these is expected to be allocated on the stack by the caller */
   CoglXlibTrapState *trap_state;
@@ -283,11 +283,11 @@ struct _CoglContext
      they increase sequentially so that we can use the id as an index
      into a bitfield representing the uniforms that a pipeline
      overrides from its parent. */
-  GPtrArray *uniform_names;
+  UPtrArray *uniform_names;
   /* A hash table to quickly get an index given an existing name. The
      name strings are owned by the uniform_names array. The values are
      the uniform location cast to a pointer. */
-  GHashTable *uniform_name_hash;
+  UHashTable *uniform_name_hash;
   int n_uniform_names;
 
   CoglPollSource *fences_poll_source;
@@ -352,7 +352,7 @@ _cogl_context_set_current_modelview_entry (CoglContext *context,
  *
  * Return value: a NULL-terminated array of strings representing the
  *   supported extensions by the current driver. This array is owned
- *   by the caller and should be freed with g_strfreev().
+ *   by the caller and should be freed with u_strfreev().
  */
 char **
 _cogl_context_get_gl_extensions (CoglContext *context);
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index f2d1696..dca2127 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -84,16 +84,16 @@ static CoglContext *_cogl_context = NULL;
 static void
 _cogl_init_feature_overrides (CoglContext *ctx)
 {
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
     COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_VBOS, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
     COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP)))
     COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_ARBFP, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
     {
       COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, FALSE);
       COGL_FLAGS_SET (ctx->features,
@@ -101,7 +101,7 @@ _cogl_init_feature_overrides (CoglContext *ctx)
                       FALSE);
     }
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_NPOT_TEXTURES)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_NPOT_TEXTURES)))
     {
       COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_TEXTURE_NPOT, FALSE);
       COGL_FLAGS_SET (ctx->features,
@@ -158,7 +158,7 @@ cogl_context_new (CoglDisplay *display,
 #endif
 
   /* Allocate context memory */
-  context = g_malloc0 (sizeof (CoglContext));
+  context = u_malloc0 (sizeof (CoglContext));
 
   /* Convert the context into an object immediately in case any of the
      code below wants to verify that the context pointer is a valid
@@ -187,7 +187,7 @@ cogl_context_new (CoglDisplay *display,
       CoglRenderer *renderer = cogl_renderer_new ();
       if (!cogl_renderer_connect (renderer, error))
         {
-          g_free (context);
+          u_free (context);
           return NULL;
         }
 
@@ -200,7 +200,7 @@ cogl_context_new (CoglDisplay *display,
   if (!cogl_display_setup (display, error))
     {
       cogl_object_unref (display);
-      g_free (context);
+      u_free (context);
       return NULL;
     }
 
@@ -216,19 +216,19 @@ cogl_context_new (CoglDisplay *display,
   context->driver_vtable = display->renderer->driver_vtable;
   context->texture_driver = display->renderer->texture_driver;
 
-  for (i = 0; i < G_N_ELEMENTS (context->private_features); i++)
+  for (i = 0; i < U_N_ELEMENTS (context->private_features); i++)
     context->private_features[i] |= display->renderer->private_features[i];
 
   winsys = _cogl_context_get_winsys (context);
   if (!winsys->context_init (context, error))
     {
       cogl_object_unref (display);
-      g_free (context);
+      u_free (context);
       return NULL;
     }
 
   context->attribute_name_states_hash =
-    g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+    u_hash_table_new_full (u_str_hash, u_str_equal, u_free, u_free);
   context->attribute_name_index_map = NULL;
   context->n_attribute_names = 0;
 
@@ -238,8 +238,8 @@ cogl_context_new (CoglDisplay *display,
 
 
   context->uniform_names =
-    g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
-  context->uniform_name_hash = g_hash_table_new (g_str_hash, g_str_equal);
+    u_ptr_array_new_with_free_func ((UDestroyNotify) u_free);
+  context->uniform_name_hash = u_hash_table_new (u_str_hash, u_str_equal);
   context->n_uniform_names = 0;
 
   /* Initialise the driver specific state */
@@ -278,7 +278,7 @@ cogl_context_new (CoglDisplay *display,
   context->flushed_matrix_mode = COGL_MATRIX_MODELVIEW;
 
   context->texture_units =
-    g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
+    u_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
 
   if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ANY_GL))
     {
@@ -289,8 +289,8 @@ cogl_context_new (CoglDisplay *display,
     }
 
   context->opaque_color_pipeline = cogl_pipeline_new (context);
-  context->codegen_header_buffer = g_string_new ("");
-  context->codegen_source_buffer = g_string_new ("");
+  context->codegen_header_buffer = u_string_new ("");
+  context->codegen_source_buffer = u_string_new ("");
 
   context->default_gl_texture_2d_tex = NULL;
   context->default_gl_texture_3d_tex = NULL;
@@ -305,10 +305,10 @@ cogl_context_new (CoglDisplay *display,
   _cogl_list_init (&context->onscreen_events_queue);
   _cogl_list_init (&context->onscreen_dirty_queue);
 
-  g_queue_init (&context->gles2_context_stack);
+  u_queue_init (&context->gles2_context_stack);
 
   context->journal_flush_attributes_array =
-    g_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
+    u_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
   context->journal_clip_bounds = NULL;
 
   context->current_pipeline = NULL;
@@ -433,9 +433,9 @@ cogl_context_new (CoglDisplay *display,
   cogl_object_unref (white_pixel_bitmap);
 
   context->atlases = NULL;
-  g_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (GHook));
+  u_hook_list_init (&context->atlas_reorganize_callbacks, sizeof (UHook));
 
-  context->buffer_map_fallback_array = g_byte_array_new ();
+  context->buffer_map_fallback_array = u_byte_array_new ();
   context->buffer_map_fallback_in_use = FALSE;
 
   /* As far as I can tell, GL_POINT_SPRITE doesn't have any effect
@@ -474,12 +474,12 @@ _cogl_context_free (CoglContext *context)
   if (context->blit_texture_pipeline)
     cogl_object_unref (context->blit_texture_pipeline);
 
-  g_warn_if_fail (context->gles2_context_stack.length == 0);
+  u_warn_if_fail (context->gles2_context_stack.length == 0);
 
   if (context->journal_flush_attributes_array)
-    g_array_free (context->journal_flush_attributes_array, TRUE);
+    u_array_free (context->journal_flush_attributes_array, TRUE);
   if (context->journal_clip_bounds)
-    g_array_free (context->journal_clip_bounds, TRUE);
+    u_array_free (context->journal_clip_bounds, TRUE);
 
   if (context->rectangle_byte_indices)
     cogl_object_unref (context->rectangle_byte_indices);
@@ -499,8 +499,8 @@ _cogl_context_free (CoglContext *context)
   if (context->current_clip_stack_valid)
     _cogl_clip_stack_unref (context->current_clip_stack);
 
-  g_slist_free (context->atlases);
-  g_hook_list_clear (&context->atlas_reorganize_callbacks);
+  u_slist_free (context->atlases);
+  u_hook_list_clear (&context->atlas_reorganize_callbacks);
 
   _cogl_bitmask_destroy (&context->enabled_builtin_attributes);
   _cogl_bitmask_destroy (&context->enable_builtin_attributes_tmp);
@@ -523,17 +523,17 @@ _cogl_context_free (CoglContext *context)
 
   _cogl_destroy_texture_units ();
 
-  g_ptr_array_free (context->uniform_names, TRUE);
-  g_hash_table_destroy (context->uniform_name_hash);
+  u_ptr_array_free (context->uniform_names, TRUE);
+  u_hash_table_destroy (context->uniform_name_hash);
 
-  g_hash_table_destroy (context->attribute_name_states_hash);
-  g_array_free (context->attribute_name_index_map, TRUE);
+  u_hash_table_destroy (context->attribute_name_states_hash);
+  u_array_free (context->attribute_name_index_map, TRUE);
 
-  g_byte_array_free (context->buffer_map_fallback_array, TRUE);
+  u_byte_array_free (context->buffer_map_fallback_array, TRUE);
 
   cogl_object_unref (context->display);
 
-  g_free (context);
+  u_free (context);
 }
 
 CoglContext *
@@ -610,13 +610,13 @@ _cogl_context_get_gl_extensions (CoglContext *context)
 
       context->glGetIntegerv (GL_NUM_EXTENSIONS, &num_extensions);
 
-      ret = g_malloc (sizeof (char *) * (num_extensions + 1));
+      ret = u_malloc (sizeof (char *) * (num_extensions + 1));
 
       for (i = 0; i < num_extensions; i++)
         {
           const char *ext =
             (const char *) context->glGetStringi (GL_EXTENSIONS, i);
-          ret[i] = g_strdup (ext);
+          ret[i] = u_strdup (ext);
         }
 
       ret[num_extensions] = NULL;
@@ -627,10 +627,10 @@ _cogl_context_get_gl_extensions (CoglContext *context)
       const char *all_extensions =
         (const char *) context->glGetString (GL_EXTENSIONS);
 
-      ret = g_strsplit (all_extensions, " ", 0 /* max tokens */);
+      ret = u_strsplit (all_extensions, " ", 0 /* max tokens */);
     }
 
-  if ((env_disabled_extensions = g_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
+  if ((env_disabled_extensions = u_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
       || _cogl_config_disable_gl_extensions)
     {
       char **split_env_disabled_extensions;
@@ -639,7 +639,7 @@ _cogl_context_get_gl_extensions (CoglContext *context)
 
       if (env_disabled_extensions)
         split_env_disabled_extensions =
-          g_strsplit (env_disabled_extensions,
+          u_strsplit (env_disabled_extensions,
                       ",",
                       0 /* no max tokens */);
       else
@@ -647,7 +647,7 @@ _cogl_context_get_gl_extensions (CoglContext *context)
 
       if (_cogl_config_disable_gl_extensions)
         split_conf_disabled_extensions =
-          g_strsplit (_cogl_config_disable_gl_extensions,
+          u_strsplit (_cogl_config_disable_gl_extensions,
                       ",",
                       0 /* no max tokens */);
       else
@@ -672,16 +672,16 @@ _cogl_context_get_gl_extensions (CoglContext *context)
           continue;
 
         disabled:
-          g_free (*src);
+          u_free (*src);
           continue;
         }
 
       *dst = NULL;
 
       if (split_env_disabled_extensions)
-        g_strfreev (split_env_disabled_extensions);
+        u_strfreev (split_env_disabled_extensions);
       if (split_conf_disabled_extensions)
-        g_strfreev (split_conf_disabled_extensions);
+        u_strfreev (split_conf_disabled_extensions);
     }
 
   return ret;
@@ -692,7 +692,7 @@ _cogl_context_get_gl_version (CoglContext *context)
 {
   const char *version_override;
 
-  if ((version_override = g_getenv ("COGL_OVERRIDE_GL_VERSION")))
+  if ((version_override = u_getenv ("COGL_OVERRIDE_GL_VERSION")))
     return version_override;
   else if (_cogl_config_override_gl_version)
     return _cogl_config_override_gl_version;
diff --git a/cogl/cogl-debug.c b/cogl/cogl-debug.c
index e748a7e..6ea5d5e 100644
--- a/cogl/cogl-debug.c
+++ b/cogl/cogl-debug.c
@@ -46,7 +46,7 @@
 /* NB: Only these options get enabled if COGL_DEBUG=all is
  * used since they don't affect the behaviour of Cogl they
  * simply print out verbose information */
-static const GDebugKey cogl_log_debug_keys[] = {
+static const UDebugKey cogl_log_debug_keys[] = {
   { "object", COGL_DEBUG_OBJECT },
   { "slicing", COGL_DEBUG_SLICING },
   { "atlas", COGL_DEBUG_ATLAS },
@@ -66,9 +66,9 @@ static const GDebugKey cogl_log_debug_keys[] = {
   { "performance", COGL_DEBUG_PERFORMANCE }
 };
 static const int n_cogl_log_debug_keys =
-  G_N_ELEMENTS (cogl_log_debug_keys);
+  U_N_ELEMENTS (cogl_log_debug_keys);
 
-static const GDebugKey cogl_behavioural_debug_keys[] = {
+static const UDebugKey cogl_behavioural_debug_keys[] = {
   { "rectangles", COGL_DEBUG_RECTANGLES },
   { "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
   { "disable-vbos", COGL_DEBUG_DISABLE_VBOS },
@@ -89,20 +89,20 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
   { "disable-fast-read-pixel", COGL_DEBUG_DISABLE_FAST_READ_PIXEL}
 };
 static const int n_cogl_behavioural_debug_keys =
-  G_N_ELEMENTS (cogl_behavioural_debug_keys);
+  U_N_ELEMENTS (cogl_behavioural_debug_keys);
 
 unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
-GHashTable *_cogl_debug_instances;
+UHashTable *_cogl_debug_instances;
 
 static void
 _cogl_parse_debug_string_for_keys (const char *value,
                                    CoglBool enable,
-                                   const GDebugKey *keys,
+                                   const UDebugKey *keys,
                                    unsigned int nkeys)
 {
   int long_num, key_num;
 
-  /* g_parse_debug_string expects the value field in GDebugKey to be a
+  /* u_parse_debug_string expects the value field in UDebugKey to be a
      mask in a guint but the flags is stored in an array of multiple
      longs so we need to build a separate array for each possible
      guint */
@@ -115,7 +115,7 @@ _cogl_parse_debug_string_for_keys (const char *value,
            int_num < sizeof (unsigned long) / sizeof (unsigned int);
            int_num++)
         {
-          GDebugKey keys_for_int[sizeof (unsigned int) * 8];
+          UDebugKey keys_for_int[sizeof (unsigned int) * 8];
           int nkeys_for_int = 0;
 
           for (key_num = 0; key_num < nkeys; key_num++)
@@ -138,7 +138,7 @@ _cogl_parse_debug_string_for_keys (const char *value,
           if (nkeys_for_int > 0)
             {
               unsigned long mask =
-                ((unsigned long) g_parse_debug_string (value,
+                ((unsigned long) u_parse_debug_string (value,
                                                        keys_for_int,
                                                        nkeys_for_int)) <<
                 (int_num * sizeof (unsigned int) * 8);
@@ -160,7 +160,7 @@ _cogl_parse_debug_string (const char *value,
   if (ignore_help && strcmp (value, "help") == 0)
     return;
 
-  /* We don't want to let g_parse_debug_string handle "all" because
+  /* We don't want to let u_parse_debug_string handle "all" because
    * literally enabling all the debug options wouldn't be useful to
    * anyone; instead the all option enables all non behavioural
    * options.
@@ -175,20 +175,20 @@ _cogl_parse_debug_string (const char *value,
         else
           COGL_DEBUG_CLEAR_FLAG (cogl_log_debug_keys[i].value);
     }
-  else if (g_ascii_strcasecmp (value, "help") == 0)
+  else if (u_ascii_strcasecmp (value, "help") == 0)
     {
-      g_printerr ("\n\n%28s\n", _("Supported debug values:"));
+      u_printerr ("\n\n%28s\n", _("Supported debug values:"));
 #define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \
-      g_printerr ("%28s %s\n", NAME ":", _(DESCRIPTION));
+      u_printerr ("%28s %s\n", NAME ":", _(DESCRIPTION));
 #include "cogl-debug-options.h"
-      g_printerr ("\n%28s\n", _("Special debug values:"));
+      u_printerr ("\n%28s\n", _("Special debug values:"));
       OPT (IGNORED, "ignored", "all", "ignored", \
            N_("Enables all non-behavioural debug options"));
       OPT (IGNORED, "ignored", "verbose", "ignored", \
            N_("Enables all non-behavioural debug options"));
 #undef OPT
 
-      g_printerr ("\n"
+      u_printerr ("\n"
                   "%28s\n"
                   " COGL_DISABLE_GL_EXTENSIONS: %s\n"
                   "   COGL_OVERRIDE_GL_VERSION: %s\n",
@@ -217,7 +217,7 @@ _cogl_debug_check_environment (void)
 {
   const char *env_string;
 
-  env_string = g_getenv ("COGL_DEBUG");
+  env_string = u_getenv ("COGL_DEBUG");
   if (env_string != NULL)
     {
       _cogl_parse_debug_string (env_string,
@@ -226,7 +226,7 @@ _cogl_debug_check_environment (void)
       env_string = NULL;
     }
 
-  env_string = g_getenv ("COGL_NO_DEBUG");
+  env_string = u_getenv ("COGL_NO_DEBUG");
   if (env_string != NULL)
     {
       _cogl_parse_debug_string (env_string,
diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h
index 1a65477..742ac8f 100644
--- a/cogl/cogl-debug.h
+++ b/cogl/cogl-debug.h
@@ -35,7 +35,7 @@
 #include "cogl-flags.h"
 #include "cogl-util.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 COGL_BEGIN_DECLS
 
@@ -79,7 +79,7 @@ typedef enum {
   COGL_DEBUG_N_FLAGS
 } CoglDebugFlags;
 
-extern GHashTable *_cogl_debug_instances;
+extern UHashTable *_cogl_debug_instances;
 #define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
 
 /* _cogl_debug_flags currently needs to exported outside of the shared
@@ -97,18 +97,18 @@ COGL_EXPORT extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
   COGL_FLAGS_SET (_cogl_debug_flags, flag, FALSE)
 
 #ifdef __GNUC__
-#define COGL_NOTE(type,x,a...)                      G_STMT_START {            \
-        if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) {            \
+#define COGL_NOTE(type,x,a...)                      U_STMT_START {            \
+        if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) {            \
           _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & " x, ##a); \
-        }                                           } G_STMT_END
+        }                                           } U_STMT_END
 
 #else
-#define COGL_NOTE(type,...)                         G_STMT_START {            \
-        if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) {            \
-          char *_fmt = g_strdup_printf (__VA_ARGS__);                         \
+#define COGL_NOTE(type,...)                         U_STMT_START {            \
+        if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) {            \
+          char *_fmt = u_strdup_printf (__VA_ARGS__);                         \
           _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & %s", _fmt);\
-          g_free (_fmt);                                                      \
-        }                                           } G_STMT_END
+          u_free (_fmt);                                                      \
+        }                                           } U_STMT_END
 
 #endif /* __GNUC__ */
 
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
index aba965f..cccbbfc 100644
--- a/cogl/cogl-display.c
+++ b/cogl/cogl-display.c
@@ -79,14 +79,14 @@ _cogl_display_free (CoglDisplay *display)
       display->onscreen_template = NULL;
     }
 
-  g_slice_free (CoglDisplay, display);
+  u_slice_free (CoglDisplay, display);
 }
 
 CoglDisplay *
 cogl_display_new (CoglRenderer *renderer,
                   CoglOnscreenTemplate *onscreen_template)
 {
-  CoglDisplay *display = g_slice_new0 (CoglDisplay);
+  CoglDisplay *display = u_slice_new0 (CoglDisplay);
   CoglError *error = NULL;
 
   _cogl_init ();
@@ -98,7 +98,7 @@ cogl_display_new (CoglRenderer *renderer,
     display->renderer = cogl_renderer_new ();
 
   if (!cogl_renderer_connect (display->renderer, &error))
-    g_error ("Failed to connect to renderer: %s\n", error->message);
+    u_error ("Failed to connect to renderer: %s\n", error->message);
 
   display->setup = FALSE;
 
diff --git a/cogl/cogl-error-private.h b/cogl/cogl-error-private.h
index 054729f..81e1fda 100644
--- a/cogl/cogl-error-private.h
+++ b/cogl/cogl-error-private.h
@@ -31,12 +31,16 @@
 
 #include "cogl-error.h"
 
+#ifdef COGL_HAS_GLIB_SUPPORT
+#include <glib.h>
+#endif
+
 void
 _cogl_set_error (CoglError **error,
                  uint32_t domain,
                  int code,
                  const char *format,
-                 ...) G_GNUC_PRINTF (4, 5);
+                 ...) U_GNUC_PRINTF (4, 5);
 
 void
 _cogl_set_error_literal (CoglError **error,
@@ -54,6 +58,6 @@ _cogl_propagate_gerror (CoglError **dest,
                         GError *src);
 #endif /* COGL_HAS_GLIB_SUPPORT */
 
-#define _cogl_clear_error(X) g_clear_error ((GError **)X)
+#define _cogl_clear_error(X) u_clear_error ((GError **)X)
 
 #endif /* __COGL_ERROR_PRIVATE_H__ */
diff --git a/cogl/cogl-error.c b/cogl/cogl-error.c
index 5298d80..8a22e61 100644
--- a/cogl/cogl-error.c
+++ b/cogl/cogl-error.c
@@ -29,26 +29,43 @@
  *   Robert Bragg <robert linux intel com>
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
 
 #include "cogl-types.h"
 #include "cogl-util.h"
 #include "cogl-error-private.h"
 
+#include <ulib.h>
+
+#ifdef COGL_HAS_GLIB_SUPPORT
 #include <glib.h>
 
+#define _RealError              GError
+#define _real_error_free        g_error_free
+#define _real_error_copy        g_error_copy
+#define _real_error_matches     g_error_matches
+#define _real_error_new_valist  g_error_new_valist
+
+#else
+
+#define _RealError              UError
+#define _real_error_free        u_error_free
+#define _real_error_copy        u_error_copy
+#define _real_error_matches     u_error_matches
+#define _real_error_new_valist  u_error_new_valist
+
+#endif
+
 void
 cogl_error_free (CoglError *error)
 {
-  g_error_free ((GError *)error);
+  _real_error_free ((_RealError *)error);
 }
 
 CoglError *
 cogl_error_copy (CoglError *error)
 {
-  return (CoglError *)g_error_copy ((GError *)error);
+  return (CoglError *)_real_error_copy ((_RealError *)error);
 }
 
 CoglBool
@@ -56,7 +73,7 @@ cogl_error_matches (CoglError *error,
                     uint32_t domain,
                     int code)
 {
-  return g_error_matches ((GError *)error, domain, code);
+  return _real_error_matches ((_RealError *)error, domain, code);
 }
 
 #define ERROR_OVERWRITTEN_WARNING \
@@ -72,7 +89,7 @@ _cogl_set_error (CoglError **error,
                  const char *format,
                  ...)
 {
-  GError *new;
+  _RealError *new;
 
   va_list args;
 
@@ -80,18 +97,18 @@ _cogl_set_error (CoglError **error,
 
   if (error == NULL)
     {
-      g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+      u_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
       va_end (args);
       return;
     }
 
-  new = g_error_new_valist (domain, code, format, args);
+  new = _real_error_new_valist (domain, code, format, args);
   va_end (args);
 
   if (*error == NULL)
     *error = (CoglError *)new;
   else
-    g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
+    u_warning (ERROR_OVERWRITTEN_WARNING, new->message);
 }
 
 void
@@ -111,11 +128,11 @@ _cogl_propagate_error (CoglError **dest,
 
   if (dest == NULL)
     {
-      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message);
+      u_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message);
       cogl_error_free (src);
     }
   else if (*dest)
-    g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
+    u_warning (ERROR_OVERWRITTEN_WARNING, src->message);
   else
     *dest = src;
 }
diff --git a/cogl/cogl-error.h b/cogl/cogl-error.h
index 52d9750..a47f6e9 100644
--- a/cogl/cogl-error.h
+++ b/cogl/cogl-error.h
@@ -166,14 +166,14 @@ cogl_error_matches (CoglError *error,
  * COGL_GLIB_ERROR:
  * @COGL_ERROR: A #CoglError thrown by the Cogl api or %NULL
  *
- * Simply casts a #CoglError to a #CoglError
+ * Simply casts a #CoglError to a #GError
  *
  * If Cogl is built with GLib support then it can safely be assumed
  * that a CoglError is a GError and can be used directly with the
  * GError api.
  */
 #ifdef COGL_HAS_GLIB_SUPPORT
-#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR)
+#define COGL_GLIB_ERROR(COGL_ERROR) ((GError *)COGL_ERROR)
 #endif
 
 COGL_END_DECLS
diff --git a/cogl/cogl-euler.c b/cogl/cogl-euler.c
index 57436c6..a43672b 100644
--- a/cogl/cogl-euler.c
+++ b/cogl/cogl-euler.c
@@ -175,9 +175,9 @@ cogl_euler_equal (const void *v1, const void *v2)
 CoglEuler *
 cogl_euler_copy (const CoglEuler *src)
 {
-  if (G_LIKELY (src))
+  if (U_LIKELY (src))
     {
-      CoglEuler *new = g_slice_new (CoglEuler);
+      CoglEuler *new = u_slice_new (CoglEuler);
       memcpy (new, src, sizeof (float) * 3);
       return new;
     }
@@ -188,6 +188,6 @@ cogl_euler_copy (const CoglEuler *src)
 void
 cogl_euler_free (CoglEuler *euler)
 {
-  g_slice_free (CoglEuler, euler);
+  u_slice_free (CoglEuler, euler);
 }
 
diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c
index 7c75ae2..ebd8438 100644
--- a/cogl/cogl-feature-private.c
+++ b/cogl/cogl-feature-private.c
@@ -80,7 +80,7 @@ _cogl_feature_check (CoglRenderer *renderer,
            namespace += strlen (namespace) + 1)
         {
           const char *extension;
-          GString *full_extension_name = g_string_new ("");
+          UString *full_extension_name = u_string_new ("");
 
           /* If the namespace part contains a ':' then the suffix for
              the function names is different from the name space */
@@ -99,18 +99,18 @@ _cogl_feature_check (CoglRenderer *renderer,
                *extension;
                extension += strlen (extension) + 1)
             {
-              g_string_assign (full_extension_name, driver_prefix);
-              g_string_append_c (full_extension_name, '_');
-              g_string_append_len (full_extension_name,
+              u_string_assign (full_extension_name, driver_prefix);
+              u_string_append_c (full_extension_name, '_');
+              u_string_append_len (full_extension_name,
                                    namespace, namespace_len);
-              g_string_append_c (full_extension_name, '_');
-              g_string_append (full_extension_name, extension);
+              u_string_append_c (full_extension_name, '_');
+              u_string_append (full_extension_name, extension);
               if (_cogl_check_extension (full_extension_name->str,
                                          extensions))
                 break;
             }
 
-          g_string_free (full_extension_name, TRUE);
+          u_string_free (full_extension_name, TRUE);
 
           /* If we found an extension with this namespace then use it
              as the suffix */
@@ -135,12 +135,12 @@ _cogl_feature_check (CoglRenderer *renderer,
       void *func;
       char *full_function_name;
 
-      full_function_name = g_strconcat (data->functions[func_num].name,
+      full_function_name = u_strconcat (data->functions[func_num].name,
                                         suffix, NULL);
       func = _cogl_renderer_get_proc_address (renderer,
                                               full_function_name,
                                               in_core);
-      g_free (full_function_name);
+      u_free (full_function_name);
 
       if (func == NULL)
         goto error;
@@ -171,7 +171,7 @@ error:
                        namespaces, extension_names)                     \
   static const CoglFeatureFunction cogl_ext_ ## name ## _funcs[] = {
 #define COGL_EXT_FUNCTION(ret, name, args)                          \
-  { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglContext, name) },
+  { G_STRINGIFY (name), U_STRUCT_OFFSET (CoglContext, name) },
 #define COGL_EXT_END()                      \
   { NULL, 0 },                                  \
   };
@@ -205,7 +205,7 @@ _cogl_feature_check_ext_functions (CoglContext *context,
 {
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (cogl_feature_ext_functions_data); i++)
+  for (i = 0; i < U_N_ELEMENTS (cogl_feature_ext_functions_data); i++)
     _cogl_feature_check (context->display->renderer,
                          "GL", cogl_feature_ext_functions_data + i,
                          gl_major, gl_minor, context->driver,
diff --git a/cogl/cogl-feature-private.h b/cogl/cogl-feature-private.h
index 5d8a273..7f11240 100644
--- a/cogl/cogl-feature-private.h
+++ b/cogl/cogl-feature-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_FEATURE_PRIVATE_H
 #define __COGL_FEATURE_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 
 #define COGL_CHECK_GL_VERSION(driver_major, driver_minor, \
diff --git a/cogl/cogl-fence.c b/cogl/cogl-fence.c
index eef7e43..2eabc65 100644
--- a/cogl/cogl-fence.c
+++ b/cogl/cogl-fence.c
@@ -90,7 +90,7 @@ static int64_t
 _cogl_fence_poll_prepare (void *source)
 {
   CoglContext *context = source;
-  GList *l;
+  UList *l;
 
   /* If there are any pending fences in any of the journals then we
    * need to flush the journal otherwise the fence will never be
@@ -165,7 +165,7 @@ cogl_framebuffer_add_fence_callback (CoglFramebuffer *framebuffer,
   if (!COGL_FLAGS_GET (context->features, COGL_FEATURE_ID_FENCE))
     return NULL;
 
-  fence = g_slice_new (CoglFenceClosure);
+  fence = u_slice_new (CoglFenceClosure);
   fence->framebuffer = framebuffer;
   fence->callback = callback;
   fence->user_data = user_data;
@@ -210,7 +210,7 @@ cogl_framebuffer_cancel_fence_callback (CoglFramebuffer *framebuffer,
 #endif
     }
 
-  g_slice_free (CoglFenceClosure, fence);
+  u_slice_free (CoglFenceClosure, fence);
 }
 
 void
diff --git a/cogl/cogl-flags.h b/cogl/cogl-flags.h
index 852bd94..847b893 100644
--- a/cogl/cogl-flags.h
+++ b/cogl/cogl-flags.h
@@ -32,7 +32,7 @@
 #ifndef __COGL_FLAGS_H
 #define __COGL_FLAGS_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-util.h"
 
@@ -76,14 +76,14 @@ COGL_BEGIN_DECLS
 /* The expectation here is that @value will be constant so the if
    statement will be optimised out */
 #define COGL_FLAGS_SET(array, flag, value)      \
-  G_STMT_START {                                \
+  U_STMT_START {                                \
     if (value)                                  \
       ((array)[COGL_FLAGS_GET_INDEX (flag)] |=  \
        COGL_FLAGS_GET_MASK (flag));             \
     else                                        \
       ((array)[COGL_FLAGS_GET_INDEX (flag)] &=  \
        ~COGL_FLAGS_GET_MASK (flag));            \
-  } G_STMT_END
+  } U_STMT_END
 
 /* Macros to help iterate an array of flags. It should be used like
  * this:
@@ -99,7 +99,7 @@ COGL_BEGIN_DECLS
  * COGL_FLAGS_FOREACH_END;
  */
 #define COGL_FLAGS_FOREACH_START(array, n_longs, bit)   \
-  G_STMT_START {                                        \
+  U_STMT_START {                                        \
   const unsigned long *_p = (array);                    \
   int _n_longs = (n_longs);                             \
   int _i;                                               \
@@ -122,7 +122,7 @@ COGL_BEGIN_DECLS
           _mask = (_mask >> (_next_bit - 1)) >> 1;      \
 
 #define COGL_FLAGS_FOREACH_END \
-  } } } G_STMT_END
+  } } } U_STMT_END
 
 COGL_END_DECLS
 
diff --git a/cogl/cogl-frame-info.c b/cogl/cogl-frame-info.c
index ef9f4c1..c574458 100644
--- a/cogl/cogl-frame-info.c
+++ b/cogl/cogl-frame-info.c
@@ -43,7 +43,7 @@ _cogl_frame_info_new (void)
 {
   CoglFrameInfo *info;
 
-  info = g_slice_new0 (CoglFrameInfo);
+  info = u_slice_new0 (CoglFrameInfo);
 
   return _cogl_frame_info_object_new (info);
 }
@@ -51,7 +51,7 @@ _cogl_frame_info_new (void)
 static void
 _cogl_frame_info_free (CoglFrameInfo *info)
 {
-  g_slice_free (CoglFrameInfo, info);
+  u_slice_free (CoglFrameInfo, info);
 }
 
 int64_t
diff --git a/cogl/cogl-frame-info.h b/cogl/cogl-frame-info.h
index a8c2e11..62f0979 100644
--- a/cogl/cogl-frame-info.h
+++ b/cogl/cogl-frame-info.h
@@ -39,9 +39,9 @@
 
 #include <cogl/cogl-types.h>
 #include <cogl/cogl-output.h>
-#include <glib.h>
+#include <ulib.h>
 
-G_BEGIN_DECLS
+U_BEGIN_DECLS
 
 typedef struct _CoglFrameInfo CoglFrameInfo;
 #define COGL_FRAME_INFO(X) ((CoglFrameInfo *)(X))
@@ -130,6 +130,6 @@ float cogl_frame_info_get_refresh_rate (CoglFrameInfo *info);
 CoglOutput *
 cogl_frame_info_get_output (CoglFrameInfo *info);
 
-G_END_DECLS
+U_END_DECLS
 
 #endif /* __COGL_FRAME_INFO_H */
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index ca1fbea..7f6a246 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -162,7 +162,7 @@ struct _CoglFramebuffer
 
   /* The scene of a given framebuffer may depend on images in other
    * framebuffers... */
-  GList              *deps;
+  UList              *deps;
 
   /* As part of an optimization for reading-back single pixels from a
    * framebuffer in some simple cases where the geometry is still
@@ -200,7 +200,7 @@ typedef enum {
 typedef struct _CoglGLFramebuffer
 {
   GLuint fbo_handle;
-  GList *renderbuffers;
+  UList *renderbuffers;
   int samples_per_pixel;
 } CoglGLFramebuffer;
 
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 90aaecd..daaa252 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -76,7 +76,7 @@ COGL_OBJECT_DEFINE_WITH_CODE (Offscreen, offscreen,
 uint32_t
 cogl_framebuffer_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-framebuffer-error-quark");
+  return u_quark_from_static_string ("cogl-framebuffer-error-quark");
 }
 
 CoglBool
@@ -159,7 +159,7 @@ _cogl_framebuffer_init (CoglFramebuffer *framebuffer,
    * we don't have to worry about retaining references to OpenGL
    * texture coordinates that may later become invalid.
    */
-  ctx->framebuffers = g_list_prepend (ctx->framebuffers, framebuffer);
+  ctx->framebuffers = u_list_prepend (ctx->framebuffers, framebuffer);
 }
 
 void
@@ -189,7 +189,7 @@ _cogl_framebuffer_free (CoglFramebuffer *framebuffer)
   if (ctx->viewport_scissor_workaround_framebuffer == framebuffer)
     ctx->viewport_scissor_workaround_framebuffer = NULL;
 
-  ctx->framebuffers = g_list_remove (ctx->framebuffers, framebuffer);
+  ctx->framebuffers = u_list_remove (ctx->framebuffers, framebuffer);
 
   if (ctx->current_draw_buffer == framebuffer)
     ctx->current_draw_buffer = NULL;
@@ -223,7 +223,7 @@ _cogl_framebuffer_clear_without_flush4f (CoglFramebuffer *framebuffer,
 
       if (!shown)
         {
-         g_warning ("You should specify at least one auxiliary buffer "
+         u_warning ("You should specify at least one auxiliary buffer "
                      "when calling cogl_framebuffer_clear");
         }
 
@@ -360,7 +360,7 @@ cogl_framebuffer_clear4f (CoglFramebuffer *framebuffer,
    * batches from the journal. It is reset here to increase the
    * chances of getting the same colours for each frame during an
    * animation */
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)) &&
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)) &&
       buffers & COGL_BUFFER_BIT_COLOR)
     {
       framebuffer->context->journal_rectangles_color = 1;
@@ -562,7 +562,7 @@ void
 _cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer,
                                   CoglFramebuffer *dependency)
 {
-  GList *l;
+  UList *l;
 
   for (l = framebuffer->deps; l; l = l->next)
     {
@@ -575,16 +575,16 @@ _cogl_framebuffer_add_dependency (CoglFramebuffer *framebuffer,
    * cogl_object_set_user_data or for pipeline children as a way to
    * avoid quite a lot of mid-scene micro allocations here... */
   framebuffer->deps =
-    g_list_prepend (framebuffer->deps, cogl_object_ref (dependency));
+    u_list_prepend (framebuffer->deps, cogl_object_ref (dependency));
 }
 
 void
 _cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer)
 {
-  GList *l;
+  UList *l;
   for (l = framebuffer->deps; l; l = l->next)
     cogl_object_unref (l->data);
-  g_list_free (framebuffer->deps);
+  u_list_free (framebuffer->deps);
   framebuffer->deps = NULL;
 }
 
@@ -603,7 +603,7 @@ _cogl_framebuffer_flush (CoglFramebuffer *framebuffer)
 void
 _cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer)
 {
-  GList *l;
+  UList *l;
   for (l = framebuffer->deps; l; l = l->next)
     _cogl_framebuffer_flush_journal (l->data);
   _cogl_framebuffer_remove_all_dependencies (framebuffer);
@@ -621,7 +621,7 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
 
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_texture (texture), NULL);
 
-  offscreen = g_new0 (CoglOffscreen, 1);
+  offscreen = u_new0 (CoglOffscreen, 1);
   offscreen->texture = cogl_object_ref (texture);
   offscreen->texture_level = level;
   offscreen->create_flags = create_flags;
@@ -669,7 +669,7 @@ _cogl_offscreen_free (CoglOffscreen *offscreen)
   if (offscreen->depth_texture != NULL)
     cogl_object_unref (offscreen->depth_texture);
 
-  g_free (offscreen);
+  u_free (offscreen);
 }
 
 CoglBool
@@ -778,7 +778,7 @@ _cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a,
        *
        * TODO: file a bug upstream!
        */
-      if (G_UNLIKELY (context->needs_viewport_scissor_workaround))
+      if (U_UNLIKELY (context->needs_viewport_scissor_workaround))
           differences |= COGL_FRAMEBUFFER_STATE_CLIP;
 
       return differences;
@@ -907,7 +907,7 @@ _cogl_framebuffer_compare (CoglFramebuffer *a,
             _cogl_framebuffer_compare_depth_write_state (a, b);
           break;
         default:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
         }
     }
   COGL_FLAGS_FOREACH_END;
@@ -1169,7 +1169,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
   CoglBool found_intersection;
   CoglPixelFormat format;
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FAST_READ_PIXEL)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FAST_READ_PIXEL)))
     return FALSE;
 
   if (source != COGL_READ_PIXELS_COLOR_BUFFER)
@@ -1782,7 +1782,7 @@ _cogl_framebuffer_unref (CoglFramebuffer *framebuffer)
       /* There should be at least two references - the one we are
          about to drop and the one held by the journal */
       if (ref_count < 2)
-        g_warning ("Inconsistent ref count on a framebuffer with journal "
+        u_warning ("Inconsistent ref count on a framebuffer with journal "
                    "entries.");
 
       if (ref_count == 2)
@@ -1812,7 +1812,7 @@ get_index (void *indices,
       return ((uint32_t *)indices)[_index];
     }
 
-  g_return_val_if_reached (0);
+  u_return_val_if_reached (0);
 }
 
 static void
@@ -1858,7 +1858,7 @@ get_line_count (CoglVerticesMode mode, int n_vertices)
     }
 #endif
 
-  g_return_val_if_reached (0);
+  u_return_val_if_reached (0);
 }
 
 static CoglIndices *
@@ -1897,7 +1897,7 @@ get_wire_line_indices (CoglContext *ctx,
   n_lines = get_line_count (mode, n_vertices_in);
 
   /* Note: we are using COGL_INDICES_TYPE_UNSIGNED_INT so 4 bytes per index. */
-  line_indices = g_malloc (4 * n_lines * 2);
+  line_indices = u_malloc (4 * n_lines * 2);
 
   pos = 0;
 
@@ -1966,7 +1966,7 @@ get_wire_line_indices (CoglContext *ctx,
                           line_indices,
                           *n_indices);
 
-  g_free (line_indices);
+  u_free (line_indices);
 
   return ret;
 }
@@ -2098,7 +2098,7 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
                                    CoglDrawFlags flags)
 {
 #ifdef COGL_ENABLE_DEBUG
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
                   (flags & COGL_DRAW_SKIP_DEBUG_WIREFRAME) == 0) &&
       mode != COGL_VERTICES_MODE_LINES &&
       mode != COGL_VERTICES_MODE_LINE_LOOP &&
@@ -2136,7 +2136,7 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
                                            CoglDrawFlags flags)
 {
 #ifdef COGL_ENABLE_DEBUG
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
                   (flags & COGL_DRAW_SKIP_DEBUG_WIREFRAME) == 0) &&
       mode != COGL_VERTICES_MODE_LINES &&
       mode != COGL_VERTICES_MODE_LINE_LOOP &&
@@ -2262,7 +2262,7 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
    * _cogl_framebuffer_draw_multitextured_rectangles.
    */
 
-  rects = g_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
+  rects = u_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
 
   for (i = 0; i < n_rectangles; i++)
     {
@@ -2291,7 +2291,7 @@ cogl_framebuffer_draw_textured_rectangles (CoglFramebuffer *framebuffer,
    * _cogl_framebuffer_draw_multitextured_rectangles.
    */
 
-  rects = g_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
+  rects = u_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
 
   for (i = 0; i < n_rectangles; i++)
     {
diff --git a/cogl/cogl-gles2-context-private.h b/cogl/cogl-gles2-context-private.h
index 5438370..52e4215 100644
--- a/cogl/cogl-gles2-context-private.h
+++ b/cogl/cogl-gles2-context-private.h
@@ -35,7 +35,7 @@
 #ifndef __COGL_GLES2_CONTEXT_PRIVATE_H
 #define __COGL_GLES2_CONTEXT_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-object-private.h"
 #include "cogl-framebuffer-private.h"
@@ -83,7 +83,7 @@ typedef struct
   GLuint object_id;
 
   /* List of shaders attached to this program */
-  GList *attached_shaders;
+  UList *attached_shaders;
 
   /* Reference count. There can be up to two references. One of these
    * will exist between glCreateProgram and glDeleteShader, the other
@@ -156,8 +156,8 @@ struct _CoglGLES2Context
    * list, we don't really want to expose this outside of the Cogl API
    * so we will assume it is undefined behaviour if an application
    * relies on this. */
-  GHashTable *shader_map;
-  GHashTable *program_map;
+  UHashTable *shader_map;
+  UHashTable *program_map;
 
   /* Currently in use program. We need to keep track of this so that
    * we can keep a reference to the data for the program while it is
@@ -185,11 +185,11 @@ struct _CoglGLES2Context
 
   /* A hash table of CoglGLES2TextureObjects indexed by the texture
    * object ID so that we can track some state */
-  GHashTable *texture_object_map;
+  UHashTable *texture_object_map;
 
   /* Array of CoglGLES2TextureUnits to keep track of state for each
    * texture unit */
-  GArray *texture_units;
+  UArray *texture_units;
 
   /* The currently active texture unit indexed from 0 (not from
    * GL_TEXTURE0) */
diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
index c654313..c8faf74 100644
--- a/cogl/cogl-gles2-context.c
+++ b/cogl/cogl-gles2-context.c
@@ -98,7 +98,7 @@ enum {
 uint32_t
 _cogl_gles2_context_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-gles2-context-error-quark");
+  return u_quark_from_static_string ("cogl-gles2-context-error-quark");
 }
 
 static void
@@ -107,7 +107,7 @@ shader_data_unref (CoglGLES2Context *context,
 {
   if (--shader_data->ref_count < 1)
     /* Removing the hash table entry should also destroy the data */
-    g_hash_table_remove (context->shader_map,
+    u_hash_table_remove (context->shader_map,
                          GINT_TO_POINTER (shader_data->object_id));
 }
 
@@ -116,7 +116,7 @@ program_data_unref (CoglGLES2ProgramData *program_data)
 {
   if (--program_data->ref_count < 1)
     /* Removing the hash table entry should also destroy the data */
-    g_hash_table_remove (program_data->context->program_map,
+    u_hash_table_remove (program_data->context->program_map,
                          GINT_TO_POINTER (program_data->object_id));
 }
 
@@ -124,7 +124,7 @@ static void
 detach_shader (CoglGLES2ProgramData *program_data,
                CoglGLES2ShaderData *shader_data)
 {
-  GList *l;
+  UList *l;
 
   for (l = program_data->attached_shaders; l; l = l->next)
     {
@@ -132,7 +132,7 @@ detach_shader (CoglGLES2ProgramData *program_data,
         {
           shader_data_unref (program_data->context, shader_data);
           program_data->attached_shaders =
-            g_list_delete_link (program_data->attached_shaders, l);
+            u_list_delete_link (program_data->attached_shaders, l);
           break;
         }
     }
@@ -141,7 +141,7 @@ detach_shader (CoglGLES2ProgramData *program_data,
 static CoglBool
 is_symbol_character (char ch)
 {
-  return g_ascii_isalnum (ch) || ch == '_';
+  return u_ascii_isalnum (ch) || ch == '_';
 }
 
 static void
@@ -198,7 +198,7 @@ update_current_flip_state (CoglGLES2Context *gles2_ctx)
 static GLuint
 get_current_texture_2d_object (CoglGLES2Context *gles2_ctx)
 {
-  return g_array_index (gles2_ctx->texture_units,
+  return u_array_index (gles2_ctx->texture_units,
                         CoglGLES2TextureUnitData,
                         gles2_ctx->current_texture_unit).current_texture_2d;
 }
@@ -216,14 +216,14 @@ set_texture_object_data (CoglGLES2Context *gles2_ctx,
 
   /* We want to keep track of all texture objects where the data is
    * created by this context so that we can delete them later */
-  texture_object = g_hash_table_lookup (gles2_ctx->texture_object_map,
+  texture_object = u_hash_table_lookup (gles2_ctx->texture_object_map,
                                         GUINT_TO_POINTER (texture_id));
   if (texture_object == NULL)
     {
-      texture_object = g_slice_new0 (CoglGLES2TextureObjectData);
+      texture_object = u_slice_new0 (CoglGLES2TextureObjectData);
       texture_object->object_id = texture_id;
 
-      g_hash_table_insert (gles2_ctx->texture_object_map,
+      u_hash_table_insert (gles2_ctx->texture_object_map,
                            GUINT_TO_POINTER (texture_id),
                            texture_object);
     }
@@ -271,7 +271,7 @@ copy_flipped_texture (CoglGLES2Context *gles2_ctx,
   CoglTexture2D *dst_texture;
   CoglPixelFormat internal_format;
 
-  tex_object_data = g_hash_table_lookup (gles2_ctx->texture_object_map,
+  tex_object_data = u_hash_table_lookup (gles2_ctx->texture_object_map,
                                          GUINT_TO_POINTER (tex_id));
 
   /* We can't do anything if the application hasn't set a level 0
@@ -552,7 +552,7 @@ gl_read_pixels_wrapper (GLint x,
       bytes_per_row = bpp * width;
       stride = ((bytes_per_row + gles2_ctx->pack_alignment - 1) &
                 ~(gles2_ctx->pack_alignment - 1));
-      temprow = g_alloca (bytes_per_row);
+      temprow = u_alloca (bytes_per_row);
 
       /* vertically flip the buffer in-place */
       for (y = 0; y < height / 2; y++)
@@ -684,14 +684,14 @@ gl_create_shader_wrapper (GLenum type)
 
   if (id != 0)
     {
-      CoglGLES2ShaderData *data = g_slice_new (CoglGLES2ShaderData);
+      CoglGLES2ShaderData *data = u_slice_new (CoglGLES2ShaderData);
 
       data->object_id = id;
       data->type = type;
       data->ref_count = 1;
       data->deleted = FALSE;
 
-      g_hash_table_insert (gles2_ctx->shader_map,
+      u_hash_table_insert (gles2_ctx->shader_map,
                            GINT_TO_POINTER (id),
                            data);
     }
@@ -705,7 +705,7 @@ gl_delete_shader_wrapper (GLuint shader)
   CoglGLES2Context *gles2_ctx = current_gles2_context;
   CoglGLES2ShaderData *shader_data;
 
-  if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map,
+  if ((shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
                                           GINT_TO_POINTER (shader))) &&
       !shader_data->deleted)
     {
@@ -726,7 +726,7 @@ gl_create_program_wrapper (void)
 
   if (id != 0)
     {
-      CoglGLES2ProgramData *data = g_slice_new (CoglGLES2ProgramData);
+      CoglGLES2ProgramData *data = u_slice_new (CoglGLES2ProgramData);
 
       data->object_id = id;
       data->attached_shaders = NULL;
@@ -736,7 +736,7 @@ gl_create_program_wrapper (void)
       data->flip_vector_location = 0;
       data->flip_vector_state = COGL_GLES2_FLIP_STATE_UNKNOWN;
 
-      g_hash_table_insert (gles2_ctx->program_map,
+      u_hash_table_insert (gles2_ctx->program_map,
                            GINT_TO_POINTER (id),
                            data);
     }
@@ -750,7 +750,7 @@ gl_delete_program_wrapper (GLuint program)
   CoglGLES2Context *gles2_ctx = current_gles2_context;
   CoglGLES2ProgramData *program_data;
 
-  if ((program_data = g_hash_table_lookup (gles2_ctx->program_map,
+  if ((program_data = u_hash_table_lookup (gles2_ctx->program_map,
                                            GINT_TO_POINTER (program))) &&
       !program_data->deleted)
     {
@@ -767,7 +767,7 @@ gl_use_program_wrapper (GLuint program)
   CoglGLES2Context *gles2_ctx = current_gles2_context;
   CoglGLES2ProgramData *program_data;
 
-  program_data = g_hash_table_lookup (gles2_ctx->program_map,
+  program_data = u_hash_table_lookup (gles2_ctx->program_map,
                                       GINT_TO_POINTER (program));
 
   if (program_data)
@@ -788,16 +788,16 @@ gl_attach_shader_wrapper (GLuint program,
   CoglGLES2ProgramData *program_data;
   CoglGLES2ShaderData *shader_data;
 
-  if ((program_data = g_hash_table_lookup (gles2_ctx->program_map,
+  if ((program_data = u_hash_table_lookup (gles2_ctx->program_map,
                                            GINT_TO_POINTER (program))) &&
-      (shader_data = g_hash_table_lookup (gles2_ctx->shader_map,
+      (shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
                                           GINT_TO_POINTER (shader))) &&
       /* Ignore attempts to attach a shader that is already attached */
-      g_list_find (program_data->attached_shaders, shader_data) == NULL)
+      u_list_find (program_data->attached_shaders, shader_data) == NULL)
     {
       shader_data->ref_count++;
       program_data->attached_shaders =
-        g_list_prepend (program_data->attached_shaders, shader_data);
+        u_list_prepend (program_data->attached_shaders, shader_data);
     }
 
   gles2_ctx->context->glAttachShader (program, shader);
@@ -811,9 +811,9 @@ gl_detach_shader_wrapper (GLuint program,
   CoglGLES2ProgramData *program_data;
   CoglGLES2ShaderData *shader_data;
 
-  if ((program_data = g_hash_table_lookup (gles2_ctx->program_map,
+  if ((program_data = u_hash_table_lookup (gles2_ctx->program_map,
                                            GINT_TO_POINTER (program))) &&
-      (shader_data = g_hash_table_lookup (gles2_ctx->shader_map,
+      (shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
                                           GINT_TO_POINTER (shader))))
     detach_shader (program_data, shader_data);
 
@@ -829,12 +829,12 @@ gl_shader_source_wrapper (GLuint shader,
   CoglGLES2Context *gles2_ctx = current_gles2_context;
   CoglGLES2ShaderData *shader_data;
 
-  if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map,
+  if ((shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
                                           GINT_TO_POINTER (shader))) &&
       shader_data->type == GL_VERTEX_SHADER)
     {
-      char **string_copy = g_alloca ((count + 1) * sizeof (char *));
-      int *length_copy = g_alloca ((count + 1) * sizeof (int));
+      char **string_copy = u_alloca ((count + 1) * sizeof (char *));
+      int *length_copy = u_alloca ((count + 1) * sizeof (int));
       int i;
 
       /* Replace any occurences of the symbol 'main' with a different
@@ -850,7 +850,7 @@ gl_shader_source_wrapper (GLuint shader,
           else
             string_length = length[i];
 
-          string_copy[i] = g_memdup (string[i], string_length);
+          string_copy[i] = u_memdup (string[i], string_length);
 
           replace_token (string_copy[i],
                          "main",
@@ -871,7 +871,7 @@ gl_shader_source_wrapper (GLuint shader,
       /* Note: we don't need to free the last entry in string_copy[]
        * because it is our static wrapper string... */
       for (i = 0; i < count; i++)
-        g_free (string_copy[i]);
+        u_free (string_copy[i]);
     }
   else
     gles2_ctx->context->glShaderSource (shader, count, string, length);
@@ -892,7 +892,7 @@ gl_get_shader_source_wrapper (GLuint shader,
                                          &length,
                                          source);
 
-  if ((shader_data = g_hash_table_lookup (gles2_ctx->shader_map,
+  if ((shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
                                           GINT_TO_POINTER (shader))) &&
       shader_data->type == GL_VERTEX_SHADER)
     {
@@ -932,7 +932,7 @@ gl_link_program_wrapper (GLuint program)
 
   gles2_ctx->context->glLinkProgram (program);
 
-  program_data = g_hash_table_lookup (gles2_ctx->program_map,
+  program_data = u_hash_table_lookup (gles2_ctx->program_map,
                                       GINT_TO_POINTER (program));
 
   if (program_data)
@@ -1350,7 +1350,7 @@ gl_active_texture_wrapper (GLenum texture)
   if (texture_unit >= 0 && texture_unit < 512)
     {
       gles2_ctx->current_texture_unit = texture_unit;
-      g_array_set_size (gles2_ctx->texture_units,
+      u_array_set_size (gles2_ctx->texture_units,
                         MAX (texture_unit, gles2_ctx->texture_units->len));
     }
 }
@@ -1373,7 +1373,7 @@ gl_delete_textures_wrapper (GLsizei n,
            texture_unit++)
         {
           CoglGLES2TextureUnitData *unit =
-            &g_array_index (gles2_ctx->texture_units,
+            &u_array_index (gles2_ctx->texture_units,
                             CoglGLES2TextureUnitData,
                             texture_unit);
 
@@ -1384,7 +1384,7 @@ gl_delete_textures_wrapper (GLsizei n,
       /* Remove the binding. We can do this immediately because unlike
        * shader objects the deletion isn't delayed until the object is
        * unbound */
-      g_hash_table_remove (gles2_ctx->texture_object_map,
+      u_hash_table_remove (gles2_ctx->texture_object_map,
                            GUINT_TO_POINTER (textures[texture_index]));
     }
 }
@@ -1400,7 +1400,7 @@ gl_bind_texture_wrapper (GLenum target,
   if (target == GL_TEXTURE_2D)
     {
       CoglGLES2TextureUnitData *unit =
-        &g_array_index (gles2_ctx->texture_units,
+        &u_array_index (gles2_ctx->texture_units,
                         CoglGLES2TextureUnitData,
                         gles2_ctx->current_texture_unit);
       unit->current_texture_2d = texture;
@@ -1440,7 +1440,7 @@ static void
 _cogl_gles2_offscreen_free (CoglGLES2Offscreen *gles2_offscreen)
 {
   _cogl_list_remove (&gles2_offscreen->link);
-  g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
+  u_slice_free (CoglGLES2Offscreen, gles2_offscreen);
 }
 
 static void
@@ -1479,7 +1479,7 @@ _cogl_gles2_context_free (CoglGLES2Context *gles2_context)
 {
   CoglContext *ctx = gles2_context->context;
   const CoglWinsysVtable *winsys;
-  GList *objects, *l;
+  UList *objects, *l;
 
   if (gles2_context->current_program)
     program_data_unref (gles2_context->current_program);
@@ -1489,30 +1489,30 @@ _cogl_gles2_context_free (CoglGLES2Context *gles2_context)
    * share list as Cogl's context these won't get deleted by default.
    * FIXME: we should do this for all of the other resources too, like
    * textures */
-  objects = g_hash_table_get_values (gles2_context->program_map);
+  objects = u_hash_table_get_values (gles2_context->program_map);
   for (l = objects; l; l = l->next)
     force_delete_program_object (gles2_context, l->data);
-  g_list_free (objects);
-  objects = g_hash_table_get_values (gles2_context->shader_map);
+  u_list_free (objects);
+  objects = u_hash_table_get_values (gles2_context->shader_map);
   for (l = objects; l; l = l->next)
     force_delete_shader_object (gles2_context, l->data);
-  g_list_free (objects);
-  objects = g_hash_table_get_values (gles2_context->texture_object_map);
+  u_list_free (objects);
+  objects = u_hash_table_get_values (gles2_context->texture_object_map);
   for (l = objects; l; l = l->next)
     force_delete_texture_object (gles2_context, l->data);
-  g_list_free (objects);
+  u_list_free (objects);
 
   /* All of the program and shader objects should now be destroyed */
-  if (g_hash_table_size (gles2_context->program_map) > 0)
-    g_warning ("Program objects have been leaked from a CoglGLES2Context");
-  if (g_hash_table_size (gles2_context->shader_map) > 0)
-    g_warning ("Shader objects have been leaked from a CoglGLES2Context");
+  if (u_hash_table_size (gles2_context->program_map) > 0)
+    u_warning ("Program objects have been leaked from a CoglGLES2Context");
+  if (u_hash_table_size (gles2_context->shader_map) > 0)
+    u_warning ("Shader objects have been leaked from a CoglGLES2Context");
 
-  g_hash_table_destroy (gles2_context->program_map);
-  g_hash_table_destroy (gles2_context->shader_map);
+  u_hash_table_destroy (gles2_context->program_map);
+  u_hash_table_destroy (gles2_context->shader_map);
 
-  g_hash_table_destroy (gles2_context->texture_object_map);
-  g_array_free (gles2_context->texture_units, TRUE);
+  u_hash_table_destroy (gles2_context->texture_object_map);
+  u_array_free (gles2_context->texture_units, TRUE);
 
   winsys = ctx->display->renderer->winsys_vtable;
   winsys->destroy_gles2_context (gles2_context);
@@ -1532,15 +1532,15 @@ _cogl_gles2_context_free (CoglGLES2Context *gles2_context)
                                  NULL);
     }
 
-  g_free (gles2_context->vtable);
+  u_free (gles2_context->vtable);
 
-  g_free (gles2_context);
+  u_free (gles2_context);
 }
 
 static void
 free_shader_data (CoglGLES2ShaderData *data)
 {
-  g_slice_free (CoglGLES2ShaderData, data);
+  u_slice_free (CoglGLES2ShaderData, data);
 }
 
 static void
@@ -1550,13 +1550,13 @@ free_program_data (CoglGLES2ProgramData *data)
     detach_shader (data,
                    data->attached_shaders->data);
 
-  g_slice_free (CoglGLES2ProgramData, data);
+  u_slice_free (CoglGLES2ProgramData, data);
 }
 
 static void
 free_texture_object_data (CoglGLES2TextureObjectData *data)
 {
-  g_slice_free (CoglGLES2TextureObjectData, data);
+  u_slice_free (CoglGLES2TextureObjectData, data);
 }
 
 CoglGLES2Context *
@@ -1574,7 +1574,7 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
       return NULL;
     }
 
-  gles2_ctx = g_malloc0 (sizeof (CoglGLES2Context));
+  gles2_ctx = u_malloc0 (sizeof (CoglGLES2Context));
 
   gles2_ctx->context = ctx;
 
@@ -1584,7 +1584,7 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
   gles2_ctx->winsys = winsys->context_create_gles2_context (ctx, error);
   if (gles2_ctx->winsys == NULL)
     {
-      g_free (gles2_ctx);
+      u_free (gles2_ctx);
       return NULL;
     }
 
@@ -1595,7 +1595,7 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
   gles2_ctx->front_face = GL_CCW;
   gles2_ctx->pack_alignment = 4;
 
-  gles2_ctx->vtable = g_malloc0 (sizeof (CoglGLES2Vtable));
+  gles2_ctx->vtable = u_malloc0 (sizeof (CoglGLES2Vtable));
 #define COGL_EXT_BEGIN(name, \
                        min_gl_major, min_gl_minor, \
                        gles_availability, \
@@ -1650,27 +1650,27 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
   gles2_ctx->vtable->glTexImage2D = gl_tex_image_2d_wrapper;
 
   gles2_ctx->shader_map =
-    g_hash_table_new_full (g_direct_hash,
-                           g_direct_equal,
+    u_hash_table_new_full (u_direct_hash,
+                           u_direct_equal,
                            NULL, /* key_destroy */
-                           (GDestroyNotify) free_shader_data);
+                           (UDestroyNotify) free_shader_data);
   gles2_ctx->program_map =
-    g_hash_table_new_full (g_direct_hash,
-                           g_direct_equal,
+    u_hash_table_new_full (u_direct_hash,
+                           u_direct_equal,
                            NULL, /* key_destroy */
-                           (GDestroyNotify) free_program_data);
+                           (UDestroyNotify) free_program_data);
 
   gles2_ctx->texture_object_map =
-    g_hash_table_new_full (g_direct_hash,
-                           g_direct_equal,
+    u_hash_table_new_full (u_direct_hash,
+                           u_direct_equal,
                            NULL, /* key_destroy */
-                           (GDestroyNotify) free_texture_object_data);
+                           (UDestroyNotify) free_texture_object_data);
 
-  gles2_ctx->texture_units = g_array_new (FALSE, /* not zero terminated */
+  gles2_ctx->texture_units = u_array_new (FALSE, /* not zero terminated */
                                           TRUE, /* clear */
                                           sizeof (CoglGLES2TextureUnitData));
   gles2_ctx->current_texture_unit = 0;
-  g_array_set_size (gles2_ctx->texture_units, 1);
+  u_array_set_size (gles2_ctx->texture_units, 1);
 
   return _cogl_gles2_context_object_new (gles2_ctx);
 }
@@ -1723,7 +1723,7 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
       return NULL;
     }
 
-  gles2_offscreen = g_slice_new0 (CoglGLES2Offscreen);
+  gles2_offscreen = u_slice_new0 (CoglGLES2Offscreen);
 
   _cogl_texture_get_level_size (offscreen->texture,
                                 offscreen->texture_level,
@@ -1743,7 +1743,7 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen,
     {
       winsys->restore_context (framebuffer->context);
 
-      g_slice_free (CoglGLES2Offscreen, gles2_offscreen);
+      u_slice_free (CoglGLES2Offscreen, gles2_offscreen);
 
       _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR,
                    COGL_FRAMEBUFFER_ERROR_ALLOCATE,
@@ -1786,9 +1786,9 @@ cogl_push_gles2_context (CoglContext *ctx,
    * don't currently track the read/write buffers as part of the stack
    * entries so we explicitly don't allow the same context to be
    * pushed multiple times. */
-  if (g_queue_find (&ctx->gles2_context_stack, gles2_ctx))
+  if (u_queue_find (&ctx->gles2_context_stack, gles2_ctx))
     {
-      g_critical ("Pushing the same GLES2 context multiple times isn't "
+      u_critical ("Pushing the same GLES2 context multiple times isn't "
                   "supported");
       return FALSE;
     }
@@ -1864,7 +1864,7 @@ cogl_push_gles2_context (CoglContext *ctx,
       return FALSE;
     }
 
-  g_queue_push_tail (&ctx->gles2_context_stack, gles2_ctx);
+  u_queue_push_tail (&ctx->gles2_context_stack, gles2_ctx);
 
   /* The last time this context was pushed may have been with a
    * different offscreen draw framebuffer and so if GL framebuffer 0
@@ -1919,9 +1919,9 @@ cogl_pop_gles2_context (CoglContext *ctx)
 
   _COGL_RETURN_IF_FAIL (ctx->gles2_context_stack.length > 0);
 
-  g_queue_pop_tail (&ctx->gles2_context_stack);
+  u_queue_pop_tail (&ctx->gles2_context_stack);
 
-  gles2_ctx = g_queue_peek_tail (&ctx->gles2_context_stack);
+  gles2_ctx = u_queue_peek_tail (&ctx->gles2_context_stack);
 
   if (gles2_ctx)
     {
diff --git a/cogl/cogl-glib-source.c b/cogl/cogl-glib-source.c
index dcc4f3f..04b636a 100644
--- a/cogl/cogl-glib-source.c
+++ b/cogl/cogl-glib-source.c
@@ -28,9 +28,9 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include <config.h>
+
+#include <glib.h>
 
 #include "cogl-glib-source.h"
 #include "cogl-poll.h"
@@ -41,7 +41,7 @@ typedef struct _CoglGLibSource
 
   CoglRenderer *renderer;
 
-  GArray *poll_fds;
+  UArray *poll_fds;
   int poll_fds_age;
 
   int64_t expiration_time;
@@ -71,15 +71,15 @@ cogl_glib_source_prepare (GSource *source, int *timeout)
       /* Remove any existing polls before adding the new ones */
       for (i = 0; i < cogl_source->poll_fds->len; i++)
         {
-          GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i);
+          GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
           g_source_remove_poll (source, poll_fd);
         }
 
-      g_array_set_size (cogl_source->poll_fds, n_poll_fds);
+      u_array_set_size (cogl_source->poll_fds, n_poll_fds);
 
       for (i = 0; i < n_poll_fds; i++)
         {
-          GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i);
+          GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
           poll_fd->fd = poll_fds[i].fd;
           g_source_add_poll (source, poll_fd);
         }
@@ -90,7 +90,7 @@ cogl_glib_source_prepare (GSource *source, int *timeout)
   /* Update the events */
   for (i = 0; i < n_poll_fds; i++)
     {
-      GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i);
+      GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
       poll_fd->events = poll_fds[i].events;
       poll_fd->revents = 0;
     }
@@ -123,7 +123,7 @@ cogl_glib_source_check (GSource *source)
 
   for (i = 0; i < cogl_source->poll_fds->len; i++)
     {
-      GPollFD *poll_fd = &g_array_index (cogl_source->poll_fds, GPollFD, i);
+      GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
       if (poll_fd->revents != 0)
         return TRUE;
     }
@@ -138,7 +138,7 @@ cogl_glib_source_dispatch (GSource *source,
 {
   CoglGLibSource *cogl_source = (CoglGLibSource *) source;
   CoglPollFD *poll_fds =
-    (CoglPollFD *) &g_array_index (cogl_source->poll_fds, GPollFD, 0);
+    (CoglPollFD *) &u_array_index (cogl_source->poll_fds, GPollFD, 0);
 
   cogl_poll_renderer_dispatch (cogl_source->renderer,
                                poll_fds,
@@ -152,7 +152,7 @@ cogl_glib_source_finalize (GSource *source)
 {
   CoglGLibSource *cogl_source = (CoglGLibSource *) source;
 
-  g_array_free (cogl_source->poll_fds, TRUE);
+  u_array_free (cogl_source->poll_fds, TRUE);
 }
 
 static GSourceFuncs
@@ -176,7 +176,7 @@ cogl_glib_renderer_source_new (CoglRenderer *renderer,
   cogl_source = (CoglGLibSource *) source;
 
   cogl_source->renderer = renderer;
-  cogl_source->poll_fds = g_array_new (FALSE, FALSE, sizeof (GPollFD));
+  cogl_source->poll_fds = u_array_new (FALSE, FALSE, sizeof (GPollFD));
 
   if (priority != G_PRIORITY_DEFAULT)
     g_source_set_priority (source, priority);
diff --git a/cogl/cogl-glib-source.h b/cogl/cogl-glib-source.h
index 6ad739d..814ea4c 100644
--- a/cogl/cogl-glib-source.h
+++ b/cogl/cogl-glib-source.h
@@ -35,10 +35,10 @@
 #ifndef __COGL_GSOURCE_H__
 #define __COGL_GSOURCE_H__
 
-#include <glib.h>
+#include <ulib.h>
 #include <cogl/cogl-context.h>
 
-G_BEGIN_DECLS
+U_BEGIN_DECLS
 
 /**
  * cogl_glib_source_new:
@@ -50,7 +50,7 @@ G_BEGIN_DECLS
  * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
  * applications that are already using the GLib main loop. After this
  * is called the #GSource should be attached to the main loop using
- * g_source_attach().
+ * u_source_attach().
  *
  * Applications that manually connect to a #CoglRenderer before they
  * create a #CoglContext should instead use
@@ -81,7 +81,7 @@ cogl_glib_source_new (CoglContext *context,
  * cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in
  * applications that are already using the GLib main loop. After this
  * is called the #GSource should be attached to the main loop using
- * g_source_attach().
+ * u_source_attach().
  *
  * Return value: a new #GSource
  *
@@ -92,6 +92,6 @@ GSource *
 cogl_glib_renderer_source_new (CoglRenderer *renderer,
                                int priority);
 
-G_END_DECLS
+U_END_DECLS
 
 #endif /* __COGL_GSOURCE_H__ */
diff --git a/cogl/cogl-glsl-shader.c b/cogl/cogl-glsl-shader.c
index 70dd4cd..cd093c2 100644
--- a/cogl/cogl-glsl-shader.c
+++ b/cogl/cogl-glsl-shader.c
@@ -43,7 +43,7 @@
 
 #include <string.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 void
 _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
@@ -56,15 +56,15 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
   const char *vertex_boilerplate;
   const char *fragment_boilerplate;
 
-  const char **strings = g_alloca (sizeof (char *) * (count_in + 4));
-  GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 4));
+  const char **strings = u_alloca (sizeof (char *) * (count_in + 4));
+  GLint *lengths = u_alloca (sizeof (GLint) * (count_in + 4));
   char *version_string;
   int count = 0;
 
   vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE;
   fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE;
 
-  version_string = g_strdup_printf ("#version %i\n\n",
+  version_string = u_strdup_printf ("#version %i\n\n",
                                     ctx->glsl_version_to_use);
   strings[count] = version_string;
   lengths[count++] = -1;
@@ -101,28 +101,28 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
     }
   count += count_in;
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
     {
-      GString *buf = g_string_new (NULL);
+      UString *buf = u_string_new (NULL);
       int i;
 
-      g_string_append_printf (buf,
+      u_string_append_printf (buf,
                               "%s shader:\n",
                               shader_gl_type == GL_VERTEX_SHADER ?
                               "vertex" : "fragment");
       for (i = 0; i < count; i++)
         if (lengths[i] != -1)
-          g_string_append_len (buf, strings[i], lengths[i]);
+          u_string_append_len (buf, strings[i], lengths[i]);
         else
-          g_string_append (buf, strings[i]);
+          u_string_append (buf, strings[i]);
 
-      g_message ("%s", buf->str);
+      u_message ("%s", buf->str);
 
-      g_string_free (buf, TRUE);
+      u_string_free (buf, TRUE);
     }
 
   GE( ctx, glShaderSource (shader_gl_handle, count,
                            (const char **) strings, lengths) );
 
-  g_free (version_string);
+  u_free (version_string);
 }
diff --git a/cogl/cogl-glx-renderer-private.h b/cogl/cogl-glx-renderer-private.h
index 1350d9c..4804a0f 100644
--- a/cogl/cogl-glx-renderer-private.h
+++ b/cogl/cogl-glx-renderer-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_RENDERER_GLX_PRIVATE_H
 #define __COGL_RENDERER_GLX_PRIVATE_H
 
-#include <gmodule.h>
+#include <umodule.h>
 #include "cogl-object-private.h"
 #include "cogl-xlib-renderer-private.h"
 
@@ -57,8 +57,8 @@ typedef struct _CoglGLXRenderer
     COGL_GLX_UST_IS_OTHER
   } ust_type;
 
-  /* GModule pointing to libGL which we use to get glX functions out of */
-  GModule *libgl_module;
+  /* UModule pointing to libGL which we use to get glX functions out of */
+  UModule *libgl_module;
 
   CoglClosure *flush_notifications_idle;
 
diff --git a/cogl/cogl-gpu-info.c b/cogl/cogl-gpu-info.c
index fadd164..f8f83c9 100644
--- a/cogl/cogl-gpu-info.c
+++ b/cogl/cogl-gpu-info.c
@@ -87,7 +87,7 @@ _cogl_gpu_info_parse_version_string (const char *version_string,
   for (i = 0; ; i++)
     {
       errno = 0;
-      part = g_ascii_strtoull (version_string,
+      part = u_ascii_strtoull (version_string,
                                (char **) &version_string,
                                10);
 
@@ -443,7 +443,7 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
 
   /* If it is a development build then we'll just leave the micro
      number as 0 */
-  if (g_str_has_prefix (v, "-devel"))
+  if (u_str_has_prefix (v, "-devel"))
     return TRUE;
 
   /* Otherwise there should be a micro version number */
@@ -451,7 +451,7 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
     return FALSE;
 
   errno = 0;
-  micro_part = g_ascii_strtoull (v + 1, NULL /* endptr */, 10 /* base */);
+  micro_part = u_ascii_strtoull (v + 1, NULL /* endptr */, 10 /* base */);
   if (errno || micro_part > COGL_VERSION_MAX_COMPONENT_VALUE)
     return FALSE;
 
@@ -474,10 +474,10 @@ UNIT_TEST (check_mesa_driver_package_parser,
   int i;
   int version;
 
-  for (i = 0; i < G_N_ELEMENTS (test_strings); i++)
+  for (i = 0; i < U_N_ELEMENTS (test_strings); i++)
     {
-      g_assert (check_mesa_driver_package (&test_strings[i], &version));
-      g_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0));
+      u_assert (check_mesa_driver_package (&test_strings[i], &version));
+      u_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0));
     }
 }
 
diff --git a/cogl/cogl-index-buffer.c b/cogl/cogl-index-buffer.c
index 43ceee9..7f0d1d6 100644
--- a/cogl/cogl-index-buffer.c
+++ b/cogl/cogl-index-buffer.c
@@ -50,7 +50,7 @@ COGL_BUFFER_DEFINE (IndexBuffer, index_buffer);
 CoglIndexBuffer *
 cogl_index_buffer_new (CoglContext *context, size_t bytes)
 {
-  CoglIndexBuffer *indices = g_slice_new (CoglIndexBuffer);
+  CoglIndexBuffer *indices = u_slice_new (CoglIndexBuffer);
 
   /* parent's constructor */
   _cogl_buffer_initialize (COGL_BUFFER (indices),
@@ -69,7 +69,7 @@ _cogl_index_buffer_free (CoglIndexBuffer *indices)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (indices));
 
-  g_slice_free (CoglIndexBuffer, indices);
+  u_slice_free (CoglIndexBuffer, indices);
 }
 
 /* XXX: do we want a convenience function like this as an alternative
@@ -98,7 +98,7 @@ cogl_index_buffer_set_data (CoglIndexBuffer *indices,
                             void *user_indices,
                             int n_indices)
 {
-  GList *l;
+  UList *l;
 
   for (l = indices->ranges; l; l = l->next)
     {
diff --git a/cogl/cogl-indices.c b/cogl/cogl-indices.c
index 52155eb..5cebe05 100644
--- a/cogl/cogl-indices.c
+++ b/cogl/cogl-indices.c
@@ -61,7 +61,7 @@ sizeof_indices_type (CoglIndicesType type)
     case COGL_INDICES_TYPE_UNSIGNED_INT:
       return 4;
     }
-  g_return_val_if_reached (0);
+  u_return_val_if_reached (0);
 }
 
 CoglIndices *
@@ -69,7 +69,7 @@ cogl_indices_new_for_buffer (CoglIndicesType type,
                              CoglIndexBuffer *buffer,
                              size_t offset)
 {
-  CoglIndices *indices = g_slice_new (CoglIndices);
+  CoglIndices *indices = u_slice_new (CoglIndices);
 
   indices->buffer = cogl_object_ref (buffer);
   indices->offset = offset;
@@ -139,7 +139,7 @@ warn_about_midscene_changes (void)
   static CoglBool seen = FALSE;
   if (!seen)
     {
-      g_warning ("Mid-scene modification of indices has "
+      u_warning ("Mid-scene modification of indices has "
                  "undefined results\n");
       seen = TRUE;
     }
@@ -151,7 +151,7 @@ cogl_indices_set_offset (CoglIndices *indices,
 {
   _COGL_RETURN_IF_FAIL (cogl_is_indices (indices));
 
-  if (G_UNLIKELY (indices->immutable_ref))
+  if (U_UNLIKELY (indices->immutable_ref))
     warn_about_midscene_changes ();
 
   indices->offset = offset;
@@ -161,7 +161,7 @@ static void
 _cogl_indices_free (CoglIndices *indices)
 {
   cogl_object_unref (indices->buffer);
-  g_slice_free (CoglIndices, indices);
+  u_slice_free (CoglIndices, indices);
 }
 
 CoglIndices *
@@ -195,7 +195,7 @@ cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
       /* Generate the byte array if we haven't already */
       if (ctx->rectangle_byte_indices == NULL)
         {
-          uint8_t *byte_array = g_malloc (256 / 4 * 6 * sizeof (uint8_t));
+          uint8_t *byte_array = u_malloc (256 / 4 * 6 * sizeof (uint8_t));
           uint8_t *p = byte_array;
           int i, vert_num = 0;
 
@@ -216,7 +216,7 @@ cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
                                 byte_array,
                                 256 / 4 * 6);
 
-          g_free (byte_array);
+          u_free (byte_array);
         }
 
       return ctx->rectangle_byte_indices;
@@ -238,7 +238,7 @@ cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
             ctx->rectangle_short_indices_len *= 2;
 
           /* Over-allocate to generate a whole number of quads */
-          p = short_array = g_malloc ((ctx->rectangle_short_indices_len
+          p = short_array = u_malloc ((ctx->rectangle_short_indices_len
                                        + 5) / 6 * 6
                                       * sizeof (uint16_t));
 
@@ -260,7 +260,7 @@ cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
                                 short_array,
                                 ctx->rectangle_short_indices_len);
 
-          g_free (short_array);
+          u_free (short_array);
         }
 
       return ctx->rectangle_short_indices;
diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h
index 98d1ea4..ffdc7ae 100644
--- a/cogl/cogl-journal-private.h
+++ b/cogl/cogl-journal-private.h
@@ -50,8 +50,8 @@ typedef struct _CoglJournal
      will cause the journal to flush */
   CoglFramebuffer *framebuffer;
 
-  GArray *entries;
-  GArray *vertices;
+  UArray *entries;
+  UArray *vertices;
   size_t needed_vbo_len;
 
   /* A pool of attribute buffers is used so that we can avoid repeatedly
diff --git a/cogl/cogl-journal.c b/cogl/cogl-journal.c
index e6b0fcc..cb2b9bc 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -46,7 +46,7 @@
 #include "cogl-private.h"
 
 #include <string.h>
-#include <gmodule.h>
+#include <umodule.h>
 #include <math.h>
 
 /* XXX NB:
@@ -104,7 +104,7 @@ typedef struct _CoglJournalFlushState
   CoglJournal *journal;
 
   CoglAttributeBuffer *attribute_buffer;
-  GArray *attributes;
+  UArray *attributes;
   int current_attribute;
 
   size_t stride;
@@ -133,21 +133,21 @@ _cogl_journal_free (CoglJournal *journal)
   int i;
 
   if (journal->entries)
-    g_array_free (journal->entries, TRUE);
+    u_array_free (journal->entries, TRUE);
   if (journal->vertices)
-    g_array_free (journal->vertices, TRUE);
+    u_array_free (journal->vertices, TRUE);
 
   for (i = 0; i < COGL_JOURNAL_VBO_POOL_SIZE; i++)
     if (journal->vbo_pool[i])
       cogl_object_unref (journal->vbo_pool[i]);
 
-  g_slice_free (CoglJournal, journal);
+  u_slice_free (CoglJournal, journal);
 }
 
 CoglJournal *
 _cogl_journal_new (CoglFramebuffer *framebuffer)
 {
-  CoglJournal *journal = g_slice_new0 (CoglJournal);
+  CoglJournal *journal = u_slice_new0 (CoglJournal);
 
   /* The journal keeps a pointer back to the framebuffer because there
      is effectively a 1:1 mapping between journals and framebuffers.
@@ -157,8 +157,8 @@ _cogl_journal_new (CoglFramebuffer *framebuffer)
      the journal is the only thing keeping it alive */
   journal->framebuffer = framebuffer;
 
-  journal->entries = g_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
-  journal->vertices = g_array_new (FALSE, FALSE, sizeof (float));
+  journal->entries = u_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
+  journal->vertices = u_array_new (FALSE, FALSE, sizeof (float));
 
   _cogl_list_init (&journal->pending_fences);
 
@@ -171,7 +171,7 @@ _cogl_journal_dump_logged_quad (uint8_t *data, int n_layers)
   size_t stride = GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (n_layers);
   int i;
 
-  g_print ("n_layers = %d; rgba=0x%02X%02X%02X%02X\n",
+  u_print ("n_layers = %d; rgba=0x%02X%02X%02X%02X\n",
            n_layers, data[0], data[1], data[2], data[3]);
 
   data += 4;
@@ -181,14 +181,14 @@ _cogl_journal_dump_logged_quad (uint8_t *data, int n_layers)
       float *v = (float *)data + (i * stride);
       int j;
 
-      g_print ("v%d: x = %f, y = %f", i, v[0], v[1]);
+      u_print ("v%d: x = %f, y = %f", i, v[0], v[1]);
 
       for (j = 0; j < n_layers; j++)
         {
           float *t = v + 2 + TEX_STRIDE * j;
-          g_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
+          u_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
         }
-      g_print ("\n");
+      u_print ("\n");
     }
 }
 
@@ -198,7 +198,7 @@ _cogl_journal_dump_quad_vertices (uint8_t *data, int n_layers)
   size_t stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers);
   int i;
 
-  g_print ("n_layers = %d; stride = %d; pos stride = %d; color stride = %d; "
+  u_print ("n_layers = %d; stride = %d; pos stride = %d; color stride = %d; "
            "tex stride = %d; stride in bytes = %d\n",
            n_layers, (int)stride, POS_STRIDE, COLOR_STRIDE,
            TEX_STRIDE, (int)stride * 4);
@@ -209,19 +209,19 @@ _cogl_journal_dump_quad_vertices (uint8_t *data, int n_layers)
       uint8_t *c = data + (POS_STRIDE * 4) + (i * stride * 4);
       int j;
 
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED
                       (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
-        g_print ("v%d: x = %f, y = %f, rgba=0x%02X%02X%02X%02X",
+        u_print ("v%d: x = %f, y = %f, rgba=0x%02X%02X%02X%02X",
                  i, v[0], v[1], c[0], c[1], c[2], c[3]);
       else
-        g_print ("v%d: x = %f, y = %f, z = %f, rgba=0x%02X%02X%02X%02X",
+        u_print ("v%d: x = %f, y = %f, z = %f, rgba=0x%02X%02X%02X%02X",
                  i, v[0], v[1], v[2], c[0], c[1], c[2], c[3]);
       for (j = 0; j < n_layers; j++)
         {
           float *t = v + POS_STRIDE + COLOR_STRIDE + TEX_STRIDE * j;
-          g_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
+          u_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
         }
-      g_print ("\n");
+      u_print ("\n");
     }
 }
 
@@ -231,7 +231,7 @@ _cogl_journal_dump_quad_batch (uint8_t *data, int n_layers, int n_quads)
   size_t byte_stride = GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS (n_layers) * 4;
   int i;
 
-  g_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n",
+  u_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n",
            n_layers, n_quads);
   for (i = 0; i < n_quads; i++)
     _cogl_journal_dump_quad_vertices (data + byte_stride * 2 * i, n_layers);
@@ -293,10 +293,10 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
 
   COGL_TIMER_START (_cogl_uprof_context, time_flush_modelview_and_entries);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
-    g_print ("BATCHING:     modelview batch len = %d\n", batch_len);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+    u_print ("BATCHING:     modelview batch len = %d\n", batch_len);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
     _cogl_context_set_current_modelview_entry (ctx,
                                                batch_start->modelview_entry);
 
@@ -352,7 +352,7 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
    * issues, visually seeing what is batched and debugging blending
    * issues, plus it looks quite cool.
    */
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)))
     {
       static CoglPipeline *outline = NULL;
       uint8_t color_intensity;
@@ -427,14 +427,14 @@ _cogl_journal_flush_pipeline_and_entries (CoglJournalEntry *batch_start,
 
   COGL_TIMER_START (_cogl_uprof_context, time_flush_pipeline_entries);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
-    g_print ("BATCHING:    pipeline batch len = %d\n", batch_len);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+    u_print ("BATCHING:    pipeline batch len = %d\n", batch_len);
 
   state->pipeline = batch_start->pipeline;
 
   /* If we haven't transformed the quads in software then we need to also break
    * up batches according to changes in the modelview matrix... */
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
     {
       batch_and_call (batch_start,
                       batch_len,
@@ -478,7 +478,7 @@ create_attribute_cb (CoglPipeline *pipeline,
   CreateAttributeState *state = user_data;
   CoglJournalFlushState *flush_state = state->flush_state;
   CoglAttribute **attribute_entry =
-    &g_array_index (flush_state->attributes,
+    &u_array_index (flush_state->attributes,
                     CoglAttribute *,
                     state->current + 2);
   const char *names[] = {
@@ -503,7 +503,7 @@ create_attribute_cb (CoglPipeline *pipeline,
    *  GET_JOURNAL_VB_STRIDE_FOR_N_LAYERS for details)
    */
   name = layer_number < 8 ? (char *)names[layer_number] :
-    g_strdup_printf ("cogl_tex_coord%d_in", layer_number);
+    u_strdup_printf ("cogl_tex_coord%d_in", layer_number);
 
   /* XXX: it may be worth having some form of static initializer for
    * attributes... */
@@ -518,7 +518,7 @@ create_attribute_cb (CoglPipeline *pipeline,
                         COGL_ATTRIBUTE_TYPE_FLOAT);
 
   if (layer_number >= 8)
-    g_free (name);
+    u_free (name);
 
   state->current++;
 
@@ -549,9 +549,9 @@ _cogl_journal_flush_texcoord_vbo_offsets_and_entries (
   /* NB: attributes 0 and 1 are position and color */
 
   for (i = 2; i < state->attributes->len; i++)
-    cogl_object_unref (g_array_index (state->attributes, CoglAttribute *, i));
+    cogl_object_unref (u_array_index (state->attributes, CoglAttribute *, i));
 
-  g_array_set_size (state->attributes, batch_start->n_layers + 2);
+  u_array_set_size (state->attributes, batch_start->n_layers + 2);
 
   create_attrib_state.current = 0;
   create_attrib_state.flush_state = state;
@@ -599,8 +599,8 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
   COGL_TIMER_START (_cogl_uprof_context,
                     time_flush_vbo_texcoord_pipeline_entries);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
-    g_print ("BATCHING:   vbo offset batch len = %d\n", batch_len);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+    u_print ("BATCHING:   vbo offset batch len = %d\n", batch_len);
 
   /* XXX NB:
    * Our journal's vertex data is arranged as follows:
@@ -616,11 +616,11 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
   state->stride = stride;
 
   for (i = 0; i < state->attributes->len; i++)
-    cogl_object_unref (g_array_index (state->attributes, CoglAttribute *, i));
+    cogl_object_unref (u_array_index (state->attributes, CoglAttribute *, i));
 
-  g_array_set_size (state->attributes, 2);
+  u_array_set_size (state->attributes, 2);
 
-  attribute_entry = &g_array_index (state->attributes, CoglAttribute *, 0);
+  attribute_entry = &u_array_index (state->attributes, CoglAttribute *, 0);
   *attribute_entry = cogl_attribute_new (state->attribute_buffer,
                                          "cogl_position_in",
                                          stride,
@@ -628,7 +628,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
                                          N_POS_COMPONENTS,
                                          COGL_ATTRIBUTE_TYPE_FLOAT);
 
-  attribute_entry = &g_array_index (state->attributes, CoglAttribute *, 1);
+  attribute_entry = &u_array_index (state->attributes, CoglAttribute *, 1);
   *attribute_entry =
     cogl_attribute_new (state->attribute_buffer,
                         "cogl_color_in",
@@ -648,7 +648,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
    */
   state->current_vertex = 0;
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
     {
       uint8_t *verts;
 
@@ -675,8 +675,8 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
 
   /* progress forward through the VBO containing all our vertices */
   state->array_offset += (stride * 4 * batch_len);
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
-    g_print ("new vbo offset = %lu\n", (unsigned long)state->array_offset);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+    u_print ("new vbo offset = %lu\n", (unsigned long)state->array_offset);
 
   COGL_TIMER_STOP (_cogl_uprof_context,
                    time_flush_vbo_texcoord_pipeline_entries);
@@ -719,8 +719,8 @@ _cogl_journal_flush_clip_stacks_and_entries (CoglJournalEntry *batch_start,
   COGL_TIMER_START (_cogl_uprof_context,
                     time_flush_clip_stack_pipeline_entries);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
-    g_print ("BATCHING:  clip stack batch len = %d\n", batch_len);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+    u_print ("BATCHING:  clip stack batch len = %d\n", batch_len);
 
   _cogl_clip_stack_flush (batch_start->clip_stack, framebuffer);
 
@@ -735,7 +735,7 @@ _cogl_journal_flush_clip_stacks_and_entries (CoglJournalEntry *batch_start,
    * matrix here. We need to do this after flushing the clip stack
    * because the clip stack flushing code can modify the current
    * modelview matrix entry */
-  if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))))
+  if (U_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))))
     _cogl_context_set_current_modelview_entry (ctx, &ctx->identity_entry);
 
   /* Setting up the clip state can sometimes also update the current
@@ -972,15 +972,15 @@ maybe_software_clip_entries (CoglJournalEntry      *batch_start,
      whether we can clip all of the entries so we don't want to do the
      rest of the dependant calculations until we're sure we can. */
   if (ctx->journal_clip_bounds == NULL)
-    ctx->journal_clip_bounds = g_array_new (FALSE, FALSE, sizeof (ClipBounds));
-  g_array_set_size (ctx->journal_clip_bounds, batch_len);
+    ctx->journal_clip_bounds = u_array_new (FALSE, FALSE, sizeof (ClipBounds));
+  u_array_set_size (ctx->journal_clip_bounds, batch_len);
 
   for (entry_num = 0; entry_num < batch_len; entry_num++)
     {
       CoglJournalEntry *journal_entry = batch_start + entry_num;
       CoglJournalEntry *prev_journal_entry =
         entry_num ? batch_start + (entry_num - 1) : NULL;
-      ClipBounds *clip_bounds = &g_array_index (ctx->journal_clip_bounds,
+      ClipBounds *clip_bounds = &u_array_index (ctx->journal_clip_bounds,
                                                 ClipBounds, entry_num);
 
       if (!can_software_clip_entry (journal_entry, prev_journal_entry,
@@ -996,9 +996,9 @@ maybe_software_clip_entries (CoglJournalEntry      *batch_start,
   for (entry_num = 0; entry_num < batch_len; entry_num++)
     {
       CoglJournalEntry *journal_entry = batch_start + entry_num;
-      float *verts = &g_array_index (journal->vertices, float,
+      float *verts = &u_array_index (journal->vertices, float,
                                      journal_entry->array_offset + 1);
-      ClipBounds *clip_bounds = &g_array_index (ctx->journal_clip_bounds,
+      ClipBounds *clip_bounds = &u_array_index (ctx->journal_clip_bounds,
                                                 ClipBounds, entry_num);
 
       software_clip_entry (journal_entry, verts, clip_bounds);
@@ -1076,7 +1076,7 @@ upload_vertices (CoglJournal *journal,
                  const CoglJournalEntry *entries,
                  int n_entries,
                  size_t needed_vbo_len,
-                 GArray *vertices)
+                 UArray *vertices)
 {
   CoglAttributeBuffer *attribute_buffer;
   CoglBuffer *buffer;
@@ -1087,7 +1087,7 @@ upload_vertices (CoglJournal *journal,
   CoglMatrixEntry *last_modelview_entry = NULL;
   CoglMatrix modelview;
 
-  g_assert (needed_vbo_len);
+  u_assert (needed_vbo_len);
 
   attribute_buffer = create_attribute_buffer (journal, needed_vbo_len * 4);
   buffer = COGL_BUFFER (attribute_buffer);
@@ -1096,7 +1096,7 @@ upload_vertices (CoglJournal *journal,
   vout = _cogl_buffer_map_range_for_fill_or_fallback (buffer,
                                                       0, /* offset */
                                                       needed_vbo_len * 4);
-  vin = &g_array_index (vertices, float, 0);
+  vin = &u_array_index (vertices, float, 0);
 
   /* Expand the number of vertices from 2 to 4 while uploading */
   for (entry_num = 0; entry_num < n_entries; entry_num++)
@@ -1111,7 +1111,7 @@ upload_vertices (CoglJournal *journal,
         memcpy (vout + vb_stride * i + POS_STRIDE, vin, 4);
       vin++;
 
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
         {
           vout[vb_stride * 0] = vin[0];
           vout[vb_stride * 0 + 1] = vin[1];
@@ -1182,14 +1182,14 @@ _cogl_journal_discard (CoglJournal *journal)
   for (i = 0; i < journal->entries->len; i++)
     {
       CoglJournalEntry *entry =
-        &g_array_index (journal->entries, CoglJournalEntry, i);
+        &u_array_index (journal->entries, CoglJournalEntry, i);
       _cogl_pipeline_journal_unref (entry->pipeline);
       cogl_matrix_entry_unref (entry->modelview_entry);
       _cogl_clip_stack_unref (entry->clip_stack);
     }
 
-  g_array_set_size (journal->entries, 0);
-  g_array_set_size (journal->vertices, 0);
+  u_array_set_size (journal->entries, 0);
+  u_array_set_size (journal->vertices, 0);
   journal->needed_vbo_len = 0;
   journal->fast_read_pixel_count = 0;
 
@@ -1246,7 +1246,7 @@ _cogl_journal_all_entries_within_bounds (CoglJournal *journal,
   for (i = 1; i < journal->entries->len; i++)
     {
       CoglBool found_reference = FALSE;
-      entry = &g_array_index (journal->entries, CoglJournalEntry, i);
+      entry = &u_array_index (journal->entries, CoglJournalEntry, i);
 
       for (clip_entry = entry->clip_stack;
            clip_entry;
@@ -1319,8 +1319,8 @@ _cogl_journal_flush (CoglJournal *journal)
    * that the timer isn't started recursively. */
   COGL_TIMER_START (_cogl_uprof_context, flush_timer);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
-    g_print ("BATCHING: journal len = %d\n", journal->entries->len);
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+    u_print ("BATCHING: journal len = %d\n", journal->entries->len);
 
   /* NB: the journal deals with flushing the modelview stack and clip
      state manually */
@@ -1339,7 +1339,7 @@ _cogl_journal_flush (CoglJournal *journal)
 
   state.attributes = ctx->journal_flush_attributes_array;
 
-  if (G_UNLIKELY ((COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_CLIP)) == 0))
+  if (U_UNLIKELY ((COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_CLIP)) == 0))
     {
       /* We do an initial walk of the journal to analyse the clip stack
          batches to see if we can do software clipping. We do this as a
@@ -1357,7 +1357,7 @@ _cogl_journal_flush (CoglJournal *journal)
      modifies the entries */
   state.attribute_buffer =
     upload_vertices (journal,
-                     &g_array_index (journal->entries, CoglJournalEntry, 0),
+                     &u_array_index (journal->entries, CoglJournalEntry, 0),
                      journal->entries->len,
                      journal->needed_vbo_len,
                      journal->vertices);
@@ -1393,8 +1393,8 @@ _cogl_journal_flush (CoglJournal *journal)
                   &state); /* data */
 
   for (i = 0; i < state.attributes->len; i++)
-    cogl_object_unref (g_array_index (state.attributes, CoglAttribute *, i));
-  g_array_set_size (state.attributes, 0);
+    cogl_object_unref (u_array_index (state.attributes, CoglAttribute *, i));
+  u_array_set_size (state.attributes, 0);
 
   cogl_object_unref (state.attribute_buffer);
 
@@ -1412,7 +1412,7 @@ add_framebuffer_deps_cb (CoglPipelineLayer *layer, void *user_data)
 {
   CoglFramebuffer *framebuffer = user_data;
   CoglTexture *texture = _cogl_pipeline_layer_get_texture_real (layer);
-  const GList *l;
+  const UList *l;
 
   if (!texture)
     return TRUE;
@@ -1474,8 +1474,8 @@ _cogl_journal_log_quad (CoglJournal  *journal,
   stride = GET_JOURNAL_ARRAY_STRIDE_FOR_N_LAYERS (n_layers);
 
   next_vert = journal->vertices->len;
-  g_array_set_size (journal->vertices, next_vert + 2 * stride + 1);
-  v = &g_array_index (journal->vertices, float, next_vert);
+  u_array_set_size (journal->vertices, next_vert + 2 * stride + 1);
+  v = &u_array_index (journal->vertices, float, next_vert);
 
   /* We calculate the needed size of the vbo as we go because it
      depends on the number of layers in each entry and it's not easy
@@ -1503,16 +1503,16 @@ _cogl_journal_log_quad (CoglJournal  *journal,
       memcpy (t + stride, tex_coords + i * 4 + 2, sizeof (float) * 2);
     }
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
     {
-      g_print ("Logged new quad:\n");
-      v = &g_array_index (journal->vertices, float, next_vert);
+      u_print ("Logged new quad:\n");
+      v = &u_array_index (journal->vertices, float, next_vert);
       _cogl_journal_dump_logged_quad ((uint8_t *)v, n_layers);
     }
 
   next_entry = journal->entries->len;
-  g_array_set_size (journal->entries, next_entry + 1);
-  entry = &g_array_index (journal->entries, CoglJournalEntry, next_entry);
+  u_array_set_size (journal->entries, next_entry + 1);
+  entry = &u_array_index (journal->entries, CoglJournalEntry, next_entry);
 
   entry->n_layers = n_layers;
   entry->array_offset = next_vert;
@@ -1520,20 +1520,20 @@ _cogl_journal_log_quad (CoglJournal  *journal,
   final_pipeline = pipeline;
 
   flush_options.flags = 0;
-  if (G_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers))
+  if (U_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers))
     {
       disable_layers = (1 << n_layers) - 1;
       disable_layers = ~disable_layers;
       flush_options.disable_layers = disable_layers;
       flush_options.flags |= COGL_PIPELINE_FLUSH_DISABLE_MASK;
     }
-  if (G_UNLIKELY (layer0_override_texture))
+  if (U_UNLIKELY (layer0_override_texture))
     {
       flush_options.flags |= COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE;
       flush_options.layer0_override_texture = layer0_override_texture;
     }
 
-  if (G_UNLIKELY (flush_options.flags))
+  if (U_UNLIKELY (flush_options.flags))
     {
       final_pipeline = cogl_pipeline_copy (pipeline);
       _cogl_pipeline_apply_overrides (final_pipeline, &flush_options);
@@ -1544,7 +1544,7 @@ _cogl_journal_log_quad (CoglJournal  *journal,
   clip_stack = _cogl_framebuffer_get_clip_stack (framebuffer);
   entry->clip_stack = _cogl_clip_stack_ref (clip_stack);
 
-  if (G_UNLIKELY (final_pipeline != pipeline))
+  if (U_UNLIKELY (final_pipeline != pipeline))
     cogl_object_unref (final_pipeline);
 
   modelview_stack =
@@ -1555,7 +1555,7 @@ _cogl_journal_log_quad (CoglJournal  *journal,
                                          add_framebuffer_deps_cb,
                                          framebuffer);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BATCHING)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BATCHING)))
     _cogl_journal_flush (journal);
 
   COGL_TIMER_STOP (_cogl_uprof_context, log_timer);
@@ -1770,8 +1770,8 @@ _cogl_journal_try_read_pixel (CoglJournal *journal,
   for (i = journal->entries->len - 1; i >= 0; i--)
     {
       CoglJournalEntry *entry =
-        &g_array_index (journal->entries, CoglJournalEntry, i);
-      uint8_t *color = (uint8_t *)&g_array_index (journal->vertices, float,
+        &u_array_index (journal->entries, CoglJournalEntry, i);
+      uint8_t *color = (uint8_t *)&u_array_index (journal->vertices, float,
                                                 entry->array_offset);
       float *vertices = (float *)color + 1;
       float poly[16];
diff --git a/cogl/cogl-magazine-private.h b/cogl/cogl-magazine-private.h
index 494fb3c..9177c03 100644
--- a/cogl/cogl-magazine-private.h
+++ b/cogl/cogl-magazine-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_MAGAZINE_PRIVATE_H__
 #define __COGL_MAGAZINE_PRIVATE_H__
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-memory-stack-private.h"
 
@@ -56,7 +56,7 @@ _cogl_magazine_new (size_t chunk_size, int initial_chunk_count);
 static inline void *
 _cogl_magazine_chunk_alloc (CoglMagazine *magazine)
 {
-  if (G_LIKELY (magazine->head))
+  if (U_LIKELY (magazine->head))
     {
       CoglMagazineChunk *chunk = magazine->head;
       magazine->head = chunk->next;
diff --git a/cogl/cogl-magazine.c b/cogl/cogl-magazine.c
index 44cbf21..a8963ff 100644
--- a/cogl/cogl-magazine.c
+++ b/cogl/cogl-magazine.c
@@ -57,14 +57,14 @@
 
 #include "cogl-memory-stack-private.h"
 #include "cogl-magazine-private.h"
-#include <glib.h>
+#include <ulib.h>
 
 #define ROUND_UP_8(X) ((X + (8 - 1)) & ~(8 - 1))
 
 CoglMagazine *
 _cogl_magazine_new (size_t chunk_size, int initial_chunk_count)
 {
-  CoglMagazine *magazine = g_new0 (CoglMagazine, 1);
+  CoglMagazine *magazine = u_new0 (CoglMagazine, 1);
 
   chunk_size = MAX (chunk_size, sizeof (CoglMagazineChunk));
   chunk_size = ROUND_UP_8 (chunk_size);
@@ -80,5 +80,5 @@ void
 _cogl_magazine_free (CoglMagazine *magazine)
 {
   _cogl_memory_stack_free (magazine->stack);
-  g_free (magazine);
+  u_free (magazine);
 }
diff --git a/cogl/cogl-matrix-private.h b/cogl/cogl-matrix-private.h
index 0726e09..f6671b6 100644
--- a/cogl/cogl-matrix-private.h
+++ b/cogl/cogl-matrix-private.h
@@ -34,14 +34,14 @@
 #ifndef __COGL_MATRIX_PRIVATE_H
 #define __COGL_MATRIX_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 COGL_BEGIN_DECLS
 
 #define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \
     { \
-      g_print ("%s:\n", G_STRFUNC); \
+      u_print ("%s:\n", G_STRFUNC); \
       cogl_debug_matrix_print (MATRIX); \
     }
 
diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c
index e57154b..970f220 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -511,21 +511,21 @@ initialized:
             return save->cache;
           }
         }
-      g_warn_if_reached ();
+      u_warn_if_reached ();
       return NULL;
     }
 
 #ifdef COGL_ENABLE_DEBUG
   if (!current)
     {
-      g_warning ("Inconsistent matrix stack");
+      u_warning ("Inconsistent matrix stack");
       return NULL;
     }
 
   entry->composite_gets++;
 #endif
 
-  children = g_alloca (sizeof (CoglMatrixEntry) * depth);
+  children = u_alloca (sizeof (CoglMatrixEntry) * depth);
 
   /* We need walk the list of entries from the init/load/save entry
    * back towards the leaf node but the nodes don't link to their
@@ -615,7 +615,7 @@ initialized:
         case COGL_MATRIX_OP_LOAD_IDENTITY:
         case COGL_MATRIX_OP_LOAD:
         case COGL_MATRIX_OP_SAVE:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
           continue;
         }
     }
@@ -645,15 +645,15 @@ static void
 _cogl_matrix_stack_free (CoglMatrixStack *stack)
 {
   cogl_matrix_entry_unref (stack->last_entry);
-  g_slice_free (CoglMatrixStack, stack);
+  u_slice_free (CoglMatrixStack, stack);
 }
 
 CoglMatrixStack *
 cogl_matrix_stack_new (CoglContext *ctx)
 {
-  CoglMatrixStack *stack = g_slice_new (CoglMatrixStack);
+  CoglMatrixStack *stack = u_slice_new (CoglMatrixStack);
 
-  if (G_UNLIKELY (cogl_matrix_stack_magazine == NULL))
+  if (U_UNLIKELY (cogl_matrix_stack_magazine == NULL))
     {
       cogl_matrix_stack_magazine =
         _cogl_magazine_new (sizeof (CoglMatrixEntryFull), 20);
@@ -689,15 +689,15 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
                                          float *y,
                                          float *z)
 {
-  GSList *head0 = NULL;
-  GSList *head1 = NULL;
+  USList *head0 = NULL;
+  USList *head1 = NULL;
   CoglMatrixEntry *node0;
   CoglMatrixEntry *node1;
   int len0 = 0;
   int len1 = 0;
   int count;
-  GSList *common_ancestor0;
-  GSList *common_ancestor1;
+  USList *common_ancestor0;
+  USList *common_ancestor1;
 
   /* Algorithm:
    *
@@ -722,12 +722,12 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
 
   for (node0 = entry0; node0; node0 = node0->parent)
     {
-      GSList *link;
+      USList *link;
 
       if (node0->op == COGL_MATRIX_OP_SAVE)
         continue;
 
-      link = alloca (sizeof (GSList));
+      link = alloca (sizeof (USList));
       link->next = head0;
       link->data = node0;
       head0 = link;
@@ -738,12 +738,12 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
     }
   for (node1 = entry1; node1; node1 = node1->parent)
     {
-      GSList *link;
+      USList *link;
 
       if (node1->op == COGL_MATRIX_OP_SAVE)
         continue;
 
-      link = alloca (sizeof (GSList));
+      link = alloca (sizeof (USList));
       link->next = head1;
       link->data = node1;
       head1 = link;
@@ -821,7 +821,7 @@ _cogl_matrix_flush_to_gl_builtin (CoglContext *ctx,
                                   CoglMatrix *matrix,
                                   CoglMatrixMode mode)
 {
-  g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
+  u_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
 
 #if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
   if (ctx->flushed_matrix_mode != mode)
@@ -861,7 +861,7 @@ _cogl_matrix_entry_flush_to_gl_builtins (CoglContext *ctx,
                                          CoglFramebuffer *framebuffer,
                                          CoglBool disable_flip)
 {
-  g_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
+  u_assert (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED));
 
 #if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
   {
@@ -1039,7 +1039,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
           }
         case COGL_MATRIX_OP_SAVE:
           /* We skip over saves above so we shouldn't see save entries */
-          g_warn_if_reached ();
+          u_warn_if_reached ();
         }
     }
 
@@ -1057,7 +1057,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
   for (depth = 0, e = entry; e; e = e->parent)
     depth++;
 
-  children = g_alloca (sizeof (CoglMatrixEntry) * depth);
+  children = u_alloca (sizeof (CoglMatrixEntry) * depth);
 
   for (i = depth - 1, e = entry;
        i >= 0 && e;
@@ -1066,7 +1066,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
       children[i] = e;
     }
 
-  g_print ("MatrixEntry %p =\n", entry);
+  u_print ("MatrixEntry %p =\n", entry);
 
   for (i = 0; i < depth; i++)
     {
@@ -1075,13 +1075,13 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
       switch (entry->op)
         {
         case COGL_MATRIX_OP_LOAD_IDENTITY:
-          g_print ("  LOAD IDENTITY\n");
+          u_print ("  LOAD IDENTITY\n");
           continue;
         case COGL_MATRIX_OP_TRANSLATE:
           {
             CoglMatrixEntryTranslate *translate =
               (CoglMatrixEntryTranslate *)entry;
-            g_print ("  TRANSLATE X=%f Y=%f Z=%f\n",
+            u_print ("  TRANSLATE X=%f Y=%f Z=%f\n",
                      translate->x,
                      translate->y,
                      translate->z);
@@ -1091,7 +1091,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
           {
             CoglMatrixEntryRotate *rotate =
               (CoglMatrixEntryRotate *)entry;
-            g_print ("  ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
+            u_print ("  ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
                      rotate->angle,
                      rotate->x,
                      rotate->y,
@@ -1102,7 +1102,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
           {
             CoglMatrixEntryRotateQuaternion *rotate =
               (CoglMatrixEntryRotateQuaternion *)entry;
-            g_print ("  ROTATE QUATERNION w=%f x=%f y=%f z=%f\n",
+            u_print ("  ROTATE QUATERNION w=%f x=%f y=%f z=%f\n",
                      rotate->values[0],
                      rotate->values[1],
                      rotate->values[2],
@@ -1113,7 +1113,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
           {
             CoglMatrixEntryRotateEuler *rotate =
               (CoglMatrixEntryRotateEuler *)entry;
-            g_print ("  ROTATE EULER heading=%f pitch=%f roll=%f\n",
+            u_print ("  ROTATE EULER heading=%f pitch=%f roll=%f\n",
                      rotate->heading,
                      rotate->pitch,
                      rotate->roll);
@@ -1122,7 +1122,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
         case COGL_MATRIX_OP_SCALE:
           {
             CoglMatrixEntryScale *scale = (CoglMatrixEntryScale *)entry;
-            g_print ("  SCALE X=%f Y=%f Z=%f\n",
+            u_print ("  SCALE X=%f Y=%f Z=%f\n",
                      scale->x,
                      scale->y,
                      scale->z);
@@ -1131,19 +1131,19 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
         case COGL_MATRIX_OP_MULTIPLY:
           {
             CoglMatrixEntryMultiply *mult = (CoglMatrixEntryMultiply *)entry;
-            g_print ("  MULT:\n");
+            u_print ("  MULT:\n");
             _cogl_matrix_prefix_print ("    ", mult->matrix);
             continue;
           }
         case COGL_MATRIX_OP_LOAD:
           {
             CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry;
-            g_print ("  LOAD:\n");
+            u_print ("  LOAD:\n");
             _cogl_matrix_prefix_print ("    ", load->matrix);
             continue;
           }
         case COGL_MATRIX_OP_SAVE:
-          g_print ("  SAVE\n");
+          u_print ("  SAVE\n");
         }
     }
 }
diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c
index 4a9b9ce..cc0a448 100644
--- a/cogl/cogl-matrix.c
+++ b/cogl/cogl-matrix.c
@@ -78,7 +78,7 @@
 #include <cogl-matrix-private.h>
 #include <cogl-quaternion-private.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <math.h>
 #include <string.h>
 
@@ -365,7 +365,7 @@ print_matrix_floats (const char *prefix, const float m[16])
 {
   int i;
   for (i = 0;i < 4; i++)
-    g_print ("%s\t%f %f %f %f\n", prefix, m[i], m[4+i], m[8+i], m[12+i] );
+    u_print ("%s\t%f %f %f %f\n", prefix, m[i], m[4+i], m[8+i], m[12+i] );
 }
 
 void
@@ -374,11 +374,11 @@ _cogl_matrix_prefix_print (const char *prefix, const CoglMatrix *matrix)
   if (!(matrix->flags & MAT_DIRTY_TYPE))
     {
       _COGL_RETURN_IF_FAIL (matrix->type < COGL_MATRIX_N_TYPES);
-      g_print ("%sMatrix type: %s, flags: %x\n",
+      u_print ("%sMatrix type: %s, flags: %x\n",
                prefix, types[matrix->type], (int)matrix->flags);
     }
   else
-    g_print ("%sMatrix type: DIRTY, flags: %x\n",
+    u_print ("%sMatrix type: DIRTY, flags: %x\n",
              prefix, (int)matrix->flags);
 
   print_matrix_floats (prefix, (float *)matrix);
@@ -1911,7 +1911,7 @@ cogl_matrix_equal (const void *v1, const void *v2)
 
   /* We want to avoid having a fuzzy _equal() function (e.g. that uses
    * an arbitrary epsilon value) since this function noteably conforms
-   * to the prototype suitable for use with g_hash_table_new() and a
+   * to the prototype suitable for use with u_hash_table_new() and a
    * fuzzy hash function isn't really appropriate for comparing hash
    * table keys since it's possible that you could end up fetching
    * different values if you end up with multiple similar keys in use
@@ -1948,8 +1948,8 @@ cogl_matrix_equal (const void *v1, const void *v2)
 CoglMatrix *
 cogl_matrix_copy (const CoglMatrix *matrix)
 {
-  if (G_LIKELY (matrix))
-    return g_slice_dup (CoglMatrix, matrix);
+  if (U_LIKELY (matrix))
+    return u_slice_dup (CoglMatrix, matrix);
 
   return NULL;
 }
@@ -1957,7 +1957,7 @@ cogl_matrix_copy (const CoglMatrix *matrix)
 void
 cogl_matrix_free (CoglMatrix *matrix)
 {
-  g_slice_free (CoglMatrix, matrix);
+  u_slice_free (CoglMatrix, matrix);
 }
 
 const float *
diff --git a/cogl/cogl-memory-stack-private.h b/cogl/cogl-memory-stack-private.h
index f23b9e1..218b3c3 100644
--- a/cogl/cogl-memory-stack-private.h
+++ b/cogl/cogl-memory-stack-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_MEMORY_STACK__
 #define __COGL_MEMORY_STACK__
 
-#include <glib.h>
+#include <ulib.h>
 
 typedef struct _CoglMemoryStack CoglMemoryStack;
 
diff --git a/cogl/cogl-memory-stack.c b/cogl/cogl-memory-stack.c
index acb8cf2..eabda3f 100644
--- a/cogl/cogl-memory-stack.c
+++ b/cogl/cogl-memory-stack.c
@@ -63,7 +63,7 @@
 
 #include <stdint.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 typedef struct _CoglMemorySubStack
 {
@@ -83,9 +83,9 @@ struct _CoglMemoryStack
 static CoglMemorySubStack *
 _cogl_memory_sub_stack_alloc (size_t bytes)
 {
-  CoglMemorySubStack *sub_stack = g_slice_new (CoglMemorySubStack);
+  CoglMemorySubStack *sub_stack = u_slice_new (CoglMemorySubStack);
   sub_stack->bytes = bytes;
-  sub_stack->data = g_malloc (bytes);
+  sub_stack->data = u_malloc (bytes);
   return sub_stack;
 }
 
@@ -103,7 +103,7 @@ _cogl_memory_stack_add_sub_stack (CoglMemoryStack *stack,
 CoglMemoryStack *
 _cogl_memory_stack_new (size_t initial_size_bytes)
 {
-  CoglMemoryStack *stack = g_slice_new0 (CoglMemoryStack);
+  CoglMemoryStack *stack = u_slice_new0 (CoglMemoryStack);
 
   _cogl_list_init (&stack->sub_stacks);
 
@@ -119,7 +119,7 @@ _cogl_memory_stack_alloc (CoglMemoryStack *stack, size_t bytes)
   void *ret;
 
   sub_stack = stack->sub_stack;
-  if (G_LIKELY (sub_stack->bytes - stack->sub_stack_offset >= bytes))
+  if (U_LIKELY (sub_stack->bytes - stack->sub_stack_offset >= bytes))
     {
       ret = sub_stack->data + stack->sub_stack_offset;
       stack->sub_stack_offset += bytes;
@@ -176,8 +176,8 @@ _cogl_memory_stack_rewind (CoglMemoryStack *stack)
 static void
 _cogl_memory_sub_stack_free (CoglMemorySubStack *sub_stack)
 {
-  g_free (sub_stack->data);
-  g_slice_free (CoglMemorySubStack, sub_stack);
+  u_free (sub_stack->data);
+  u_slice_free (CoglMemorySubStack, sub_stack);
 }
 
 void
@@ -192,5 +192,5 @@ _cogl_memory_stack_free (CoglMemoryStack *stack)
       _cogl_memory_sub_stack_free (sub_stack);
     }
 
-  g_slice_free (CoglMemoryStack, stack);
+  u_slice_free (CoglMemoryStack, stack);
 }
diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h
index f2f8822..7ddef4c 100644
--- a/cogl/cogl-object-private.h
+++ b/cogl/cogl-object-private.h
@@ -32,7 +32,7 @@
 #ifndef __COGL_OBJECT_PRIVATE_H
 #define __COGL_OBJECT_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-types.h"
 #include "cogl-object.h"
@@ -80,7 +80,7 @@ struct _CoglObject
 
   CoglUserDataEntry user_data_entry[
     COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES];
-  GArray           *user_data_array;
+  UArray           *user_data_array;
   int               n_user_data_entries;
 
   unsigned int      ref_count;
@@ -95,17 +95,17 @@ struct _CoglObject
   COGL_NOTE (OBJECT, "COGL " G_STRINGIFY (type_name) " NEW   %p %i",    \
              (obj), (obj)->ref_count)
 
-#define _COGL_OBJECT_DEBUG_REF(type_name, object)       G_STMT_START {  \
+#define _COGL_OBJECT_DEBUG_REF(type_name, object)       U_STMT_START {  \
   CoglObject *__obj = (CoglObject *)object;                             \
   COGL_NOTE (OBJECT, "COGL %s REF %p %i",                               \
              (__obj)->klass->name,                                      \
-             (__obj), (__obj)->ref_count);              } G_STMT_END
+             (__obj), (__obj)->ref_count);              } U_STMT_END
 
-#define _COGL_OBJECT_DEBUG_UNREF(type_name, object)     G_STMT_START {  \
+#define _COGL_OBJECT_DEBUG_UNREF(type_name, object)     U_STMT_START {  \
   CoglObject *__obj = (CoglObject *)object;                             \
   COGL_NOTE (OBJECT, "COGL %s UNREF %p %i",                             \
              (__obj)->klass->name,                                      \
-             (__obj), (__obj)->ref_count - 1);          } G_STMT_END
+             (__obj), (__obj)->ref_count - 1);          } U_STMT_END
 
 #define COGL_OBJECT_DEBUG_FREE(obj)                                     \
   COGL_NOTE (OBJECT, "COGL %s FREE %p",                                 \
@@ -160,7 +160,7 @@ _cogl_##type_name##_object_new (Cogl##TypeName *new_obj)                \
                                                                         \
       if (_cogl_debug_instances == NULL)                                \
         _cogl_debug_instances =                                         \
-          g_hash_table_new (g_str_hash, g_str_equal);                   \
+          u_hash_table_new (u_str_hash, u_str_equal);                   \
                                                                         \
       obj->klass->virt_free =                                           \
         _cogl_object_##type_name##_indirect_free;                       \
@@ -168,7 +168,7 @@ _cogl_##type_name##_object_new (Cogl##TypeName *new_obj)                \
         _cogl_object_default_unref;                                     \
       obj->klass->name = "Cogl"#TypeName,                               \
                                                                         \
-      g_hash_table_insert (_cogl_debug_instances,                       \
+      u_hash_table_insert (_cogl_debug_instances,                       \
                            (void *) obj->klass->name,                   \
                            &_cogl_object_##type_name##_count);          \
                                                                         \
diff --git a/cogl/cogl-object.c b/cogl/cogl-object.c
index 0029a30..ae639d5 100644
--- a/cogl/cogl-object.c
+++ b/cogl/cogl-object.c
@@ -33,7 +33,7 @@
 #include "config.h"
 #endif
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 #include "cogl-util.h"
@@ -81,13 +81,13 @@ _cogl_object_default_unref (void *object)
               for (i = 0; i < obj->user_data_array->len; i++)
                 {
                   CoglUserDataEntry *entry =
-                    &g_array_index (obj->user_data_array,
+                    &u_array_index (obj->user_data_array,
                                     CoglUserDataEntry, i);
 
                   if (entry->destroy)
                     entry->destroy (entry->user_data, obj);
                 }
-              g_array_free (obj->user_data_array, TRUE);
+              u_array_free (obj->user_data_array, TRUE);
             }
         }
 
@@ -126,12 +126,12 @@ _cogl_object_find_entry (CoglObject *object, CoglUserDataKey *key)
         entry = current;
     }
 
-  if (G_UNLIKELY (object->user_data_array != NULL))
+  if (U_UNLIKELY (object->user_data_array != NULL))
     {
       for (i = 0; i < object->user_data_array->len; i++)
         {
           CoglUserDataEntry *current =
-            &g_array_index (object->user_data_array, CoglUserDataEntry, i);
+            &u_array_index (object->user_data_array, CoglUserDataEntry, i);
 
           if (current->key == key)
             return current;
@@ -164,7 +164,7 @@ _cogl_object_set_user_data (CoglObject *object,
   entry = _cogl_object_find_entry (object, key);
   if (entry)
     {
-      if (G_LIKELY (entry->destroy))
+      if (U_LIKELY (entry->destroy))
         entry->destroy (entry->user_data, object);
     }
   else
@@ -175,21 +175,21 @@ _cogl_object_set_user_data (CoglObject *object,
       if (user_data == NULL)
         return;
 
-      if (G_LIKELY (object->n_user_data_entries <
+      if (U_LIKELY (object->n_user_data_entries <
                     COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES))
         entry = &object->user_data_entry[object->n_user_data_entries++];
       else
         {
-          if (G_UNLIKELY (object->user_data_array == NULL))
+          if (U_UNLIKELY (object->user_data_array == NULL))
             {
               object->user_data_array =
-                g_array_new (FALSE, FALSE, sizeof (CoglUserDataEntry));
+                u_array_new (FALSE, FALSE, sizeof (CoglUserDataEntry));
             }
 
-          g_array_set_size (object->user_data_array,
+          u_array_set_size (object->user_data_array,
                             object->user_data_array->len + 1);
           entry =
-            &g_array_index (object->user_data_array, CoglUserDataEntry,
+            &u_array_index (object->user_data_array, CoglUserDataEntry,
                             object->user_data_array->len - 1);
 
           object->n_user_data_entries++;
@@ -230,7 +230,7 @@ cogl_object_get_user_data (CoglObject *object, CoglUserDataKey *key)
       for (i = 0; i < object->user_data_array->len; i++)
         {
           CoglUserDataEntry *entry =
-            &g_array_index (object->user_data_array, CoglUserDataEntry, i);
+            &u_array_index (object->user_data_array, CoglUserDataEntry, i);
 
           if (entry->key == key)
             return entry->user_data;
@@ -244,12 +244,12 @@ void
 cogl_debug_object_foreach_type (CoglDebugObjectForeachTypeCallback func,
                                 void *user_data)
 {
-  GHashTableIter iter;
+  UHashTableIter iter;
   unsigned int *instance_count;
   CoglDebugObjectTypeInfo info;
 
-  g_hash_table_iter_init (&iter, _cogl_debug_instances);
-  while (g_hash_table_iter_next (&iter,
+  u_hash_table_iter_init (&iter, _cogl_debug_instances);
+  while (u_hash_table_iter_next (&iter,
                                  (void *) &info.name,
                                  (void *) &instance_count))
     {
@@ -262,13 +262,13 @@ static void
 print_instances_cb (const CoglDebugObjectTypeInfo *info,
                     void *user_data)
 {
-  g_print ("\t%s: %u\n", info->name, info->instance_count);
+  u_print ("\t%s: %u\n", info->name, info->instance_count);
 }
 
 void
 cogl_debug_object_print_instances (void)
 {
-  g_print ("Cogl instances:\n");
+  u_print ("Cogl instances:\n");
 
   cogl_debug_object_foreach_type (print_instances_cb, NULL);
 }
diff --git a/cogl/cogl-object.h b/cogl/cogl-object.h
index cf73116..df1ab93 100644
--- a/cogl/cogl-object.h
+++ b/cogl/cogl-object.h
@@ -81,7 +81,7 @@ cogl_object_unref (void *object);
  * static void
  * destroy_path_private_cb (void *data)
  * {
- *   g_free (data);
+ *   u_free (data);
  * }
  *
  * static void
diff --git a/cogl/cogl-onscreen-private.h b/cogl/cogl-onscreen-private.h
index b058e7b..eb4fd4b 100644
--- a/cogl/cogl-onscreen-private.h
+++ b/cogl/cogl-onscreen-private.h
@@ -36,7 +36,7 @@
 #include "cogl-closure-list-private.h"
 #include "cogl-list.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 #ifdef COGL_HAS_WIN32_SUPPORT
 #include <windows.h>
@@ -90,7 +90,7 @@ struct _CoglOnscreen
   int64_t swap_frame_counter; /* frame counter at last all to
                                * cogl_onscreen_swap_region() or
                                * cogl_onscreen_swap_buffers() */
-  GQueue pending_frame_infos;
+  UQueue pending_frame_infos;
 
   void *winsys;
 };
diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c
index 4f350e1..6ad624a 100644
--- a/cogl/cogl-onscreen-template.c
+++ b/cogl/cogl-onscreen-template.c
@@ -47,13 +47,13 @@ COGL_OBJECT_DEFINE (OnscreenTemplate, onscreen_template);
 static void
 _cogl_onscreen_template_free (CoglOnscreenTemplate *onscreen_template)
 {
-  g_slice_free (CoglOnscreenTemplate, onscreen_template);
+  u_slice_free (CoglOnscreenTemplate, onscreen_template);
 }
 
 CoglOnscreenTemplate *
 cogl_onscreen_template_new (void)
 {
-  CoglOnscreenTemplate *onscreen_template = g_slice_new0 (CoglOnscreenTemplate);
+  CoglOnscreenTemplate *onscreen_template = u_slice_new0 (CoglOnscreenTemplate);
   char *user_config;
 
   onscreen_template->config.swap_throttled = TRUE;
diff --git a/cogl/cogl-onscreen.c b/cogl/cogl-onscreen.c
index 3ccaa59..7d5f288 100644
--- a/cogl/cogl-onscreen.c
+++ b/cogl/cogl-onscreen.c
@@ -77,7 +77,7 @@ cogl_onscreen_new (CoglContext *ctx, int width, int height)
      is not premultiplied in case it is being used for some special
      purpose. */
 
-  onscreen = g_new0 (CoglOnscreen, 1);
+  onscreen = u_new0 (CoglOnscreen, 1);
   _cogl_framebuffer_init (COGL_FRAMEBUFFER (onscreen),
                           ctx,
                           COGL_FRAMEBUFFER_TYPE_ONSCREEN,
@@ -100,9 +100,9 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
   _cogl_closure_list_disconnect_all (&onscreen->frame_closures);
   _cogl_closure_list_disconnect_all (&onscreen->dirty_closures);
 
-  while ((frame_info = g_queue_pop_tail (&onscreen->pending_frame_infos)))
+  while ((frame_info = u_queue_pop_tail (&onscreen->pending_frame_infos)))
     cogl_object_unref (frame_info);
-  g_queue_clear (&onscreen->pending_frame_infos);
+  u_queue_clear (&onscreen->pending_frame_infos);
 
   winsys->onscreen_deinit (onscreen);
   _COGL_RETURN_IF_FAIL (onscreen->winsys == NULL);
@@ -110,7 +110,7 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
   /* Chain up to parent */
   _cogl_framebuffer_free (framebuffer);
 
-  g_free (onscreen);
+  u_free (onscreen);
 }
 
 static void
@@ -150,7 +150,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
       cogl_object_unref (onscreen);
       cogl_object_unref (info);
 
-      g_slice_free (CoglOnscreenEvent, event);
+      u_slice_free (CoglOnscreenEvent, event);
     }
 
   while (!_cogl_list_empty (&context->onscreen_dirty_queue))
@@ -169,7 +169,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
 
       cogl_object_unref (qe->onscreen);
 
-      g_slice_free (CoglOnscreenQueuedDirty, qe);
+      u_slice_free (CoglOnscreenQueuedDirty, qe);
     }
 }
 
@@ -194,7 +194,7 @@ _cogl_onscreen_queue_dirty (CoglOnscreen *onscreen,
                             const CoglOnscreenDirtyInfo *info)
 {
   CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
-  CoglOnscreenQueuedDirty *qe = g_slice_new (CoglOnscreenQueuedDirty);
+  CoglOnscreenQueuedDirty *qe = u_slice_new (CoglOnscreenQueuedDirty);
 
   qe->onscreen = cogl_object_ref (onscreen);
   qe->info = *info;
@@ -224,7 +224,7 @@ _cogl_onscreen_queue_event (CoglOnscreen *onscreen,
 {
   CoglContext *ctx = COGL_FRAMEBUFFER (onscreen)->context;
 
-  CoglOnscreenEvent *event = g_slice_new (CoglOnscreenEvent);
+  CoglOnscreenEvent *event = u_slice_new (CoglOnscreenEvent);
 
   event->onscreen = cogl_object_ref (onscreen);
   event->info = cogl_object_ref (info);
@@ -248,7 +248,7 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
 
   info = _cogl_frame_info_new ();
   info->frame_counter = onscreen->frame_counter;
-  g_queue_push_tail (&onscreen->pending_frame_infos, info);
+  u_queue_push_tail (&onscreen->pending_frame_infos, info);
 
   _cogl_framebuffer_flush_journal (framebuffer);
 
@@ -264,9 +264,9 @@ cogl_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
     {
       CoglFrameInfo *info;
 
-      g_warn_if_fail (onscreen->pending_frame_infos.length == 1);
+      u_warn_if_fail (onscreen->pending_frame_infos.length == 1);
 
-      info = g_queue_pop_tail (&onscreen->pending_frame_infos);
+      info = u_queue_pop_tail (&onscreen->pending_frame_infos);
 
       _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
       _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
@@ -297,7 +297,7 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
 
   info = _cogl_frame_info_new ();
   info->frame_counter = onscreen->frame_counter;
-  g_queue_push_tail (&onscreen->pending_frame_infos, info);
+  u_queue_push_tail (&onscreen->pending_frame_infos, info);
 
   _cogl_framebuffer_flush_journal (framebuffer);
 
@@ -320,9 +320,9 @@ cogl_onscreen_swap_region (CoglOnscreen *onscreen,
     {
       CoglFrameInfo *info;
 
-      g_warn_if_fail (onscreen->pending_frame_infos.length == 1);
+      u_warn_if_fail (onscreen->pending_frame_infos.length == 1);
 
-      info = g_queue_pop_tail (&onscreen->pending_frame_infos);
+      info = u_queue_pop_tail (&onscreen->pending_frame_infos);
 
       _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
       _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
diff --git a/cogl/cogl-output.c b/cogl/cogl-output.c
index 15d5e5f..d49bb57 100644
--- a/cogl/cogl-output.c
+++ b/cogl/cogl-output.c
@@ -45,8 +45,8 @@ _cogl_output_new (const char *name)
 {
   CoglOutput *output;
 
-  output = g_slice_new0 (CoglOutput);
-  output->name = g_strdup (name);
+  output = u_slice_new0 (CoglOutput);
+  output->name = u_strdup (name);
 
   return _cogl_output_object_new (output);
 }
@@ -54,18 +54,18 @@ _cogl_output_new (const char *name)
 static void
 _cogl_output_free (CoglOutput *output)
 {
-  g_free (output->name);
+  u_free (output->name);
 
-  g_slice_free (CoglOutput, output);
+  u_slice_free (CoglOutput, output);
 }
 
-gboolean
+CoglBool
 _cogl_output_values_equal (CoglOutput *output,
                            CoglOutput *other)
 {
-  return memcmp ((const char *)output + G_STRUCT_OFFSET (CoglOutput, x),
-                 (const char *)other + G_STRUCT_OFFSET (CoglOutput, x),
-                 sizeof (CoglOutput) - G_STRUCT_OFFSET (CoglOutput, x)) == 0;
+  return memcmp ((const char *)output + U_STRUCT_OFFSET (CoglOutput, x),
+                 (const char *)other + U_STRUCT_OFFSET (CoglOutput, x),
+                 sizeof (CoglOutput) - U_STRUCT_OFFSET (CoglOutput, x)) == 0;
 }
 
 int
diff --git a/cogl/cogl-pipeline-cache.c b/cogl/cogl-pipeline-cache.c
index b6a61c6..04fcff3 100644
--- a/cogl/cogl-pipeline-cache.c
+++ b/cogl/cogl-pipeline-cache.c
@@ -52,7 +52,7 @@ struct _CoglPipelineCache
 CoglPipelineCache *
 _cogl_pipeline_cache_new (void)
 {
-  CoglPipelineCache *cache = g_new (CoglPipelineCache, 1);
+  CoglPipelineCache *cache = u_new (CoglPipelineCache, 1);
   unsigned long vertex_state;
   unsigned long layer_vertex_state;
   unsigned int fragment_state;
@@ -91,7 +91,7 @@ _cogl_pipeline_cache_free (CoglPipelineCache *cache)
   _cogl_pipeline_hash_table_destroy (&cache->fragment_hash);
   _cogl_pipeline_hash_table_destroy (&cache->vertex_hash);
   _cogl_pipeline_hash_table_destroy (&cache->combined_hash);
-  g_free (cache);
+  u_free (cache);
 }
 
 CoglPipelineCacheEntry *
@@ -128,7 +128,7 @@ create_pipelines (CoglPipeline **pipelines,
 
   for (i = 0; i < n_pipelines; i++)
     {
-      char *source = g_strdup_printf ("  cogl_color_out = "
+      char *source = u_strdup_printf ("  cogl_color_out = "
                                       "vec4 (%f, 0.0, 0.0, 1.0);\n",
                                       i / 255.0f);
       CoglSnippet *snippet =
@@ -136,7 +136,7 @@ create_pipelines (CoglPipeline **pipelines,
                           NULL, /* declarations */
                           source);
 
-      g_free (source);
+      u_free (source);
 
       pipelines[i] = cogl_pipeline_new (test_ctx);
       cogl_pipeline_add_snippet (pipelines[i], snippet);
@@ -187,10 +187,10 @@ UNIT_TEST (check_pipeline_pruning,
   /* These pipelines should all have unique entries in the cache. We
    * should have run the garbage collection once and at that point the
    * expected minimum size would have been 17 */
-  g_assert_cmpint (g_hash_table_size (fragment_hash->table), ==, 18);
-  g_assert_cmpint (g_hash_table_size (combined_hash->table), ==, 18);
-  g_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
-  g_assert_cmpint (combined_hash->expected_min_size, ==, 17);
+  u_assert_cmpint (u_hash_table_size (fragment_hash->table), ==, 18);
+  u_assert_cmpint (u_hash_table_size (combined_hash->table), ==, 18);
+  u_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
+  u_assert_cmpint (combined_hash->expected_min_size, ==, 17);
 
   /* Destroy the original pipelines and create some new ones. This
    * should run the garbage collector again but this time the
@@ -202,12 +202,12 @@ UNIT_TEST (check_pipeline_pruning,
 
   /* The garbage collection should have freed half of the original 18
    * pipelines which means there should now be 18*1.5 = 27 */
-  g_assert_cmpint (g_hash_table_size (fragment_hash->table), ==, 27);
-  g_assert_cmpint (g_hash_table_size (combined_hash->table), ==, 27);
+  u_assert_cmpint (u_hash_table_size (fragment_hash->table), ==, 27);
+  u_assert_cmpint (u_hash_table_size (combined_hash->table), ==, 27);
   /* The 35th pipeline would have caused the garbage collection. At
    * that point there would be 35-18=17 used unique pipelines. */
-  g_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
-  g_assert_cmpint (combined_hash->expected_min_size, ==, 17);
+  u_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
+  u_assert_cmpint (combined_hash->expected_min_size, ==, 17);
 
   for (i = 0; i < 18; i++)
     cogl_object_unref (pipelines[i]);
diff --git a/cogl/cogl-pipeline-debug.c b/cogl/cogl-pipeline-debug.c
index c0ee39b..24adc25 100644
--- a/cogl/cogl-pipeline-debug.c
+++ b/cogl/cogl-pipeline-debug.c
@@ -40,13 +40,13 @@
 #include "cogl-pipeline-layer-private.h"
 #include "cogl-node-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 typedef struct
 {
   int parent_id;
   int *node_id_ptr;
-  GString *graph;
+  UString *graph;
   int indent;
 } PrintDebugState;
 
@@ -57,16 +57,16 @@ dump_layer_cb (CoglNode *node, void *user_data)
   PrintDebugState *state = user_data;
   int layer_id = *state->node_id_ptr;
   PrintDebugState state_out;
-  GString *changes_label;
+  UString *changes_label;
   CoglBool changes = FALSE;
 
   if (state->parent_id >= 0)
-    g_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n",
+    u_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n",
                             state->indent, "",
                             layer->_parent.parent,
                             layer);
 
-  g_string_append_printf (state->graph,
+  u_string_append_printf (state->graph,
                           "%*slayer%p [label=\"layer=0x%p\\n"
                           "ref count=%d\" "
                           "color=\"blue\"];\n",
@@ -75,8 +75,8 @@ dump_layer_cb (CoglNode *node, void *user_data)
                           layer,
                           COGL_OBJECT (layer)->ref_count);
 
-  changes_label = g_string_new ("");
-  g_string_append_printf (changes_label,
+  changes_label = u_string_new ("");
+  u_string_append_printf (changes_label,
                           "%*slayer%p -> layer_state%d [weight=100];\n"
                           "%*slayer_state%d [shape=box label=\"",
                           state->indent, "",
@@ -88,7 +88,7 @@ dump_layer_cb (CoglNode *node, void *user_data)
   if (layer->differences & COGL_PIPELINE_LAYER_STATE_UNIT)
     {
       changes = TRUE;
-      g_string_append_printf (changes_label,
+      u_string_append_printf (changes_label,
                               "\\lunit=%u\\n",
                               layer->unit_index);
     }
@@ -96,16 +96,16 @@ dump_layer_cb (CoglNode *node, void *user_data)
   if (layer->differences & COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA)
     {
       changes = TRUE;
-      g_string_append_printf (changes_label,
+      u_string_append_printf (changes_label,
                               "\\ltexture=%p\\n",
                               layer->texture);
     }
 
   if (changes)
     {
-      g_string_append_printf (changes_label, "\"];\n");
-      g_string_append (state->graph, changes_label->str);
-      g_string_free (changes_label, TRUE);
+      u_string_append_printf (changes_label, "\"];\n");
+      u_string_append (state->graph, changes_label->str);
+      u_string_free (changes_label, TRUE);
     }
 
   state_out.parent_id = layer_id;
@@ -129,7 +129,7 @@ dump_layer_ref_cb (CoglPipelineLayer *layer, void *data)
   PrintDebugState *state = data;
   int pipeline_id = *state->node_id_ptr;
 
-  g_string_append_printf (state->graph,
+  u_string_append_printf (state->graph,
                           "%*spipeline_state%d -> layer%p;\n",
                           state->indent, "",
                           pipeline_id,
@@ -145,17 +145,17 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
   PrintDebugState *state = user_data;
   int pipeline_id = *state->node_id_ptr;
   PrintDebugState state_out;
-  GString *changes_label;
+  UString *changes_label;
   CoglBool changes = FALSE;
   CoglBool layers = FALSE;
 
   if (state->parent_id >= 0)
-    g_string_append_printf (state->graph, "%*spipeline%d -> pipeline%d;\n",
+    u_string_append_printf (state->graph, "%*spipeline%d -> pipeline%d;\n",
                             state->indent, "",
                             state->parent_id,
                             pipeline_id);
 
-  g_string_append_printf (state->graph,
+  u_string_append_printf (state->graph,
                           "%*spipeline%d [label=\"pipeline=0x%p\\n"
                           "ref count=%d\\n"
                           "breadcrumb=\\\"%s\\\"\" color=\"red\"];\n",
@@ -171,8 +171,8 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
 #endif
                           );
 
-  changes_label = g_string_new ("");
-  g_string_append_printf (changes_label,
+  changes_label = u_string_new ("");
+  u_string_append_printf (changes_label,
                           "%*spipeline%d -> pipeline_state%d [weight=100];\n"
                           "%*spipeline_state%d [shape=box label=\"",
                           state->indent, "",
@@ -185,7 +185,7 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
   if (pipeline->differences & COGL_PIPELINE_STATE_COLOR)
     {
       changes = TRUE;
-      g_string_append_printf (changes_label,
+      u_string_append_printf (changes_label,
                               "\\lcolor=0x%02X%02X%02X%02X\\n",
                               cogl_color_get_red_byte (&pipeline->color),
                               cogl_color_get_green_byte (&pipeline->color),
@@ -213,7 +213,7 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
         default:
           blend_enable_name = "UNKNOWN";
         }
-      g_string_append_printf (changes_label,
+      u_string_append_printf (changes_label,
                               "\\lblend=%s\\n",
                               blend_enable_name);
     }
@@ -222,20 +222,20 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
     {
       changes = TRUE;
       layers = TRUE;
-      g_string_append_printf (changes_label, "\\ln_layers=%d\\n",
+      u_string_append_printf (changes_label, "\\ln_layers=%d\\n",
                               pipeline->n_layers);
     }
 
   if (changes)
     {
-      g_string_append_printf (changes_label, "\"];\n");
-      g_string_append (state->graph, changes_label->str);
-      g_string_free (changes_label, TRUE);
+      u_string_append_printf (changes_label, "\"];\n");
+      u_string_append (state->graph, changes_label->str);
+      u_string_free (changes_label, TRUE);
     }
 
   if (layers)
     {
-      g_list_foreach (pipeline->layer_differences,
+      u_list_foreach (pipeline->layer_differences,
                       (GFunc)dump_layer_ref_cb,
                       state);
     }
@@ -264,7 +264,7 @@ _cogl_debug_dump_pipelines_dot_file (const char *filename);
 void
 _cogl_debug_dump_pipelines_dot_file (const char *filename)
 {
-  GString *graph;
+  UString *graph;
   PrintDebugState layer_state;
   PrintDebugState pipeline_state;
   int layer_id = 0;
@@ -275,8 +275,8 @@ _cogl_debug_dump_pipelines_dot_file (const char *filename)
   if (!ctx->default_pipeline)
     return;
 
-  graph = g_string_new ("");
-  g_string_append_printf (graph, "digraph {\n");
+  graph = u_string_new ("");
+  u_string_append_printf (graph, "digraph {\n");
 
   layer_state.graph = graph;
   layer_state.parent_id = -1;
@@ -290,12 +290,12 @@ _cogl_debug_dump_pipelines_dot_file (const char *filename)
   pipeline_state.indent = 0;
   dump_pipeline_cb ((CoglNode *)ctx->default_pipeline, &pipeline_state);
 
-  g_string_append_printf (graph, "}\n");
+  u_string_append_printf (graph, "}\n");
 
   if (filename)
-    g_file_set_contents (filename, graph->str, -1, NULL);
+    u_file_set_contents (filename, graph->str, -1, NULL);
   else
-    g_print ("%s", graph->str);
+    u_print ("%s", graph->str);
 
-  g_string_free (graph, TRUE);
+  u_string_free (graph, TRUE);
 }
diff --git a/cogl/cogl-pipeline-hash-table.c b/cogl/cogl-pipeline-hash-table.c
index 596c583..84435b1 100644
--- a/cogl/cogl-pipeline-hash-table.c
+++ b/cogl/cogl-pipeline-hash-table.c
@@ -47,10 +47,10 @@ typedef struct
   /* Calculating the hash is a little bit expensive for pipelines so
    * we don't want to do it repeatedly for entries that are already in
    * the hash table. Instead we cache the value here and calculate it
-   * outside of the GHashTable. */
+   * outside of the UHashTable. */
   unsigned int hash_value;
 
-  /* GHashTable annoyingly doesn't let us pass a user data pointer to
+  /* UHashTable annoyingly doesn't let us pass a user data pointer to
    * the hash and equal functions so to work around it we have to
    * store the pointer in every hash table entry. We will use this
    * entry as both the key and the value */
@@ -68,7 +68,7 @@ value_destroy_cb (void *value)
 
   cogl_object_unref (entry->parent.pipeline);
 
-  g_slice_free (CoglPipelineHashTableEntry, entry);
+  u_slice_free (CoglPipelineHashTableEntry, entry);
 }
 
 static unsigned int
@@ -106,7 +106,7 @@ _cogl_pipeline_hash_table_init (CoglPipelineHashTable *hash,
   hash->layer_state = layer_state;
   /* We'll only start pruning once we get to 16 unique pipelines */
   hash->expected_min_size = 8;
-  hash->table = g_hash_table_new_full (entry_hash,
+  hash->table = u_hash_table_new_full (entry_hash,
                                        entry_equal,
                                        NULL, /* key destroy */
                                        value_destroy_cb);
@@ -115,7 +115,7 @@ _cogl_pipeline_hash_table_init (CoglPipelineHashTable *hash,
 void
 _cogl_pipeline_hash_table_destroy (CoglPipelineHashTable *hash)
 {
-  g_hash_table_destroy (hash->table);
+  u_hash_table_destroy (hash->table);
 }
 
 static void
@@ -123,11 +123,11 @@ collect_prunable_entries_cb (void *key,
                              void *value,
                              void *user_data)
 {
-  GQueue *entries = user_data;
+  UQueue *entries = user_data;
   CoglPipelineCacheEntry *entry = value;
 
   if (entry->usage_count == 0)
-    g_queue_push_tail (entries, entry);
+    u_queue_push_tail (entries, entry);
 }
 
 static int
@@ -143,21 +143,21 @@ compare_pipeline_age_cb (const void *a,
 static void
 prune_old_pipelines (CoglPipelineHashTable *hash)
 {
-  GQueue entries;
-  GList *l;
+  UQueue entries;
+  UList *l;
   int i;
 
-  /* Collect all of the prunable entries into a GQueue */
-  g_queue_init (&entries);
-  g_hash_table_foreach (hash->table,
+  /* Collect all of the prunable entries into a UQueue */
+  u_queue_init (&entries);
+  u_hash_table_foreach (hash->table,
                         collect_prunable_entries_cb,
                         &entries);
 
   /* Sort the entries by increasing order of age */
-  entries.head = g_list_sort (entries.head, compare_pipeline_age_cb);
+  entries.head = u_list_sort (entries.head, compare_pipeline_age_cb);
 
   /* The +1 is to include the pipeline that we're about to add */
-  hash->expected_min_size = (g_hash_table_size (hash->table) -
+  hash->expected_min_size = (u_hash_table_size (hash->table) -
                              entries.length +
                              1);
 
@@ -169,10 +169,10 @@ prune_old_pipelines (CoglPipelineHashTable *hash)
     {
       CoglPipelineCacheEntry *entry = l->data;
 
-      g_hash_table_remove (hash->table, entry);
+      u_hash_table_remove (hash->table, entry);
     }
 
-  g_list_free (entries.head);
+  u_list_free (entries.head);
 }
 
 CoglPipelineCacheEntry *
@@ -189,7 +189,7 @@ _cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash,
                                                 hash->main_state,
                                                 hash->layer_state,
                                                 0);
-  entry = g_hash_table_lookup (hash->table, &dummy_entry);
+  entry = u_hash_table_lookup (hash->table, &dummy_entry);
 
   if (entry)
     {
@@ -198,17 +198,17 @@ _cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash,
     }
 
   if (hash->n_unique_pipelines == 50)
-    g_warning ("Over 50 separate %s have been generated which is very "
+    u_warning ("Over 50 separate %s have been generated which is very "
                "unusual, so something is probably wrong!\n",
                hash->debug_string);
 
   /* If we are going to have more than twice the expected minimum
    * number of pipelines in the hash then we'll try pruning and update
    * the minimum */
-  if (g_hash_table_size (hash->table) >= hash->expected_min_size * 2)
+  if (u_hash_table_size (hash->table) >= hash->expected_min_size * 2)
     prune_old_pipelines (hash);
 
-  entry = g_slice_new (CoglPipelineHashTableEntry);
+  entry = u_slice_new (CoglPipelineHashTableEntry);
   entry->parent.usage_count = 0;
   entry->hash = hash;
   entry->hash_value = dummy_entry.hash_value;
@@ -225,7 +225,7 @@ _cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash,
                                                      copy_state,
                                                      hash->layer_state);
 
-  g_hash_table_insert (hash->table, entry, entry);
+  u_hash_table_insert (hash->table, entry, entry);
 
   hash->n_unique_pipelines++;
 
diff --git a/cogl/cogl-pipeline-hash-table.h b/cogl/cogl-pipeline-hash-table.h
index a7cba2c..40ed811 100644
--- a/cogl/cogl-pipeline-hash-table.h
+++ b/cogl/cogl-pipeline-hash-table.h
@@ -54,7 +54,7 @@ typedef struct
   unsigned int main_state;
   unsigned int layer_state;
 
-  GHashTable *table;
+  UHashTable *table;
 } CoglPipelineHashTable;
 
 void
diff --git a/cogl/cogl-pipeline-layer-private.h b/cogl/cogl-pipeline-layer-private.h
index 91d76f4..5e6bd41 100644
--- a/cogl/cogl-pipeline-layer-private.h
+++ b/cogl/cogl-pipeline-layer-private.h
@@ -43,7 +43,7 @@
 #include "cogl-pipeline-snippet-private.h"
 #include "cogl-sampler-cache-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 typedef struct _CoglPipelineLayer     CoglPipelineLayer;
 #define COGL_PIPELINE_LAYER(OBJECT) ((CoglPipelineLayer *)OBJECT)
diff --git a/cogl/cogl-pipeline-layer-state.c b/cogl/cogl-pipeline-layer-state.c
index ce67bfa..40f3a0f 100644
--- a/cogl/cogl-pipeline-layer-state.c
+++ b/cogl/cogl-pipeline-layer-state.c
@@ -193,7 +193,7 @@ _cogl_pipeline_set_layer_texture_type (CoglPipeline *pipeline,
             {
               layer->differences &= ~change;
 
-              g_assert (layer->owner == pipeline);
+              u_assert (layer->owner == pipeline);
               if (layer->differences == 0)
                 _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                              layer);
@@ -267,7 +267,7 @@ _cogl_pipeline_set_layer_texture_data (CoglPipeline *pipeline,
               if (layer->texture != NULL)
                 cogl_object_unref (layer->texture);
 
-              g_assert (layer->owner == pipeline);
+              u_assert (layer->owner == pipeline);
               if (layer->differences == 0)
                 _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                              layer);
@@ -348,7 +348,7 @@ cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline,
     case COGL_TEXTURE_TYPE_3D:
       if (ctx->default_gl_texture_3d_tex == NULL)
         {
-          g_warning ("The default 3D texture was set on a pipeline but "
+          u_warning ("The default 3D texture was set on a pipeline but "
                      "3D textures are not supported");
           texture_type = COGL_TEXTURE_TYPE_2D;
           return;
@@ -358,7 +358,7 @@ cogl_pipeline_set_layer_null_texture (CoglPipeline *pipeline,
     case COGL_TEXTURE_TYPE_RECTANGLE:
       if (ctx->default_gl_texture_rect_tex == NULL)
         {
-          g_warning ("The default rectangle texture was set on a pipeline but "
+          u_warning ("The default rectangle texture was set on a pipeline but "
                      "rectangle textures are not supported");
           texture_type = COGL_TEXTURE_TYPE_2D;
         }
@@ -401,7 +401,7 @@ _cogl_pipeline_set_layer_sampler_state (CoglPipeline *pipeline,
             {
               layer->differences &= ~change;
 
-              g_assert (layer->owner == pipeline);
+              u_assert (layer->owner == pipeline);
               if (layer->differences == 0)
                 _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                              layer);
@@ -769,7 +769,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
         {
           static CoglBool warning_seen = FALSE;
           if (!warning_seen)
-            g_warning ("Point sprite texture coordinates are enabled "
+            u_warning ("Point sprite texture coordinates are enabled "
                        "for a layer but the GL driver does not support it.");
           warning_seen = TRUE;
         }
@@ -812,7 +812,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
             {
               layer->differences &= ~change;
 
-              g_assert (layer->owner == pipeline);
+              u_assert (layer->owner == pipeline);
               if (layer->differences == 0)
                 _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                              layer);
@@ -1137,7 +1137,7 @@ setup_texture_combine_state (CoglBlendStringStatement *statement,
           texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS;
           break;
         default:
-          g_warning ("Unexpected texture combine source");
+          u_warning ("Unexpected texture combine source");
           texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
         }
 
@@ -1240,7 +1240,7 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
         {
           layer->differences &= ~state;
 
-          g_assert (layer->owner == pipeline);
+          u_assert (layer->owner == pipeline);
           if (layer->differences == 0)
             _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                          layer);
@@ -1320,7 +1320,7 @@ cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline,
             {
               layer->differences &= ~state;
 
-              g_assert (layer->owner == pipeline);
+              u_assert (layer->owner == pipeline);
               if (layer->differences == 0)
                 _cogl_pipeline_prune_empty_layer_difference (pipeline,
                                                              layer);
diff --git a/cogl/cogl-pipeline-layer.c b/cogl/cogl-pipeline-layer.c
index 983c3ab..b448423 100644
--- a/cogl/cogl-pipeline-layer.c
+++ b/cogl/cogl-pipeline-layer.c
@@ -164,7 +164,7 @@ _cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
   if ((differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE) &&
       !dest->has_big_state)
     {
-      dest->big_state = g_slice_new (CoglPipelineLayerBigState);
+      dest->big_state = u_slice_new (CoglPipelineLayerBigState);
       dest->has_big_state = TRUE;
     }
 
@@ -186,7 +186,7 @@ _cogl_pipeline_layer_copy_differences (CoglPipelineLayer *dest,
         {
         case COGL_PIPELINE_LAYER_STATE_COUNT:
         case COGL_PIPELINE_LAYER_STATE_UNIT_INDEX:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
           break;
 
         case COGL_PIPELINE_LAYER_STATE_TEXTURE_TYPE_INDEX:
@@ -279,7 +279,7 @@ _cogl_pipeline_layer_init_multi_property_sparse_state (
     case COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS:
     case COGL_PIPELINE_LAYER_STATE_COMBINE_CONSTANT:
     case COGL_PIPELINE_LAYER_STATE_SAMPLER:
-      g_return_if_reached ();
+      u_return_if_reached ();
 
     /* XXX: technically we could probably even consider these as
      * single property state-groups from the pov that currently the
@@ -430,7 +430,7 @@ init_layer_state:
   if (change & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE &&
       !layer->has_big_state)
     {
-      layer->big_state = g_slice_new (CoglPipelineLayerBigState);
+      layer->big_state = u_slice_new (CoglPipelineLayerBigState);
       layer->has_big_state = TRUE;
     }
 
@@ -479,7 +479,7 @@ _cogl_pipeline_layer_set_parent (CoglPipelineLayer *layer,
 CoglPipelineLayer *
 _cogl_pipeline_layer_copy (CoglPipelineLayer *src)
 {
-  CoglPipelineLayer *layer = g_slice_new (CoglPipelineLayer);
+  CoglPipelineLayer *layer = u_slice_new (CoglPipelineLayer);
 
   _cogl_pipeline_node_init (COGL_NODE (layer));
 
@@ -521,15 +521,15 @@ unsigned long
 _cogl_pipeline_layer_compare_differences (CoglPipelineLayer *layer0,
                                           CoglPipelineLayer *layer1)
 {
-  GSList *head0 = NULL;
-  GSList *head1 = NULL;
+  USList *head0 = NULL;
+  USList *head1 = NULL;
   CoglPipelineLayer *node0;
   CoglPipelineLayer *node1;
   int len0 = 0;
   int len1 = 0;
   int count;
-  GSList *common_ancestor0;
-  GSList *common_ancestor1;
+  USList *common_ancestor0;
+  USList *common_ancestor1;
   unsigned long layers_difference = 0;
 
   /* Algorithm:
@@ -547,7 +547,7 @@ _cogl_pipeline_layer_compare_differences (CoglPipelineLayer *layer0,
 
   for (node0 = layer0; node0; node0 = _cogl_pipeline_layer_get_parent (node0))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head0;
       link->data = node0;
       head0 = link;
@@ -555,7 +555,7 @@ _cogl_pipeline_layer_compare_differences (CoglPipelineLayer *layer0,
     }
   for (node1 = layer1; node1; node1 = _cogl_pipeline_layer_get_parent (node1))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head1;
       link->data = node1;
       head1 = link;
@@ -634,7 +634,7 @@ _cogl_pipeline_layer_resolve_authorities (CoglPipelineLayer *layer,
     }
   while ((authority = _cogl_pipeline_layer_get_parent (authority)));
 
-  g_assert (remaining == 0);
+  u_assert (remaining == 0);
 }
 
 CoglBool
@@ -738,17 +738,17 @@ _cogl_pipeline_layer_free (CoglPipelineLayer *layer)
     _cogl_pipeline_snippet_list_free (&layer->big_state->fragment_snippets);
 
   if (layer->differences & COGL_PIPELINE_LAYER_STATE_NEEDS_BIG_STATE)
-    g_slice_free (CoglPipelineLayerBigState, layer->big_state);
+    u_slice_free (CoglPipelineLayerBigState, layer->big_state);
 
-  g_slice_free (CoglPipelineLayer, layer);
+  u_slice_free (CoglPipelineLayer, layer);
 }
 
 void
 _cogl_pipeline_init_default_layers (void)
 {
-  CoglPipelineLayer *layer = g_slice_new0 (CoglPipelineLayer);
+  CoglPipelineLayer *layer = u_slice_new0 (CoglPipelineLayer);
   CoglPipelineLayerBigState *big_state =
-    g_slice_new0 (CoglPipelineLayerBigState);
+    u_slice_new0 (CoglPipelineLayerBigState);
   CoglPipelineLayer *new;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@@ -817,7 +817,7 @@ _cogl_pipeline_init_default_layers (void)
    */
   ctx->default_layer_n = _cogl_pipeline_layer_copy (layer);
   new = _cogl_pipeline_set_layer_unit (NULL, ctx->default_layer_n, 1);
-  g_assert (new == ctx->default_layer_n);
+  u_assert (new == ctx->default_layer_n);
   /* Since we passed a newly allocated layer we don't expect that
    * _set_layer_unit() will have to allocate *another* layer. */
 
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index b78b67a..84e24c2 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -47,7 +47,7 @@
 #include "cogl-framebuffer.h"
 #include "cogl-bitmask.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 #ifdef HAVE_COGL_GL
 
@@ -379,7 +379,7 @@ struct _CoglPipeline
    *
    * This is sparse state, ref COGL_PIPELINE_STATE_LAYERS */
   unsigned int     n_layers;
-  GList                  *layer_differences;
+  UList                  *layer_differences;
 
   /* As a basic way to reduce memory usage we divide the pipeline
    * state into two groups; the minimal state modified in 90% of
@@ -739,7 +739,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
  * static void
  * destroy_cache_cb (CoglObject *object, void *user_data)
  * {
- *   g_slice_free (MyValidatedMaterialCache, user_data);
+ *   u_slice_free (MyValidatedMaterialCache, user_data);
  * }
  *
  * static void
@@ -756,16 +756,16 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
  *   MyValidatedMaterialCache *cache =
  *     cogl_object_get_user_data (COGL_OBJECT (source),
  *                                &_cogl_my_cache_key);
- *   if (G_UNLIKELY (cache == NULL))
+ *   if (U_UNLIKELY (cache == NULL))
  *     {
- *       cache = g_slice_new (MyValidatedMaterialCache);
+ *       cache = u_slice_new (MyValidatedMaterialCache);
  *       cogl_object_set_user_data (COGL_OBJECT (source),
  *                                  &_cogl_my_cache_key,
  *                                  cache, destroy_cache_cb);
  *       cache->validated_source = source;
  *     }
  *
- *   if (G_UNLIKELY (cache->validated_source == NULL))
+ *   if (U_UNLIKELY (cache->validated_source == NULL))
  *     {
  *       cache->validated_source = source;
  *
diff --git a/cogl/cogl-pipeline-snippet-private.h b/cogl/cogl-pipeline-snippet-private.h
index b291072..5e19f73 100644
--- a/cogl/cogl-pipeline-snippet-private.h
+++ b/cogl/cogl-pipeline-snippet-private.h
@@ -34,13 +34,13 @@
 #ifndef __COGL_PIPELINE_SNIPPET_PRIVATE_H
 #define __COGL_PIPELINE_SNIPPET_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-snippet.h"
 
 typedef struct
 {
-  GList *entries;
+  UList *entries;
 } CoglPipelineSnippetList;
 
 /* Arguments to pass to _cogl_pipeline_snippet_generate_code() */
@@ -82,14 +82,14 @@ typedef struct
   const char *argument_declarations;
 
   /* The string to generate the source into */
-  GString *source_buf;
+  UString *source_buf;
 } CoglPipelineSnippetData;
 
 void
 _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data);
 
 void
-_cogl_pipeline_snippet_generate_declarations (GString *declarations_buf,
+_cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
                                               CoglSnippetHook hook,
                                               CoglPipelineSnippetList *list);
 
diff --git a/cogl/cogl-pipeline-snippet.c b/cogl/cogl-pipeline-snippet.c
index 3d7b6b1..f09aa05 100644
--- a/cogl/cogl-pipeline-snippet.c
+++ b/cogl/cogl-pipeline-snippet.c
@@ -47,7 +47,7 @@
 void
 _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data)
 {
-  GList *first_snippet, *l;
+  UList *first_snippet, *l;
   CoglSnippet *snippet;
   int snippet_num = 0;
   int n_snippets = 0;
@@ -79,7 +79,7 @@ _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data)
   if (n_snippets == 0)
     {
       if (data->return_type)
-        g_string_append_printf (data->source_buf,
+        u_string_append_printf (data->source_buf,
                                 "\n"
                                 "%s\n"
                                 "%s (%s)\n"
@@ -93,7 +93,7 @@ _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data)
                                 data->chain_function,
                                 data->arguments ? data->arguments : "");
       else
-        g_string_append_printf (data->source_buf,
+        u_string_append_printf (data->source_buf,
                                 "\n"
                                 "void\n"
                                 "%s (%s)\n"
@@ -118,9 +118,9 @@ _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data)
           const char *source;
 
           if ((source = cogl_snippet_get_declarations (snippet)))
-            g_string_append (data->source_buf, source);
+            u_string_append (data->source_buf, source);
 
-          g_string_append_printf (data->source_buf,
+          u_string_append_printf (data->source_buf,
                                   "\n"
                                   "%s\n",
                                   data->return_type ?
@@ -128,81 +128,81 @@ _cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data)
                                   "void");
 
           if (snippet_num + 1 < n_snippets)
-            g_string_append_printf (data->source_buf,
+            u_string_append_printf (data->source_buf,
                                     "%s_%i",
                                     data->function_prefix,
                                     snippet_num);
           else
-            g_string_append (data->source_buf, data->final_name);
+            u_string_append (data->source_buf, data->final_name);
 
-          g_string_append (data->source_buf, " (");
+          u_string_append (data->source_buf, " (");
 
           if (data->argument_declarations)
-            g_string_append (data->source_buf, data->argument_declarations);
+            u_string_append (data->source_buf, data->argument_declarations);
 
-          g_string_append (data->source_buf,
+          u_string_append (data->source_buf,
                            ")\n"
                            "{\n");
 
           if (data->return_type && !data->return_variable_is_argument)
-            g_string_append_printf (data->source_buf,
+            u_string_append_printf (data->source_buf,
                                     "  %s %s;\n"
                                     "\n",
                                     data->return_type,
                                     data->return_variable);
 
           if ((source = cogl_snippet_get_pre (snippet)))
-            g_string_append (data->source_buf, source);
+            u_string_append (data->source_buf, source);
 
           /* Chain on to the next function, or bypass it if there is
              a replace string */
           if ((source = cogl_snippet_get_replace (snippet)))
-            g_string_append (data->source_buf, source);
+            u_string_append (data->source_buf, source);
           else
             {
-              g_string_append (data->source_buf, "  ");
+              u_string_append (data->source_buf, "  ");
 
               if (data->return_type)
-                g_string_append_printf (data->source_buf,
+                u_string_append_printf (data->source_buf,
                                         "%s = ",
                                         data->return_variable);
 
               if (snippet_num > 0)
-                g_string_append_printf (data->source_buf,
+                u_string_append_printf (data->source_buf,
                                         "%s_%i",
                                         data->function_prefix,
                                         snippet_num - 1);
               else
-                g_string_append (data->source_buf, data->chain_function);
+                u_string_append (data->source_buf, data->chain_function);
 
-              g_string_append (data->source_buf, " (");
+              u_string_append (data->source_buf, " (");
 
               if (data->arguments)
-                g_string_append (data->source_buf, data->arguments);
+                u_string_append (data->source_buf, data->arguments);
 
-              g_string_append (data->source_buf, ");\n");
+              u_string_append (data->source_buf, ");\n");
             }
 
           if ((source = cogl_snippet_get_post (snippet)))
-            g_string_append (data->source_buf, source);
+            u_string_append (data->source_buf, source);
 
           if (data->return_type)
-            g_string_append_printf (data->source_buf,
+            u_string_append_printf (data->source_buf,
                                     "  return %s;\n",
                                     data->return_variable);
 
-          g_string_append (data->source_buf, "}\n");
+          u_string_append (data->source_buf, "}\n");
           snippet_num++;
         }
     }
 }
 
 void
-_cogl_pipeline_snippet_generate_declarations (GString *declarations_buf,
+_cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
                                               CoglSnippetHook hook,
                                               CoglPipelineSnippetList *snippets)
 {
-  GList *l;
+  UList *l;
 
   for (l = snippets->entries; l; l = l->next)
     {
@@ -213,7 +213,7 @@ _cogl_pipeline_snippet_generate_declarations (GString *declarations_buf,
           const char *source;
 
           if ((source = cogl_snippet_get_declarations (snippet)))
-            g_string_append (declarations_buf, source);
+            u_string_append (declarations_buf, source);
         }
     }
 }
@@ -221,14 +221,14 @@ _cogl_pipeline_snippet_generate_declarations (GString *declarations_buf,
 void
 _cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list)
 {
-  GList *l, *tmp;
+  UList *l, *tmp;
 
   for (l = list->entries; l; l = tmp)
     {
       tmp = l->next;
 
       cogl_object_unref (l->data);
-      g_list_free_1 (l);
+      u_list_free_1 (l);
     }
 }
 
@@ -236,7 +236,7 @@ void
 _cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list,
                                  CoglSnippet *snippet)
 {
-  list->entries = g_list_append (list->entries, cogl_object_ref (snippet));
+  list->entries = u_list_append (list->entries, cogl_object_ref (snippet));
 
   _cogl_snippet_make_immutable (snippet);
 }
@@ -245,11 +245,11 @@ void
 _cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst,
                                   const CoglPipelineSnippetList *src)
 {
-  GQueue queue = G_QUEUE_INIT;
-  const GList *l;
+  UQueue queue = U_QUEUE_INIT;
+  const UList *l;
 
   for (l = src->entries; l; l = l->next)
-    g_queue_push_tail (&queue, cogl_object_ref (l->data));
+    u_queue_push_tail (&queue, cogl_object_ref (l->data));
 
   dst->entries = queue.head;
 }
@@ -258,7 +258,7 @@ void
 _cogl_pipeline_snippet_list_hash (CoglPipelineSnippetList *list,
                                   unsigned int *hash)
 {
-  GList *l;
+  UList *l;
 
   for (l = list->entries; l; l = l->next)
     {
@@ -274,7 +274,7 @@ CoglBool
 _cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0,
                                    CoglPipelineSnippetList *list1)
 {
-  GList *l0, *l1;
+  UList *l0, *l1;
 
   for (l0 = list0->entries, l1 = list1->entries;
        l0 && l1;
diff --git a/cogl/cogl-pipeline-state.c b/cogl/cogl-pipeline-state.c
index 710b195..15c09d1 100644
--- a/cogl/cogl-pipeline-state.c
+++ b/cogl/cogl-pipeline-state.c
@@ -265,11 +265,11 @@ _cogl_pipeline_uniforms_state_equal (CoglPipeline *authority0,
   if (authority0 == authority1)
     return TRUE;
 
-  values0 = g_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
-  values1 = g_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
+  values0 = u_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
+  values1 = u_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
 
   n_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names);
-  differences = g_alloca (n_longs * sizeof (unsigned long));
+  differences = u_alloca (n_longs * sizeof (unsigned long));
   memset (differences, 0, sizeof (unsigned long) * n_longs);
   _cogl_pipeline_compare_uniform_differences (differences,
                                               authority0,
@@ -601,7 +601,7 @@ arg_to_gl_blend_factor (CoglBlendStringArgument *arg)
     }
 #endif
 
-  g_warning ("Unable to determine valid blend factor from blend string\n");
+  u_warning ("Unable to determine valid blend factor from blend string\n");
   return GL_ONE;
 }
 
@@ -618,7 +618,7 @@ setup_blend_state (CoglBlendStringStatement *statement,
       break;
     /* TODO - add more */
     default:
-      g_warning ("Unsupported blend function given");
+      u_warning ("Unsupported blend function given");
       *blend_equation = GL_FUNC_ADD;
     }
 
@@ -1080,9 +1080,9 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
 
   _COGL_GET_CONTEXT (ctx, NULL);
 
-  g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
-  g_return_val_if_fail (location >= 0, NULL);
-  g_return_val_if_fail (location < ctx->n_uniform_names, NULL);
+  u_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
+  u_return_val_if_fail (location >= 0, NULL);
+  u_return_val_if_fail (location < ctx->n_uniform_names, NULL);
 
   /* - Flush journal primitives referencing the current state.
    * - Make sure the pipeline has no dependants so it may be modified.
@@ -1113,8 +1113,8 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
 
   if (uniforms_state->override_values == NULL)
     {
-      g_assert (override_index == 0);
-      uniforms_state->override_values = g_new (CoglBoxedValue, 1);
+      u_assert (override_index == 0);
+      uniforms_state->override_values = u_new (CoglBoxedValue, 1);
     }
   else
     {
@@ -1122,7 +1122,7 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
       CoglBoxedValue *old_values = uniforms_state->override_values;
       int old_size = _cogl_bitmask_popcount (&uniforms_state->override_mask);
 
-      uniforms_state->override_values = g_new (CoglBoxedValue, old_size + 1);
+      uniforms_state->override_values = u_new (CoglBoxedValue, old_size + 1);
 
       /* Copy in the old values leaving a gap for the new value */
       memcpy (uniforms_state->override_values,
@@ -1132,7 +1132,7 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
               old_values + override_index,
               sizeof (CoglBoxedValue) * (old_size - override_index));
 
-      g_free (old_values);
+      u_free (old_values);
     }
 
   _cogl_boxed_value_init (uniforms_state->override_values + override_index);
@@ -1251,9 +1251,9 @@ void
 cogl_pipeline_add_snippet (CoglPipeline *pipeline,
                            CoglSnippet *snippet)
 {
-  g_return_if_fail (cogl_is_pipeline (pipeline));
-  g_return_if_fail (cogl_is_snippet (snippet));
-  g_return_if_fail (snippet->hook < COGL_SNIPPET_FIRST_LAYER_HOOK);
+  u_return_if_fail (cogl_is_pipeline (pipeline));
+  u_return_if_fail (cogl_is_snippet (snippet));
+  u_return_if_fail (snippet->hook < COGL_SNIPPET_FIRST_LAYER_HOOK);
 
   if (snippet->hook < COGL_SNIPPET_FIRST_PIPELINE_FRAGMENT_HOOK)
     _cogl_pipeline_add_vertex_snippet (pipeline, snippet);
@@ -1527,7 +1527,7 @@ _cogl_pipeline_hash_uniforms_state (CoglPipeline *authority,
   /* This isn't used anywhere yet because the uniform state doesn't
      affect program generation. It's quite a hassle to implement so
      let's just leave it until something actually needs it */
-  g_warn_if_reached ();
+  u_warn_if_reached ();
 }
 
 void
@@ -1535,15 +1535,15 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
                                             CoglPipeline *pipeline0,
                                             CoglPipeline *pipeline1)
 {
-  GSList *head0 = NULL;
-  GSList *head1 = NULL;
+  USList *head0 = NULL;
+  USList *head1 = NULL;
   CoglPipeline *node0;
   CoglPipeline *node1;
   int len0 = 0;
   int len1 = 0;
   int count;
-  GSList *common_ancestor0;
-  GSList *common_ancestor1;
+  USList *common_ancestor0;
+  USList *common_ancestor1;
 
   /* This algorithm is copied from
      _cogl_pipeline_compare_differences(). It might be nice to share
@@ -1551,7 +1551,7 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
 
   for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head0;
       link->data = node0;
       head0 = link;
@@ -1559,7 +1559,7 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
     }
   for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head1;
       link->data = node1;
       head1 = link;
@@ -1652,7 +1652,7 @@ UNIT_TEST (check_blend_constant_ancestry,
   for (node = (CoglNode *) pipeline; node; node = node->parent)
     pipeline_length++;
 
-  g_assert_cmpint (pipeline_length, <=, 2);
+  u_assert_cmpint (pipeline_length, <=, 2);
 
   cogl_object_unref (pipeline);
 }
@@ -1687,7 +1687,7 @@ UNIT_TEST (check_uniform_ancestry,
   for (node = (CoglNode *) pipeline; node; node = node->parent)
     pipeline_length++;
 
-  g_assert_cmpint (pipeline_length, <=, 2);
+  u_assert_cmpint (pipeline_length, <=, 2);
 
   cogl_object_unref (pipeline);
 }
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 29c5928..b4b3f21 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -52,7 +52,7 @@
 #include "cogl-depth-state-private.h"
 #include "cogl-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 static void _cogl_pipeline_free (CoglPipeline *tex);
@@ -106,10 +106,10 @@ void
 _cogl_pipeline_init_default_pipeline (void)
 {
   /* Create new - blank - pipeline */
-  CoglPipeline *pipeline = g_slice_new0 (CoglPipeline);
+  CoglPipeline *pipeline = u_slice_new0 (CoglPipeline);
   /* XXX: NB: It's important that we zero this to avoid polluting
    * pipeline hash values with un-initialized data */
-  CoglPipelineBigState *big_state = g_slice_new0 (CoglPipelineBigState);
+  CoglPipelineBigState *big_state = u_slice_new0 (CoglPipelineBigState);
   CoglPipelineAlphaFuncState *alpha_state = &big_state->alpha_state;
   CoglPipelineBlendState *blend_state = &big_state->blend_state;
   CoglPipelineLogicOpsState *logic_ops_state = &big_state->logic_ops_state;
@@ -238,8 +238,8 @@ recursively_free_layer_caches (CoglPipeline *pipeline)
   if (pipeline->layers_cache_dirty)
     return;
 
-  if (G_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache))
-    g_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers,
+  if (U_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache))
+    u_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers,
                    pipeline->layers_cache);
   pipeline->layers_cache_dirty = TRUE;
 
@@ -330,7 +330,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
 static CoglPipeline *
 _cogl_pipeline_copy (CoglPipeline *src, CoglBool is_weak)
 {
-  CoglPipeline *pipeline = g_slice_new (CoglPipeline);
+  CoglPipeline *pipeline = u_slice_new (CoglPipeline);
 
   _cogl_pipeline_node_init (COGL_NODE (pipeline));
 
@@ -438,7 +438,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
                                      destroy_weak_children_cb,
                                      NULL);
 
-  g_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children));
+  u_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children));
 
   _cogl_pipeline_unparent (COGL_NODE (pipeline));
 
@@ -451,20 +451,20 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
 
       for (i = 0; i < n_overrides; i++)
         _cogl_boxed_value_destroy (uniforms_state->override_values + i);
-      g_free (uniforms_state->override_values);
+      u_free (uniforms_state->override_values);
 
       _cogl_bitmask_destroy (&uniforms_state->override_mask);
       _cogl_bitmask_destroy (&uniforms_state->changed_mask);
     }
 
   if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
-    g_slice_free (CoglPipelineBigState, pipeline->big_state);
+    u_slice_free (CoglPipelineBigState, pipeline->big_state);
 
   if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
     {
-      g_list_foreach (pipeline->layer_differences,
+      u_list_foreach (pipeline->layer_differences,
                       (GFunc)cogl_object_unref, NULL);
-      g_list_free (pipeline->layer_differences);
+      u_list_free (pipeline->layer_differences);
     }
 
   if (pipeline->differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
@@ -475,7 +475,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
 
   recursively_free_layer_caches (pipeline);
 
-  g_slice_free (CoglPipeline, pipeline);
+  u_slice_free (CoglPipeline, pipeline);
 }
 
 CoglBool
@@ -494,24 +494,24 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
   CoglPipeline *current;
   int layers_found;
 
-  if (G_LIKELY (!pipeline->layers_cache_dirty) ||
+  if (U_LIKELY (!pipeline->layers_cache_dirty) ||
       pipeline->n_layers == 0)
     return;
 
   pipeline->layers_cache_dirty = FALSE;
 
   n_layers = pipeline->n_layers;
-  if (G_LIKELY (n_layers < G_N_ELEMENTS (pipeline->short_layers_cache)))
+  if (U_LIKELY (n_layers < U_N_ELEMENTS (pipeline->short_layers_cache)))
     {
       pipeline->layers_cache = pipeline->short_layers_cache;
       memset (pipeline->layers_cache, 0,
               sizeof (CoglPipelineLayer *) *
-              G_N_ELEMENTS (pipeline->short_layers_cache));
+              U_N_ELEMENTS (pipeline->short_layers_cache));
     }
   else
     {
       pipeline->layers_cache =
-        g_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers);
+        u_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers);
     }
 
   /* Notes:
@@ -542,7 +542,7 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
        _cogl_pipeline_get_parent (current);
        current = _cogl_pipeline_get_parent (current))
     {
-      GList *l;
+      UList *l;
 
       if (!(current->differences & COGL_PIPELINE_STATE_LAYERS))
         continue;
@@ -562,7 +562,7 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
         }
     }
 
-  g_warn_if_reached ();
+  u_warn_if_reached ();
 }
 
 /* XXX: Be carefull when using this API that the callback given doesn't result
@@ -653,7 +653,7 @@ cogl_pipeline_foreach_layer (CoglPipeline *pipeline,
    * user doesn't remove layers. */
 
   state.i = 0;
-  state.indices = g_alloca (authority->n_layers * sizeof (int));
+  state.indices = u_alloca (authority->n_layers * sizeof (int));
 
   _cogl_pipeline_foreach_layer_internal (pipeline,
                                          append_layer_index_cb,
@@ -753,7 +753,7 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
   CoglPipelineBlendState *blend_state;
   CoglPipelineBlendEnable enabled;
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
     return FALSE;
 
   /* We unconditionally check the _BLEND_ENABLE state first because
@@ -864,15 +864,15 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
 
   if (differences & COGL_PIPELINE_STATE_LAYERS)
     {
-      GList *l;
+      UList *l;
 
       if (dest->differences & COGL_PIPELINE_STATE_LAYERS &&
           dest->layer_differences)
         {
-          g_list_foreach (dest->layer_differences,
+          u_list_foreach (dest->layer_differences,
                           (GFunc)cogl_object_unref,
                           NULL);
-          g_list_free (dest->layer_differences);
+          u_list_free (dest->layer_differences);
         }
 
       for (l = src->layer_differences; l; l = l->next)
@@ -896,7 +896,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
     {
       if (!dest->has_big_state)
         {
-          dest->big_state = g_slice_new (CoglPipelineBigState);
+          dest->big_state = u_slice_new (CoglPipelineBigState);
           dest->has_big_state = TRUE;
         }
       big_state = dest->big_state;
@@ -956,7 +956,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
       int i;
 
       big_state->uniforms_state.override_values =
-        g_malloc (n_overrides * sizeof (CoglBoxedValue));
+        u_malloc (n_overrides * sizeof (CoglBoxedValue));
 
       for (i = 0; i < n_overrides; i++)
         {
@@ -1020,7 +1020,7 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
     case COGL_PIPELINE_STATE_POINT_SIZE:
     case COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE:
     case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE:
-      g_return_if_reached ();
+      u_return_if_reached ();
 
     case COGL_PIPELINE_STATE_LAYERS:
       pipeline->n_layers = authority->n_layers;
@@ -1290,7 +1290,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline     *pipeline,
   if (change & COGL_PIPELINE_STATE_NEEDS_BIG_STATE &&
       !pipeline->has_big_state)
     {
-      pipeline->big_state = g_slice_new (CoglPipelineBigState);
+      pipeline->big_state = u_slice_new (CoglPipelineBigState);
       pipeline->has_big_state = TRUE;
     }
 
@@ -1359,7 +1359,7 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
   pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
 
   pipeline->layer_differences =
-    g_list_prepend (pipeline->layer_differences, layer);
+    u_list_prepend (pipeline->layer_differences, layer);
 
   if (inc_n_layers)
     pipeline->n_layers++;
@@ -1403,7 +1403,7 @@ _cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline,
       cogl_object_unref (layer);
 
       pipeline->layer_differences =
-        g_list_remove (pipeline->layer_differences, layer);
+        u_list_remove (pipeline->layer_differences, layer);
     }
 
   pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
@@ -1508,8 +1508,8 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
   CoglPipeline *authority =
     _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
   CoglPipelinePruneLayersInfo state;
-  GList *l;
-  GList *next;
+  UList *l;
+  UList *next;
 
   if (authority->n_layers <= n)
     return;
@@ -1674,7 +1674,7 @@ _cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
    * and bump up the texture unit for all layers with an index
    * > layer_index. */
   layer_info.layers_to_shift =
-    g_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
+    u_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
   layer_info.n_layers_to_shift = 0;
 
   /* If an exact match is found though we don't need a complete
@@ -1698,7 +1698,7 @@ _cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline,
       new = _cogl_pipeline_set_layer_unit (NULL, layer, unit_index);
       /* Since we passed a newly allocated layer we wouldn't expect
        * _set_layer_unit() to have to allocate *another* layer. */
-      g_assert (new == layer);
+      u_assert (new == layer);
     }
   layer->index = layer_index;
 
@@ -1725,8 +1725,8 @@ void
 _cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
                                              CoglPipelineLayer *layer)
 {
-  /* Find the GList link that references the empty layer */
-  GList *link = g_list_find (layers_authority->layer_differences, layer);
+  /* Find the UList link that references the empty layer */
+  UList *link = u_list_find (layers_authority->layer_differences, layer);
   /* No pipeline directly owns the root node layer so this is safe... */
   CoglPipelineLayer *layer_parent = _cogl_pipeline_layer_get_parent (layer);
   CoglPipelineLayerInfo layer_info;
@@ -1766,7 +1766,7 @@ _cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
    * and bump up the texture unit for all layers with an index
    * > layer_index. */
   layer_info.layers_to_shift =
-    g_alloca (sizeof (CoglPipelineLayer *) * layers_authority->n_layers);
+    u_alloca (sizeof (CoglPipelineLayer *) * layers_authority->n_layers);
   layer_info.n_layers_to_shift = 0;
 
   /* If an exact match is found though we don't need a complete
@@ -1843,7 +1843,7 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
 
   if (texture == NULL)
     {
-      g_warning ("We don't have a fallback texture we can use to fill "
+      u_warning ("We don't have a fallback texture we can use to fill "
                  "in for an invalid pipeline layer, since it was "
                  "using an unsupported texture target ");
       /* might get away with this... */
@@ -1960,15 +1960,15 @@ unsigned long
 _cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
                                     CoglPipeline *pipeline1)
 {
-  GSList *head0 = NULL;
-  GSList *head1 = NULL;
+  USList *head0 = NULL;
+  USList *head1 = NULL;
   CoglPipeline *node0;
   CoglPipeline *node1;
   int len0 = 0;
   int len1 = 0;
   int count;
-  GSList *common_ancestor0;
-  GSList *common_ancestor1;
+  USList *common_ancestor0;
+  USList *common_ancestor1;
   unsigned long pipelines_difference = 0;
 
   /* Algorithm:
@@ -1986,7 +1986,7 @@ _cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
 
   for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head0;
       link->data = node0;
       head0 = link;
@@ -1994,7 +1994,7 @@ _cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
     }
   for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1))
     {
-      GSList *link = alloca (sizeof (GSList));
+      USList *link = alloca (sizeof (USList));
       link->next = head1;
       link->data = node1;
       head1 = link;
@@ -2064,7 +2064,7 @@ _cogl_pipeline_resolve_authorities (CoglPipeline *pipeline,
     }
   while ((authority = _cogl_pipeline_get_parent (authority)));
 
-  g_assert (remaining == 0);
+  u_assert (remaining == 0);
 }
 
 /* Comparison of two arbitrary pipelines is done by:
@@ -2236,7 +2236,7 @@ _cogl_pipeline_equal (CoglPipeline *pipeline0,
         case COGL_PIPELINE_STATE_BLEND_ENABLE_INDEX:
         case COGL_PIPELINE_STATE_REAL_BLEND_ENABLE_INDEX:
         case COGL_PIPELINE_STATE_COUNT:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
         }
     }
   COGL_FLAGS_FOREACH_END;
@@ -2269,7 +2269,7 @@ _cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline)
    */
   if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
     {
-      if (pipeline->n_layers != g_list_length (pipeline->layer_differences))
+      if (pipeline->n_layers != u_list_length (pipeline->layer_differences))
         return;
     }
 
@@ -2347,7 +2347,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index)
    * dropped down to a lower texture unit to fill the gap of the
    * removed layer. */
   layer_info.layers_to_shift =
-    g_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
+    u_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
   layer_info.n_layers_to_shift = 0;
 
   /* Unlike when we query layer info when adding a layer we must
@@ -2791,7 +2791,7 @@ _cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline,
         return authority0;
 
       authority0_layers =
-        g_alloca (sizeof (CoglPipelineLayer *) * n_layers);
+        u_alloca (sizeof (CoglPipelineLayer *) * n_layers);
       state.i = 0;
       state.layers = authority0_layers;
       _cogl_pipeline_foreach_layer_internal (authority0,
@@ -2799,7 +2799,7 @@ _cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline,
                                              &state);
 
       authority1_layers =
-        g_alloca (sizeof (CoglPipelineLayer *) * n_layers);
+        u_alloca (sizeof (CoglPipelineLayer *) * n_layers);
       state.i = 0;
       state.layers = authority1_layers;
       _cogl_pipeline_foreach_layer_internal (authority1,
@@ -2904,15 +2904,15 @@ cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
      be. */
 
   /* Look for an existing uniform with this name */
-  if (g_hash_table_lookup_extended (ctx->uniform_name_hash,
+  if (u_hash_table_lookup_extended (ctx->uniform_name_hash,
                                     uniform_name,
                                     NULL,
                                     &location_ptr))
     return GPOINTER_TO_INT (location_ptr);
 
-  uniform_name_copy = g_strdup (uniform_name);
-  g_ptr_array_add (ctx->uniform_names, uniform_name_copy);
-  g_hash_table_insert (ctx->uniform_name_hash,
+  uniform_name_copy = u_strdup (uniform_name);
+  u_ptr_array_add (ctx->uniform_names, uniform_name_copy);
+  u_hash_table_insert (ctx->uniform_name_hash,
                        uniform_name_copy,
                        GINT_TO_POINTER (ctx->n_uniform_names));
 
diff --git a/cogl/cogl-pixel-buffer-private.h b/cogl/cogl-pixel-buffer-private.h
index a8c9aee..1d4a58c 100644
--- a/cogl/cogl-pixel-buffer-private.h
+++ b/cogl/cogl-pixel-buffer-private.h
@@ -38,7 +38,7 @@
 #include "cogl-object-private.h"
 #include "cogl-buffer-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl/cogl-pixel-buffer.c b/cogl/cogl-pixel-buffer.c
index 74e1c06..20cb670 100644
--- a/cogl/cogl-pixel-buffer.c
+++ b/cogl/cogl-pixel-buffer.c
@@ -43,7 +43,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-private.h"
 #include "cogl-util.h"
@@ -79,7 +79,7 @@ cogl_pixel_buffer_new (CoglContext *context,
                        const void *data,
                        CoglError **error)
 {
-  CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
+  CoglPixelBuffer *pixel_buffer = u_slice_new0 (CoglPixelBuffer);
   CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
 
   /* parent's constructor */
@@ -114,6 +114,6 @@ _cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
   /* parent's destructor */
   _cogl_buffer_fini (COGL_BUFFER (buffer));
 
-  g_slice_free (CoglPixelBuffer, buffer);
+  u_slice_free (CoglPixelBuffer, buffer);
 }
 
diff --git a/cogl/cogl-point-in-poly-private.h b/cogl/cogl-point-in-poly-private.h
index 1973147..df5cb6a 100644
--- a/cogl/cogl-point-in-poly-private.h
+++ b/cogl/cogl-point-in-poly-private.h
@@ -29,7 +29,7 @@
 #ifndef __COGL_POINT_INT_POLYGON_PRIVATE_H
 #define __COGL_POINT_INT_POLYGON_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl/cogl-point-in-poly.c b/cogl/cogl-point-in-poly.c
index cf87b93..dea60ba 100644
--- a/cogl/cogl-point-in-poly.c
+++ b/cogl/cogl-point-in-poly.c
@@ -41,7 +41,7 @@
 #include "cogl-util.h"
 #include "cogl-point-in-poly-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 /* We've made a notable change to the original algorithm referenced
  * above to make sure we have reliable results for screen aligned
diff --git a/cogl/cogl-poll.c b/cogl/cogl-poll.c
index 6f7697a..deaec21 100644
--- a/cogl/cogl-poll.c
+++ b/cogl/cogl-poll.c
@@ -53,7 +53,7 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer,
                              int *n_poll_fds,
                              int64_t *timeout)
 {
-  GList *l, *next;
+  UList *l, *next;
 
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), 0);
   _COGL_RETURN_VAL_IF_FAIL (poll_fds != NULL, 0);
@@ -95,7 +95,7 @@ cogl_poll_renderer_dispatch (CoglRenderer *renderer,
                              const CoglPollFD *poll_fds,
                              int n_poll_fds)
 {
-  GList *l, *next;
+  UList *l, *next;
 
   _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
 
@@ -136,7 +136,7 @@ find_pollfd (CoglRenderer *renderer, int fd)
 
   for (i = 0; i < renderer->poll_fds->len; i++)
     {
-      CoglPollFD *pollfd = &g_array_index (renderer->poll_fds, CoglPollFD, i);
+      CoglPollFD *pollfd = &u_array_index (renderer->poll_fds, CoglPollFD, i);
 
       if (pollfd->fd == fd)
         return i;
@@ -149,12 +149,12 @@ void
 _cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd)
 {
   int i = find_pollfd (renderer, fd);
-  GList *l;
+  UList *l;
 
   if (i < 0)
     return;
 
-  g_array_remove_index_fast (renderer->poll_fds, i);
+  u_array_remove_index_fast (renderer->poll_fds, i);
   renderer->poll_fds_age++;
 
   for (l = renderer->poll_sources; l; l = l->next)
@@ -163,8 +163,8 @@ _cogl_poll_renderer_remove_fd (CoglRenderer *renderer, int fd)
       if (source->fd == fd)
         {
           renderer->poll_sources =
-            g_list_delete_link (renderer->poll_sources, l);
-          g_slice_free (CoglPollSource, source);
+            u_list_delete_link (renderer->poll_sources, l);
+          u_slice_free (CoglPollSource, source);
           break;
         }
     }
@@ -178,11 +178,11 @@ _cogl_poll_renderer_modify_fd (CoglRenderer *renderer,
   int fd_index = find_pollfd (renderer, fd);
 
   if (fd_index == -1)
-    g_warn_if_reached ();
+    u_warn_if_reached ();
   else
     {
       CoglPollFD *pollfd =
-        &g_array_index (renderer->poll_sources, CoglPollFD, fd_index);
+        &u_array_index (renderer->poll_sources, CoglPollFD, fd_index);
 
       pollfd->events = events;
       renderer->poll_fds_age++;
@@ -205,15 +205,15 @@ _cogl_poll_renderer_add_fd (CoglRenderer *renderer,
 
   _cogl_poll_renderer_remove_fd (renderer, fd);
 
-  source = g_slice_new0 (CoglPollSource);
+  source = u_slice_new0 (CoglPollSource);
   source->fd = fd;
   source->prepare = prepare;
   source->dispatch = dispatch;
   source->user_data = user_data;
 
-  renderer->poll_sources = g_list_prepend (renderer->poll_sources, source);
+  renderer->poll_sources = u_list_prepend (renderer->poll_sources, source);
 
-  g_array_append_val (renderer->poll_fds, pollfd);
+  u_array_append_val (renderer->poll_fds, pollfd);
   renderer->poll_fds_age++;
 }
 
@@ -225,13 +225,13 @@ _cogl_poll_renderer_add_source (CoglRenderer *renderer,
 {
   CoglPollSource *source;
 
-  source = g_slice_new0 (CoglPollSource);
+  source = u_slice_new0 (CoglPollSource);
   source->fd = -1;
   source->prepare = prepare;
   source->dispatch = dispatch;
   source->user_data = user_data;
 
-  renderer->poll_sources = g_list_prepend (renderer->poll_sources, source);
+  renderer->poll_sources = u_list_prepend (renderer->poll_sources, source);
 
   return source;
 }
@@ -240,15 +240,15 @@ void
 _cogl_poll_renderer_remove_source (CoglRenderer *renderer,
                                    CoglPollSource *source)
 {
-  GList *l;
+  UList *l;
 
   for (l = renderer->poll_sources; l; l = l->next)
     {
       if (l->data == source)
         {
           renderer->poll_sources =
-            g_list_delete_link (renderer->poll_sources, l);
-          g_slice_free (CoglPollSource, source);
+            u_list_delete_link (renderer->poll_sources, l);
+          u_slice_free (CoglPollSource, source);
           break;
         }
     }
diff --git a/cogl/cogl-primitive-texture.c b/cogl/cogl-primitive-texture.c
index 17fba3e..3a4d43b 100644
--- a/cogl/cogl-primitive-texture.c
+++ b/cogl/cogl-primitive-texture.c
@@ -54,7 +54,7 @@ cogl_primitive_texture_set_auto_mipmap (CoglPrimitiveTexture *primitive_texture,
 
   texture = COGL_TEXTURE (primitive_texture);
 
-  g_assert (texture->vtable->set_auto_mipmap != NULL);
+  u_assert (texture->vtable->set_auto_mipmap != NULL);
 
   texture->vtable->set_auto_mipmap (texture, value);
 }
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index b899799..cff9efd 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -58,7 +58,7 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
   CoglPrimitive *primitive;
   int i;
 
-  primitive = g_slice_alloc (sizeof (CoglPrimitive) +
+  primitive = u_slice_alloc (sizeof (CoglPrimitive) +
                              sizeof (CoglAttribute *) * (n_attributes - 1));
   primitive->mode = mode;
   primitive->first_vertex = 0;
@@ -121,7 +121,7 @@ cogl_primitive_new (CoglVerticesMode mode,
     ;
   va_end (ap);
 
-  attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
+  attributes = u_alloca (sizeof (CoglAttribute *) * n_attributes);
 
   va_start (ap, n_vertices);
   for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
@@ -384,13 +384,13 @@ _cogl_primitive_free (CoglPrimitive *primitive)
     cogl_object_unref (primitive->attributes[i]);
 
   if (primitive->attributes != &primitive->embedded_attribute)
-    g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+    u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                    primitive->attributes);
 
   if (primitive->indices)
     cogl_object_unref (primitive->indices);
 
-  g_slice_free1 (sizeof (CoglPrimitive) +
+  u_slice_free1 (sizeof (CoglPrimitive) +
                  sizeof (CoglAttribute *) *
                  (primitive->n_embedded_attributes - 1), primitive);
 }
@@ -401,7 +401,7 @@ warn_about_midscene_changes (void)
   static CoglBool seen = FALSE;
   if (!seen)
     {
-      g_warning ("Mid-scene modification of primitives has "
+      u_warning ("Mid-scene modification of primitives has "
                  "undefined results\n");
       seen = TRUE;
     }
@@ -416,7 +416,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
 
   _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
 
-  if (G_UNLIKELY (primitive->immutable_ref))
+  if (U_UNLIKELY (primitive->immutable_ref))
     {
       warn_about_midscene_changes ();
       return;
@@ -441,17 +441,17 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
   if (n_attributes <= primitive->n_embedded_attributes)
     {
       if (primitive->attributes != &primitive->embedded_attribute)
-        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+        u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                        primitive->attributes);
       primitive->attributes = &primitive->embedded_attribute;
     }
   else
     {
       if (primitive->attributes != &primitive->embedded_attribute)
-        g_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+        u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
                        primitive->attributes);
       primitive->attributes =
-        g_slice_alloc (sizeof (CoglAttribute *) * n_attributes);
+        u_slice_alloc (sizeof (CoglAttribute *) * n_attributes);
     }
 
   memcpy (primitive->attributes, attributes,
@@ -474,7 +474,7 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
 {
   _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
 
-  if (G_UNLIKELY (primitive->immutable_ref))
+  if (U_UNLIKELY (primitive->immutable_ref))
     {
       warn_about_midscene_changes ();
       return;
@@ -514,7 +514,7 @@ cogl_primitive_set_mode (CoglPrimitive *primitive,
 {
   _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
 
-  if (G_UNLIKELY (primitive->immutable_ref))
+  if (U_UNLIKELY (primitive->immutable_ref))
     {
       warn_about_midscene_changes ();
       return;
@@ -530,7 +530,7 @@ cogl_primitive_set_indices (CoglPrimitive *primitive,
 {
   _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
 
-  if (G_UNLIKELY (primitive->immutable_ref))
+  if (U_UNLIKELY (primitive->immutable_ref))
     {
       warn_about_midscene_changes ();
       return;
diff --git a/cogl/cogl-primitives-private.h b/cogl/cogl-primitives-private.h
index 1edb9b1..4103874 100644
--- a/cogl/cogl-primitives-private.h
+++ b/cogl/cogl-primitives-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_PRIMITIVES_PRIVATE_H
 #define __COGL_PRIMITIVES_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 COGL_BEGIN_DECLS
 
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
index 76b46b4..bf87808 100644
--- a/cogl/cogl-primitives.c
+++ b/cogl/cogl-primitives.c
@@ -349,7 +349,7 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
             {
               static CoglBool warning_seen = FALSE;
               if (!warning_seen)
-                g_warning ("Skipping layers 1..n of your material since "
+                u_warning ("Skipping layers 1..n of your material since "
                            "the first layer doesn't support hardware "
                            "repeat (e.g. because of waste or use of "
                            "GL_TEXTURE_RECTANGLE_ARB) and you supplied "
@@ -368,7 +368,7 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
         {
           static CoglBool warning_seen = FALSE;
           if (!warning_seen)
-            g_warning ("Skipping layer %d of your material "
+            u_warning ("Skipping layer %d of your material "
                        "since you have supplied texture coords "
                        "outside the range [0,1] but the texture "
                        "doesn't support hardware repeat (e.g. "
@@ -563,7 +563,7 @@ _cogl_rectangles_validate_layer_cb (CoglPipeline *pipeline,
               _cogl_pipeline_prune_to_n_layers (state->override_source, 1);
 
               if (!warning_seen)
-                g_warning ("Skipping layers 1..n of your pipeline since "
+                u_warning ("Skipping layers 1..n of your pipeline since "
                            "the first layer is sliced. We don't currently "
                            "support any multi-texturing with sliced "
                            "textures but assume layer 0 is the most "
@@ -581,7 +581,7 @@ _cogl_rectangles_validate_layer_cb (CoglPipeline *pipeline,
           CoglTexture2D *tex_2d;
 
           if (!warning_seen)
-            g_warning ("Skipping layer %d of your pipeline consisting of "
+            u_warning ("Skipping layer %d of your pipeline consisting of "
                        "a sliced texture (unsuported for multi texturing)",
                        state->i);
           warning_seen = TRUE;
diff --git a/cogl/cogl-profile.c b/cogl/cogl-profile.c
index 3cab783..5e2bbc3 100644
--- a/cogl/cogl-profile.c
+++ b/cogl/cogl-profile.c
@@ -52,7 +52,7 @@ print_exit_report (void)
       /* just bail out if the mainloop timer wasn't hit */
       if (!mainloop_timer)
         {
-          g_warning ("\n\n"
+          u_warning ("\n\n"
                      "No UProf \"Mainloop\" timer was setup by the "
                      "application therefore we\ncan't provide a meaningful "
                      "profile report.\n"
@@ -71,7 +71,7 @@ print_exit_report (void)
                      "And start/stop it around your mainloop like this:\n"
                      "\n"
                      "  UPROF_TIMER_START (uprof_get_mainloop_context (), mainloop_timer);\n"
-                     "  g_main_loop_run (loop);\n"
+                     "  u_main_loop_run (loop);\n"
                      "  UPROF_TIMER_STOP (uprof_get_mainloop_context (), mainloop_timer);\n");
           return;
         }
@@ -90,7 +90,7 @@ _cogl_uprof_init (void)
   _cogl_uprof_context = uprof_context_new ("Cogl");
   uprof_context_link (_cogl_uprof_context, uprof_get_mainloop_context ());
 #define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \
-  G_STMT_START { \
+  U_STMT_START { \
     int shift = COGL_DEBUG_ ## MASK_NAME; \
     uprof_context_add_boolean_option (_cogl_uprof_context, \
                                       _(GROUP), \
@@ -100,7 +100,7 @@ _cogl_uprof_init (void)
                                       debug_option_getter, \
                                       debug_option_setter, \
                                       GUINT_TO_POINTER (shift)); \
-  } G_STMT_END;
+  } U_STMT_END;
 
 #include "cogl-debug-options.h"
 #undef OPT
@@ -114,7 +114,7 @@ _cogl_profile_trace_message (const char *format, ...)
   va_list ap;
 
   va_start (ap, format);
-  g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, ap);
+  u_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, ap);
   va_end (ap);
 
   if (_cogl_uprof_context)
diff --git a/cogl/cogl-profile.h b/cogl/cogl-profile.h
index 401f275..2d94469 100644
--- a/cogl/cogl-profile.h
+++ b/cogl/cogl-profile.h
@@ -55,12 +55,12 @@ _cogl_profile_trace_message (const char *format, ...);
 
 #define COGL_STATIC_TIMER(A,B,C,D,E) extern void _cogl_dummy_decl (void)
 #define COGL_STATIC_COUNTER(A,B,C,D) extern void _cogl_dummy_decl (void)
-#define COGL_COUNTER_INC(A,B) G_STMT_START{ (void)0; }G_STMT_END
-#define COGL_COUNTER_DEC(A,B) G_STMT_START{ (void)0; }G_STMT_END
-#define COGL_TIMER_START(A,B) G_STMT_START{ (void)0; }G_STMT_END
-#define COGL_TIMER_STOP(A,B) G_STMT_START{ (void)0; }G_STMT_END
+#define COGL_COUNTER_INC(A,B) U_STMT_START{ (void)0; }U_STMT_END
+#define COGL_COUNTER_DEC(A,B) U_STMT_START{ (void)0; }U_STMT_END
+#define COGL_TIMER_START(A,B) U_STMT_START{ (void)0; }U_STMT_END
+#define COGL_TIMER_STOP(A,B) U_STMT_START{ (void)0; }U_STMT_END
 
-#define _cogl_profile_trace_message g_message
+#define _cogl_profile_trace_message u_message
 
 #endif
 
diff --git a/cogl/cogl-quaternion-private.h b/cogl/cogl-quaternion-private.h
index 09403ff..f079ca8 100644
--- a/cogl/cogl-quaternion-private.h
+++ b/cogl/cogl-quaternion-private.h
@@ -32,7 +32,7 @@
 #ifndef __COGL_QUATERNION_PRIVATE_H__
 #define __COGL_QUATERNION_PRIVATE_H__
 
-#include <glib.h>
+#include <ulib.h>
 
 /* squared length */
 #define _COGL_QUATERNION_NORM(Q) \
diff --git a/cogl/cogl-quaternion.c b/cogl/cogl-quaternion.c
index 6e63211..73eadd8 100644
--- a/cogl/cogl-quaternion.c
+++ b/cogl/cogl-quaternion.c
@@ -74,7 +74,7 @@ _cogl_quaternion_print (CoglQuaternion *quarternion);
 void
 _cogl_quaternion_print (CoglQuaternion *quaternion)
 {
-  g_print ("[ %6.4f (%6.4f, %6.4f, %6.4f)]\n",
+  u_print ("[ %6.4f (%6.4f, %6.4f, %6.4f)]\n",
            quaternion->w,
            quaternion->x,
            quaternion->y,
@@ -335,9 +335,9 @@ cogl_quaternion_equal (const void *v1, const void *v2)
 CoglQuaternion *
 cogl_quaternion_copy (const CoglQuaternion *src)
 {
-  if (G_LIKELY (src))
+  if (U_LIKELY (src))
     {
-      CoglQuaternion *new = g_slice_new (CoglQuaternion);
+      CoglQuaternion *new = u_slice_new (CoglQuaternion);
       memcpy (new, src, sizeof (float) * 4);
       return new;
     }
@@ -348,7 +348,7 @@ cogl_quaternion_copy (const CoglQuaternion *src)
 void
 cogl_quaternion_free (CoglQuaternion *quaternion)
 {
-  g_slice_free (CoglQuaternion, quaternion);
+  u_slice_free (CoglQuaternion, quaternion);
 }
 
 float
@@ -531,7 +531,7 @@ cogl_quaternion_slerp (CoglQuaternion *result,
     }
 
   /* If we have two unit quaternions the dot should be <= 1.0 */
-  g_assert (cos_difference < 1.1f);
+  u_assert (cos_difference < 1.1f);
 
 
   /* Determine the interpolation factors for each quaternion, simply using
@@ -618,7 +618,7 @@ cogl_quaternion_nlerp (CoglQuaternion *result,
     }
 
   /* If we have two unit quaternions the dot should be <= 1.0 */
-  g_assert (cos_difference < 1.1f);
+  u_assert (cos_difference < 1.1f);
 
   fa = 1.0f - t;
   fb = t;
diff --git a/cogl/cogl-rectangle-map.c b/cogl/cogl-rectangle-map.c
index 354a4ec..118ba6a 100644
--- a/cogl/cogl-rectangle-map.c
+++ b/cogl/cogl-rectangle-map.c
@@ -35,7 +35,7 @@
 #include "config.h"
 #endif
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-util.h"
 #include "cogl-rectangle-map.h"
@@ -79,12 +79,12 @@ struct _CoglRectangleMap
 
   unsigned int space_remaining;
 
-  GDestroyNotify value_destroy_func;
+  UDestroyNotify value_destroy_func;
 
   /* Stack used for walking the structure. This is only used during
      the lifetime of a single function call but it is kept here as an
      optimisation to avoid reallocating it every time it is needed */
-  GArray *stack;
+  UArray *stack;
 };
 
 struct _CoglRectangleMapNode
@@ -123,21 +123,21 @@ struct _CoglRectangleMapStackEntry
 static CoglRectangleMapNode *
 _cogl_rectangle_map_node_new (void)
 {
-  return g_slice_new (CoglRectangleMapNode);
+  return u_slice_new (CoglRectangleMapNode);
 }
 
 static void
 _cogl_rectangle_map_node_free (CoglRectangleMapNode *node)
 {
-  g_slice_free (CoglRectangleMapNode, node);
+  u_slice_free (CoglRectangleMapNode, node);
 }
 
 CoglRectangleMap *
 _cogl_rectangle_map_new (unsigned int width,
                          unsigned int height,
-                         GDestroyNotify value_destroy_func)
+                         UDestroyNotify value_destroy_func)
 {
-  CoglRectangleMap *map = g_new (CoglRectangleMap, 1);
+  CoglRectangleMap *map = u_new (CoglRectangleMap, 1);
   CoglRectangleMapNode *root = _cogl_rectangle_map_node_new ();
 
   root->type = COGL_RECTANGLE_MAP_EMPTY_LEAF;
@@ -153,21 +153,21 @@ _cogl_rectangle_map_new (unsigned int width,
   map->value_destroy_func = value_destroy_func;
   map->space_remaining = width * height;
 
-  map->stack = g_array_new (FALSE, FALSE, sizeof (CoglRectangleMapStackEntry));
+  map->stack = u_array_new (FALSE, FALSE, sizeof (CoglRectangleMapStackEntry));
 
   return map;
 }
 
 static void
-_cogl_rectangle_map_stack_push (GArray *stack,
+_cogl_rectangle_map_stack_push (UArray *stack,
                                 CoglRectangleMapNode *node,
                                 CoglBool next_index)
 {
   CoglRectangleMapStackEntry *new_entry;
 
-  g_array_set_size (stack, stack->len + 1);
+  u_array_set_size (stack, stack->len + 1);
 
-  new_entry = &g_array_index (stack, CoglRectangleMapStackEntry,
+  new_entry = &u_array_index (stack, CoglRectangleMapStackEntry,
                               stack->len - 1);
 
   new_entry->node = node;
@@ -175,15 +175,15 @@ _cogl_rectangle_map_stack_push (GArray *stack,
 }
 
 static void
-_cogl_rectangle_map_stack_pop (GArray *stack)
+_cogl_rectangle_map_stack_pop (UArray *stack)
 {
-  g_array_set_size (stack, stack->len - 1);
+  u_array_set_size (stack, stack->len - 1);
 }
 
 static CoglRectangleMapStackEntry *
-_cogl_rectangle_map_stack_get_top (GArray *stack)
+_cogl_rectangle_map_stack_get_top (UArray *stack)
 {
-  return &g_array_index (stack, CoglRectangleMapStackEntry,
+  return &u_array_index (stack, CoglRectangleMapStackEntry,
                          stack->len - 1);
 }
 
@@ -287,19 +287,19 @@ _cogl_rectangle_map_verify_recursive (CoglRectangleMapNode *node)
         int sum =
           _cogl_rectangle_map_verify_recursive (node->d.branch.left) +
           _cogl_rectangle_map_verify_recursive (node->d.branch.right);
-        g_assert (node->largest_gap ==
+        u_assert (node->largest_gap ==
                   MAX (node->d.branch.left->largest_gap,
                        node->d.branch.right->largest_gap));
         return sum;
       }
 
     case COGL_RECTANGLE_MAP_EMPTY_LEAF:
-      g_assert (node->largest_gap ==
+      u_assert (node->largest_gap ==
                 node->rectangle.width * node->rectangle.height);
       return 0;
 
     case COGL_RECTANGLE_MAP_FILLED_LEAF:
-      g_assert (node->largest_gap == 0);
+      u_assert (node->largest_gap == 0);
       return 1;
     }
 
@@ -342,8 +342,8 @@ _cogl_rectangle_map_verify (CoglRectangleMap *map)
   unsigned int actual_space_remaining =
     _cogl_rectangle_map_get_space_remaining_recursive (map->root);
 
-  g_assert_cmpuint (actual_n_rectangles, ==, map->n_rectangles);
-  g_assert_cmpuint (actual_space_remaining, ==, map->space_remaining);
+  u_assert_cmpuint (actual_n_rectangles, ==, map->n_rectangles);
+  u_assert_cmpuint (actual_space_remaining, ==, map->space_remaining);
 }
 
 #endif /* COGL_ENABLE_DEBUG */
@@ -357,7 +357,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
 {
   unsigned int rectangle_size = width * height;
   /* Stack of nodes to search in */
-  GArray *stack = map->stack;
+  UArray *stack = map->stack;
   CoglRectangleMapNode *found_node = NULL;
 
   /* Zero-sized rectangles break the algorithm for removing rectangles
@@ -365,7 +365,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
   _COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, FALSE);
 
   /* Start with the root node */
-  g_array_set_size (stack, 0);
+  u_array_set_size (stack, 0);
   _cogl_rectangle_map_stack_push (stack, map->root, FALSE);
 
   /* Depth-first search for an empty node that is big enough */
@@ -450,7 +450,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
       for (node = found_node->parent; node; node = node->parent)
         {
           /* This node is a parent so it should always be a branch */
-          g_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
+          u_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
 
           node->largest_gap = MAX (node->d.branch.left->largest_gap,
                                    node->d.branch.right->largest_gap);
@@ -462,7 +462,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
       map->space_remaining -= rectangle_size;
 
 #ifdef COGL_ENABLE_DEBUG
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
         {
 #ifdef HAVE_CAIRO
           _cogl_rectangle_map_dump_image (map);
@@ -511,7 +511,7 @@ _cogl_rectangle_map_remove (CoglRectangleMap *map,
       node->rectangle.height != rectangle->height)
     /* This should only happen if someone tried to remove a rectangle
        that was not in the map so something has gone wrong */
-    g_return_if_reached ();
+    u_return_if_reached ();
   else
     {
       /* Convert the node back to an empty node */
@@ -525,7 +525,7 @@ _cogl_rectangle_map_remove (CoglRectangleMap *map,
       for (node = node->parent; node; node = node->parent)
         {
           /* This node is a parent so it should always be a branch */
-          g_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
+          u_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
 
           if (node->d.branch.left->type == COGL_RECTANGLE_MAP_EMPTY_LEAF &&
               node->d.branch.right->type == COGL_RECTANGLE_MAP_EMPTY_LEAF)
@@ -548,14 +548,14 @@ _cogl_rectangle_map_remove (CoglRectangleMap *map,
                                  node->d.branch.right->largest_gap);
 
       /* There is now one less rectangle */
-      g_assert (map->n_rectangles > 0);
+      u_assert (map->n_rectangles > 0);
       map->n_rectangles--;
       /* and more space */
       map->space_remaining += rectangle_size;
     }
 
 #ifdef COGL_ENABLE_DEBUG
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
     {
 #ifdef HAVE_CAIRO
       _cogl_rectangle_map_dump_image (map);
@@ -597,10 +597,10 @@ _cogl_rectangle_map_internal_foreach (CoglRectangleMap *map,
                                       void *data)
 {
   /* Stack of nodes to search in */
-  GArray *stack = map->stack;
+  UArray *stack = map->stack;
 
   /* Start with the root node */
-  g_array_set_size (stack, 0);
+  u_array_set_size (stack, 0);
   _cogl_rectangle_map_stack_push (stack, map->root, 0);
 
   /* Iterate all nodes depth-first */
@@ -650,7 +650,7 @@ _cogl_rectangle_map_internal_foreach (CoglRectangleMap *map,
     }
 
   /* The stack should now be empty */
-  g_assert (stack->len == 0);
+  u_assert (stack->len == 0);
 }
 
 typedef struct _CoglRectangleMapForeachClosure
@@ -701,9 +701,9 @@ _cogl_rectangle_map_free (CoglRectangleMap *map)
                                         _cogl_rectangle_map_free_cb,
                                         map);
 
-  g_array_free (map->stack, TRUE);
+  u_array_free (map->stack, TRUE);
 
-  g_free (map);
+  u_free (map);
 }
 
 #if defined (COGL_ENABLE_DEBUG) && defined (HAVE_CAIRO)
diff --git a/cogl/cogl-rectangle-map.h b/cogl/cogl-rectangle-map.h
index bb89562..c2f11ce 100644
--- a/cogl/cogl-rectangle-map.h
+++ b/cogl/cogl-rectangle-map.h
@@ -29,7 +29,7 @@
 #ifndef __COGL_RECTANGLE_MAP_H
 #define __COGL_RECTANGLE_MAP_H
 
-#include <glib.h>
+#include <ulib.h>
 #include "cogl-types.h"
 
 typedef struct _CoglRectangleMap      CoglRectangleMap;
@@ -48,7 +48,7 @@ struct _CoglRectangleMapEntry
 CoglRectangleMap *
 _cogl_rectangle_map_new (unsigned int width,
                          unsigned int height,
-                         GDestroyNotify value_destroy_func);
+                         UDestroyNotify value_destroy_func);
 
 CoglBool
 _cogl_rectangle_map_add (CoglRectangleMap *map,
diff --git a/cogl/cogl-renderer-private.h b/cogl/cogl-renderer-private.h
index fe61d1b..3cee158 100644
--- a/cogl/cogl-renderer-private.h
+++ b/cogl/cogl-renderer-private.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_RENDERER_PRIVATE_H
 #define __COGL_RENDERER_PRIVATE_H
 
-#include <gmodule.h>
+#include <umodule.h>
 
 #include "cogl-object-private.h"
 #include "cogl-winsys-private.h"
@@ -57,15 +57,15 @@ struct _CoglRenderer
   const CoglTextureDriver *texture_driver;
   const CoglWinsysVtable *winsys_vtable;
   CoglWinsysID winsys_id_override;
-  GList *constraints;
+  UList *constraints;
 
-  GArray *poll_fds;
+  UArray *poll_fds;
   int poll_fds_age;
-  GList *poll_sources;
+  UList *poll_sources;
 
   CoglList idle_closures;
 
-  GList *outputs;
+  UList *outputs;
 
 #ifdef COGL_HAS_XLIB_SUPPORT
   Display *foreign_xdpy;
@@ -80,7 +80,7 @@ struct _CoglRenderer
   unsigned long private_features
     [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)];
 #ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
-  GModule *libgl_module;
+  UModule *libgl_module;
 #endif
 
 #if defined (COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT)
@@ -94,7 +94,7 @@ struct _CoglRenderer
 #endif
 
   /* List of callback functions that will be given every native event */
-  GSList *event_filters;
+  USList *event_filters;
   void *winsys;
 };
 
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 041b19b..310396b 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -237,7 +237,7 @@ typedef struct _CoglNativeFilterClosure
 uint32_t
 cogl_renderer_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-renderer-error-quark");
+  return u_quark_from_static_string ("cogl-renderer-error-quark");
 }
 
 static const CoglWinsysVtable *
@@ -249,7 +249,7 @@ _cogl_renderer_get_winsys (CoglRenderer *renderer)
 static void
 native_filter_closure_free (CoglNativeFilterClosure *closure)
 {
-  g_slice_free (CoglNativeFilterClosure, closure);
+  u_slice_free (CoglNativeFilterClosure, closure);
 }
 
 static void
@@ -264,30 +264,30 @@ _cogl_renderer_free (CoglRenderer *renderer)
 
 #ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
   if (renderer->libgl_module)
-    g_module_close (renderer->libgl_module);
+    u_module_close (renderer->libgl_module);
 #endif
 
-  g_slist_foreach (renderer->event_filters,
+  u_slist_foreach (renderer->event_filters,
                    (GFunc) native_filter_closure_free,
                    NULL);
-  g_slist_free (renderer->event_filters);
+  u_slist_free (renderer->event_filters);
 
-  g_array_free (renderer->poll_fds, TRUE);
+  u_array_free (renderer->poll_fds, TRUE);
 
-  g_free (renderer);
+  u_free (renderer);
 }
 
 CoglRenderer *
 cogl_renderer_new (void)
 {
-  CoglRenderer *renderer = g_new0 (CoglRenderer, 1);
+  CoglRenderer *renderer = u_new0 (CoglRenderer, 1);
 
   _cogl_init ();
 
   renderer->connected = FALSE;
   renderer->event_filters = NULL;
 
-  renderer->poll_fds = g_array_new (FALSE, TRUE, sizeof (CoglPollFD));
+  renderer->poll_fds = u_array_new (FALSE, TRUE, sizeof (CoglPollFD));
 
   _cogl_list_init (&renderer->idle_closures);
 
@@ -380,7 +380,7 @@ foreach_driver_description (CoglDriver driver_override,
 
   if (driver_override != COGL_DRIVER_ANY)
     {
-      for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++)
+      for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
         {
           if (_cogl_drivers[i].id == driver_override)
             {
@@ -389,15 +389,15 @@ foreach_driver_description (CoglDriver driver_override,
             }
         }
 
-      g_warn_if_reached ();
+      u_warn_if_reached ();
       return;
     }
 
 #ifdef COGL_DEFAULT_DRIVER
-  for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++)
+  for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
     {
       const CoglDriverDescription *desc = &_cogl_drivers[i];
-      if (g_ascii_strcasecmp (desc->name, COGL_DEFAULT_DRIVER) == 0)
+      if (u_ascii_strcasecmp (desc->name, COGL_DEFAULT_DRIVER) == 0)
         {
           default_driver = desc;
           break;
@@ -411,7 +411,7 @@ foreach_driver_description (CoglDriver driver_override,
     }
 #endif
 
-  for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++)
+  for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
     {
 #ifdef COGL_DEFAULT_DRIVER
       if (&_cogl_drivers[i] == default_driver)
@@ -428,9 +428,9 @@ driver_name_to_id (const char *name)
 {
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++)
+  for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
     {
-      if (g_ascii_strcasecmp (_cogl_drivers[i].name, name) == 0)
+      if (u_ascii_strcasecmp (_cogl_drivers[i].name, name) == 0)
         return _cogl_drivers[i].id;
     }
 
@@ -455,17 +455,17 @@ driver_id_to_name (CoglDriver id)
       case COGL_DRIVER_NOP:
         return "nop";
       case COGL_DRIVER_ANY:
-        g_warn_if_reached ();
+        u_warn_if_reached ();
         return "any";
     }
 
-  g_warn_if_reached ();
+  u_warn_if_reached ();
   return "unknown";
 }
 
 typedef struct _SatisfyConstraintsState
 {
-  GList *constraints;
+  UList *constraints;
   const CoglDriverDescription *driver_description;
 } SatisfyConstraintsState;
 
@@ -474,7 +474,7 @@ satisfy_constraints (CoglDriverDescription *description,
                      void *user_data)
 {
   SatisfyConstraintsState *state = user_data;
-  GList *l;
+  UList *l;
 
   for (l = state->constraints; l; l = l->next)
     {
@@ -500,7 +500,7 @@ static CoglBool
 _cogl_renderer_choose_driver (CoglRenderer *renderer,
                               CoglError **error)
 {
-  const char *driver_name = g_getenv ("COGL_DRIVER");
+  const char *driver_name = u_getenv ("COGL_DRIVER");
   CoglDriver driver_override = COGL_DRIVER_ANY;
   const char *invalid_override = NULL;
   const char *libgl_name;
@@ -539,7 +539,7 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
       CoglBool found = FALSE;
       int i;
 
-      for (i = 0; i < G_N_ELEMENTS (_cogl_drivers); i++)
+      for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
         {
           if (_cogl_drivers[i].id == driver_override)
             {
@@ -593,8 +593,8 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
   if (COGL_FLAGS_GET (renderer->private_features,
                       COGL_PRIVATE_FEATURE_ANY_GL))
     {
-      renderer->libgl_module = g_module_open (libgl_name,
-                                              G_MODULE_BIND_LAZY);
+      renderer->libgl_module = u_module_open (libgl_name,
+                                              U_MODULE_BIND_LAZY);
 
       if (renderer->libgl_module == NULL)
         {
@@ -617,7 +617,7 @@ CoglBool
 cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
 {
   int i;
-  GString *error_message;
+  UString *error_message;
   CoglBool constraints_failed = FALSE;
 
   if (renderer->connected)
@@ -629,12 +629,12 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
   if (!_cogl_renderer_choose_driver (renderer, error))
     return FALSE;
 
-  error_message = g_string_new ("");
-  for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
+  error_message = u_string_new ("");
+  for (i = 0; i < U_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
     {
       const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
       CoglError *tmp_error = NULL;
-      GList *l;
+      UList *l;
       CoglBool skip_due_to_constraints = FALSE;
 
       if (renderer->winsys_id_override != COGL_WINSYS_ID_ANY)
@@ -648,7 +648,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
           if (!user_choice)
             user_choice = _cogl_config_renderer;
           if (user_choice &&
-              g_ascii_strcasecmp (winsys->name, user_choice) != 0)
+              u_ascii_strcasecmp (winsys->name, user_choice) != 0)
             continue;
         }
 
@@ -674,14 +674,14 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
 
       if (!winsys->renderer_connect (renderer, &tmp_error))
         {
-          g_string_append_c (error_message, '\n');
-          g_string_append (error_message, tmp_error->message);
+          u_string_append_c (error_message, '\n');
+          u_string_append (error_message, tmp_error->message);
           cogl_error_free (tmp_error);
         }
       else
         {
           renderer->connected = TRUE;
-          g_string_free (error_message, TRUE);
+          u_string_free (error_message, TRUE);
           return TRUE;
         }
     }
@@ -701,7 +701,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
                    COGL_WINSYS_ERROR_INIT,
                    "Failed to connected to any renderer: %s",
                    error_message->str);
-      g_string_free (error_message, TRUE);
+      u_string_free (error_message, TRUE);
       return FALSE;
     }
 
@@ -712,7 +712,7 @@ CoglFilterReturn
 _cogl_renderer_handle_native_event (CoglRenderer *renderer,
                                     void *event)
 {
-  GSList *l, *next;
+  USList *l, *next;
 
   /* Pass the event on to all of the registered filters in turn */
   for (l = renderer->event_filters; l; l = next)
@@ -740,11 +740,11 @@ _cogl_renderer_add_native_filter (CoglRenderer *renderer,
 {
   CoglNativeFilterClosure *closure;
 
-  closure = g_slice_new (CoglNativeFilterClosure);
+  closure = u_slice_new (CoglNativeFilterClosure);
   closure->func = func;
   closure->data = data;
 
-  renderer->event_filters = g_slist_prepend (renderer->event_filters, closure);
+  renderer->event_filters = u_slist_prepend (renderer->event_filters, closure);
 }
 
 void
@@ -752,7 +752,7 @@ _cogl_renderer_remove_native_filter (CoglRenderer *renderer,
                                      CoglNativeFilterFunc func,
                                      void *data)
 {
-  GSList *l, *prev = NULL;
+  USList *l, *prev = NULL;
 
   for (l = renderer->event_filters; l; prev = l, l = l->next)
     {
@@ -762,10 +762,10 @@ _cogl_renderer_remove_native_filter (CoglRenderer *renderer,
         {
           native_filter_closure_free (closure);
           if (prev)
-            prev->next = g_slist_delete_link (prev->next, l);
+            prev->next = u_slist_delete_link (prev->next, l);
           else
             renderer->event_filters =
-              g_slist_delete_link (renderer->event_filters, l);
+              u_slist_delete_link (renderer->event_filters, l);
           break;
         }
     }
@@ -817,8 +817,8 @@ void
 cogl_renderer_add_constraint (CoglRenderer *renderer,
                               CoglRendererConstraint constraint)
 {
-  g_return_if_fail (!renderer->connected);
-  renderer->constraints = g_list_prepend (renderer->constraints,
+  u_return_if_fail (!renderer->connected);
+  renderer->constraints = u_list_prepend (renderer->constraints,
                                           GUINT_TO_POINTER (constraint));
 }
 
@@ -826,8 +826,8 @@ void
 cogl_renderer_remove_constraint (CoglRenderer *renderer,
                                  CoglRendererConstraint constraint)
 {
-  g_return_if_fail (!renderer->connected);
-  renderer->constraints = g_list_remove (renderer->constraints,
+  u_return_if_fail (!renderer->connected);
+  renderer->constraints = u_list_remove (renderer->constraints,
                                          GUINT_TO_POINTER (constraint));
 }
 
@@ -852,7 +852,7 @@ cogl_renderer_foreach_output (CoglRenderer *renderer,
                               CoglOutputCallback callback,
                               void *user_data)
 {
-  GList *l;
+  UList *l;
 
   _COGL_RETURN_IF_FAIL (renderer->connected);
   _COGL_RETURN_IF_FAIL (callback != NULL);
diff --git a/cogl/cogl-sampler-cache.c b/cogl/cogl-sampler-cache.c
index 9fceaed..194d334 100644
--- a/cogl/cogl-sampler-cache.c
+++ b/cogl/cogl-sampler-cache.c
@@ -54,8 +54,8 @@ struct _CoglSamplerCache
      pointer instead of the whole state and the second is used so that
      only a single GL sampler object will be created for each unique
      GL state. */
-  GHashTable *hash_table_cogl;
-  GHashTable *hash_table_gl;
+  UHashTable *hash_table_cogl;
+  UHashTable *hash_table_gl;
 
   /* This is used for generated fake unique sampler object numbers
      when the sampler object extension is not supported */
@@ -174,15 +174,15 @@ hash_sampler_state_cogl (const void *key)
 CoglSamplerCache *
 _cogl_sampler_cache_new (CoglContext *context)
 {
-  CoglSamplerCache *cache = g_new (CoglSamplerCache, 1);
+  CoglSamplerCache *cache = u_new (CoglSamplerCache, 1);
 
   /* No reference is taken on the context because it would create a
      circular reference */
   cache->context = context;
 
-  cache->hash_table_gl = g_hash_table_new (hash_sampler_state_gl,
+  cache->hash_table_gl = u_hash_table_new (hash_sampler_state_gl,
                                            sampler_state_equal_gl);
-  cache->hash_table_cogl = g_hash_table_new (hash_sampler_state_cogl,
+  cache->hash_table_cogl = u_hash_table_new (hash_sampler_state_cogl,
                                              sampler_state_equal_cogl);
   cache->next_fake_sampler_object_number = 1;
 
@@ -206,13 +206,13 @@ _cogl_sampler_cache_get_entry_gl (CoglSamplerCache *cache,
 {
   CoglSamplerCacheEntry *entry;
 
-  entry = g_hash_table_lookup (cache->hash_table_gl, key);
+  entry = u_hash_table_lookup (cache->hash_table_gl, key);
 
   if (entry == NULL)
     {
       CoglContext *context = cache->context;
 
-      entry = g_slice_dup (CoglSamplerCacheEntry, key);
+      entry = u_slice_dup (CoglSamplerCacheEntry, key);
 
       if (_cogl_has_private_feature (context,
                                      COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS))
@@ -248,7 +248,7 @@ _cogl_sampler_cache_get_entry_gl (CoglSamplerCache *cache,
           entry->sampler_object = cache->next_fake_sampler_object_number++;
         }
 
-      g_hash_table_insert (cache->hash_table_gl, entry, entry);
+      u_hash_table_insert (cache->hash_table_gl, entry, entry);
     }
 
   return entry;
@@ -260,14 +260,14 @@ _cogl_sampler_cache_get_entry_cogl (CoglSamplerCache *cache,
 {
   CoglSamplerCacheEntry *entry;
 
-  entry = g_hash_table_lookup (cache->hash_table_cogl, key);
+  entry = u_hash_table_lookup (cache->hash_table_cogl, key);
 
   if (entry == NULL)
     {
       CoglSamplerCacheEntry canonical_key;
       CoglSamplerCacheEntry *gl_entry;
 
-      entry = g_slice_dup (CoglSamplerCacheEntry, key);
+      entry = u_slice_dup (CoglSamplerCacheEntry, key);
 
       /* Get the sampler object number from the canonical GL version
          of the sampler state cache */
@@ -276,7 +276,7 @@ _cogl_sampler_cache_get_entry_cogl (CoglSamplerCache *cache,
       gl_entry = _cogl_sampler_cache_get_entry_gl (cache, &canonical_key);
       entry->sampler_object = gl_entry->sampler_object;
 
-      g_hash_table_insert (cache->hash_table_cogl, entry, entry);
+      u_hash_table_insert (cache->hash_table_cogl, entry, entry);
     }
 
   return entry;
@@ -339,7 +339,7 @@ hash_table_free_gl_cb (void *key,
                                  COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS))
     GE( context, glDeleteSamplers (1, &entry->sampler_object) );
 
-  g_slice_free (CoglSamplerCacheEntry, entry);
+  u_slice_free (CoglSamplerCacheEntry, entry);
 }
 
 static void
@@ -349,23 +349,23 @@ hash_table_free_cogl_cb (void *key,
 {
   CoglSamplerCacheEntry *entry = value;
 
-  g_slice_free (CoglSamplerCacheEntry, entry);
+  u_slice_free (CoglSamplerCacheEntry, entry);
 }
 
 void
 _cogl_sampler_cache_free (CoglSamplerCache *cache)
 {
-  g_hash_table_foreach (cache->hash_table_gl,
+  u_hash_table_foreach (cache->hash_table_gl,
                         hash_table_free_gl_cb,
                         cache->context);
 
-  g_hash_table_destroy (cache->hash_table_gl);
+  u_hash_table_destroy (cache->hash_table_gl);
 
-  g_hash_table_foreach (cache->hash_table_cogl,
+  u_hash_table_foreach (cache->hash_table_cogl,
                         hash_table_free_cogl_cb,
                         cache->context);
 
-  g_hash_table_destroy (cache->hash_table_cogl);
+  u_hash_table_destroy (cache->hash_table_cogl);
 
-  g_free (cache);
+  u_free (cache);
 }
diff --git a/cogl/cogl-snippet-private.h b/cogl/cogl-snippet-private.h
index 1963d39..4869fa1 100644
--- a/cogl/cogl-snippet-private.h
+++ b/cogl/cogl-snippet-private.h
@@ -34,7 +34,7 @@
 #ifndef __COGL_SNIPPET_PRIVATE_H
 #define __COGL_SNIPPET_PRIVATE_H
 
-#include <glib.h>
+#include <ulib.h>
 
 #include "cogl-snippet.h"
 #include "cogl-object-private.h"
diff --git a/cogl/cogl-snippet.c b/cogl/cogl-snippet.c
index b4108ac..0c5d752 100644
--- a/cogl/cogl-snippet.c
+++ b/cogl/cogl-snippet.c
@@ -49,7 +49,7 @@ cogl_snippet_new (CoglSnippetHook hook,
                   const char *declarations,
                   const char *post)
 {
-  CoglSnippet *snippet = g_slice_new0 (CoglSnippet);
+  CoglSnippet *snippet = u_slice_new0 (CoglSnippet);
 
   _cogl_snippet_object_new (snippet);
 
@@ -74,7 +74,7 @@ _cogl_snippet_modify (CoglSnippet *snippet)
 {
   if (snippet->immutable)
     {
-      g_warning ("A CoglSnippet should not be modified once it has been "
+      u_warning ("A CoglSnippet should not be modified once it has been "
                  "attached to a pipeline. Any modifications after that point "
                  "will be ignored.");
 
@@ -93,8 +93,8 @@ cogl_snippet_set_declarations (CoglSnippet *snippet,
   if (!_cogl_snippet_modify (snippet))
     return;
 
-  g_free (snippet->declarations);
-  snippet->declarations = declarations ? g_strdup (declarations) : NULL;
+  u_free (snippet->declarations);
+  snippet->declarations = declarations ? u_strdup (declarations) : NULL;
 }
 
 const char *
@@ -114,8 +114,8 @@ cogl_snippet_set_pre (CoglSnippet *snippet,
   if (!_cogl_snippet_modify (snippet))
     return;
 
-  g_free (snippet->pre);
-  snippet->pre = pre ? g_strdup (pre) : NULL;
+  u_free (snippet->pre);
+  snippet->pre = pre ? u_strdup (pre) : NULL;
 }
 
 const char *
@@ -135,8 +135,8 @@ cogl_snippet_set_replace (CoglSnippet *snippet,
   if (!_cogl_snippet_modify (snippet))
     return;
 
-  g_free (snippet->replace);
-  snippet->replace = replace ? g_strdup (replace) : NULL;
+  u_free (snippet->replace);
+  snippet->replace = replace ? u_strdup (replace) : NULL;
 }
 
 const char *
@@ -156,8 +156,8 @@ cogl_snippet_set_post (CoglSnippet *snippet,
   if (!_cogl_snippet_modify (snippet))
     return;
 
-  g_free (snippet->post);
-  snippet->post = post ? g_strdup (post) : NULL;
+  u_free (snippet->post);
+  snippet->post = post ? u_strdup (post) : NULL;
 }
 
 const char *
@@ -177,9 +177,9 @@ _cogl_snippet_make_immutable (CoglSnippet *snippet)
 static void
 _cogl_snippet_free (CoglSnippet *snippet)
 {
-  g_free (snippet->declarations);
-  g_free (snippet->pre);
-  g_free (snippet->replace);
-  g_free (snippet->post);
-  g_slice_free (CoglSnippet, snippet);
+  u_free (snippet->declarations);
+  u_free (snippet->pre);
+  u_free (snippet->replace);
+  u_free (snippet->post);
+  u_slice_free (CoglSnippet, snippet);
 }
diff --git a/cogl/cogl-spans.c b/cogl/cogl-spans.c
index 073b889..5f2d59c 100644
--- a/cogl/cogl-spans.c
+++ b/cogl/cogl-spans.c
@@ -135,7 +135,7 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
         }
     }
   else
-    g_warn_if_reached ();
+    u_warn_if_reached ();
 
   iter->cover_start = cover_start;
   iter->cover_end = cover_end;
@@ -167,7 +167,7 @@ _cogl_span_iter_next (CoglSpanIter *iter)
         }
     }
   else
-    g_warn_if_reached ();
+    u_warn_if_reached ();
 
   /* Update intersection */
   _cogl_span_iter_update (iter);
diff --git a/cogl/cogl-sub-texture-private.h b/cogl/cogl-sub-texture-private.h
index 6117ae1..4ff411b 100644
--- a/cogl/cogl-sub-texture-private.h
+++ b/cogl/cogl-sub-texture-private.h
@@ -33,7 +33,7 @@
 
 #include "cogl-texture-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 struct _CoglSubTexture
 {
diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c
index 4b4ee28..5770223 100644
--- a/cogl/cogl-sub-texture.c
+++ b/cogl/cogl-sub-texture.c
@@ -237,7 +237,7 @@ cogl_sub_texture_new (CoglContext *ctx,
   _COGL_RETURN_VAL_IF_FAIL (sub_x + sub_width <= next_width, NULL);
   _COGL_RETURN_VAL_IF_FAIL (sub_y + sub_height <= next_height, NULL);
 
-  sub_tex = g_new (CoglSubTexture, 1);
+  sub_tex = u_new (CoglSubTexture, 1);
 
   tex = COGL_TEXTURE (sub_tex);
 
diff --git a/cogl/cogl-texture-2d-sliced-private.h b/cogl/cogl-texture-2d-sliced-private.h
index 6948c75..5598ee8 100644
--- a/cogl/cogl-texture-2d-sliced-private.h
+++ b/cogl/cogl-texture-2d-sliced-private.h
@@ -36,15 +36,15 @@
 #include "cogl-texture-private.h"
 #include "cogl-texture-2d-sliced.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 struct _CoglTexture2DSliced
 {
   CoglTexture _parent;
 
-  GArray *slice_x_spans;
-  GArray *slice_y_spans;
-  GArray *slice_textures;
+  UArray *slice_x_spans;
+  UArray *slice_y_spans;
+  UArray *slice_textures;
   int max_waste;
   CoglPixelFormat internal_format;
 };
diff --git a/cogl/cogl-texture-2d-sliced.c b/cogl/cogl-texture-2d-sliced.c
index 1236178..3873e8e 100644
--- a/cogl/cogl-texture-2d-sliced.c
+++ b/cogl/cogl-texture-2d-sliced.c
@@ -157,21 +157,21 @@ _cogl_texture_2d_sliced_allocate_waste_buffer (CoglTexture2DSliced *tex_2ds,
 
   /* If the texture has any waste then allocate a buffer big enough to
      fill the gaps */
-  last_x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan,
+  last_x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan,
                                 tex_2ds->slice_x_spans->len - 1);
-  last_y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan,
+  last_y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan,
                                 tex_2ds->slice_y_spans->len - 1);
   if (last_x_span->waste > 0 || last_y_span->waste > 0)
     {
       int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
       CoglSpan  *first_x_span
-        = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+        = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
       CoglSpan  *first_y_span
-        = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+        = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
       unsigned int right_size = first_y_span->size * last_x_span->waste;
       unsigned int bottom_size = first_x_span->size * last_y_span->waste;
 
-      waste_buf = g_malloc (MAX (right_size, bottom_size) * bpp);
+      waste_buf = u_malloc (MAX (right_size, bottom_size) * bpp);
     }
 
   return waste_buf;
@@ -358,7 +358,7 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
   /* Iterate vertical slices */
   for (y = 0; y < tex_2ds->slice_y_spans->len; ++y)
     {
-      y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
+      y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
 
       /* Iterate horizontal slices */
       for (x = 0; x < tex_2ds->slice_x_spans->len; ++x)
@@ -366,10 +366,10 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
           int slice_num = y * tex_2ds->slice_x_spans->len + x;
           CoglSpanIter x_iter, y_iter;
 
-          x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
+          x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
 
           /* Pick the gl texture object handle */
-          slice_tex = g_array_index (tex_2ds->slice_textures,
+          slice_tex = u_array_index (tex_2ds->slice_textures,
                                      CoglTexture2D *, slice_num);
 
           if (!cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex),
@@ -386,7 +386,7 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
                                                     error))
             {
               if (waste_buf)
-                g_free (waste_buf);
+                u_free (waste_buf);
               return FALSE;
             }
 
@@ -416,14 +416,14 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
                                                   error)) /* dst_y */
             {
               if (waste_buf)
-                g_free (waste_buf);
+                u_free (waste_buf);
               return FALSE;
             }
         }
     }
 
   if (waste_buf)
-    g_free (waste_buf);
+    u_free (waste_buf);
 
   return TRUE;
 }
@@ -471,7 +471,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
        _cogl_span_iter_next (&y_iter),
        source_y += inter_h )
     {
-      y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan,
+      y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan,
                                y_iter.index);
 
       /* Iterate horizontal spans */
@@ -491,7 +491,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
         {
           int slice_num;
 
-          x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan,
+          x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan,
                                    x_iter.index);
 
           /* Pick intersection width and height */
@@ -505,7 +505,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
           slice_num = y_iter.index * tex_2ds->slice_x_spans->len + x_iter.index;
 
           /* Pick slice texture */
-          slice_tex = g_array_index (tex_2ds->slice_textures,
+          slice_tex = u_array_index (tex_2ds->slice_textures,
                                      CoglTexture2D *, slice_num);
 
           if (!cogl_texture_set_region_from_bitmap (COGL_TEXTURE (slice_tex),
@@ -520,7 +520,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
                                                     error))
             {
               if (waste_buf)
-                g_free (waste_buf);
+                u_free (waste_buf);
               return FALSE;
             }
 
@@ -535,14 +535,14 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
                                                   error))
             {
               if (waste_buf)
-                g_free (waste_buf);
+                u_free (waste_buf);
               return FALSE;
             }
         }
     }
 
   if (waste_buf)
-    g_free (waste_buf);
+    u_free (waste_buf);
 
   return TRUE;
 }
@@ -551,7 +551,7 @@ static int
 _cogl_rect_slices_for_size (int     size_to_fill,
                             int     max_span_size,
                             int     max_waste,
-                            GArray *out_spans)
+                            UArray *out_spans)
 {
   int       n_spans = 0;
   CoglSpan  span;
@@ -566,7 +566,7 @@ _cogl_rect_slices_for_size (int     size_to_fill,
     {
       /* Add another slice span of same size */
       if (out_spans)
-        g_array_append_val (out_spans, span);
+        u_array_append_val (out_spans, span);
       span.start   += span.size;
       size_to_fill -= span.size;
       n_spans++;
@@ -577,7 +577,7 @@ _cogl_rect_slices_for_size (int     size_to_fill,
     {
       span.size = size_to_fill;
       if (out_spans)
-        g_array_append_val (out_spans, span);
+        u_array_append_val (out_spans, span);
       n_spans++;
     }
 
@@ -588,7 +588,7 @@ static int
 _cogl_pot_slices_for_size (int    size_to_fill,
                            int    max_span_size,
                            int    max_waste,
-                           GArray *out_spans)
+                           UArray *out_spans)
 {
   int      n_spans = 0;
   CoglSpan span;
@@ -609,7 +609,7 @@ _cogl_pot_slices_for_size (int    size_to_fill,
         {
           /* Not yet - add a span of this size */
           if (out_spans)
-            g_array_append_val (out_spans, span);
+            u_array_append_val (out_spans, span);
 
           span.start   += span.size;
           size_to_fill -= span.size;
@@ -624,7 +624,7 @@ _cogl_pot_slices_for_size (int    size_to_fill,
           span.size = _cogl_util_next_p2 (size_to_fill);
           span.waste = span.size - size_to_fill;
           if (out_spans)
-            g_array_append_val (out_spans, span);
+            u_array_append_val (out_spans, span);
 
           return ++n_spans;
         }
@@ -634,7 +634,7 @@ _cogl_pot_slices_for_size (int    size_to_fill,
           while (span.size - size_to_fill > max_waste)
             {
               span.size /= 2;
-              g_assert (span.size > 0);
+              u_assert (span.size > 0);
             }
         }
     }
@@ -655,7 +655,7 @@ _cogl_texture_2d_sliced_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
   /* Pass the set wrap mode on to all of the child textures */
   for (i = 0; i < tex_2ds->slice_textures->len; i++)
     {
-      CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures,
+      CoglTexture2D *slice_tex = u_array_index (tex_2ds->slice_textures,
                                                 CoglTexture2D *,
                                                 i);
 
@@ -671,13 +671,13 @@ free_spans (CoglTexture2DSliced *tex_2ds)
 {
   if (tex_2ds->slice_x_spans != NULL)
     {
-      g_array_free (tex_2ds->slice_x_spans, TRUE);
+      u_array_free (tex_2ds->slice_x_spans, TRUE);
       tex_2ds->slice_x_spans = NULL;
     }
 
   if (tex_2ds->slice_y_spans != NULL)
     {
-      g_array_free (tex_2ds->slice_y_spans, TRUE);
+      u_array_free (tex_2ds->slice_y_spans, TRUE);
       tex_2ds->slice_y_spans = NULL;
     }
 }
@@ -696,7 +696,7 @@ setup_spans (CoglContext *ctx,
   int n_x_slices;
   int n_y_slices;
 
-  int   (*slices_for_size) (int, int, int, GArray*);
+  int   (*slices_for_size) (int, int, int, UArray*);
 
   /* Initialize size of largest slice according to supported features */
   if (cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
@@ -737,11 +737,11 @@ setup_spans (CoglContext *ctx,
       n_y_slices = 1;
 
       /* Init span arrays */
-      tex_2ds->slice_x_spans = g_array_sized_new (FALSE, FALSE,
+      tex_2ds->slice_x_spans = u_array_sized_new (FALSE, FALSE,
                                                   sizeof (CoglSpan),
                                                   1);
 
-      tex_2ds->slice_y_spans = g_array_sized_new (FALSE, FALSE,
+      tex_2ds->slice_y_spans = u_array_sized_new (FALSE, FALSE,
                                                   sizeof (CoglSpan),
                                                   1);
 
@@ -749,11 +749,11 @@ setup_spans (CoglContext *ctx,
       span.start = 0;
       span.size = max_width;
       span.waste = max_width - width;
-      g_array_append_val (tex_2ds->slice_x_spans, span);
+      u_array_append_val (tex_2ds->slice_x_spans, span);
 
       span.size = max_height;
       span.waste = max_height - height;
-      g_array_append_val (tex_2ds->slice_y_spans, span);
+      u_array_append_val (tex_2ds->slice_y_spans, span);
     }
   else
     {
@@ -771,7 +771,7 @@ setup_spans (CoglContext *ctx,
 
           if (max_width == 0 || max_height == 0)
             {
-              /* Maybe it would be ok to just g_warn_if_reached() for this
+              /* Maybe it would be ok to just u_warn_if_reached() for this
                * codepath */
               _cogl_set_error (error,
                                COGL_TEXTURE_ERROR,
@@ -792,11 +792,11 @@ setup_spans (CoglContext *ctx,
                                     NULL);
 
       /* Init span arrays with reserved size */
-      tex_2ds->slice_x_spans = g_array_sized_new (FALSE, FALSE,
+      tex_2ds->slice_x_spans = u_array_sized_new (FALSE, FALSE,
                                                   sizeof (CoglSpan),
                                                   n_x_slices);
 
-      tex_2ds->slice_y_spans = g_array_sized_new (FALSE, FALSE,
+      tex_2ds->slice_y_spans = u_array_sized_new (FALSE, FALSE,
                                                   sizeof (CoglSpan),
                                                   n_y_slices);
 
@@ -823,11 +823,11 @@ free_slices (CoglTexture2DSliced *tex_2ds)
       for (i = 0; i < tex_2ds->slice_textures->len; i++)
         {
           CoglTexture2D *slice_tex =
-            g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
+            u_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
           cogl_object_unref (slice_tex);
         }
 
-      g_array_free (tex_2ds->slice_textures, TRUE);
+      u_array_free (tex_2ds->slice_textures, TRUE);
     }
 
   free_spans (tex_2ds);
@@ -866,20 +866,20 @@ allocate_slices (CoglTexture2DSliced *tex_2ds,
   n_y_slices = tex_2ds->slice_y_spans->len;
   n_slices = n_x_slices * n_y_slices;
 
-  tex_2ds->slice_textures = g_array_sized_new (FALSE, FALSE,
+  tex_2ds->slice_textures = u_array_sized_new (FALSE, FALSE,
                                                sizeof (CoglTexture2D *),
                                                n_slices);
 
   /* Allocate each slice */
   for (y = 0; y < n_y_slices; ++y)
     {
-      y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
+      y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
 
       for (x = 0; x < n_x_slices; ++x)
         {
           CoglTexture *slice;
 
-          x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
+          x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
 
           COGL_NOTE (SLICING, "CREATE SLICE (%d,%d)\tsize (%d,%d)",
                      x, y,
@@ -892,7 +892,7 @@ allocate_slices (CoglTexture2DSliced *tex_2ds,
 
           _cogl_texture_copy_internal_format (tex, slice);
 
-          g_array_append_val (tex_2ds->slice_textures, slice);
+          u_array_append_val (tex_2ds->slice_textures, slice);
           if (!cogl_texture_allocate (slice, error))
             {
               free_slices (tex_2ds);
@@ -921,7 +921,7 @@ _cogl_texture_2d_sliced_create_base (CoglContext *ctx,
                                      CoglPixelFormat internal_format,
                                      CoglTextureLoader *loader)
 {
-  CoglTexture2DSliced *tex_2ds = g_new0 (CoglTexture2DSliced, 1);
+  CoglTexture2DSliced *tex_2ds = u_new0 (CoglTexture2DSliced, 1);
 
   _cogl_texture_init (COGL_TEXTURE (tex_2ds), ctx, width, height,
                       internal_format, loader,
@@ -1145,7 +1145,7 @@ _cogl_texture_2d_sliced_allocate (CoglTexture *tex,
       break;
     }
 
-  g_return_val_if_reached (FALSE);
+  u_return_val_if_reached (FALSE);
 }
 
 static CoglBool
@@ -1159,7 +1159,7 @@ _cogl_texture_2d_sliced_is_foreign (CoglTexture *tex)
     return FALSE;
 
   /* Pass the call on to the first slice */
-  slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+  slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
   return _cogl_texture_is_foreign (COGL_TEXTURE (slice_tex));
 }
 
@@ -1193,13 +1193,13 @@ _cogl_texture_2d_sliced_can_hardware_repeat (CoglTexture *tex)
     return FALSE;
 
   /* If there's any waste then we can't hardware repeat */
-  x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
-  y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+  x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+  y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
   if (x_span->waste > 0 || y_span->waste > 0)
     return FALSE;
 
   /* Otherwise pass the query on to the single slice texture */
-  slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+  slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
   return _cogl_texture_can_hardware_repeat (COGL_TEXTURE (slice_tex));
 }
 
@@ -1213,17 +1213,17 @@ _cogl_texture_2d_sliced_transform_coords_to_gl (CoglTexture *tex,
   CoglSpan *y_span;
   CoglTexture2D *slice_tex;
 
-  g_assert (!_cogl_texture_2d_sliced_is_sliced (tex));
+  u_assert (!_cogl_texture_2d_sliced_is_sliced (tex));
 
   /* Don't include the waste in the texture coordinates */
-  x_span = &g_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
-  y_span = &g_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+  x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+  y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
 
   *s *= tex->width / (float)x_span->size;
   *t *= tex->height / (float)y_span->size;
 
   /* Let the child texture further transform the coords */
-  slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+  slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
   _cogl_texture_transform_coords_to_gl (COGL_TEXTURE (slice_tex), s, t);
 }
 
@@ -1270,7 +1270,7 @@ _cogl_texture_2d_sliced_get_gl_texture (CoglTexture *tex,
   if (tex_2ds->slice_textures->len < 1)
     return FALSE;
 
-  slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+  slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
 
   return cogl_texture_get_gl_texture (COGL_TEXTURE (slice_tex),
                                       out_gl_handle, out_gl_target);
@@ -1292,7 +1292,7 @@ _cogl_texture_2d_sliced_gl_flush_legacy_texobj_filters (CoglTexture *tex,
      GL */
   for (i = 0; i < tex_2ds->slice_textures->len; i++)
     {
-      slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
+      slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
       _cogl_texture_gl_flush_legacy_texobj_filters (COGL_TEXTURE (slice_tex),
                                                     min_filter, mag_filter);
     }
@@ -1310,7 +1310,7 @@ _cogl_texture_2d_sliced_pre_paint (CoglTexture *tex,
   /* Pass the pre-paint on to every slice */
   for (i = 0; i < tex_2ds->slice_textures->len; i++)
     {
-      CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures,
+      CoglTexture2D *slice_tex = u_array_index (tex_2ds->slice_textures,
                                                 CoglTexture2D *, i);
       _cogl_texture_pre_paint (COGL_TEXTURE (slice_tex), flags);
     }
@@ -1327,7 +1327,7 @@ _cogl_texture_2d_sliced_ensure_non_quad_rendering (CoglTexture *tex)
   /* Pass the call on to every slice */
   for (i = 0; i < tex_2ds->slice_textures->len; i++)
     {
-      CoglTexture2D *slice_tex = g_array_index (tex_2ds->slice_textures,
+      CoglTexture2D *slice_tex = u_array_index (tex_2ds->slice_textures,
                                                 CoglTexture2D *, i);
       _cogl_texture_ensure_non_quad_rendering (COGL_TEXTURE (slice_tex));
     }
@@ -1386,7 +1386,7 @@ _cogl_texture_2d_sliced_get_gl_format (CoglTexture *tex)
   cogl_texture_allocate (tex, NULL); /* (abort on error) */
 
   /* Pass the call on to the first slice */
-  slice_tex = g_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+  slice_tex = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
   return _cogl_texture_gl_get_format (COGL_TEXTURE (slice_tex));
 }
 
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index 94b34ef..305d474 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -98,7 +98,7 @@ _cogl_texture_2d_create_base (CoglContext *ctx,
                               CoglPixelFormat internal_format,
                               CoglTextureLoader *loader)
 {
-  CoglTexture2D *tex_2d = g_new (CoglTexture2D, 1);
+  CoglTexture2D *tex_2d = u_new (CoglTexture2D, 1);
   CoglTexture *tex = COGL_TEXTURE (tex_2d);
 
   _cogl_texture_init (tex, ctx, width, height, internal_format, loader,
@@ -300,7 +300,7 @@ shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer,
       break;
 #endif
     default:
-      g_warn_if_reached ();
+      u_warn_if_reached ();
       format = COGL_PIXEL_FORMAT_ARGB_8888;
     }
 
diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c
index eedfda9..fea0031 100644
--- a/cogl/cogl-texture-3d.c
+++ b/cogl/cogl-texture-3d.c
@@ -126,7 +126,7 @@ _cogl_texture_3d_create_base (CoglContext *ctx,
                               CoglPixelFormat internal_format,
                               CoglTextureLoader *loader)
 {
-  CoglTexture3D *tex_3d = g_new (CoglTexture3D, 1);
+  CoglTexture3D *tex_3d = u_new (CoglTexture3D, 1);
   CoglTexture *tex = COGL_TEXTURE (tex_3d);
 
   _cogl_texture_init (tex, ctx, width, height,
@@ -477,7 +477,7 @@ allocate_from_bitmap (CoglTexture3D *tex_3d,
         }
       else
         {
-          g_warning ("Failed to read first pixel of bitmap for "
+          u_warning ("Failed to read first pixel of bitmap for "
                      "glGenerateMipmap fallback");
           cogl_error_free (ignore);
           memset (tex_3d->first_pixel.data, 0,
@@ -537,7 +537,7 @@ _cogl_texture_3d_allocate (CoglTexture *tex,
       break;
     }
 
-  g_return_val_if_reached (FALSE);
+  u_return_val_if_reached (FALSE);
 }
 
 static CoglBool
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h
index 878fb5f..59567f2 100644
--- a/cogl/cogl-texture-private.h
+++ b/cogl/cogl-texture-private.h
@@ -192,7 +192,7 @@ struct _CoglTexture
   CoglObject _parent;
   CoglContext *context;
   CoglTextureLoader *loader;
-  GList *framebuffers;
+  UList *framebuffers;
   int max_level;
   int width;
   int height;
@@ -318,7 +318,7 @@ void
 _cogl_texture_associate_framebuffer (CoglTexture *texture,
                                      CoglFramebuffer *framebuffer);
 
-const GList *
+const UList *
 _cogl_texture_get_associated_framebuffers (CoglTexture *texture);
 
 void
diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c
index 5d61d03..932366d 100644
--- a/cogl/cogl-texture-rectangle.c
+++ b/cogl/cogl-texture-rectangle.c
@@ -90,8 +90,8 @@ _cogl_texture_rectangle_gl_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
   if (tex_rect->gl_legacy_texobj_wrap_mode_s != wrap_mode_s ||
       tex_rect->gl_legacy_texobj_wrap_mode_t != wrap_mode_t)
     {
-      g_assert (can_use_wrap_mode (wrap_mode_s));
-      g_assert (can_use_wrap_mode (wrap_mode_t));
+      u_assert (can_use_wrap_mode (wrap_mode_s));
+      u_assert (can_use_wrap_mode (wrap_mode_t));
 
       _cogl_bind_gl_texture_transient (GL_TEXTURE_RECTANGLE_ARB,
                                        tex_rect->gl_texture,
@@ -176,7 +176,7 @@ _cogl_texture_rectangle_create_base (CoglContext *ctx,
                                      CoglPixelFormat internal_format,
                                      CoglTextureLoader *loader)
 {
-  CoglTextureRectangle *tex_rect = g_new (CoglTextureRectangle, 1);
+  CoglTextureRectangle *tex_rect = u_new (CoglTextureRectangle, 1);
   CoglTexture *tex = COGL_TEXTURE (tex_rect);
 
   _cogl_texture_init (tex, ctx, width, height,
@@ -482,7 +482,7 @@ _cogl_texture_rectangle_allocate (CoglTexture *tex,
       break;
     }
 
-  g_return_val_if_reached (FALSE);
+  u_return_val_if_reached (FALSE);
 }
 
 CoglTextureRectangle *
@@ -606,7 +606,7 @@ _cogl_texture_rectangle_gl_flush_legacy_texobj_filters (CoglTexture *tex,
     return;
 
   /* Rectangle textures don't support mipmapping */
-  g_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST);
+  u_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST);
 
   /* Store new values */
   tex_rect->gl_legacy_texobj_min_filter = min_filter;
@@ -627,7 +627,7 @@ _cogl_texture_rectangle_pre_paint (CoglTexture *tex,
                                    CoglTexturePrePaintFlags flags)
 {
   /* Rectangle textures don't support mipmaps */
-  g_assert ((flags & COGL_TEXTURE_NEEDS_MIPMAP) == 0);
+  u_assert ((flags & COGL_TEXTURE_NEEDS_MIPMAP) == 0);
 }
 
 static void
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 8378ec6..8d8af46 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -74,7 +74,7 @@
 uint32_t
 cogl_texture_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-texture-error-quark");
+  return u_quark_from_static_string ("cogl-texture-error-quark");
 }
 
 /* XXX:
@@ -83,19 +83,19 @@ cogl_texture_error_domain (void)
  * abstract class manually.
  */
 
-static GSList *_cogl_texture_types;
+static USList *_cogl_texture_types;
 
 void
 _cogl_texture_register_texture_type (const CoglObjectClass *klass)
 {
-  _cogl_texture_types = g_slist_prepend (_cogl_texture_types, (void *) klass);
+  _cogl_texture_types = u_slist_prepend (_cogl_texture_types, (void *) klass);
 }
 
 CoglBool
 cogl_is_texture (void *object)
 {
   CoglObject *obj = (CoglObject *)object;
-  GSList *l;
+  USList *l;
 
   if (object == NULL)
     return FALSE;
@@ -160,7 +160,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
           cogl_object_unref (loader->src.bitmap.bitmap);
           break;
         }
-      g_slice_free (CoglTextureLoader, loader);
+      u_slice_free (CoglTextureLoader, loader);
       texture->loader = NULL;
     }
 }
@@ -168,7 +168,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
 CoglTextureLoader *
 _cogl_texture_create_loader (void)
 {
-  return g_slice_new0 (CoglTextureLoader);
+  return u_slice_new0 (CoglTextureLoader);
 }
 
 void
@@ -176,7 +176,7 @@ _cogl_texture_free (CoglTexture *texture)
 {
   _cogl_texture_free_loader (texture);
 
-  g_free (texture);
+  u_free (texture);
 }
 
 CoglBool
@@ -827,7 +827,7 @@ get_texture_bits_via_copy (CoglTexture *texture,
   bpp = _cogl_pixel_format_get_bytes_per_pixel (dst_format);
 
   full_rowstride = bpp * full_tex_width;
-  full_bits = g_malloc (full_rowstride * full_tex_height);
+  full_bits = u_malloc (full_rowstride * full_tex_height);
 
   if (texture->vtable->get_data (texture,
                                  dst_format,
@@ -848,7 +848,7 @@ get_texture_bits_via_copy (CoglTexture *texture,
   else
     ret = FALSE;
 
-  g_free (full_bits);
+  u_free (full_bits);
 
   return ret;
 }
@@ -1116,7 +1116,7 @@ _cogl_texture_framebuffer_destroy_cb (void *user_data,
   CoglTexture *tex = user_data;
   CoglFramebuffer *framebuffer = instance;
 
-  tex->framebuffers = g_list_remove (tex->framebuffers, framebuffer);
+  tex->framebuffers = u_list_remove (tex->framebuffers, framebuffer);
 }
 
 void
@@ -1127,7 +1127,7 @@ _cogl_texture_associate_framebuffer (CoglTexture *texture,
 
   /* Note: we don't take a reference on the framebuffer here because
    * that would introduce a circular reference. */
-  texture->framebuffers = g_list_prepend (texture->framebuffers, framebuffer);
+  texture->framebuffers = u_list_prepend (texture->framebuffers, framebuffer);
 
   /* Since we haven't taken a reference on the framebuffer we setup
     * some private data so we will be notified if it is destroyed... */
@@ -1137,7 +1137,7 @@ _cogl_texture_associate_framebuffer (CoglTexture *texture,
                               _cogl_texture_framebuffer_destroy_cb);
 }
 
-const GList *
+const UList *
 _cogl_texture_get_associated_framebuffers (CoglTexture *texture)
 {
   return texture->framebuffers;
@@ -1146,7 +1146,7 @@ _cogl_texture_get_associated_framebuffers (CoglTexture *texture)
 void
 _cogl_texture_flush_journal_rendering (CoglTexture *texture)
 {
-  GList *l;
+  UList *l;
 
   /* It could be that a referenced texture is part of a framebuffer
    * which has an associated journal that must be flushed before it
@@ -1394,7 +1394,7 @@ _cogl_texture_determine_internal_format (CoglTexture *texture,
       }
     }
 
-  g_return_val_if_reached (COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+  u_return_val_if_reached (COGL_PIXEL_FORMAT_RGBA_8888_PRE);
 }
 
 void
diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c
index 8be128d..883c106 100644
--- a/cogl/cogl-util.c
+++ b/cogl/cogl-util.c
@@ -157,7 +157,7 @@ _cogl_util_popcount_table[256] =
  */
 static CoglPixelFormat
 _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
-                                         unsigned long g_mask,
+                                         unsigned long u_mask,
                                          unsigned long b_mask,
                                          int depth, int bpp,
                                          CoglBool check_bgr,
@@ -167,22 +167,22 @@ _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
   CoglPixelFormat image_format;
 
   if (depth == 24 && bpp == 24 &&
-      r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff)
+      r_mask == 0xff0000 && u_mask == 0xff00 && b_mask == 0xff)
     {
       return COGL_PIXEL_FORMAT_RGB_888;
     }
   else if ((depth == 24 || depth == 32) && bpp == 32 &&
-           r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff)
+           r_mask == 0xff0000 && u_mask == 0xff00 && b_mask == 0xff)
     {
       return COGL_PIXEL_FORMAT_ARGB_8888_PRE;
     }
   else if ((depth == 30 || depth == 32) &&
-           r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff)
+           r_mask == 0x3ff00000 && u_mask == 0xffc00 && b_mask == 0x3ff)
     {
       return COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
     }
   else if (depth == 16 && bpp == 16 &&
-           r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f)
+           r_mask == 0xf800 && u_mask == 0x7e0 && b_mask == 0x1f)
     {
       return COGL_PIXEL_FORMAT_RGB_565;
     }
@@ -194,7 +194,7 @@ _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
   if (check_bgr)
     {
       image_format =
-        _cogl_util_pixel_format_from_masks_real (b_mask, g_mask, r_mask,
+        _cogl_util_pixel_format_from_masks_real (b_mask, u_mask, r_mask,
                                                  depth, bpp,
                                                  FALSE,
                                                  TRUE,
@@ -211,7 +211,7 @@ _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
 
       image_format =
         _cogl_util_pixel_format_from_masks_real (r_mask >> shift,
-                                                 g_mask >> shift,
+                                                 u_mask >> shift,
                                                  b_mask >> shift,
                                                  depth, bpp,
                                                  TRUE,
@@ -226,13 +226,13 @@ _cogl_util_pixel_format_from_masks_real (unsigned long r_mask,
 
 CoglPixelFormat
 _cogl_util_pixel_format_from_masks (unsigned long r_mask,
-                                    unsigned long g_mask,
+                                    unsigned long u_mask,
                                     unsigned long b_mask,
                                     int depth, int bpp,
                                     CoglBool byte_order_is_lsb_first)
 {
   CoglPixelFormat image_format =
-    _cogl_util_pixel_format_from_masks_real (r_mask, g_mask, b_mask,
+    _cogl_util_pixel_format_from_masks_real (r_mask, u_mask, b_mask,
                                              depth, bpp,
                                              TRUE,
                                              TRUE,
@@ -241,9 +241,9 @@ _cogl_util_pixel_format_from_masks (unsigned long r_mask,
   if (!image_format)
     {
       const char *byte_order[] = { "MSB first", "LSB first" };
-      g_warning ("Could not find a matching pixel format for red mask=0x%lx,"
+      u_warning ("Could not find a matching pixel format for red mask=0x%lx,"
                  "green mask=0x%lx, blue mask=0x%lx at depth=%d, bpp=%d "
-                 "and byte order=%s\n", r_mask, g_mask, b_mask, depth, bpp,
+                 "and byte order=%s\n", r_mask, u_mask, b_mask, depth, bpp,
                  byte_order[!!byte_order_is_lsb_first]);
       return 0;
     }
diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
index da791e1..50e2c9d 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -31,7 +31,7 @@
 #ifndef __COGL_UTIL_H
 #define __COGL_UTIL_H
 
-#include <glib.h>
+#include <ulib.h>
 #include <math.h>
 
 #include <cogl/cogl-defines.h>
@@ -198,8 +198,8 @@ _cogl_util_popcountl (unsigned long num)
 #endif /* COGL_UTIL_HAVE_BUILTIN_POPCOUNTL */
 
 #ifdef COGL_HAS_GLIB_SUPPORT
-#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
-#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
+#define _COGL_RETURN_IF_FAIL(EXPR) u_return_if_fail(EXPR)
+#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) u_return_val_if_fail(EXPR, VAL)
 #else
 #ifdef COGL_ENABLE_DEBUG
 #define _COGL_RETURN_START do {
@@ -243,7 +243,7 @@ _cogl_util_popcountl (unsigned long num)
  */
 CoglPixelFormat
 _cogl_util_pixel_format_from_masks (unsigned long r_mask,
-                                    unsigned long g_mask,
+                                    unsigned long u_mask,
                                     unsigned long b_mask,
                                     int depth, int bpp,
                                     int byte_order);
diff --git a/cogl/cogl-vector.c b/cogl/cogl-vector.c
index eadf483..f937ccd 100644
--- a/cogl/cogl-vector.c
+++ b/cogl/cogl-vector.c
@@ -36,7 +36,7 @@
 #include <cogl-util.h>
 #include <cogl-vector.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <math.h>
 #include <string.h>
 
@@ -97,14 +97,14 @@ float *
 cogl_vector3_copy (const float *vector)
 {
   if (vector)
-    return g_slice_copy (sizeof (float) * 3, vector);
+    return u_slice_copy (sizeof (float) * 3, vector);
   return NULL;
 }
 
 void
 cogl_vector3_free (float *vector)
 {
-  g_slice_free1 (sizeof (float) * 3, vector);
+  u_slice_free1 (sizeof (float) * 3, vector);
 }
 
 void
@@ -239,14 +239,14 @@ float *
 cogl_vector4_copy (float *vector)
 {
   if (vector)
-    return g_slice_dup (CoglVector4, vector);
+    return u_slice_dup (CoglVector4, vector);
   return NULL;
 }
 
 void
 cogl_vector4_free (float *vector)
 {
-  g_slice_free (CoglVector4, vector);
+  u_slice_free (CoglVector4, vector);
 }
 
 void
diff --git a/cogl/cogl-xlib-renderer.c b/cogl/cogl-xlib-renderer.c
index 8d90da1..9c44a9c 100644
--- a/cogl/cogl-xlib-renderer.c
+++ b/cogl/cogl-xlib-renderer.c
@@ -53,12 +53,12 @@
 #include <string.h>
 
 static char *_cogl_x11_display_name = NULL;
-static GList *_cogl_xlib_renderers = NULL;
+static UList *_cogl_xlib_renderers = NULL;
 
 static void
 destroy_xlib_renderer_data (void *user_data)
 {
-  g_slice_free (CoglXlibRenderer, user_data);
+  u_slice_free (CoglXlibRenderer, user_data);
 }
 
 CoglXlibRenderer *
@@ -77,7 +77,7 @@ _cogl_xlib_renderer_get_data (CoglRenderer *renderer)
 
   if (data == NULL)
     {
-      data = g_slice_new0 (CoglXlibRenderer);
+      data = u_slice_new0 (CoglXlibRenderer);
 
       cogl_object_set_user_data (COGL_OBJECT (renderer),
                                  &key,
@@ -91,25 +91,25 @@ _cogl_xlib_renderer_get_data (CoglRenderer *renderer)
 static void
 register_xlib_renderer (CoglRenderer *renderer)
 {
-  GList *l;
+  UList *l;
 
   for (l = _cogl_xlib_renderers; l; l = l->next)
     if (l->data == renderer)
       return;
 
-  _cogl_xlib_renderers = g_list_prepend (_cogl_xlib_renderers, renderer);
+  _cogl_xlib_renderers = u_list_prepend (_cogl_xlib_renderers, renderer);
 }
 
 static void
 unregister_xlib_renderer (CoglRenderer *renderer)
 {
-  _cogl_xlib_renderers = g_list_remove (_cogl_xlib_renderers, renderer);
+  _cogl_xlib_renderers = u_list_remove (_cogl_xlib_renderers, renderer);
 }
 
 static CoglRenderer *
 get_renderer_for_xdisplay (Display *xdpy)
 {
-  GList *l;
+  UList *l;
 
   for (l = _cogl_xlib_renderers; l; l = l->next)
     {
@@ -134,7 +134,7 @@ error_handler (Display *xdpy,
   renderer = get_renderer_for_xdisplay (xdpy);
 
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
-  g_assert (xlib_renderer->trap_state);
+  u_assert (xlib_renderer->trap_state);
 
   xlib_renderer->trap_state->trapped_error_code = error->error_code;
 
@@ -163,7 +163,7 @@ _cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer,
   CoglXlibRenderer *xlib_renderer;
 
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
-  g_assert (state == xlib_renderer->trap_state);
+  u_assert (state == xlib_renderer->trap_state);
 
   XSetErrorHandler (state->old_error_handler);
 
@@ -232,8 +232,8 @@ update_outputs (CoglRenderer *renderer,
   XRRScreenResources *resources;
   CoglXlibTrapState state;
   CoglBool error = FALSE;
-  GList *new_outputs = NULL;
-  GList *l, *m;
+  UList *new_outputs = NULL;
+  UList *l, *m;
   CoglBool changed = FALSE;
   int i;
 
@@ -330,7 +330,7 @@ update_outputs (CoglRenderer *renderer,
             output->subpixel_order = subpixel_map[j][output->subpixel_order];
         }
 
-      new_outputs = g_list_prepend (new_outputs, output);
+      new_outputs = u_list_prepend (new_outputs, output);
 
     next:
       if (crtc_info != NULL)
@@ -344,7 +344,7 @@ update_outputs (CoglRenderer *renderer,
 
   if (!error)
     {
-      new_outputs = g_list_sort (new_outputs, (GCompareFunc)compare_outputs);
+      new_outputs = u_list_sort (new_outputs, (GCompareFunc)compare_outputs);
 
       l = new_outputs;
       m = renderer->outputs;
@@ -364,12 +364,12 @@ update_outputs (CoglRenderer *renderer,
 
           if (cmp == 0)
             {
-              GList *m_next = m->next;
+              UList *m_next = m->next;
 
               if (!_cogl_output_values_equal (output_l, output_m))
                 {
-                  renderer->outputs = g_list_remove_link (renderer->outputs, m);
-                  renderer->outputs = g_list_insert_before (renderer->outputs,
+                  renderer->outputs = u_list_remove_link (renderer->outputs, m);
+                  renderer->outputs = u_list_insert_before (renderer->outputs,
                                                             m_next, output_l);
                   cogl_object_ref (output_l);
 
@@ -382,22 +382,22 @@ update_outputs (CoglRenderer *renderer,
           else if (cmp < 0)
             {
               renderer->outputs =
-                g_list_insert_before (renderer->outputs, m, output_l);
+                u_list_insert_before (renderer->outputs, m, output_l);
               cogl_object_ref (output_l);
               changed = TRUE;
               l = l->next;
             }
           else
             {
-              GList *m_next = m->next;
-              renderer->outputs = g_list_remove_link (renderer->outputs, m);
+              UList *m_next = m->next;
+              renderer->outputs = u_list_remove_link (renderer->outputs, m);
               changed = TRUE;
               m = m_next;
             }
         }
     }
 
-  g_list_free_full (new_outputs, (GDestroyNotify)cogl_object_unref);
+  u_list_free_full (new_outputs, (UDestroyNotify)cogl_object_unref);
   _cogl_xlib_renderer_untrap_errors (renderer, &state);
 
   if (changed)
@@ -561,7 +561,7 @@ _cogl_xlib_renderer_disconnect (CoglRenderer *renderer)
   CoglXlibRenderer *xlib_renderer =
     _cogl_xlib_renderer_get_data (renderer);
 
-  g_list_free_full (renderer->outputs, (GDestroyNotify)cogl_object_unref);
+  u_list_free_full (renderer->outputs, (UDestroyNotify)cogl_object_unref);
   renderer->outputs = NULL;
 
   if (!renderer->foreign_xdpy && xlib_renderer->xdpy)
@@ -632,7 +632,7 @@ _cogl_xlib_renderer_output_for_rectangle (CoglRenderer *renderer,
 {
   int max_overlap = 0;
   CoglOutput *max_overlapped = NULL;
-  GList *l;
+  UList *l;
   int xa1 = x, xa2 = x + width;
   int ya1 = y, ya2 = y + height;
 
diff --git a/cogl/cogl.c b/cogl/cogl.c
index ab89a6c..e285b22 100644
--- a/cogl/cogl.c
+++ b/cogl/cogl.c
@@ -103,7 +103,7 @@ cogl_foreach_feature (CoglContext *ctx,
 void
 _cogl_flush (CoglContext *ctx)
 {
-  GList *l;
+  UList *l;
 
   for (l = ctx->framebuffers; l; l = l->next)
     _cogl_framebuffer_flush_journal (l->data);
@@ -112,7 +112,7 @@ _cogl_flush (CoglContext *ctx)
 uint32_t
 _cogl_driver_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-driver-error-quark");
+  return u_quark_from_static_string ("cogl-driver-error-quark");
 }
 
 /* Scale from OpenGL normalized device coordinates (ranging from -1 to 1)
@@ -158,7 +158,7 @@ _cogl_transform_point (const CoglMatrix *matrix_mv,
 uint32_t
 _cogl_system_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-system-error-quark");
+  return u_quark_from_static_string ("cogl-system-error-quark");
 }
 
 void
@@ -173,10 +173,6 @@ _cogl_init (void)
       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 #endif
 
-#ifdef COGL_HAS_GTYPE_SUPPORT
-      g_type_init ();
-#endif
-
       _cogl_config_read ();
       _cogl_debug_check_environment ();
       initialized = TRUE;
diff --git a/cogl/driver/gl/cogl-attribute-gl.c b/cogl/driver/gl/cogl-attribute-gl.c
index 438b0ff..261dd64 100644
--- a/cogl/driver/gl/cogl-attribute-gl.c
+++ b/cogl/driver/gl/cogl-attribute-gl.c
@@ -226,7 +226,7 @@ setup_generic_const_attribute (CoglContext *context,
                                         attribute->d.constant.boxed.v.matrix));
       break;
     default:
-      g_warn_if_reached ();
+      u_warn_if_reached ();
     }
 }
 
@@ -294,7 +294,7 @@ setup_legacy_buffered_attribute (CoglContext *ctx,
 #endif
       break;
     default:
-      g_warn_if_reached ();
+      u_warn_if_reached ();
     }
 }
 
@@ -355,7 +355,7 @@ setup_legacy_const_attribute (CoglContext *ctx,
           GE (ctx, glVertex4f (vector[0], vector[1], vector[2], vector[3]));
           break;
         default:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
         }
     }
 }
@@ -423,7 +423,7 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
         break;
       }
 
-  if (G_UNLIKELY (layers_state->options.flags))
+  if (U_UNLIKELY (layers_state->options.flags))
     {
       /* If we haven't already created a derived pipeline... */
       if (!copy)
@@ -446,13 +446,13 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
        *                 sizeof (options) != 0)
        *       {
        *         cogl_object_unref (overrides->weak_pipeline);
-       *         g_slice_free (Overrides, overrides);
+       *         u_slice_free (Overrides, overrides);
        *         overrides = NULL;
        *       }
        *   }
        * if (!overrides)
        *   {
-       *     overrides = g_slice_new (Overrides);
+       *     overrides = u_slice_new (Overrides);
        *     overrides->weak_pipeline =
        *       cogl_pipeline_weak_copy (pipeline);
        *     _cogl_pipeline_apply_overrides (overrides->weak_pipeline,
diff --git a/cogl/driver/gl/cogl-buffer-gl.c b/cogl/driver/gl/cogl-buffer-gl.c
index 030b799..332c8c0 100644
--- a/cogl/driver/gl/cogl-buffer-gl.c
+++ b/cogl/driver/gl/cogl-buffer-gl.c
@@ -114,7 +114,7 @@ update_hints_to_gl_enum (CoglBuffer *buffer)
 #endif
     }
 
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 }
 
 static GLenum
@@ -131,7 +131,7 @@ convert_bind_target_to_gl_target (CoglBufferBindTarget target)
       case COGL_BUFFER_BIND_TARGET_INDEX_BUFFER:
         return GL_ELEMENT_ARRAY_BUFFER;
       default:
-        g_return_val_if_reached (COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK);
+        u_return_val_if_reached (COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK);
     }
 }
 
diff --git a/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/driver/gl/cogl-clip-stack-gl.c
index e27db5d..d833031 100644
--- a/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -122,7 +122,7 @@ set_clip_plane (CoglFramebuffer *framebuffer,
   switch (ctx->driver)
     {
     default:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       break;
 
     case COGL_DRIVER_GLES1:
diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
index 56c04a9..c0c83ff 100644
--- a/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -41,7 +41,7 @@
 #include "cogl-texture-gl-private.h"
 #include "cogl-texture-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 #ifndef GL_FRAMEBUFFER
@@ -124,7 +124,7 @@ _cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
 {
   float gl_viewport_y;
 
-  g_assert (framebuffer->viewport_width >=0 &&
+  u_assert (framebuffer->viewport_width >=0 &&
             framebuffer->viewport_height >=0);
 
   /* Convert the Cogl viewport y offset to an OpenGL viewport y offset
@@ -315,9 +315,9 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
     return;
 
   /* Lazily ensure the framebuffers have been allocated */
-  if (G_UNLIKELY (!draw_buffer->allocated))
+  if (U_UNLIKELY (!draw_buffer->allocated))
     cogl_framebuffer_allocate (draw_buffer, NULL);
-  if (G_UNLIKELY (!read_buffer->allocated))
+  if (U_UNLIKELY (!read_buffer->allocated))
     cogl_framebuffer_allocate (read_buffer, NULL);
 
   /* We handle buffer binding separately since the method depends on whether
@@ -378,7 +378,7 @@ _cogl_framebuffer_gl_flush_state (CoglFramebuffer *draw_buffer,
            * be taken into account when flushing the pipeline's depth state. */
           break;
         default:
-          g_warn_if_reached ();
+          u_warn_if_reached ();
         }
     }
   COGL_FLAGS_FOREACH_END;
@@ -413,7 +413,7 @@ attach_depth_texture (CoglContext *ctx,
     {
       /* attach a GL_DEPTH_STENCIL texture to the GL_DEPTH_ATTACHMENT and
        * GL_STENCIL_ATTACHMENT attachement points */
-      g_assert (_cogl_texture_get_format (depth_texture) ==
+      u_assert (_cogl_texture_get_format (depth_texture) ==
                 COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8);
 
       cogl_texture_get_gl_texture (depth_texture,
@@ -432,7 +432,7 @@ attach_depth_texture (CoglContext *ctx,
     {
       /* attach a newly created GL_DEPTH_COMPONENT16 texture to the
        * GL_DEPTH_ATTACHMENT attachement point */
-      g_assert (_cogl_texture_get_format (depth_texture) ==
+      u_assert (_cogl_texture_get_format (depth_texture) ==
                 COGL_PIXEL_FORMAT_DEPTH_16);
 
       cogl_texture_get_gl_texture (COGL_TEXTURE (depth_texture),
@@ -447,14 +447,14 @@ attach_depth_texture (CoglContext *ctx,
   return COGL_TEXTURE (depth_texture);
 }
 
-static GList *
+static UList *
 try_creating_renderbuffers (CoglContext *ctx,
                             int width,
                             int height,
                             CoglOffscreenAllocateFlags flags,
                             int n_samples)
 {
-  GList *renderbuffers = NULL;
+  UList *renderbuffers = NULL;
   GLuint gl_depth_stencil_handle;
 
   if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_DEPTH_STENCIL)
@@ -514,7 +514,7 @@ try_creating_renderbuffers (CoglContext *ctx,
                                           gl_depth_stencil_handle));
 #endif
       renderbuffers =
-        g_list_prepend (renderbuffers,
+        u_list_prepend (renderbuffers,
                         GUINT_TO_POINTER (gl_depth_stencil_handle));
     }
 
@@ -539,7 +539,7 @@ try_creating_renderbuffers (CoglContext *ctx,
                                           GL_DEPTH_ATTACHMENT,
                                           GL_RENDERBUFFER, gl_depth_handle));
       renderbuffers =
-        g_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_depth_handle));
+        u_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_depth_handle));
     }
 
   if (flags & COGL_OFFSCREEN_ALLOCATE_FLAG_STENCIL)
@@ -561,16 +561,16 @@ try_creating_renderbuffers (CoglContext *ctx,
                                           GL_STENCIL_ATTACHMENT,
                                           GL_RENDERBUFFER, gl_stencil_handle));
       renderbuffers =
-        g_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_stencil_handle));
+        u_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_stencil_handle));
     }
 
   return renderbuffers;
 }
 
 static void
-delete_renderbuffers (CoglContext *ctx, GList *renderbuffers)
+delete_renderbuffers (CoglContext *ctx, UList *renderbuffers)
 {
-  GList *l;
+  UList *l;
 
   for (l = renderbuffers; l; l = l->next)
     {
@@ -578,7 +578,7 @@ delete_renderbuffers (CoglContext *ctx, GList *renderbuffers)
       GE (ctx, glDeleteRenderbuffers (1, &renderbuffer));
     }
 
-  g_list_free (renderbuffers);
+  u_list_free (renderbuffers);
 }
 
 /*
@@ -953,7 +953,7 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
 {
   CoglContext *ctx = framebuffer->context;
 
-  if (G_LIKELY (!framebuffer->dirty_bitmasks))
+  if (U_LIKELY (!framebuffer->dirty_bitmasks))
     return;
 
   cogl_framebuffer_allocate (framebuffer, NULL);
@@ -988,7 +988,7 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
           };
       int i;
 
-      for (i = 0; i < G_N_ELEMENTS (params); i++)
+      for (i = 0; i < U_N_ELEMENTS (params); i++)
         {
           int *value =
             (int *) ((uint8_t *) &framebuffer->bits + params[i].offset);
@@ -1118,7 +1118,7 @@ sizeof_index_type (CoglIndicesType type)
     case COGL_INDICES_TYPE_UNSIGNED_INT:
       return 4;
     }
-  g_return_val_if_reached (0);
+  u_return_val_if_reached (0);
 }
 
 void
@@ -1510,7 +1510,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
       if (pixels == NULL)
         goto EXIT;
 
-      temprow = g_alloca (rowstride * sizeof (uint8_t));
+      temprow = u_alloca (rowstride * sizeof (uint8_t));
 
       /* vertically flip the buffer in-place */
       for (y = 0; y < height / 2; y++)
diff --git a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
index 12d14ff..bbe3135 100644
--- a/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
+++ b/cogl/driver/gl/cogl-pipeline-fragend-fixed.c
@@ -48,7 +48,7 @@
 #include "cogl-blend-string.h"
 #include "cogl-profile.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 #ifndef GL_TEXTURE_RECTANGLE_ARB
@@ -64,7 +64,7 @@ _cogl_disable_texture_unit (int unit_index)
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
-  unit = &g_array_index (ctx->texture_units, CoglTextureUnit, unit_index);
+  unit = &u_array_index (ctx->texture_units, CoglTextureUnit, unit_index);
 
   if (unit->enabled_gl_target)
     {
@@ -141,7 +141,7 @@ translate_sources (CoglPipeline *pipeline,
               static CoglBool warning_seen = FALSE;
               if (!warning_seen)
                 {
-                  g_warning ("The application is trying to use a texture "
+                  u_warning ("The application is trying to use a texture "
                              "combine with a layer number that does not exist");
                   warning_seen = TRUE;
                 }
@@ -175,7 +175,7 @@ _cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
    */
   _cogl_set_active_texture_unit (unit_index);
 
-  if (G_UNLIKELY (unit_index >= get_max_texture_units ()))
+  if (U_UNLIKELY (unit_index >= get_max_texture_units ()))
     {
       _cogl_disable_texture_unit (unit_index);
       /* TODO: although this isn't considered an error that
@@ -218,7 +218,7 @@ _cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
             GE (ctx, glDisable (unit->enabled_gl_target));
 
           /* Enable the new target */
-          if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
+          if (!U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
             {
               GE (ctx, glEnable (gl_target));
               unit->enabled_gl_target = gl_target;
@@ -232,7 +232,7 @@ _cogl_pipeline_fragend_fixed_add_layer (CoglPipeline *pipeline,
        * texture unit has been disabled for some time so we need to assert that
        * it's enabled now.
        */
-      if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)) &&
+      if (!U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)) &&
           unit->enabled_gl_target == 0)
         {
           _cogl_set_active_texture_unit (unit_index);
diff --git a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index 29cea56..db05154 100644
--- a/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
+++ b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
@@ -54,7 +54,7 @@
 #include "cogl-pipeline-fragend-glsl-private.h"
 #include "cogl-glsl-shader-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 
 /*
  * GL/GLES compatability defines for pipeline thingies:
@@ -91,7 +91,7 @@ typedef struct
   int ref_count;
 
   GLuint gl_shader;
-  GString *header, *source;
+  UString *header, *source;
   UnitState *unit_state;
 
   /* List of layers that we haven't generated code for yet. These are
@@ -115,9 +115,9 @@ shader_state_new (int n_layers,
 {
   CoglPipelineShaderState *shader_state;
 
-  shader_state = g_slice_new0 (CoglPipelineShaderState);
+  shader_state = u_slice_new0 (CoglPipelineShaderState);
   shader_state->ref_count = 1;
-  shader_state->unit_state = g_new0 (UnitState, n_layers);
+  shader_state->unit_state = u_new0 (UnitState, n_layers);
   shader_state->cache_entry = cache_entry;
 
   return shader_state;
@@ -146,9 +146,9 @@ destroy_shader_state (void *user_data,
       if (shader_state->gl_shader)
         GE( ctx, glDeleteShader (shader_state->gl_shader) );
 
-      g_free (shader_state->unit_state);
+      u_free (shader_state->unit_state);
 
-      g_slice_free (CoglPipelineShaderState, shader_state);
+      u_slice_free (CoglPipelineShaderState, shader_state);
     }
 }
 
@@ -215,7 +215,7 @@ static CoglBool
 has_replace_hook (CoglPipelineLayer *layer,
                   CoglSnippetHook hook)
 {
-  GList *l;
+  UList *l;
 
   for (l = get_layer_fragment_snippets (layer)->entries; l; l = l->next)
     {
@@ -239,7 +239,7 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
 
   _cogl_gl_util_get_texture_target_string (texture_type, &target_string, NULL);
 
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "varying vec4 _cogl_tex_coord%i;\n"
                           "#define cogl_tex_coord%i_in _cogl_tex_coord%i\n"
                           "uniform sampler%s cogl_sampler%i;\n",
@@ -319,7 +319,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
         {
           /* Check if there is already a similar cached pipeline whose
              shader state we can share */
-          if (G_LIKELY (!(COGL_DEBUG_ENABLED
+          if (U_LIKELY (!(COGL_DEBUG_ENABLED
                           (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
             {
               cache_entry =
@@ -356,13 +356,13 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
      without a gl_shader because this is the first time we've
      encountered it. */
 
-  /* We reuse two grow-only GStrings for code-gen. One string
+  /* We reuse two grow-only UStrings for code-gen. One string
      contains the uniform and attribute declarations while the
      other contains the main function. We need two strings
      because we need to dynamically declare attributes as the
      add_layer callback is invoked */
-  g_string_set_size (ctx->codegen_header_buffer, 0);
-  g_string_set_size (ctx->codegen_source_buffer, 0);
+  u_string_set_size (ctx->codegen_header_buffer, 0);
+  u_string_set_size (ctx->codegen_source_buffer, 0);
   shader_state->header = ctx->codegen_header_buffer;
   shader_state->source = ctx->codegen_source_buffer;
   _cogl_list_init (&shader_state->layers);
@@ -370,7 +370,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
   add_layer_declarations (pipeline, shader_state);
   add_global_declarations (pipeline, shader_state);
 
-  g_string_append (shader_state->source,
+  u_string_append (shader_state->source,
                    "void\n"
                    "cogl_generated_source ()\n"
                    "{\n");
@@ -388,7 +388,7 @@ add_constant_lookup (CoglPipelineShaderState *shader_state,
                      CoglPipelineLayer *layer,
                      const char *swizzle)
 {
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "_cogl_layer_constant_%i.%s",
                           layer->index, swizzle);
 }
@@ -416,11 +416,11 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
 
   shader_state->unit_state[unit_index].sampled = TRUE;
 
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "vec4 cogl_texel%i;\n",
                           layer->index);
 
-  g_string_append_printf (shader_state->source,
+  u_string_append_printf (shader_state->source,
                           "  cogl_texel%i = cogl_texture_lookup%i ("
                           "cogl_sampler%i, ",
                           layer->index,
@@ -429,20 +429,20 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
 
   if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline,
                                                            layer->index))
-    g_string_append_printf (shader_state->source,
+    u_string_append_printf (shader_state->source,
                             "vec4 (cogl_point_coord, 0.0, 1.0)");
   else
-    g_string_append_printf (shader_state->source,
+    u_string_append_printf (shader_state->source,
                             "cogl_tex_coord%i_in",
                             layer->index);
 
-  g_string_append (shader_state->source, ");\n");
+  u_string_append (shader_state->source, ");\n");
 
   /* There's no need to generate the real texture lookup if it's going
      to be replaced */
   if (!has_replace_hook (layer, COGL_SNIPPET_HOOK_TEXTURE_LOOKUP))
     {
-      g_string_append_printf (shader_state->header,
+      u_string_append_printf (shader_state->header,
                               "vec4\n"
                               "cogl_real_texture_lookup%i (sampler%s tex,\n"
                               "                            vec4 coords)\n"
@@ -451,41 +451,41 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
                               layer->index,
                               target_string);
 
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
-        g_string_append (shader_state->header,
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
+        u_string_append (shader_state->header,
                          "vec4 (1.0, 1.0, 1.0, 1.0);\n");
       else
-        g_string_append_printf (shader_state->header,
+        u_string_append_printf (shader_state->header,
                                 "texture%s (tex, coords.%s);\n",
                                 target_string, tex_coord_swizzle);
 
-      g_string_append (shader_state->header, "}\n");
+      u_string_append (shader_state->header, "}\n");
     }
 
   /* Wrap the texture lookup in any snippets that have been hooked */
   memset (&snippet_data, 0, sizeof (snippet_data));
   snippet_data.snippets = get_layer_fragment_snippets (layer);
   snippet_data.hook = COGL_SNIPPET_HOOK_TEXTURE_LOOKUP;
-  snippet_data.chain_function = g_strdup_printf ("cogl_real_texture_lookup%i",
+  snippet_data.chain_function = u_strdup_printf ("cogl_real_texture_lookup%i",
                                                  layer->index);
-  snippet_data.final_name = g_strdup_printf ("cogl_texture_lookup%i",
+  snippet_data.final_name = u_strdup_printf ("cogl_texture_lookup%i",
                                              layer->index);
-  snippet_data.function_prefix = g_strdup_printf ("cogl_texture_lookup_hook%i",
+  snippet_data.function_prefix = u_strdup_printf ("cogl_texture_lookup_hook%i",
                                                   layer->index);
   snippet_data.return_type = "vec4";
   snippet_data.return_variable = "cogl_texel";
   snippet_data.arguments = "cogl_sampler, cogl_tex_coord";
   snippet_data.argument_declarations =
-    g_strdup_printf ("sampler%s cogl_sampler, vec4 cogl_tex_coord",
+    u_strdup_printf ("sampler%s cogl_sampler, vec4 cogl_tex_coord",
                      target_string);
   snippet_data.source_buf = shader_state->header;
 
   _cogl_pipeline_snippet_generate_code (&snippet_data);
 
-  g_free ((char *) snippet_data.chain_function);
-  g_free ((char *) snippet_data.final_name);
-  g_free ((char *) snippet_data.function_prefix);
-  g_free ((char *) snippet_data.argument_declarations);
+  u_free ((char *) snippet_data.chain_function);
+  u_free ((char *) snippet_data.final_name);
+  u_free ((char *) snippet_data.function_prefix);
+  u_free ((char *) snippet_data.argument_declarations);
 }
 
 static void
@@ -497,14 +497,14 @@ add_arg (CoglPipelineShaderState *shader_state,
          CoglPipelineCombineOp operand,
          const char *swizzle)
 {
-  GString *shader_source = shader_state->header;
+  UString *shader_source = shader_state->header;
   char alpha_swizzle[5] = "aaaa";
 
-  g_string_append_c (shader_source, '(');
+  u_string_append_c (shader_source, '(');
 
   if (operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR ||
       operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA)
-    g_string_append_printf (shader_source,
+    u_string_append_printf (shader_source,
                             "vec4(1.0, 1.0, 1.0, 1.0).%s - ",
                             swizzle);
 
@@ -520,7 +520,7 @@ add_arg (CoglPipelineShaderState *shader_state,
   switch (src)
     {
     case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE:
-      g_string_append_printf (shader_source,
+      u_string_append_printf (shader_source,
                               "cogl_texel%i.%s",
                               layer->index,
                               swizzle);
@@ -536,7 +536,7 @@ add_arg (CoglPipelineShaderState *shader_state,
     case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS:
       if (previous_layer_index >= 0)
         {
-          g_string_append_printf (shader_source,
+          u_string_append_printf (shader_source,
                                   "cogl_layer%i.%s",
                                   previous_layer_index,
                                   swizzle);
@@ -544,7 +544,7 @@ add_arg (CoglPipelineShaderState *shader_state,
         }
       /* flow through */
     case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR:
-      g_string_append_printf (shader_source, "cogl_color_in.%s", swizzle);
+      u_string_append_printf (shader_source, "cogl_color_in.%s", swizzle);
       break;
 
     default:
@@ -559,16 +559,16 @@ add_arg (CoglPipelineShaderState *shader_state,
             static CoglBool warning_seen = FALSE;
             if (!warning_seen)
               {
-                g_warning ("The application is trying to use a texture "
+                u_warning ("The application is trying to use a texture "
                            "combine with a layer number that does not exist");
                 warning_seen = TRUE;
               }
-            g_string_append_printf (shader_source,
+            u_string_append_printf (shader_source,
                                     "vec4 (1.0, 1.0, 1.0, 1.0).%s",
                                     swizzle);
           }
         else
-          g_string_append_printf (shader_source,
+          u_string_append_printf (shader_source,
                                   "cogl_texel%i.%s",
                                   other_layer->index,
                                   swizzle);
@@ -576,7 +576,7 @@ add_arg (CoglPipelineShaderState *shader_state,
       break;
     }
 
-  g_string_append_c (shader_source, ')');
+  u_string_append_c (shader_source, ')');
 }
 
 static void
@@ -599,7 +599,7 @@ ensure_arg_generated (CoglPipeline *pipeline,
         /* Create a sampler uniform for this layer if we haven't already */
         if (!shader_state->unit_state[unit_index].combine_constant_used)
           {
-            g_string_append_printf (shader_state->header,
+            u_string_append_printf (shader_state->header,
                                     "uniform vec4 _cogl_layer_constant_%i;\n",
                                     layer->index);
             shader_state->unit_state[unit_index].combine_constant_used = TRUE;
@@ -659,9 +659,9 @@ append_masked_combine (CoglPipeline *pipeline,
                        CoglPipelineCombineOp *op)
 {
   CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
-  GString *shader_source = shader_state->header;
+  UString *shader_source = shader_state->header;
 
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "  cogl_layer.%s = ",
                           swizzle);
 
@@ -675,7 +675,7 @@ append_masked_combine (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_FUNC_MODULATE:
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], swizzle);
-      g_string_append (shader_source, " * ");
+      u_string_append (shader_source, " * ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], swizzle);
       break;
@@ -683,7 +683,7 @@ append_masked_combine (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_FUNC_ADD:
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], swizzle);
-      g_string_append (shader_source, " + ");
+      u_string_append (shader_source, " + ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], swizzle);
       break;
@@ -691,10 +691,10 @@ append_masked_combine (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED:
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], swizzle);
-      g_string_append (shader_source, " + ");
+      u_string_append (shader_source, " + ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], swizzle);
-      g_string_append_printf (shader_source,
+      u_string_append_printf (shader_source,
                               " - vec4(0.5, 0.5, 0.5, 0.5).%s",
                               swizzle);
       break;
@@ -702,7 +702,7 @@ append_masked_combine (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT:
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], swizzle);
-      g_string_append (shader_source, " - ");
+      u_string_append (shader_source, " - ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], swizzle);
       break;
@@ -710,45 +710,45 @@ append_masked_combine (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_FUNC_INTERPOLATE:
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], swizzle);
-      g_string_append (shader_source, " * ");
+      u_string_append (shader_source, " * ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[2], op[2], swizzle);
-      g_string_append (shader_source, " + ");
+      u_string_append (shader_source, " + ");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], swizzle);
-      g_string_append_printf (shader_source,
+      u_string_append_printf (shader_source,
                               " * (vec4(1.0, 1.0, 1.0, 1.0).%s - ",
                               swizzle);
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[2], op[2], swizzle);
-      g_string_append_c (shader_source, ')');
+      u_string_append_c (shader_source, ')');
       break;
 
     case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB:
     case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA:
-      g_string_append (shader_source, "vec4(4.0 * ((");
+      u_string_append (shader_source, "vec4(4.0 * ((");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], "r");
-      g_string_append (shader_source, " - 0.5) * (");
+      u_string_append (shader_source, " - 0.5) * (");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], "r");
-      g_string_append (shader_source, " - 0.5) + (");
+      u_string_append (shader_source, " - 0.5) + (");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], "g");
-      g_string_append (shader_source, " - 0.5) * (");
+      u_string_append (shader_source, " - 0.5) * (");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], "g");
-      g_string_append (shader_source, " - 0.5) + (");
+      u_string_append (shader_source, " - 0.5) + (");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[0], op[0], "b");
-      g_string_append (shader_source, " - 0.5) * (");
+      u_string_append (shader_source, " - 0.5) * (");
       add_arg (shader_state, pipeline, layer, previous_layer_index,
                src[1], op[1], "b");
-      g_string_append_printf (shader_source, " - 0.5))).%s", swizzle);
+      u_string_append_printf (shader_source, " - 0.5))).%s", swizzle);
       break;
     }
 
-  g_string_append_printf (shader_source, ";\n");
+  u_string_append_printf (shader_source, ";\n");
 }
 
 static void
@@ -786,7 +786,7 @@ ensure_layer_generated (CoglPipeline *pipeline,
   big_state = combine_authority->big_state;
 
   /* Make a global variable for the result of the layer code */
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "vec4 cogl_layer%i;\n",
                           layer_index);
 
@@ -809,7 +809,7 @@ ensure_layer_generated (CoglPipeline *pipeline,
                             big_state->texture_combine_alpha_func,
                             big_state->texture_combine_alpha_src);
 
-      g_string_append_printf (shader_state->header,
+      u_string_append_printf (shader_state->header,
                               "vec4\n"
                               "cogl_real_generate_layer%i ()\n"
                               "{\n"
@@ -847,7 +847,7 @@ ensure_layer_generated (CoglPipeline *pipeline,
                                  big_state->texture_combine_alpha_op);
         }
 
-      g_string_append (shader_state->header,
+      u_string_append (shader_state->header,
                        "  return cogl_layer;\n"
                        "}\n");
     }
@@ -856,11 +856,11 @@ ensure_layer_generated (CoglPipeline *pipeline,
   memset (&snippet_data, 0, sizeof (snippet_data));
   snippet_data.snippets = get_layer_fragment_snippets (layer);
   snippet_data.hook = COGL_SNIPPET_HOOK_LAYER_FRAGMENT;
-  snippet_data.chain_function = g_strdup_printf ("cogl_real_generate_layer%i",
+  snippet_data.chain_function = u_strdup_printf ("cogl_real_generate_layer%i",
                                                  layer_index);
-  snippet_data.final_name = g_strdup_printf ("cogl_generate_layer%i",
+  snippet_data.final_name = u_strdup_printf ("cogl_generate_layer%i",
                                              layer_index);
-  snippet_data.function_prefix = g_strdup_printf ("cogl_generate_layer%i",
+  snippet_data.function_prefix = u_strdup_printf ("cogl_generate_layer%i",
                                                   layer_index);
   snippet_data.return_type = "vec4";
   snippet_data.return_variable = "cogl_layer";
@@ -868,16 +868,16 @@ ensure_layer_generated (CoglPipeline *pipeline,
 
   _cogl_pipeline_snippet_generate_code (&snippet_data);
 
-  g_free ((char *) snippet_data.chain_function);
-  g_free ((char *) snippet_data.final_name);
-  g_free ((char *) snippet_data.function_prefix);
+  u_free ((char *) snippet_data.chain_function);
+  u_free ((char *) snippet_data.final_name);
+  u_free ((char *) snippet_data.function_prefix);
 
-  g_string_append_printf (shader_state->source,
+  u_string_append_printf (shader_state->source,
                           "  cogl_layer%i = cogl_generate_layer%i ();\n",
                           layer_index,
                           layer_index);
 
-  g_slice_free (LayerData, layer_data);
+  u_slice_free (LayerData, layer_data);
 }
 
 static CoglBool
@@ -892,7 +892,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
     return TRUE;
 
   /* Store the layers in reverse order */
-  layer_data = g_slice_new (LayerData);
+  layer_data = u_slice_new (LayerData);
   layer_data->layer = layer;
 
   if (_cogl_list_empty (&shader_state->layers))
@@ -931,7 +931,7 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
   if (alpha_func == COGL_PIPELINE_ALPHA_FUNC_NEVER)
     {
       /* Always discard the fragment */
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "  discard;\n");
       return;
     }
@@ -939,40 +939,40 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
   /* For all of the other alpha functions we need a uniform for the
      reference */
 
-  g_string_append (shader_state->header,
+  u_string_append (shader_state->header,
                    "uniform float _cogl_alpha_test_ref;\n");
 
-  g_string_append (shader_state->source,
+  u_string_append (shader_state->source,
                    "  if (cogl_color_out.a ");
 
   switch (alpha_func)
     {
     case COGL_PIPELINE_ALPHA_FUNC_LESS:
-      g_string_append (shader_state->source, ">=");
+      u_string_append (shader_state->source, ">=");
       break;
     case COGL_PIPELINE_ALPHA_FUNC_EQUAL:
-      g_string_append (shader_state->source, "!=");
+      u_string_append (shader_state->source, "!=");
       break;
     case COGL_PIPELINE_ALPHA_FUNC_LEQUAL:
-      g_string_append (shader_state->source, ">");
+      u_string_append (shader_state->source, ">");
       break;
     case COGL_PIPELINE_ALPHA_FUNC_GREATER:
-      g_string_append (shader_state->source, "<=");
+      u_string_append (shader_state->source, "<=");
       break;
     case COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL:
-      g_string_append (shader_state->source, "==");
+      u_string_append (shader_state->source, "==");
       break;
     case COGL_PIPELINE_ALPHA_FUNC_GEQUAL:
-      g_string_append (shader_state->source, "< ");
+      u_string_append (shader_state->source, "< ");
       break;
 
     case COGL_PIPELINE_ALPHA_FUNC_ALWAYS:
     case COGL_PIPELINE_ALPHA_FUNC_NEVER:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       break;
     }
 
-  g_string_append (shader_state->source,
+  u_string_append (shader_state->source,
                    " _cogl_alpha_test_ref)\n    discard;\n");
 }
 
@@ -1016,7 +1016,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
           last_layer = layer_data->layer;
 
           ensure_layer_generated (pipeline, last_layer->index);
-          g_string_append_printf (shader_state->source,
+          u_string_append_printf (shader_state->source,
                                   "  cogl_color_out = cogl_layer%i;\n",
                                   last_layer->index);
 
@@ -1024,10 +1024,10 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
                                     tmp,
                                     &shader_state->layers,
                                     link)
-            g_slice_free (LayerData, layer_data);
+            u_slice_free (LayerData, layer_data);
         }
       else
-        g_string_append (shader_state->source,
+        u_string_append (shader_state->source,
                          "  cogl_color_out = cogl_color_in;\n");
 
 #if defined(HAVE_COGL_GLES2) || defined (HAVE_COGL_GL)
@@ -1036,7 +1036,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
 #endif
 
       /* Close the function surrounding the generated fragment processing */
-      g_string_append (shader_state->source, "}\n");
+      u_string_append (shader_state->source, "}\n");
 
       /* Add all of the hooks for fragment processing */
       memset (&snippet_data, 0, sizeof (snippet_data));
@@ -1069,9 +1069,9 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
           char *shader_log;
 
           GE( ctx, glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len) );
-          shader_log = g_alloca (len);
+          shader_log = u_alloca (len);
           GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) );
-          g_warning ("Shader compilation failed:\n%s", shader_log);
+          u_warning ("Shader compilation failed:\n%s", shader_log);
         }
 
       shader_state->header = NULL;
diff --git a/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c
index cd6fd44..8ccc87b 100644
--- a/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -47,7 +47,7 @@
 
 #include <test-fixtures/test-unit.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 /*
@@ -103,17 +103,17 @@ _cogl_get_texture_unit (int index_)
     {
       int i;
       int prev_len = ctx->texture_units->len;
-      ctx->texture_units = g_array_set_size (ctx->texture_units, index_ + 1);
+      ctx->texture_units = u_array_set_size (ctx->texture_units, index_ + 1);
       for (i = prev_len; i <= index_; i++)
         {
           CoglTextureUnit *unit =
-            &g_array_index (ctx->texture_units, CoglTextureUnit, i);
+            &u_array_index (ctx->texture_units, CoglTextureUnit, i);
 
           texture_unit_init (ctx, unit, i);
         }
     }
 
-  return &g_array_index (ctx->texture_units, CoglTextureUnit, index_);
+  return &u_array_index (ctx->texture_units, CoglTextureUnit, index_);
 }
 
 void
@@ -126,10 +126,10 @@ _cogl_destroy_texture_units (void)
   for (i = 0; i < ctx->texture_units->len; i++)
     {
       CoglTextureUnit *unit =
-        &g_array_index (ctx->texture_units, CoglTextureUnit, i);
+        &u_array_index (ctx->texture_units, CoglTextureUnit, i);
       texture_unit_free (unit);
     }
-  g_array_free (ctx->texture_units, TRUE);
+  u_array_free (ctx->texture_units, TRUE);
 }
 
 void
@@ -207,7 +207,7 @@ _cogl_delete_gl_texture (GLuint gl_texture)
   for (i = 0; i < ctx->texture_units->len; i++)
     {
       CoglTextureUnit *unit =
-        &g_array_index (ctx->texture_units, CoglTextureUnit, i);
+        &u_array_index (ctx->texture_units, CoglTextureUnit, i);
 
       if (unit->gl_texture == gl_texture)
         {
@@ -235,7 +235,7 @@ _cogl_pipeline_texture_storage_change_notify (CoglTexture *texture)
   for (i = 0; i < ctx->texture_units->len; i++)
     {
       CoglTextureUnit *unit =
-        &g_array_index (ctx->texture_units, CoglTextureUnit, i);
+        &u_array_index (ctx->texture_units, CoglTextureUnit, i);
 
       if (unit->layer &&
           _cogl_pipeline_layer_get_texture (unit->layer) == texture)
@@ -321,13 +321,13 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
 
 #else
 
-      g_warning ("Unexpected use of GLSL fragend!");
+      u_warning ("Unexpected use of GLSL fragend!");
 
 #endif /* COGL_PIPELINE_FRAGEND_GLSL */
     }
 #ifndef COGL_PIPELINE_FRAGEND_ARBFP
   else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP)
-    g_warning ("Unexpected use of ARBFP fragend!");
+    u_warning ("Unexpected use of ARBFP fragend!");
 #endif /* COGL_PIPELINE_FRAGEND_ARBFP */
 
   ctx->current_fragment_program_type = type;
@@ -354,7 +354,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
 
         case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
           /* It doesn't make sense to enable ARBfp for the vertex program */
-          g_assert_not_reached ();
+          u_assert_not_reached ();
           break;
 
         case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
@@ -367,7 +367,7 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
         {
         case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
           /* It doesn't make sense to enable ARBfp for the vertex program */
-          g_assert_not_reached ();
+          u_assert_not_reached ();
           break;
 
         case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
@@ -384,13 +384,13 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
 
 #else
 
-      g_warning ("Unexpected use of GLSL vertend!");
+      u_warning ("Unexpected use of GLSL vertend!");
 
 #endif /* COGL_PIPELINE_VERTEND_GLSL */
     }
 #ifndef COGL_PIPELINE_VERTEND_ARBFP
   else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP)
-    g_warning ("Unexpected use of ARBFP vertend!");
+    u_warning ("Unexpected use of ARBFP vertend!");
 #endif /* COGL_PIPELINE_VERTEND_ARBFP */
 
   ctx->current_vertex_program_type = type;
@@ -464,21 +464,21 @@ UNIT_TEST (check_gl_blend_enable,
   CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
 
   /* By default blending should be disabled */
-  g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+  u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
 
   cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1);
   _cogl_framebuffer_flush_journal (test_fb);
 
   /* After drawing an opaque rectangle blending should still be
    * disabled */
-  g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+  u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
 
   cogl_pipeline_set_color4f (pipeline, 0, 0, 0, 0);
   cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1);
   _cogl_framebuffer_flush_journal (test_fb);
 
   /* After drawing a transparent rectangle blending should be enabled */
-  g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 1);
+  u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 1);
 
   cogl_pipeline_set_blend (pipeline, "RGBA=ADD(SRC_COLOR, 0)", NULL);
   cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 1, 1);
@@ -486,7 +486,7 @@ UNIT_TEST (check_gl_blend_enable,
 
   /* After setting a blend string that effectively disables blending
    * then blending should be disabled */
-  g_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+  u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
 }
 
 static void
@@ -642,7 +642,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
           switch (cull_face_state->mode)
             {
             case COGL_PIPELINE_CULL_FACE_MODE_NONE:
-              g_assert_not_reached ();
+              u_assert_not_reached ();
 
             case COGL_PIPELINE_CULL_FACE_MODE_FRONT:
               GE( ctx, glCullFace (GL_FRONT) );
@@ -707,7 +707,7 @@ get_max_activateable_texture_units (void)
 {
   _COGL_GET_CONTEXT (ctx, 0);
 
-  if (G_UNLIKELY (ctx->max_activateable_texture_units == -1))
+  if (U_UNLIKELY (ctx->max_activateable_texture_units == -1))
     {
       GLint values[3];
       int n_values = 0;
@@ -764,7 +764,7 @@ get_max_activateable_texture_units (void)
         }
 #endif
 
-      g_assert (n_values <= G_N_ELEMENTS (values) &&
+      u_assert (n_values <= U_N_ELEMENTS (values) &&
                 n_values > 0);
 
       /* Use the maximum value */
@@ -797,13 +797,13 @@ flush_layers_common_gl_state_cb (CoglPipelineLayer *layer, void *user_data)
   /* There may not be enough texture units so we can bail out if
    * that's the case...
    */
-  if (G_UNLIKELY (unit_index >= get_max_activateable_texture_units ()))
+  if (U_UNLIKELY (unit_index >= get_max_activateable_texture_units ()))
     {
       static CoglBool shown_warning = FALSE;
 
       if (!shown_warning)
         {
-          g_warning ("Your hardware does not have enough texture units"
+          u_warning ("Your hardware does not have enough texture units"
                      "to handle this many texture layers");
           shown_warning = TRUE;
         }
@@ -1016,7 +1016,7 @@ foreach_texture_unit_update_filter_and_wrap_modes (void)
   for (i = 0; i < ctx->texture_units->len; i++)
     {
       CoglTextureUnit *unit =
-        &g_array_index (ctx->texture_units, CoglTextureUnit, i);
+        &u_array_index (ctx->texture_units, CoglTextureUnit, i);
 
       if (unit->layer)
         {
@@ -1098,7 +1098,7 @@ vertend_add_layer_cb (CoglPipelineLayer *layer,
 
   /* Either generate per layer code snippets or setup the
    * fixed function glTexEnv for each layer... */
-  if (G_LIKELY (vertend->add_layer (pipeline,
+  if (U_LIKELY (vertend->add_layer (pipeline,
                                     layer,
                                     state->layer_differences[unit_index],
                                     state->framebuffer)))
@@ -1123,7 +1123,7 @@ fragend_add_layer_cb (CoglPipelineLayer *layer,
 
   /* Either generate per layer code snippets or setup the
    * fixed function glTexEnv for each layer... */
-  if (G_LIKELY (fragend->add_layer (pipeline,
+  if (U_LIKELY (fragend->add_layer (pipeline,
                                     layer,
                                     state->layer_differences[unit_index])))
     state->added_layer = TRUE;
@@ -1268,7 +1268,7 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
   if (n_layers)
     {
       CoglPipelineCompareLayersState state;
-      layer_differences = g_alloca (sizeof (unsigned long) * n_layers);
+      layer_differences = u_alloca (sizeof (unsigned long) * n_layers);
       memset (layer_differences, 0, sizeof (unsigned long) * n_layers);
       state.i = 0;
       state.layer_differences = layer_differences;
@@ -1325,7 +1325,7 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
 
       progend = _cogl_pipeline_progends[i];
 
-      if (G_UNLIKELY (!progend->start (pipeline)))
+      if (U_UNLIKELY (!progend->start (pipeline)))
         continue;
 
       vertend = _cogl_pipeline_vertends[progend->vertend];
@@ -1345,10 +1345,10 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
                                              vertend_add_layer_cb,
                                              &state);
 
-      if (G_UNLIKELY (state.error_adding_layer))
+      if (U_UNLIKELY (state.error_adding_layer))
         continue;
 
-      if (G_UNLIKELY (!vertend->end (pipeline, pipelines_difference)))
+      if (U_UNLIKELY (!vertend->end (pipeline, pipelines_difference)))
         continue;
 
       /* Now prepare the fragment processing state (fragend)
@@ -1369,17 +1369,17 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
                                              fragend_add_layer_cb,
                                              &state);
 
-      if (G_UNLIKELY (state.error_adding_layer))
+      if (U_UNLIKELY (state.error_adding_layer))
         continue;
 
       if (!state.added_layer)
         {
           if (fragend->passthrough &&
-              G_UNLIKELY (!fragend->passthrough (pipeline)))
+              U_UNLIKELY (!fragend->passthrough (pipeline)))
             continue;
         }
 
-      if (G_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
+      if (U_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
         continue;
 
       if (progend->end)
diff --git a/cogl/driver/gl/cogl-pipeline-progend-fixed.c b/cogl/driver/gl/cogl-pipeline-progend-fixed.c
index 34b98a7..f56e11f 100644
--- a/cogl/driver/gl/cogl-pipeline-progend-fixed.c
+++ b/cogl/driver/gl/cogl-pipeline-progend-fixed.c
@@ -51,7 +51,7 @@ _cogl_pipeline_progend_fixed_start (CoglPipeline *pipeline)
 {
   _COGL_GET_CONTEXT (ctx, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
     return FALSE;
 
   if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED))
diff --git a/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/driver/gl/cogl-pipeline-progend-glsl.c
index be5b28f..9e88fe4 100644
--- a/cogl/driver/gl/cogl-pipeline-progend-glsl.c
+++ b/cogl/driver/gl/cogl-pipeline-progend-glsl.c
@@ -108,7 +108,7 @@ typedef struct
   GLuint program;
 
   unsigned long dirty_builtin_uniforms;
-  GLint builtin_uniform_locations[G_N_ELEMENTS (builtin_uniforms)];
+  GLint builtin_uniform_locations[U_N_ELEMENTS (builtin_uniforms)];
 
   GLint modelview_uniform;
   GLint projection_uniform;
@@ -124,10 +124,10 @@ typedef struct
   /* Array of GL uniform locations indexed by Cogl's uniform
      location. We are careful only to allocated this array if a custom
      uniform is actually set */
-  GArray *uniform_locations;
+  UArray *uniform_locations;
 
   /* Array of attribute locations. */
-  GArray *attribute_locations;
+  UArray *attribute_locations;
 
   /* The 'flip' uniform is used to flip the geometry upside-down when
      the framebuffer requires it only when there are vertex
@@ -177,25 +177,25 @@ _cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline,
   _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1);
   _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1);
 
-  if (G_UNLIKELY (program_state->attribute_locations == NULL))
+  if (U_UNLIKELY (program_state->attribute_locations == NULL))
     program_state->attribute_locations =
-      g_array_new (FALSE, FALSE, sizeof (int));
+      u_array_new (FALSE, FALSE, sizeof (int));
 
-  if (G_UNLIKELY (program_state->attribute_locations->len <= name_index))
+  if (U_UNLIKELY (program_state->attribute_locations->len <= name_index))
     {
       int i = program_state->attribute_locations->len;
-      g_array_set_size (program_state->attribute_locations, name_index + 1);
+      u_array_set_size (program_state->attribute_locations, name_index + 1);
       for (; i < program_state->attribute_locations->len; i++)
-        g_array_index (program_state->attribute_locations, int, i)
+        u_array_index (program_state->attribute_locations, int, i)
           = ATTRIBUTE_LOCATION_UNKNOWN;
     }
 
-  locations = &g_array_index (program_state->attribute_locations, int, 0);
+  locations = &u_array_index (program_state->attribute_locations, int, 0);
 
   if (locations[name_index] == ATTRIBUTE_LOCATION_UNKNOWN)
     {
       CoglAttributeNameState *name_state =
-        g_array_index (ctx->attribute_name_index_map,
+        u_array_index (ctx->attribute_name_index_map,
                        CoglAttributeNameState *, name_index);
 
       _COGL_RETURN_VAL_IF_FAIL (name_state != NULL, 0);
@@ -213,7 +213,7 @@ clear_attribute_cache (CoglPipelineProgramState *program_state)
 {
   if (program_state->attribute_locations)
     {
-      g_array_free (program_state->attribute_locations, TRUE);
+      u_array_free (program_state->attribute_locations, TRUE);
       program_state->attribute_locations = NULL;
     }
 }
@@ -233,10 +233,10 @@ program_state_new (int n_layers,
 {
   CoglPipelineProgramState *program_state;
 
-  program_state = g_slice_new (CoglPipelineProgramState);
+  program_state = u_slice_new (CoglPipelineProgramState);
   program_state->ref_count = 1;
   program_state->program = 0;
-  program_state->unit_state = g_new (UnitState, n_layers);
+  program_state->unit_state = u_new (UnitState, n_layers);
   program_state->uniform_locations = NULL;
   program_state->attribute_locations = NULL;
   program_state->cache_entry = cache_entry;
@@ -275,12 +275,12 @@ destroy_program_state (void *user_data,
       if (program_state->program)
         GE( ctx, glDeleteProgram (program_state->program) );
 
-      g_free (program_state->unit_state);
+      u_free (program_state->unit_state);
 
       if (program_state->uniform_locations)
-        g_array_free (program_state->uniform_locations, TRUE);
+        u_array_free (program_state->uniform_locations, TRUE);
 
-      g_slice_free (CoglPipelineProgramState, program_state);
+      u_slice_free (CoglPipelineProgramState, program_state);
     }
 }
 
@@ -333,15 +333,15 @@ link_program (GLint gl_program)
 
       GE( ctx, glGetProgramiv (gl_program, GL_INFO_LOG_LENGTH, &log_length) );
 
-      log = g_malloc (log_length);
+      log = u_malloc (log_length);
 
       GE( ctx, glGetProgramInfoLog (gl_program, log_length,
                                     &out_log_length, log) );
 
-      g_warning ("Failed to link GLSL program:\n%.*s\n",
+      u_warning ("Failed to link GLSL program:\n%.*s\n",
                  log_length, log);
 
-      g_free (log);
+      u_free (log);
     }
 }
 
@@ -367,8 +367,8 @@ get_uniform_cb (CoglPipeline *pipeline,
 
   /* We can reuse the source buffer to create the uniform name because
      the program has now been linked */
-  g_string_set_size (ctx->codegen_source_buffer, 0);
-  g_string_append_printf (ctx->codegen_source_buffer,
+  u_string_set_size (ctx->codegen_source_buffer, 0);
+  u_string_append_printf (ctx->codegen_source_buffer,
                           "cogl_sampler%i", layer_index);
 
   GE_RET( uniform_location,
@@ -382,8 +382,8 @@ get_uniform_cb (CoglPipeline *pipeline,
   if (uniform_location != -1)
     GE( ctx, glUniform1i (uniform_location, state->unit) );
 
-  g_string_set_size (ctx->codegen_source_buffer, 0);
-  g_string_append_printf (ctx->codegen_source_buffer,
+  u_string_set_size (ctx->codegen_source_buffer, 0);
+  u_string_append_printf (ctx->codegen_source_buffer,
                           "_cogl_layer_constant_%i", layer_index);
 
   GE_RET( uniform_location,
@@ -434,7 +434,7 @@ update_builtin_uniforms (CoglContext *context,
   if (program_state->dirty_builtin_uniforms == 0)
     return;
 
-  for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++)
+  for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
     if (!_cogl_has_private_feature (context,
                                     builtin_uniforms[i].feature_replacement) &&
         (program_state->dirty_builtin_uniforms & (1 << i)) &&
@@ -464,12 +464,12 @@ flush_uniform_cb (int uniform_num, void *user_data)
 
   if (COGL_FLAGS_GET (data->uniform_differences, uniform_num))
     {
-      GArray *uniform_locations;
+      UArray *uniform_locations;
       GLint uniform_location;
 
       if (data->program_state->uniform_locations == NULL)
         data->program_state->uniform_locations =
-          g_array_new (FALSE, FALSE, sizeof (GLint));
+          u_array_new (FALSE, FALSE, sizeof (GLint));
 
       uniform_locations = data->program_state->uniform_locations;
 
@@ -477,27 +477,27 @@ flush_uniform_cb (int uniform_num, void *user_data)
         {
           unsigned int old_len = uniform_locations->len;
 
-          g_array_set_size (uniform_locations, uniform_num + 1);
+          u_array_set_size (uniform_locations, uniform_num + 1);
 
           while (old_len <= uniform_num)
             {
-              g_array_index (uniform_locations, GLint, old_len) =
+              u_array_index (uniform_locations, GLint, old_len) =
                 UNIFORM_LOCATION_UNKNOWN;
               old_len++;
             }
         }
 
-      uniform_location = g_array_index (uniform_locations, GLint, uniform_num);
+      uniform_location = u_array_index (uniform_locations, GLint, uniform_num);
 
       if (uniform_location == UNIFORM_LOCATION_UNKNOWN)
         {
           const char *uniform_name =
-            g_ptr_array_index (data->ctx->uniform_names, uniform_num);
+            u_ptr_array_index (data->ctx->uniform_names, uniform_num);
 
           uniform_location =
             data->ctx->glGetUniformLocation (data->program_state->program,
                                              uniform_name);
-          g_array_index (uniform_locations, GLint, uniform_num) =
+          u_array_index (uniform_locations, GLint, uniform_num) =
             uniform_location;
         }
 
@@ -538,7 +538,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline,
 
   n_uniform_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names);
 
-  data.uniform_differences = g_newa (unsigned long, n_uniform_longs);
+  data.uniform_differences = u_newa (unsigned long, n_uniform_longs);
 
   /* Try to find a common ancestor for the values that were already
      flushed on the pipeline that this program state was last used for
@@ -551,7 +551,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline,
           /* The program has changed so all of the uniform locations
              are invalid */
           if (program_state->uniform_locations)
-            g_array_set_size (program_state->uniform_locations, 0);
+            u_array_set_size (program_state->uniform_locations, 0);
         }
 
       /* We need to flush everything so mark all of the uniforms as
@@ -654,7 +654,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
         {
           /* Check if there is already a similar cached pipeline whose
              program state we can share */
-          if (G_LIKELY (!(COGL_DEBUG_ENABLED
+          if (U_LIKELY (!(COGL_DEBUG_ENABLED
                           (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
             {
               cache_entry =
@@ -742,7 +742,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
 
       clear_flushed_matrix_stacks (program_state);
 
-      for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++)
+      for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
         if (!_cogl_has_private_feature
             (ctx, builtin_uniforms[i].feature_replacement))
           GE_RET( program_state->builtin_uniform_locations[i], ctx,
@@ -794,7 +794,7 @@ _cogl_pipeline_progend_glsl_pre_change_notify (CoglPipeline *pipeline,
     {
       int i;
 
-      for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++)
+      for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
         if (!_cogl_has_private_feature
             (ctx, builtin_uniforms[i].feature_replacement) &&
             (change & builtin_uniforms[i].change))
diff --git a/cogl/driver/gl/cogl-pipeline-vertend-glsl.c b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
index 8dfd2ca..1bb323f 100644
--- a/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
+++ b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c
@@ -59,7 +59,7 @@ typedef struct
   unsigned int ref_count;
 
   GLuint gl_shader;
-  GString *header, *source;
+  UString *header, *source;
 
   CoglPipelineCacheEntry *cache_entry;
 } CoglPipelineShaderState;
@@ -71,7 +71,7 @@ shader_state_new (CoglPipelineCacheEntry *cache_entry)
 {
   CoglPipelineShaderState *shader_state;
 
-  shader_state = g_slice_new0 (CoglPipelineShaderState);
+  shader_state = u_slice_new0 (CoglPipelineShaderState);
   shader_state->ref_count = 1;
   shader_state->cache_entry = cache_entry;
 
@@ -101,7 +101,7 @@ destroy_shader_state (void *user_data,
       if (shader_state->gl_shader)
         GE( ctx, glDeleteShader (shader_state->gl_shader) );
 
-      g_slice_free (CoglPipelineShaderState, shader_state);
+      u_slice_free (CoglPipelineShaderState, shader_state);
     }
 }
 
@@ -176,7 +176,7 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
 
   _cogl_gl_util_get_texture_target_string (texture_type, &target_string, NULL);
 
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "attribute vec4 cogl_tex_coord%i_in;\n"
                           "varying vec4 _cogl_tex_coord%i;\n"
                           "#define cogl_tex_coord%i_out _cogl_tex_coord%i\n"
@@ -250,7 +250,7 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline,
         {
           /* Check if there is already a similar cached pipeline whose
              shader state we can share */
-          if (G_LIKELY (!(COGL_DEBUG_ENABLED
+          if (U_LIKELY (!(COGL_DEBUG_ENABLED
                           (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
             {
               cache_entry =
@@ -283,26 +283,26 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline,
   /* If we make it here then we have a shader_state struct without a gl_shader
      because this is the first time we've encountered it */
 
-  /* We reuse two grow-only GStrings for code-gen. One string
+  /* We reuse two grow-only UStrings for code-gen. One string
      contains the uniform and attribute declarations while the
      other contains the main function. We need two strings
      because we need to dynamically declare attributes as the
      add_layer callback is invoked */
-  g_string_set_size (ctx->codegen_header_buffer, 0);
-  g_string_set_size (ctx->codegen_source_buffer, 0);
+  u_string_set_size (ctx->codegen_header_buffer, 0);
+  u_string_set_size (ctx->codegen_source_buffer, 0);
   shader_state->header = ctx->codegen_header_buffer;
   shader_state->source = ctx->codegen_source_buffer;
 
   add_layer_declarations (pipeline, shader_state);
   add_global_declarations (pipeline, shader_state);
 
-  g_string_append (shader_state->source,
+  u_string_append (shader_state->source,
                    "void\n"
                    "cogl_generated_source ()\n"
                    "{\n");
 
   if (cogl_pipeline_get_per_vertex_point_size (pipeline))
-    g_string_append (shader_state->header,
+    u_string_append (shader_state->header,
                      "attribute float cogl_point_size_in;\n");
   else if (!_cogl_has_private_feature
            (ctx, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM))
@@ -315,9 +315,9 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline,
          generates a new program */
       if (cogl_pipeline_get_point_size (pipeline) > 0.0f)
         {
-          g_string_append (shader_state->header,
+          u_string_append (shader_state->header,
                            "uniform float cogl_point_size_in;\n");
-          g_string_append (shader_state->source,
+          u_string_append (shader_state->source,
                            "  cogl_point_size_out = cogl_point_size_in;\n");
         }
     }
@@ -344,7 +344,7 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
    * directly uses the texture coordinates.
    */
 
-  g_string_append_printf (shader_state->header,
+  u_string_append_printf (shader_state->header,
                           "vec4\n"
                           "cogl_real_transform_layer%i (vec4 tex_coord)\n"
                           "{\n"
@@ -356,11 +356,11 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
   memset (&snippet_data, 0, sizeof (snippet_data));
   snippet_data.snippets = get_layer_vertex_snippets (layer);
   snippet_data.hook = COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM;
-  snippet_data.chain_function = g_strdup_printf ("cogl_real_transform_layer%i",
+  snippet_data.chain_function = u_strdup_printf ("cogl_real_transform_layer%i",
                                                  layer_index);
-  snippet_data.final_name = g_strdup_printf ("cogl_transform_layer%i",
+  snippet_data.final_name = u_strdup_printf ("cogl_transform_layer%i",
                                              layer_index);
-  snippet_data.function_prefix = g_strdup_printf ("cogl_transform_layer%i",
+  snippet_data.function_prefix = u_strdup_printf ("cogl_transform_layer%i",
                                                   layer_index);
   snippet_data.return_type = "vec4";
   snippet_data.return_variable = "cogl_tex_coord";
@@ -371,11 +371,11 @@ _cogl_pipeline_vertend_glsl_add_layer (CoglPipeline *pipeline,
 
   _cogl_pipeline_snippet_generate_code (&snippet_data);
 
-  g_free ((char *) snippet_data.chain_function);
-  g_free ((char *) snippet_data.final_name);
-  g_free ((char *) snippet_data.function_prefix);
+  u_free ((char *) snippet_data.chain_function);
+  u_free ((char *) snippet_data.final_name);
+  u_free ((char *) snippet_data.function_prefix);
 
-  g_string_append_printf (shader_state->source,
+  u_string_append_printf (shader_state->source,
                           "  cogl_tex_coord%i_out = "
                           "cogl_transform_layer%i (cogl_tex_coord%i_in);\n",
                           layer_index,
@@ -413,7 +413,7 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
                            0 /* no application private data */);
       COGL_COUNTER_INC (_cogl_uprof_context, vertend_glsl_compile_counter);
 
-      g_string_append (shader_state->header,
+      u_string_append (shader_state->header,
                        "void\n"
                        "cogl_real_vertex_transform ()\n"
                        "{\n"
@@ -422,22 +422,22 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
                        "cogl_position_in;\n"
                        "}\n");
 
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "  cogl_vertex_transform ();\n");
 
       if (has_per_vertex_point_size)
         {
-          g_string_append (shader_state->header,
+          u_string_append (shader_state->header,
                            "void\n"
                            "cogl_real_point_size_calculation ()\n"
                            "{\n"
                            "  cogl_point_size_out = cogl_point_size_in;\n"
                            "}\n");
-          g_string_append (shader_state->source,
+          u_string_append (shader_state->source,
                            "  cogl_point_size_calculation ();\n");
         }
 
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "  cogl_color_out = cogl_color_in;\n"
                        "}\n");
 
@@ -476,7 +476,7 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
       snippet_data.source_buf = shader_state->source;
       _cogl_pipeline_snippet_generate_code (&snippet_data);
 
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "void\n"
                        "main ()\n"
                        "{\n"
@@ -488,13 +488,13 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
          uniform */
       if (_cogl_pipeline_has_vertex_snippets (pipeline))
         {
-          g_string_append (shader_state->header,
+          u_string_append (shader_state->header,
                            "uniform vec4 _cogl_flip_vector;\n");
-          g_string_append (shader_state->source,
+          u_string_append (shader_state->source,
                            "  cogl_position_out *= _cogl_flip_vector;\n");
         }
 
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "}\n");
 
       GE_RET( shader, ctx, glCreateShader (GL_VERTEX_SHADER) );
@@ -518,9 +518,9 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
           char *shader_log;
 
           GE( ctx, glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len) );
-          shader_log = g_alloca (len);
+          shader_log = u_alloca (len);
           GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) );
-          g_warning ("Shader compilation failed:\n%s", shader_log);
+          u_warning ("Shader compilation failed:\n%s", shader_log);
         }
 
       shader_state->header = NULL;
@@ -600,7 +600,7 @@ UNIT_TEST (check_point_size_shader,
            0 /* no failure cases */)
 {
   CoglPipeline *pipelines[4];
-  CoglPipelineShaderState *shader_states[G_N_ELEMENTS (pipelines)];
+  CoglPipelineShaderState *shader_states[U_N_ELEMENTS (pipelines)];
   int i;
 
   /* Default pipeline with zero point size */
@@ -621,7 +621,7 @@ UNIT_TEST (check_point_size_shader,
 
   /* Draw something with all of the pipelines to make sure their state
    * is flushed */
-  for (i = 0; i < G_N_ELEMENTS (pipelines); i++)
+  for (i = 0; i < U_N_ELEMENTS (pipelines); i++)
     cogl_framebuffer_draw_rectangle (test_fb,
                                      pipelines[i],
                                      0.0f, 0.0f,
@@ -630,7 +630,7 @@ UNIT_TEST (check_point_size_shader,
 
   /* Get all of the shader states. These might be NULL if the driver
    * is not using GLSL */
-  for (i = 0; i < G_N_ELEMENTS (pipelines); i++)
+  for (i = 0; i < U_N_ELEMENTS (pipelines); i++)
     shader_states[i] = get_shader_state (pipelines[i]);
 
   /* If the first two pipelines are using GLSL then they should have
@@ -640,18 +640,18 @@ UNIT_TEST (check_point_size_shader,
     {
       if (_cogl_has_private_feature
           (test_ctx, COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM))
-        g_assert (shader_states[0] == shader_states[1]);
+        u_assert (shader_states[0] == shader_states[1]);
       else
-        g_assert (shader_states[0] != shader_states[1]);
+        u_assert (shader_states[0] != shader_states[1]);
     }
 
   /* The second and third pipelines should always have the same shader
    * state because only toggling between zero and non-zero should
    * change the shader */
-  g_assert (shader_states[1] == shader_states[2]);
+  u_assert (shader_states[1] == shader_states[2]);
 
   /* The fourth pipeline should be exactly the same as the first */
-  g_assert (shader_states[0] == shader_states[3]);
+  u_assert (shader_states[0] == shader_states[3]);
 }
 
 #endif /* COGL_PIPELINE_VERTEND_GLSL */
diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c
index 10e6722..decee1c 100644
--- a/cogl/driver/gl/cogl-texture-2d-gl.c
+++ b/cogl/driver/gl/cogl-texture-2d-gl.c
@@ -242,7 +242,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d,
         }
       else
         {
-          g_warning ("Failed to read first pixel of bitmap for "
+          u_warning ("Failed to read first pixel of bitmap for "
                      "glGenerateMipmap fallback");
           cogl_error_free (ignore);
           memset (tex_2d->first_pixel.data, 0,
@@ -464,13 +464,13 @@ _cogl_texture_2d_gl_allocate (CoglTexture *tex,
 #if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
       return allocate_from_egl_image (tex_2d, loader, error);
 #else
-      g_return_val_if_reached (FALSE);
+      u_return_val_if_reached (FALSE);
 #endif
     case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN:
       return allocate_from_gl_foreign (tex_2d, loader, error);
     }
 
-  g_return_val_if_reached (FALSE);
+  u_return_val_if_reached (FALSE);
 }
 
 void
@@ -693,7 +693,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
         }
       else
         {
-          g_warning ("Failed to read first bitmap pixel for "
+          u_warning ("Failed to read first bitmap pixel for "
                      "glGenerateMipmap fallback");
           cogl_error_free (ignore);
           memset (tex_2d->first_pixel.data, 0, bpp);
diff --git a/cogl/driver/gl/cogl-util-gl-private.h b/cogl/driver/gl/cogl-util-gl-private.h
index 2218bce..d106bcb 100644
--- a/cogl/driver/gl/cogl-util-gl-private.h
+++ b/cogl/driver/gl/cogl-util-gl-private.h
@@ -42,27 +42,27 @@
 const char *
 _cogl_gl_error_to_string (GLenum error_code);
 
-#define GE(ctx, x)                      G_STMT_START {  \
+#define GE(ctx, x)                      U_STMT_START {  \
   GLenum __err;                                         \
   (ctx)->x;                                             \
   while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
     {                                                   \
-      g_warning ("%s: GL error (%d): %s\n",             \
+      u_warning ("%s: GL error (%d): %s\n",             \
                  G_STRLOC,                              \
                  __err,                                 \
                  _cogl_gl_error_to_string (__err));     \
-    }                                   } G_STMT_END
+    }                                   } U_STMT_END
 
-#define GE_RET(ret, ctx, x)             G_STMT_START {  \
+#define GE_RET(ret, ctx, x)             U_STMT_START {  \
   GLenum __err;                                         \
   ret = (ctx)->x;                                       \
   while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
     {                                                   \
-      g_warning ("%s: GL error (%d): %s\n",             \
+      u_warning ("%s: GL error (%d): %s\n",             \
                  G_STRLOC,                              \
                  __err,                                 \
                  _cogl_gl_error_to_string (__err));     \
-    }                                   } G_STMT_END
+    }                                   } U_STMT_END
 
 #else /* !COGL_GL_DEBUG */
 
diff --git a/cogl/driver/gl/cogl-util-gl.c b/cogl/driver/gl/cogl-util-gl.c
index cb4d2d2..8e6ad9e 100644
--- a/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/driver/gl/cogl-util-gl.c
@@ -60,7 +60,7 @@ static const struct {
 #endif
 };
 
-static const unsigned int n_gl_errors = G_N_ELEMENTS (gl_errors);
+static const unsigned int n_gl_errors = U_N_ELEMENTS (gl_errors);
 
 const char *
 _cogl_gl_error_to_string (GLenum error_code)
@@ -90,7 +90,7 @@ _cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error)
 #ifdef COGL_GL_DEBUG
       else
         {
-          g_warning ("%s: GL error (%d): %s\n",
+          u_warning ("%s: GL error (%d): %s\n",
                      G_STRLOC,
                      gl_error,
                      _cogl_gl_error_to_string (gl_error));
diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index 32109c8..355ccea 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -259,13 +259,13 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
       break;
 
     case COGL_PIXEL_FORMAT_ANY:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       break;
     }
 
   /* All of the pixel formats are handled above so if this hits then
      we've been given an invalid pixel format */
-  g_assert (glformat != 0);
+  u_assert (glformat != 0);
 
   if (out_glintformat != NULL)
     *out_glintformat = glintformat;
@@ -402,9 +402,9 @@ _cogl_driver_update_features (CoglContext *ctx,
   if (!check_gl_version (ctx, gl_extensions, error))
     return FALSE;
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
     {
-      char *all_extensions = g_strjoinv (" ", gl_extensions);
+      char *all_extensions = u_strjoinv (" ", gl_extensions);
 
       COGL_NOTE (WINSYS,
                  "Checking features\n"
@@ -417,7 +417,7 @@ _cogl_driver_update_features (CoglContext *ctx,
                  _cogl_context_get_gl_version (ctx),
                  all_extensions);
 
-      g_free (all_extensions);
+      u_free (all_extensions);
     }
 
   _cogl_get_gl_version (ctx, &gl_major, &gl_minor);
@@ -632,10 +632,10 @@ _cogl_driver_update_features (CoglContext *ctx,
                     TRUE);
 
   /* Cache features */
-  for (i = 0; i < G_N_ELEMENTS (private_features); i++)
+  for (i = 0; i < U_N_ELEMENTS (private_features); i++)
     ctx->private_features[i] |= private_features[i];
 
-  g_strfreev (gl_extensions);
+  u_strfreev (gl_extensions);
 
   if (!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) &&
       !COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
diff --git a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
index 7b2d67f..f5d3b10 100644
--- a/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
+++ b/cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c
@@ -51,7 +51,7 @@
 #include "cogl-color-private.h"
 #include "cogl-profile.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 /* This might not be defined on GLES */
@@ -75,7 +75,7 @@ typedef struct
   int ref_count;
 
   /* XXX: only valid during codegen */
-  GString *source;
+  UString *source;
   GLuint gl_program;
   UnitState *unit_state;
   int next_constant_id;
@@ -95,9 +95,9 @@ shader_state_new (int n_layers,
 {
   CoglPipelineShaderState *shader_state;
 
-  shader_state = g_slice_new0 (CoglPipelineShaderState);
+  shader_state = u_slice_new0 (CoglPipelineShaderState);
   shader_state->ref_count = 1;
-  shader_state->unit_state = g_new0 (UnitState, n_layers);
+  shader_state->unit_state = u_new0 (UnitState, n_layers);
   shader_state->cache_entry = cache_entry;
 
   return shader_state;
@@ -136,9 +136,9 @@ destroy_shader_state (void *user_data,
           shader_state->gl_program = 0;
         }
 
-      g_free (shader_state->unit_state);
+      u_free (shader_state->unit_state);
 
-      g_slice_free (CoglPipelineShaderState, shader_state);
+      u_slice_free (CoglPipelineShaderState, shader_state);
     }
 }
 
@@ -216,7 +216,7 @@ _cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline,
   /* If we haven't yet found an existing program then before we resort to
    * generating a new arbfp program we see if we can find a suitable
    * program in the pipeline_cache. */
-  if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
+  if (U_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
     {
       cache_entry =
         _cogl_pipeline_cache_get_fragment_template (ctx->pipeline_cache,
@@ -234,10 +234,10 @@ _cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline,
     {
       shader_state = shader_state_new (n_layers, cache_entry);
 
-      /* We reuse a single grow-only GString for code-gen */
-      g_string_set_size (ctx->codegen_source_buffer, 0);
+      /* We reuse a single grow-only UString for code-gen */
+      u_string_set_size (ctx->codegen_source_buffer, 0);
       shader_state->source = ctx->codegen_source_buffer;
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "!!ARBfp1.0\n"
                        "TEMP output;\n"
                        "TEMP tmp0, tmp1, tmp2, tmp3, tmp4;\n"
@@ -280,7 +280,7 @@ texture_type_to_arbfp_string (CoglTextureType texture_type)
       return "RECT";
     }
 
-  g_warn_if_reached ();
+  u_warn_if_reached ();
 
   return "2D";
 }
@@ -292,14 +292,14 @@ setup_texture_source (CoglPipelineShaderState *shader_state,
 {
   if (!shader_state->unit_state[unit_index].sampled)
     {
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
-        g_string_append_printf (shader_state->source,
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
+        u_string_append_printf (shader_state->source,
                                 "TEMP texel%d;\n"
                                 "MOV texel%d, one;\n",
                                 unit_index,
                                 unit_index);
       else
-        g_string_append_printf (shader_state->source,
+        u_string_append_printf (shader_state->source,
                                 "TEMP texel%d;\n"
                                 "TEX texel%d,fragment.texcoord[%d],"
                                 "texture[%d],%s;\n",
@@ -337,20 +337,20 @@ typedef struct _CoglPipelineFragendARBfpArg
 } CoglPipelineFragendARBfpArg;
 
 static void
-append_arg (GString *source, const CoglPipelineFragendARBfpArg *arg)
+append_arg (UString *source, const CoglPipelineFragendARBfpArg *arg)
 {
   switch (arg->type)
     {
     case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_TEXTURE:
-      g_string_append_printf (source, "texel%d%s",
+      u_string_append_printf (source, "texel%d%s",
                               arg->texture_unit, arg->swizzle);
       break;
     case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_CONSTANT:
-      g_string_append_printf (source, "program.local[%d]%s",
+      u_string_append_printf (source, "program.local[%d]%s",
                               arg->constant_id, arg->swizzle);
       break;
     case COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE:
-      g_string_append_printf (source, "%s%s",
+      u_string_append_printf (source, "%s%s",
                               arg->name, arg->swizzle);
       break;
     }
@@ -418,7 +418,7 @@ setup_arg (CoglPipeline *pipeline,
             static CoglBool warning_seen = FALSE;
             if (!warning_seen)
               {
-                g_warning ("The application is trying to use a texture "
+                u_warning ("The application is trying to use a texture "
                            "combine with a layer number that does not exist");
                 warning_seen = TRUE;
               }
@@ -449,11 +449,11 @@ setup_arg (CoglPipeline *pipeline,
     case COGL_PIPELINE_COMBINE_OP_SRC_COLOR:
       break;
     case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR:
-      g_string_append_printf (shader_state->source,
+      u_string_append_printf (shader_state->source,
                               "SUB tmp%d, one, ",
                               arg_index);
       append_arg (shader_state->source, arg);
-      g_string_append_printf (shader_state->source, ";\n");
+      u_string_append_printf (shader_state->source, ";\n");
       arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
       arg->name = tmp_name[arg_index];
       arg->swizzle = "";
@@ -465,21 +465,21 @@ setup_arg (CoglPipeline *pipeline,
         arg->swizzle = ".a";
       break;
     case COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA:
-      g_string_append_printf (shader_state->source,
+      u_string_append_printf (shader_state->source,
                               "SUB tmp%d, one, ",
                               arg_index);
       append_arg (shader_state->source, arg);
       /* avoid a swizzle if we know RGB are going to be masked
        * in the end anyway */
       if (mask != COGL_BLEND_STRING_CHANNEL_MASK_ALPHA)
-        g_string_append_printf (shader_state->source, ".a;\n");
+        u_string_append_printf (shader_state->source, ".a;\n");
       else
-        g_string_append_printf (shader_state->source, ";\n");
+        u_string_append_printf (shader_state->source, ";\n");
       arg->type = COGL_PIPELINE_FRAGEND_ARBFP_ARG_TYPE_SIMPLE;
       arg->name = tmp_name[arg_index];
       break;
     default:
-      g_error ("Unknown texture combine operator %d", op);
+      u_error ("Unknown texture combine operator %d", op);
       break;
     }
 }
@@ -534,42 +534,42 @@ append_function (CoglPipeline *pipeline,
       mask_name = "";
       break;
     default:
-      g_error ("Unknown channel mask %d", mask);
+      u_error ("Unknown channel mask %d", mask);
       mask_name = "";
     }
 
   switch (function)
     {
     case COGL_PIPELINE_COMBINE_FUNC_ADD:
-      g_string_append_printf (shader_state->source,
+      u_string_append_printf (shader_state->source,
                               "ADD_SAT output%s, ",
                               mask_name);
       break;
     case COGL_PIPELINE_COMBINE_FUNC_MODULATE:
       /* Note: no need to saturate since we can assume operands
        * have values in the range [0,1] */
-      g_string_append_printf (shader_state->source, "MUL output%s, ",
+      u_string_append_printf (shader_state->source, "MUL output%s, ",
                               mask_name);
       break;
     case COGL_PIPELINE_COMBINE_FUNC_REPLACE:
       /* Note: no need to saturate since we can assume operand
        * has a value in the range [0,1] */
-      g_string_append_printf (shader_state->source, "MOV output%s, ",
+      u_string_append_printf (shader_state->source, "MOV output%s, ",
                               mask_name);
       break;
     case COGL_PIPELINE_COMBINE_FUNC_SUBTRACT:
-      g_string_append_printf (shader_state->source,
+      u_string_append_printf (shader_state->source,
                               "SUB_SAT output%s, ",
                               mask_name);
       break;
     case COGL_PIPELINE_COMBINE_FUNC_ADD_SIGNED:
-      g_string_append_printf (shader_state->source, "ADD tmp3%s, ",
+      u_string_append_printf (shader_state->source, "ADD tmp3%s, ",
                               mask_name);
       append_arg (shader_state->source, &args[0]);
-      g_string_append (shader_state->source, ", ");
+      u_string_append (shader_state->source, ", ");
       append_arg (shader_state->source, &args[1]);
-      g_string_append (shader_state->source, ";\n");
-      g_string_append_printf (shader_state->source,
+      u_string_append (shader_state->source, ";\n");
+      u_string_append_printf (shader_state->source,
                               "SUB_SAT output%s, tmp3, half",
                               mask_name);
       n_args = 0;
@@ -598,20 +598,20 @@ append_function (CoglPipeline *pipeline,
          * output = 4 * DP3 (src0 - 0.5, src1 - 0.5)
          */
 
-        g_string_append (shader_state->source, "MAD tmp3, two, ");
+        u_string_append (shader_state->source, "MAD tmp3, two, ");
         append_arg (shader_state->source, &args[0]);
-        g_string_append (shader_state->source, ", minus_one;\n");
+        u_string_append (shader_state->source, ", minus_one;\n");
 
         if (!fragend_arbfp_args_equal (&args[0], &args[1]))
           {
-            g_string_append (shader_state->source, "MAD tmp4, two, ");
+            u_string_append (shader_state->source, "MAD tmp4, two, ");
             append_arg (shader_state->source, &args[1]);
-            g_string_append (shader_state->source, ", minus_one;\n");
+            u_string_append (shader_state->source, ", minus_one;\n");
           }
         else
           tmp4 = "tmp3";
 
-        g_string_append_printf (shader_state->source,
+        u_string_append_printf (shader_state->source,
                                 "DP3_SAT output%s, tmp3, %s",
                                 mask_name, tmp4);
         n_args = 0;
@@ -623,18 +623,18 @@ append_function (CoglPipeline *pipeline,
 
       /* NB: GL_INTERPOLATE = arg0*arg2 + arg1*(1-arg2)
        * but LRP dst, a, b, c = b*a + c*(1-a) */
-      g_string_append_printf (shader_state->source, "LRP output%s, ",
+      u_string_append_printf (shader_state->source, "LRP output%s, ",
                               mask_name);
       append_arg (shader_state->source, &args[2]);
-      g_string_append (shader_state->source, ", ");
+      u_string_append (shader_state->source, ", ");
       append_arg (shader_state->source, &args[0]);
-      g_string_append (shader_state->source, ", ");
+      u_string_append (shader_state->source, ", ");
       append_arg (shader_state->source, &args[1]);
       n_args = 0;
       break;
     default:
-      g_error ("Unknown texture combine function %d", function);
-      g_string_append_printf (shader_state->source, "MUL_SAT output%s, ",
+      u_error ("Unknown texture combine function %d", function);
+      u_string_append_printf (shader_state->source, "MUL_SAT output%s, ",
                               mask_name);
       n_args = 2;
       break;
@@ -644,10 +644,10 @@ append_function (CoglPipeline *pipeline,
     append_arg (shader_state->source, &args[0]);
   if (n_args > 1)
     {
-      g_string_append (shader_state->source, ", ");
+      u_string_append (shader_state->source, ", ");
       append_arg (shader_state->source, &args[1]);
     }
-  g_string_append (shader_state->source, ";\n");
+  u_string_append (shader_state->source, ";\n");
 }
 
 static void
@@ -774,7 +774,7 @@ _cogl_pipeline_fragend_arbfp_passthrough (CoglPipeline *pipeline)
   if (!shader_state->source)
     return TRUE;
 
-  g_string_append (shader_state->source,
+  u_string_append (shader_state->source,
                    "MOV output, fragment.color.primary;\n");
   return TRUE;
 }
@@ -833,12 +833,12 @@ _cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline,
 
       COGL_COUNTER_INC (_cogl_uprof_context, fragend_arbfp_compile_counter);
 
-      g_string_append (shader_state->source,
+      u_string_append (shader_state->source,
                        "MOV result.color,output;\n");
-      g_string_append (shader_state->source, "END\n");
+      u_string_append (shader_state->source, "END\n");
 
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
-        g_message ("pipeline program:\n%s", shader_state->source->str);
+      if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
+        u_message ("pipeline program:\n%s", shader_state->source->str);
 
       GE (ctx, glGenPrograms (1, &shader_state->gl_program));
 
@@ -853,7 +853,7 @@ _cogl_pipeline_fragend_arbfp_end (CoglPipeline *pipeline,
                             shader_state->source->str);
       if (ctx->glGetError () != GL_NO_ERROR)
         {
-          g_warning ("\n%s\n%s",
+          u_warning ("\n%s\n%s",
                      shader_state->source->str,
                      ctx->glGetString (GL_PROGRAM_ERROR_STRING_ARB));
         }
diff --git a/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c 
b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c
index 9af9ba8..e97748f 100644
--- a/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c
+++ b/cogl/driver/gl/gl/cogl-pipeline-progend-fixed-arbfp.c
@@ -51,7 +51,7 @@ _cogl_pipeline_progend_fixed_arbfp_start (CoglPipeline *pipeline)
 {
   _COGL_GET_CONTEXT (ctx, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
     return FALSE;
 
   if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_FIXED))
diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c
index ab34bc6..6b3c648 100644
--- a/cogl/driver/gl/gl/cogl-texture-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c
@@ -97,7 +97,7 @@ _cogl_texture_driver_gen (CoglContext *ctx,
       break;
 
     default:
-      g_assert_not_reached();
+      u_assert_not_reached();
     }
 
   /* If the driver doesn't support alpha textures directly then we'll
diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
index c8b53f9..26b57ed 100644
--- a/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -195,13 +195,13 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
       break;
 
     case COGL_PIXEL_FORMAT_ANY:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       break;
     }
 
   /* All of the pixel formats are handled above so if this hits then
      we've been given an invalid pixel format */
-  g_assert (glformat != 0);
+  u_assert (glformat != 0);
 
   if (out_glintformat != NULL)
     *out_glintformat = glintformat;
@@ -232,9 +232,9 @@ _cogl_driver_update_features (CoglContext *context,
 
   gl_extensions = _cogl_context_get_gl_extensions (context);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
+  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
     {
-      char *all_extensions = g_strjoinv (" ", gl_extensions);
+      char *all_extensions = u_strjoinv (" ", gl_extensions);
 
       COGL_NOTE (WINSYS,
                  "Checking features\n"
@@ -247,7 +247,7 @@ _cogl_driver_update_features (CoglContext *context,
                  _cogl_context_get_gl_version (context),
                  all_extensions);
 
-      g_free (all_extensions);
+      u_free (all_extensions);
     }
 
   context->glsl_major = 1;
@@ -374,10 +374,10 @@ _cogl_driver_update_features (CoglContext *context,
                     TRUE);
 
   /* Cache features */
-  for (i = 0; i < G_N_ELEMENTS (private_features); i++)
+  for (i = 0; i < U_N_ELEMENTS (private_features); i++)
     context->private_features[i] |= private_features[i];
 
-  g_strfreev (gl_extensions);
+  u_strfreev (gl_extensions);
 
   return TRUE;
 }
diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c
index aef1a21..73c659c 100644
--- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -95,7 +95,7 @@ _cogl_texture_driver_gen (CoglContext *ctx,
       break;
 
     default:
-      g_assert_not_reached();
+      u_assert_not_reached();
     }
 
   return tex;
@@ -118,8 +118,8 @@ prep_gl_for_pixels_upload_full (CoglContext *ctx,
     }
   else
     {
-      g_assert (pixels_src_x == 0);
-      g_assert (pixels_src_y == 0);
+      u_assert (pixels_src_x == 0);
+      u_assert (pixels_src_y == 0);
     }
 
   _cogl_texture_gl_prep_alignment_for_pixels_upload (ctx, pixels_rowstride);
diff --git a/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/driver/nop/cogl-framebuffer-nop.c
index 445776f..cc701a9 100644
--- a/cogl/driver/nop/cogl-framebuffer-nop.c
+++ b/cogl/driver/nop/cogl-framebuffer-nop.c
@@ -34,7 +34,7 @@
 
 #include "cogl-framebuffer-nop-private.h"
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 
 void
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 8035d3d..9c0fd99 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -77,7 +77,7 @@ static const CoglTextureVtable cogl_texture_pixmap_x11_vtable;
 uint32_t
 cogl_texture_pixmap_x11_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-texture-pixmap-error-quark");
+  return u_quark_from_static_string ("cogl-texture-pixmap-error-quark");
 }
 
 static void
@@ -169,7 +169,7 @@ process_damage_event (CoglTexturePixmapX11 *tex_pixmap,
       break;
 
     default:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 
   /* If the damage already covers the whole rectangle then we don't
@@ -288,7 +288,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
                              CoglBool automatic_updates,
                              CoglError **error)
 {
-  CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1);
+  CoglTexturePixmapX11 *tex_pixmap = u_new (CoglTexturePixmapX11, 1);
   Display *display = cogl_xlib_renderer_get_display (ctxt->display->renderer);
   Window pixmap_root_window;
   int pixmap_x, pixmap_y;
@@ -305,7 +305,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
                      &pixmap_width, &pixmap_height,
                      &pixmap_border_width, &tex_pixmap->depth))
     {
-      g_free (tex_pixmap);
+      u_free (tex_pixmap);
       _cogl_set_error (error,
                    COGL_TEXTURE_PIXMAP_X11_ERROR,
                    COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
@@ -335,7 +335,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctxt,
      it from the pixmap's root window */
   if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes))
     {
-      g_free (tex_pixmap);
+      u_free (tex_pixmap);
       _cogl_set_error (error,
                    COGL_TEXTURE_PIXMAP_X11_ERROR,
                    COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
@@ -450,15 +450,15 @@ try_alloc_shm (CoglTexturePixmapX11 *tex_pixmap)
   return;
 
  failed_xshmattach:
-  g_warning ("XShmAttach failed");
+  u_warning ("XShmAttach failed");
   shmdt (tex_pixmap->shm_info.shmaddr);
 
  failed_shmat:
-  g_warning ("shmat failed");
+  u_warning ("shmat failed");
   shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);
 
  failed_shmget:
-  g_warning ("shmget failed");
+  u_warning ("shmget failed");
   XDestroyImage (dummy_image);
 
  failed_image_create:
@@ -767,7 +767,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
       _cogl_texture_pixmap_x11_update (tex_pixmap, FALSE);
     }
 
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 
   return NULL;
 }
diff --git a/cogl/winsys/cogl-winsys-egl-android.c b/cogl/winsys/cogl-winsys-egl-android.c
index bbf3f4c..fca958c 100644
--- a/cogl/winsys/cogl-winsys-egl-android.c
+++ b/cogl/winsys/cogl-winsys-egl-android.c
@@ -70,7 +70,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static CoglBool
@@ -79,7 +79,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
 {
   CoglRendererEGL *egl_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
 
   egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
@@ -173,7 +173,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayAndroid *android_display;
 
-  android_display = g_slice_new0 (CoglDisplayAndroid);
+  android_display = u_slice_new0 (CoglDisplayAndroid);
   egl_display->platform = android_display;
 
   return TRUE;
@@ -184,7 +184,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayAndroid, egl_display->platform);
+  u_slice_free (CoglDisplayAndroid, egl_display->platform);
 }
 
 static CoglBool
diff --git a/cogl/winsys/cogl-winsys-egl-gdl.c b/cogl/winsys/cogl-winsys-egl-gdl.c
index 40bfe64..81ce5ed 100644
--- a/cogl/winsys/cogl-winsys-egl-gdl.c
+++ b/cogl/winsys/cogl-winsys-egl-gdl.c
@@ -67,7 +67,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static CoglBool
@@ -79,10 +79,10 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   gdl_ret_t rc = GDL_SUCCESS;
   gdl_display_info_t gdl_display_info;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
 
-  gdl_renderer = g_slice_new0 (CoglRendererGDL);
+  gdl_renderer = u_slice_new0 (CoglRendererGDL);
   egl_renderer->platform = gdl_renderer;
 
   egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
@@ -255,7 +255,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayGDL *gdl_display;
 
-  gdl_display = g_slice_new0 (CoglDisplayGDL);
+  gdl_display = u_slice_new0 (CoglDisplayGDL);
   egl_display->platform = gdl_display;
 
   if (!gdl_plane_init (display, error))
@@ -269,7 +269,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayGDL, egl_display->platform);
+  u_slice_free (CoglDisplayGDL, egl_display->platform);
 }
 
 static void
diff --git a/cogl/winsys/cogl-winsys-egl-kms.c b/cogl/winsys/cogl-winsys-egl-kms.c
index 144ad9b..837704b 100644
--- a/cogl/winsys/cogl-winsys-egl-kms.c
+++ b/cogl/winsys/cogl-winsys-egl-kms.c
@@ -45,7 +45,7 @@
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 #include <gbm.h>
-#include <glib.h>
+#include <ulib.h>
 #include <sys/fcntl.h>
 #include <unistd.h>
 #include <string.h>
@@ -85,8 +85,8 @@ typedef struct _CoglOutputKMS
 
 typedef struct _CoglDisplayKMS
 {
-  GList *outputs;
-  GList *crtcs;
+  UList *outputs;
+  UList *crtcs;
 
   int width, height;
   CoglBool pending_set_crtc;
@@ -121,8 +121,8 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererKMS, kms_renderer);
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererKMS, kms_renderer);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static void
@@ -139,7 +139,7 @@ flush_pending_swap_notify_cb (void *data,
 
       if (kms_onscreen->pending_swap_notify)
         {
-          CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos);
+          CoglFrameInfo *info = u_queue_pop_head (&onscreen->pending_frame_infos);
 
           _cogl_onscreen_notify_frame_sync (onscreen, info);
           _cogl_onscreen_notify_complete (onscreen, info);
@@ -162,7 +162,7 @@ flush_pending_swap_notify_idle (void *user_data)
   _cogl_closure_disconnect (kms_renderer->swap_notify_idle);
   kms_renderer->swap_notify_idle = NULL;
 
-  g_list_foreach (context->framebuffers,
+  u_list_foreach (context->framebuffers,
                   flush_pending_swap_notify_cb,
                   NULL);
 }
@@ -237,7 +237,7 @@ page_flip_handler (int fd,
 
       cogl_object_unref (flip->onscreen);
 
-      g_slice_free (CoglFlipKMS, flip);
+      u_slice_free (CoglFlipKMS, flip);
     }
 }
 
@@ -272,11 +272,11 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglRendererEGL *egl_renderer;
   CoglRendererKMS *kms_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
 
   egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
-  egl_renderer->platform = g_slice_new0 (CoglRendererKMS);
+  egl_renderer->platform = u_slice_new0 (CoglRendererKMS);
   kms_renderer = egl_renderer->platform;
 
   kms_renderer->fd = open (device_name, O_RDWR);
@@ -422,7 +422,7 @@ find_output (int _index,
              int n_excluded_connectors,
              CoglError **error)
 {
-  char *connector_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
+  char *connector_env_name = u_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
   char *mode_env_name;
   drmModeConnector *connector;
   drmModeEncoder *encoder;
@@ -437,7 +437,7 @@ find_output (int _index,
     }
   else
     connector = NULL;
-  g_free (connector_env_name);
+  u_free (connector_env_name);
 
   if (connector == NULL)
     connector = find_connector (fd, resources,
@@ -455,7 +455,7 @@ find_output (int _index,
    * seems more reliable. */
   encoder = drmModeGetEncoder (fd, connector->encoders[0]);
 
-  output = g_slice_new0 (CoglOutputKMS);
+  output = u_slice_new0 (CoglOutputKMS);
   output->connector = connector;
   output->encoder = encoder;
   output->saved_crtc = drmModeGetCrtc (fd, encoder->crtc_id);
@@ -463,7 +463,7 @@ find_output (int _index,
   if (is_panel (connector->connector_type))
     {
       n_modes = connector->count_modes + 1;
-      modes = g_new (drmModeModeInfo, n_modes);
+      modes = u_new (drmModeModeInfo, n_modes);
       memcpy (modes, connector->modes,
               sizeof (drmModeModeInfo) * connector->count_modes);
       /* TODO: parse EDID */
@@ -472,12 +472,12 @@ find_output (int _index,
   else
     {
       n_modes = connector->count_modes;
-      modes = g_new (drmModeModeInfo, n_modes);
+      modes = u_new (drmModeModeInfo, n_modes);
       memcpy (modes, connector->modes,
               sizeof (drmModeModeInfo) * n_modes);
     }
 
-  mode_env_name = g_strdup_printf ("COGL_KMS_CONNECTOR%d_MODE", _index);
+  mode_env_name = u_strdup_printf ("COGL_KMS_CONNECTOR%d_MODE", _index);
   if (getenv (mode_env_name))
     {
       const char *name = getenv (mode_env_name);
@@ -495,7 +495,7 @@ find_output (int _index,
         }
       if (!found)
         {
-          g_free (mode_env_name);
+          u_free (mode_env_name);
           _cogl_set_error (error, COGL_WINSYS_ERROR,
                        COGL_WINSYS_ERROR_INIT,
                        "COGL_KMS_CONNECTOR%d_MODE of %s could not be found",
@@ -504,11 +504,11 @@ find_output (int _index,
         }
       n_modes = 1;
       mode = modes[i];
-      g_free (modes);
-      modes = g_new (drmModeModeInfo, 1);
+      u_free (modes);
+      modes = u_new (drmModeModeInfo, 1);
       modes[0] = mode;
     }
-  g_free (mode_env_name);
+  u_free (mode_env_name);
 
   output->modes = modes;
   output->n_modes = n_modes;
@@ -523,7 +523,7 @@ setup_crtc_modes (CoglDisplay *display, int fb_id)
   CoglDisplayKMS *kms_display = egl_display->platform;
   CoglRendererEGL *egl_renderer = display->renderer->winsys;
   CoglRendererKMS *kms_renderer = egl_renderer->platform;
-  GList *l;
+  UList *l;
 
   for (l = kms_display->crtcs; l; l = l->next)
     {
@@ -535,7 +535,7 @@ setup_crtc_modes (CoglDisplay *display, int fb_id)
                                 crtc->connectors, crtc->count,
                                 crtc->count ? &crtc->mode : NULL);
       if (ret)
-        g_warning ("Failed to set crtc mode %s: %m", crtc->mode.name);
+        u_warning ("Failed to set crtc mode %s: %m", crtc->mode.name);
     }
 }
 
@@ -546,7 +546,7 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
   CoglDisplayKMS *kms_display = egl_display->platform;
   CoglRendererEGL *egl_renderer = display->renderer->winsys;
   CoglRendererKMS *kms_renderer = egl_renderer->platform;
-  GList *l;
+  UList *l;
 
   for (l = kms_display->crtcs; l; l = l->next)
     {
@@ -562,7 +562,7 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
 
       if (ret)
         {
-          g_warning ("Failed to flip: %m");
+          u_warning ("Failed to flip: %m");
           continue;
         }
 
@@ -573,8 +573,8 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
 static void
 crtc_free (CoglKmsCrtc *crtc)
 {
-  g_free (crtc->connectors);
-  g_slice_free (CoglKmsCrtc, crtc);
+  u_free (crtc->connectors);
+  u_slice_free (CoglKmsCrtc, crtc);
 }
 
 static CoglKmsCrtc *
@@ -582,10 +582,10 @@ crtc_copy (CoglKmsCrtc *from)
 {
   CoglKmsCrtc *new;
 
-  new = g_slice_new (CoglKmsCrtc);
+  new = u_slice_new (CoglKmsCrtc);
 
   *new = *from;
-  new->connectors = g_memdup (from->connectors, from->count * sizeof(uint32_t));
+  new->connectors = u_memdup (from->connectors, from->count * sizeof(uint32_t));
 
   return new;
 }
@@ -603,7 +603,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglBool mirror;
   CoglKmsCrtc *crtc0, *crtc1;
 
-  kms_display = g_slice_new0 (CoglDisplayKMS);
+  kms_display = u_slice_new0 (CoglDisplayKMS);
   egl_display->platform = kms_display;
 
   resources = drmModeGetResources (kms_renderer->fd);
@@ -621,7 +621,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
                          NULL,
                          0, /* n excluded connectors */
                          error);
-  kms_display->outputs = g_list_append (kms_display->outputs, output0);
+  kms_display->outputs = u_list_append (kms_display->outputs, output0);
   if (!output0)
     return FALSE;
 
@@ -642,7 +642,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
       if (!output1)
         return FALSE;
 
-      kms_display->outputs = g_list_append (kms_display->outputs, output1);
+      kms_display->outputs = u_list_append (kms_display->outputs, output1);
 
       if (!find_mirror_modes (output0->modes, output0->n_modes,
                               output1->modes, output1->n_modes,
@@ -661,27 +661,27 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
       output1 = NULL;
     }
 
-  crtc0 = g_slice_new (CoglKmsCrtc);
+  crtc0 = u_slice_new (CoglKmsCrtc);
   crtc0->id = output0->encoder->crtc_id;
   crtc0->x = 0;
   crtc0->y = 0;
   crtc0->mode = output0->mode;
-  crtc0->connectors = g_new (uint32_t, 1);
+  crtc0->connectors = u_new (uint32_t, 1);
   crtc0->connectors[0] = output0->connector->connector_id;
   crtc0->count = 1;
-  kms_display->crtcs = g_list_prepend (kms_display->crtcs, crtc0);
+  kms_display->crtcs = u_list_prepend (kms_display->crtcs, crtc0);
 
   if (output1)
     {
-      crtc1 = g_slice_new (CoglKmsCrtc);
+      crtc1 = u_slice_new (CoglKmsCrtc);
       crtc1->id = output1->encoder->crtc_id;
       crtc1->x = 0;
       crtc1->y = 0;
       crtc1->mode = output1->mode;
-      crtc1->connectors = g_new (uint32_t, 1);
+      crtc1->connectors = u_new (uint32_t, 1);
       crtc1->connectors[0] = output1->connector->connector_id;
       crtc1->count = 1;
-      kms_display->crtcs = g_list_prepend (kms_display->crtcs, crtc1);
+      kms_display->crtcs = u_list_prepend (kms_display->crtcs, crtc1);
     }
 
   kms_display->width = output0->mode.hdisplay;
@@ -698,7 +698,7 @@ static void
 output_free (int fd, CoglOutputKMS *output)
 {
   if (output->modes)
-    g_free (output->modes);
+    u_free (output->modes);
 
   if (output->encoder)
     drmModeFreeEncoder (output->encoder);
@@ -715,12 +715,12 @@ output_free (int fd, CoglOutputKMS *output)
                                     &output->connector->connector_id, 1,
                                     &output->saved_crtc->mode);
           if (ret)
-            g_warning (G_STRLOC ": Error restoring saved CRTC");
+            u_warning (G_STRLOC ": Error restoring saved CRTC");
         }
       drmModeFreeConnector (output->connector);
     }
 
-  g_slice_free (CoglOutputKMS, output);
+  u_slice_free (CoglOutputKMS, output);
 }
 
 static void
@@ -731,16 +731,16 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
   CoglRenderer *renderer = display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
   CoglRendererKMS *kms_renderer = egl_renderer->platform;
-  GList *l;
+  UList *l;
 
   for (l = kms_display->outputs; l; l = l->next)
     output_free (kms_renderer->fd, l->data);
-  g_list_free (kms_display->outputs);
+  u_list_free (kms_display->outputs);
   kms_display->outputs = NULL;
 
-  g_list_free_full (kms_display->crtcs, (GDestroyNotify) crtc_free);
+  u_list_free_full (kms_display->crtcs, (UDestroyNotify) crtc_free);
 
-  g_slice_free (CoglDisplayKMS, egl_display->platform);
+  u_slice_free (CoglDisplayKMS, egl_display->platform);
 }
 
 static CoglBool
@@ -857,7 +857,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
                     handle,
                     &kms_onscreen->next_fb_id))
     {
-      g_warning ("Failed to create new back buffer handle: %m");
+      u_warning ("Failed to create new back buffer handle: %m");
       gbm_surface_release_buffer (kms_onscreen->surface,
                                   kms_onscreen->next_bo);
       kms_onscreen->next_bo = NULL;
@@ -873,7 +873,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
       kms_display->pending_set_crtc = FALSE;
     }
 
-  flip = g_slice_new0 (CoglFlipKMS);
+  flip = u_slice_new0 (CoglFlipKMS);
   flip->onscreen = onscreen;
 
   flip_all_crtcs (context->display, flip, kms_onscreen->next_fb_id);
@@ -885,7 +885,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
                                   kms_onscreen->next_bo);
       kms_onscreen->next_bo = NULL;
       kms_onscreen->next_fb_id = 0;
-      g_slice_free (CoglFlipKMS, flip);
+      u_slice_free (CoglFlipKMS, flip);
       flip = NULL;
     }
   else
@@ -933,10 +933,10 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
 
   kms_display->onscreen = onscreen;
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
+  onscreen->winsys = u_slice_new0 (CoglOnscreenEGL);
   egl_onscreen = onscreen->winsys;
 
-  kms_onscreen = g_slice_new0 (CoglOnscreenKMS);
+  kms_onscreen = u_slice_new0 (CoglOnscreenKMS);
   egl_onscreen->platform = kms_onscreen;
 
   kms_onscreen->surface =
@@ -998,7 +998,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
   /* flip state takes a reference on the onscreen so there should
    * never be outstanding flips when we reach here. */
-  g_return_if_fail (kms_onscreen->next_fb_id == 0);
+  u_return_if_fail (kms_onscreen->next_fb_id == 0);
 
   free_current_bo (onscreen);
 
@@ -1014,8 +1014,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
       kms_onscreen->surface = NULL;
     }
 
-  g_slice_free (CoglOnscreenKMS, kms_onscreen);
-  g_slice_free (CoglOnscreenEGL, onscreen->winsys);
+  u_slice_free (CoglOnscreenKMS, kms_onscreen);
+  u_slice_free (CoglOnscreenEGL, onscreen->winsys);
   onscreen->winsys = NULL;
 }
 
@@ -1102,7 +1102,7 @@ cogl_kms_display_set_layout (CoglDisplay *display,
   CoglRenderer *renderer = display->renderer;
   CoglRendererEGL *egl_renderer = renderer->winsys;
   CoglRendererKMS *kms_renderer = egl_renderer->platform;
-  GList *crtc_list;
+  UList *crtc_list;
   int i;
 
   if ((width != kms_display->width ||
@@ -1156,14 +1156,14 @@ cogl_kms_display_set_layout (CoglDisplay *display,
   kms_display->width = width;
   kms_display->height = height;
 
-  g_list_free_full (kms_display->crtcs, (GDestroyNotify) crtc_free);
+  u_list_free_full (kms_display->crtcs, (UDestroyNotify) crtc_free);
 
   crtc_list = NULL;
   for (i = 0; i < n_crtcs; i++)
     {
-      crtc_list = g_list_prepend (crtc_list, crtc_copy (crtcs[i]));
+      crtc_list = u_list_prepend (crtc_list, crtc_copy (crtcs[i]));
     }
-  crtc_list = g_list_reverse (crtc_list);
+  crtc_list = u_list_reverse (crtc_list);
   kms_display->crtcs = crtc_list;
 
   kms_display->pending_set_crtc = TRUE;
diff --git a/cogl/winsys/cogl-winsys-egl-null.c b/cogl/winsys/cogl-winsys-egl-null.c
index 63b302a..69df3e1 100644
--- a/cogl/winsys/cogl-winsys-egl-null.c
+++ b/cogl/winsys/cogl-winsys-egl-null.c
@@ -57,7 +57,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static CoglBool
@@ -66,7 +66,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
 {
   CoglRendererEGL *egl_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
 
   egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
@@ -139,7 +139,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayNull *null_display;
 
-  null_display = g_slice_new0 (CoglDisplayNull);
+  null_display = u_slice_new0 (CoglDisplayNull);
   egl_display->platform = null_display;
 
   return TRUE;
@@ -150,7 +150,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayNull, egl_display->platform);
+  u_slice_free (CoglDisplayNull, egl_display->platform);
 }
 
 static void
diff --git a/cogl/winsys/cogl-winsys-egl-wayland.c b/cogl/winsys/cogl-winsys-egl-wayland.c
index c0d6613..9b5570a 100644
--- a/cogl/winsys/cogl-winsys-egl-wayland.c
+++ b/cogl/winsys/cogl-winsys-egl-wayland.c
@@ -131,8 +131,8 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
         wl_display_disconnect (wayland_renderer->wayland_display);
     }
 
-  g_slice_free (CoglRendererWayland, egl_renderer->platform);
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererWayland, egl_renderer->platform);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static const struct wl_registry_listener registry_listener = {
@@ -235,9 +235,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglRendererEGL *egl_renderer;
   CoglRendererWayland *wayland_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
-  wayland_renderer = g_slice_new0 (CoglRendererWayland);
+  wayland_renderer = u_slice_new0 (CoglRendererWayland);
   egl_renderer->platform = wayland_renderer;
 
   egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
@@ -246,7 +246,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
    * platform when the driver can support multiple. Mesa allows
    * selection using an environment variable though so that's what
    * we're doing here... */
-  g_setenv ("EGL_PLATFORM", "wayland", 1);
+  u_setenv ("EGL_PLATFORM", "wayland", 1);
 
   if (renderer->foreign_wayland_display)
     {
@@ -311,7 +311,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayWayland *wayland_display;
 
-  wayland_display = g_slice_new0 (CoglDisplayWayland);
+  wayland_display = u_slice_new0 (CoglDisplayWayland);
   egl_display->platform = wayland_display;
 
   return TRUE;
@@ -322,7 +322,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayWayland, egl_display->platform);
+  u_slice_free (CoglDisplayWayland, egl_display->platform);
 }
 
 static CoglBool
@@ -452,7 +452,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
   CoglRendererEGL *egl_renderer = renderer->winsys;
   CoglRendererWayland *wayland_renderer = egl_renderer->platform;
 
-  wayland_onscreen = g_slice_new0 (CoglOnscreenWayland);
+  wayland_onscreen = u_slice_new0 (CoglOnscreenWayland);
   egl_onscreen->platform = wayland_onscreen;
 
   _cogl_list_init (&wayland_onscreen->frame_callbacks);
@@ -505,7 +505,7 @@ free_frame_callback_data (FrameCallbackData *callback_data)
   cogl_object_unref (callback_data->frame_info);
   wl_callback_destroy (callback_data->callback);
   _cogl_list_remove (&callback_data->link);
-  g_slice_free (FrameCallbackData, callback_data);
+  u_slice_free (FrameCallbackData, callback_data);
 }
 
 static void
@@ -545,7 +545,7 @@ _cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen)
         }
     }
 
-  g_slice_free (CoglOnscreenWayland, wayland_onscreen);
+  u_slice_free (CoglOnscreenWayland, wayland_onscreen);
 }
 
 static void
@@ -583,7 +583,7 @@ frame_cb (void *data,
   CoglFrameInfo *info = callback_data->frame_info;
   CoglOnscreen *onscreen = callback_data->onscreen;
 
-  g_assert (callback_data->callback == callback);
+  u_assert (callback_data->callback == callback);
 
   _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_SYNC, info);
   _cogl_onscreen_queue_event (onscreen, COGL_FRAME_EVENT_COMPLETE, info);
@@ -604,7 +604,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
 {
   CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
   CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;
-  FrameCallbackData *frame_callback_data = g_slice_new (FrameCallbackData);
+  FrameCallbackData *frame_callback_data = u_slice_new (FrameCallbackData);
 
   flush_pending_resize (onscreen);
 
@@ -616,7 +616,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
    * frame that Wayland reports as completed. This will steal the
    * reference */
   frame_callback_data->frame_info =
-    g_queue_pop_tail (&onscreen->pending_frame_infos);
+    u_queue_pop_tail (&onscreen->pending_frame_infos);
   frame_callback_data->onscreen = onscreen;
 
   frame_callback_data->callback =
diff --git a/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/winsys/cogl-winsys-egl-x11.c
index c530fd1..b669306 100644
--- a/cogl/winsys/cogl-winsys-egl-x11.c
+++ b/cogl/winsys/cogl-winsys-egl-x11.c
@@ -77,7 +77,7 @@ typedef struct _CoglTexturePixmapEGL
 static CoglOnscreen *
 find_onscreen_for_xid (CoglContext *context, uint32_t xid)
 {
-  GList *l;
+  UList *l;
 
   for (l = context->framebuffers; l; l = l->next)
     {
@@ -128,7 +128,7 @@ flush_pending_resize_notifications_idle (void *user_data)
   _cogl_closure_disconnect (egl_renderer->resize_notify_idle);
   egl_renderer->resize_notify_idle = NULL;
 
-  g_list_foreach (context->framebuffers,
+  u_list_foreach (context->framebuffers,
                   flush_pending_resize_notifications_cb,
                   NULL);
 }
@@ -258,7 +258,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 
   eglTerminate (egl_renderer->edpy);
 
-  g_slice_free (CoglRendererEGL, egl_renderer);
+  u_slice_free (CoglRendererEGL, egl_renderer);
 }
 
 static CoglBool
@@ -268,7 +268,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglRendererEGL *egl_renderer;
   CoglXlibRenderer *xlib_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglRendererEGL);
+  renderer->winsys = u_slice_new0 (CoglRendererEGL);
   egl_renderer = renderer->winsys;
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
 
@@ -297,7 +297,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
   CoglDisplayEGL *egl_display = display->winsys;
   CoglDisplayXlib *xlib_display;
 
-  xlib_display = g_slice_new0 (CoglDisplayXlib);
+  xlib_display = u_slice_new0 (CoglDisplayXlib);
   egl_display->platform = xlib_display;
 
   return TRUE;
@@ -308,7 +308,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
 {
   CoglDisplayEGL *egl_display = display->winsys;
 
-  g_slice_free (CoglDisplayXlib, egl_display->platform);
+  u_slice_free (CoglDisplayXlib, egl_display->platform);
 }
 
 static CoglBool
@@ -471,7 +471,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
         }
     }
 
-  xlib_onscreen = g_slice_new (CoglOnscreenXlib);
+  xlib_onscreen = u_slice_new (CoglOnscreenXlib);
   egl_onscreen->platform = xlib_onscreen;
 
   xlib_onscreen->xwin = xwin;
@@ -512,9 +512,9 @@ _cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen)
 
   if (_cogl_xlib_renderer_untrap_errors (renderer,
                                          &old_state) != Success)
-    g_warning ("X Error while destroying X window");
+    u_warning ("X Error while destroying X window");
 
-  g_slice_free (CoglOnscreenXlib, xlib_onscreen);
+  u_slice_free (CoglOnscreenXlib, xlib_onscreen);
 }
 
 static void
@@ -719,7 +719,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
       return FALSE;
     }
 
-  egl_tex_pixmap = g_new0 (CoglTexturePixmapEGL, 1);
+  egl_tex_pixmap = u_new0 (CoglTexturePixmapEGL, 1);
 
   egl_tex_pixmap->image =
     _cogl_egl_create_image (ctx,
@@ -728,7 +728,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
                             attribs);
   if (egl_tex_pixmap->image == EGL_NO_IMAGE_KHR)
     {
-      g_free (egl_tex_pixmap);
+      u_free (egl_tex_pixmap);
       return FALSE;
     }
 
@@ -770,7 +770,7 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
     _cogl_egl_destroy_image (ctx, egl_tex_pixmap->image);
 
   tex_pixmap->winsys = NULL;
-  g_free (egl_tex_pixmap);
+  u_free (egl_tex_pixmap);
 }
 
 static CoglBool
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index e336bfb..8fa7f9a 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -82,7 +82,7 @@
   static const CoglFeatureFunction                                      \
   cogl_egl_feature_ ## name ## _funcs[] = {
 #define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args)                   \
-  { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglRendererEGL, pf_ ## name) },
+  { G_STRINGIFY (name), U_STRUCT_OFFSET (CoglRendererEGL, pf_ ## name) },
 #define COGL_WINSYS_FEATURE_END()               \
   { NULL, 0 },                                  \
     };
@@ -135,7 +135,7 @@ get_error_string (void)
   case EGL_BAD_SURFACE:
      return "Invalid surface";
   default:
-    g_assert_not_reached ();
+    u_assert_not_reached ();
   }
 }
 
@@ -150,9 +150,9 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
     ptr = eglGetProcAddress (name);
 
   /* eglGetProcAddress doesn't support fetching core API so we need to
-     get that separately with GModule */
+     get that separately with UModule */
   if (ptr == NULL)
-    g_module_symbol (renderer->libgl_module, name, &ptr);
+    u_module_symbol (renderer->libgl_module, name, &ptr);
 
   return ptr;
 }
@@ -161,7 +161,7 @@ static void
 _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 {
   /* This function must be overridden by a platform winsys */
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 }
 
 /* Updates all the function pointers */
@@ -174,12 +174,12 @@ check_egl_extensions (CoglRenderer *renderer)
   int i;
 
   egl_extensions = eglQueryString (egl_renderer->edpy, EGL_EXTENSIONS);
-  split_extensions = g_strsplit (egl_extensions, " ", 0 /* max_tokens */);
+  split_extensions = u_strsplit (egl_extensions, " ", 0 /* max_tokens */);
 
   COGL_NOTE (WINSYS, "  EGL Extensions: %s", egl_extensions);
 
   egl_renderer->private_features = 0;
-  for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++)
+  for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
     if (_cogl_feature_check (renderer,
                              "EGL", winsys_feature_data + i, 0, 0,
                              COGL_DRIVER_GL, /* the driver isn't used */
@@ -190,7 +190,7 @@ check_egl_extensions (CoglRenderer *renderer)
           winsys_feature_data[i].feature_flags_private;
       }
 
-  g_strfreev (split_extensions);
+  u_strfreev (split_extensions);
 }
 
 CoglBool
@@ -219,7 +219,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
                                CoglError **error)
 {
   /* This function must be overridden by a platform winsys */
-  g_assert_not_reached ();
+  u_assert_not_reached ();
 }
 
 static void
@@ -280,7 +280,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
 
   attributes[i++] = EGL_NONE;
 
-  g_assert (i < MAX_EGL_CONFIG_ATTRIBS);
+  u_assert (i < MAX_EGL_CONFIG_ATTRIBS);
 }
 
 EGLBoolean
@@ -438,7 +438,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
   if (egl_renderer->platform_vtable->display_destroy)
     egl_renderer->platform_vtable->display_destroy (display);
 
-  g_slice_free (CoglDisplayEGL, display->winsys);
+  u_slice_free (CoglDisplayEGL, display->winsys);
   display->winsys = NULL;
 }
 
@@ -452,7 +452,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
 
-  egl_display = g_slice_new0 (CoglDisplayEGL);
+  egl_display = u_slice_new0 (CoglDisplayEGL);
   display->winsys = egl_display;
 
 #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
@@ -490,7 +490,7 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
   CoglDisplayEGL *egl_display = context->display->winsys;
   CoglRendererEGL *egl_renderer = renderer->winsys;
 
-  context->winsys = g_new0 (CoglContextEGL, 1);
+  context->winsys = u_new0 (CoglContextEGL, 1);
 
   _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE);
 
@@ -537,7 +537,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
   if (egl_renderer->platform_vtable->context_deinit)
     egl_renderer->platform_vtable->context_deinit (context);
 
-  g_free (context->winsys);
+  u_free (context->winsys);
 }
 
 typedef struct _CoglGLES2ContextEGL
@@ -629,18 +629,18 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
       status = eglGetConfigAttrib (egl_renderer->edpy,
                                    egl_config,
                                    EGL_SAMPLES, &samples);
-      g_return_val_if_fail (status == EGL_TRUE, TRUE);
+      u_return_val_if_fail (status == EGL_TRUE, TRUE);
       framebuffer->samples_per_pixel = samples;
     }
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
+  onscreen->winsys = u_slice_new0 (CoglOnscreenEGL);
 
   if (egl_renderer->platform_vtable->onscreen_init &&
       !egl_renderer->platform_vtable->onscreen_init (onscreen,
                                                      egl_config,
                                                      error))
     {
-      g_slice_free (CoglOnscreenEGL, onscreen->winsys);
+      u_slice_free (CoglOnscreenEGL, onscreen->winsys);
       return FALSE;
     }
 
@@ -678,14 +678,14 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
       if (eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface)
           == EGL_FALSE)
-        g_warning ("Failed to destroy EGL surface");
+        u_warning ("Failed to destroy EGL surface");
       egl_onscreen->egl_surface = EGL_NO_SURFACE;
     }
 
   if (egl_renderer->platform_vtable->onscreen_deinit)
     egl_renderer->platform_vtable->onscreen_deinit (onscreen);
 
-  g_slice_free (CoglOnscreenEGL, onscreen->winsys);
+  u_slice_free (CoglOnscreenEGL, onscreen->winsys);
   onscreen->winsys = NULL;
 }
 
@@ -764,7 +764,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
   CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
   CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
   int framebuffer_height  = cogl_framebuffer_get_height (framebuffer);
-  int *rectangles = g_alloca (sizeof (int) * n_rectangles * 4);
+  int *rectangles = u_alloca (sizeof (int) * n_rectangles * 4);
   int i;
 
   /* eglSwapBuffersRegion expects rectangles relative to the
@@ -789,7 +789,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
                                              egl_onscreen->egl_surface,
                                              n_rectangles,
                                              rectangles) == EGL_FALSE)
-    g_warning ("Error reported by eglSwapBuffersRegion");
+    u_warning ("Error reported by eglSwapBuffersRegion");
 }
 
 static void
@@ -830,7 +830,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
                                                      egl_onscreen->egl_surface,
                                                      flipped,
                                                      n_rectangles) == EGL_FALSE)
-        g_warning ("Error reported by eglSwapBuffersWithDamage");
+        u_warning ("Error reported by eglSwapBuffersWithDamage");
     }
   else
     eglSwapBuffers (egl_renderer->edpy, egl_onscreen->egl_surface);
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index d59f3dc..fbb950a 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -114,7 +114,7 @@ typedef struct _CoglTexturePixmapGLX
   static const CoglFeatureFunction                                      \
   cogl_glx_feature_ ## name ## _funcs[] = {
 #define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args)                   \
-  { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglGLXRenderer, name) },
+  { G_STRINGIFY (name), U_STRUCT_OFFSET (CoglGLXRenderer, name) },
 #define COGL_WINSYS_FEATURE_END()               \
   { NULL, 0 },                                  \
     };
@@ -157,7 +157,7 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
 static CoglOnscreen *
 find_onscreen_for_xid (CoglContext *context, uint32_t xid)
 {
-  GList *l;
+  UList *l;
 
   for (l = context->framebuffers; l; l = l->next)
     {
@@ -247,7 +247,7 @@ ust_to_nanoseconds (CoglRenderer *renderer,
   switch (glx_renderer->ust_type)
     {
     case COGL_GLX_UST_IS_UNKNOWN:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
       break;
     case COGL_GLX_UST_IS_GETTIMEOFDAY:
     case COGL_GLX_UST_IS_MONOTONIC_TIME:
@@ -301,7 +301,7 @@ _cogl_winsys_get_clock_time (CoglContext *context)
       }
     }
 
-  g_assert_not_reached();
+  u_assert_not_reached();
   return 0;
 }
 
@@ -326,14 +326,14 @@ flush_pending_notifications_cb (void *data,
 
       if (pending_sync_notify)
         {
-          CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos);
+          CoglFrameInfo *info = u_queue_peek_head (&onscreen->pending_frame_infos);
 
           _cogl_onscreen_notify_frame_sync (onscreen, info);
         }
 
       if (pending_complete_notify)
         {
-          CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos);
+          CoglFrameInfo *info = u_queue_pop_head (&onscreen->pending_frame_infos);
 
           _cogl_onscreen_notify_complete (onscreen, info);
 
@@ -360,7 +360,7 @@ flush_pending_notifications_idle (void *user_data)
   _cogl_closure_disconnect (glx_renderer->flush_notifications_idle);
   glx_renderer->flush_notifications_idle = NULL;
 
-  g_list_foreach (context->framebuffers,
+  u_list_foreach (context->framebuffers,
                   flush_pending_notifications_cb,
                   NULL);
 }
@@ -428,7 +428,7 @@ notify_swap_buffers (CoglContext *context, GLXBufferSwapComplete *swap_event)
 
   if (swap_event->ust != 0)
     {
-      CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos);
+      CoglFrameInfo *info = u_queue_peek_head (&onscreen->pending_frame_infos);
 
       info->presentation_time =
         ust_to_nanoseconds (context->display->renderer,
@@ -590,15 +590,15 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
   _cogl_xlib_renderer_disconnect (renderer);
 
   if (glx_renderer->libgl_module)
-    g_module_close (glx_renderer->libgl_module);
+    u_module_close (glx_renderer->libgl_module);
 
-  g_slice_free (CoglGLXRenderer, renderer->winsys);
+  u_slice_free (CoglGLXRenderer, renderer->winsys);
 }
 
 static CoglBool
 update_all_outputs (CoglRenderer *renderer)
 {
-  GList *l;
+  UList *l;
 
   _COGL_GET_CONTEXT (context, FALSE);
 
@@ -635,17 +635,17 @@ resolve_core_glx_functions (CoglRenderer *renderer,
 
   glx_renderer = renderer->winsys;
 
-  if (!g_module_symbol (glx_renderer->libgl_module, "glXQueryExtension",
+  if (!u_module_symbol (glx_renderer->libgl_module, "glXQueryExtension",
                         (void **) &glx_renderer->glXQueryExtension) ||
-      !g_module_symbol (glx_renderer->libgl_module, "glXQueryVersion",
+      !u_module_symbol (glx_renderer->libgl_module, "glXQueryVersion",
                         (void **) &glx_renderer->glXQueryVersion) ||
-      !g_module_symbol (glx_renderer->libgl_module, "glXQueryExtensionsString",
+      !u_module_symbol (glx_renderer->libgl_module, "glXQueryExtensionsString",
                         (void **) &glx_renderer->glXQueryExtensionsString) ||
-      (!g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddress",
+      (!u_module_symbol (glx_renderer->libgl_module, "glXGetProcAddress",
                          (void **) &glx_renderer->glXGetProcAddress) &&
-       !g_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
+       !u_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
                          (void **) &glx_renderer->glXGetProcAddress)) ||
-       !g_module_symbol (glx_renderer->libgl_module, "glXQueryDrawable",
+       !u_module_symbol (glx_renderer->libgl_module, "glXQueryDrawable",
                          (void **) &glx_renderer->glXQueryDrawable))
     {
       _cogl_set_error (error, COGL_WINSYS_ERROR,
@@ -675,9 +675,9 @@ update_base_winsys_features (CoglRenderer *renderer)
 
   COGL_NOTE (WINSYS, "  GLX Extensions: %s", glx_extensions);
 
-  split_extensions = g_strsplit (glx_extensions, " ", 0 /* max_tokens */);
+  split_extensions = u_strsplit (glx_extensions, " ", 0 /* max_tokens */);
 
-  for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++)
+  for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
     if (_cogl_feature_check (renderer,
                              "GLX", winsys_feature_data + i,
                              glx_renderer->glx_major,
@@ -692,7 +692,7 @@ update_base_winsys_features (CoglRenderer *renderer)
                           TRUE);
       }
 
-  g_strfreev (split_extensions);
+  u_strfreev (split_extensions);
 
   /* Note: the GLX_SGI_video_sync spec explicitly states this extension
    * only works for direct contexts. */
@@ -723,7 +723,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
   CoglGLXRenderer *glx_renderer;
   CoglXlibRenderer *xlib_renderer;
 
-  renderer->winsys = g_slice_new0 (CoglGLXRenderer);
+  renderer->winsys = u_slice_new0 (CoglGLXRenderer);
 
   glx_renderer = renderer->winsys;
   xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
@@ -740,8 +740,8 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
       goto error;
     }
 
-  glx_renderer->libgl_module = g_module_open (COGL_GL_LIBNAME,
-                                              G_MODULE_BIND_LAZY);
+  glx_renderer->libgl_module = u_module_open (COGL_GL_LIBNAME,
+                                              U_MODULE_BIND_LAZY);
 
   if (glx_renderer->libgl_module == NULL)
     {
@@ -901,7 +901,7 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
 
   attributes[i++] = None;
 
-  g_assert (i < MAX_GLX_CONFIG_ATTRIBS);
+  u_assert (i < MAX_GLX_CONFIG_ATTRIBS);
 }
 
 /* It seems the GLX spec never defined an invalid GLXFBConfig that
@@ -1173,7 +1173,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
       glx_display->dummy_xwin = None;
     }
 
-  g_slice_free (CoglGLXDisplay, display->winsys);
+  u_slice_free (CoglGLXDisplay, display->winsys);
   display->winsys = NULL;
 }
 
@@ -1186,7 +1186,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
 
-  glx_display = g_slice_new0 (CoglGLXDisplay);
+  glx_display = u_slice_new0 (CoglGLXDisplay);
   display->winsys = glx_display;
 
   if (!create_context (display, error))
@@ -1205,7 +1205,7 @@ error:
 static CoglBool
 _cogl_winsys_context_init (CoglContext *context, CoglError **error)
 {
-  context->winsys = g_new0 (CoglContextGLX, 1);
+  context->winsys = u_new0 (CoglContextGLX, 1);
 
   cogl_xlib_renderer_add_filter (context->display->renderer,
                                  glx_event_filter_cb,
@@ -1219,7 +1219,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
   cogl_xlib_renderer_remove_filter (context->display->renderer,
                                     glx_event_filter_cb,
                                     context);
-  g_free (context->winsys);
+  u_free (context->winsys);
 }
 
 static CoglBool
@@ -1262,7 +1262,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
                                                        fbconfig,
                                                        GLX_SAMPLES,
                                                        &samples);
-      g_return_val_if_fail (status == Success, TRUE);
+      u_return_val_if_fail (status == Success, TRUE);
       framebuffer->samples_per_pixel = samples;
     }
 
@@ -1374,7 +1374,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
         }
     }
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenGLX);
+  onscreen->winsys = u_slice_new0 (CoglOnscreenGLX);
   xlib_onscreen = onscreen->winsys;
   glx_onscreen = onscreen->winsys;
 
@@ -1480,7 +1480,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
   _cogl_xlib_renderer_untrap_errors (context->display->renderer, &old_state);
 
-  g_slice_free (CoglOnscreenGLX, onscreen->winsys);
+  u_slice_free (CoglOnscreenGLX, onscreen->winsys);
   onscreen->winsys = NULL;
 }
 
@@ -1554,7 +1554,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
   if (_cogl_xlib_renderer_untrap_errors (context->display->renderer,
                                          &old_state))
     {
-      g_warning ("X Error received while making drawable 0x%08lX current",
+      u_warning ("X Error received while making drawable 0x%08lX current",
                  drawable);
       return;
     }
@@ -1585,7 +1585,7 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen)
   if (glx_renderer->glXWaitForMsc ||
       glx_renderer->glXGetVideoSync)
     {
-      CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+      CoglFrameInfo *info = u_queue_peek_tail (&onscreen->pending_frame_infos);
 
       if (glx_renderer->glXWaitForMsc)
         {
@@ -1662,7 +1662,7 @@ static void
 set_frame_info_output (CoglOnscreen *onscreen,
                        CoglOutput *output)
 {
-  CoglFrameInfo *info = g_queue_peek_tail (&onscreen->pending_frame_infos);
+  CoglFrameInfo *info = u_queue_peek_tail (&onscreen->pending_frame_infos);
 
   info->output = output;
 
@@ -1704,7 +1704,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
 
   int framebuffer_width =  cogl_framebuffer_get_width (framebuffer);
   int framebuffer_height =  cogl_framebuffer_get_height (framebuffer);
-  int *rectangles = g_alloca (sizeof (int) * n_rectangles * 4);
+  int *rectangles = u_alloca (sizeof (int) * n_rectangles * 4);
   int i;
 
   /* glXCopySubBuffer expects rectangles relative to the bottom left corner but
@@ -2247,19 +2247,19 @@ should_use_rectangle (CoglContext *context)
             COGL_WINSYS_RECTANGLE_STATE_DISABLE :
             COGL_WINSYS_RECTANGLE_STATE_ENABLE;
 
-          if ((rect_env = g_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
+          if ((rect_env = u_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
               /* For compatibility, we'll also look at the old Clutter
                  environment variable */
-              (rect_env = g_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
+              (rect_env = u_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
             {
-              if (g_ascii_strcasecmp (rect_env, "force") == 0)
+              if (u_ascii_strcasecmp (rect_env, "force") == 0)
                 context->rectangle_state =
                   COGL_WINSYS_RECTANGLE_STATE_ENABLE;
-              else if (g_ascii_strcasecmp (rect_env, "disable") == 0)
+              else if (u_ascii_strcasecmp (rect_env, "disable") == 0)
                 context->rectangle_state =
                   COGL_WINSYS_RECTANGLE_STATE_DISABLE;
-              else if (g_ascii_strcasecmp (rect_env, "allow"))
-                g_warning ("Unknown value for COGL_PIXMAP_TEXTURE_RECTANGLE, "
+              else if (u_ascii_strcasecmp (rect_env, "allow"))
+                u_warning ("Unknown value for COGL_PIXMAP_TEXTURE_RECTANGLE, "
                            "should be 'force' or 'disable'");
             }
         }
@@ -2380,7 +2380,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
       return FALSE;
     }
 
-  glx_tex_pixmap = g_new0 (CoglTexturePixmapGLX, 1);
+  glx_tex_pixmap = u_new0 (CoglTexturePixmapGLX, 1);
 
   glx_tex_pixmap->glx_pixmap = None;
   glx_tex_pixmap->can_mipmap = FALSE;
@@ -2396,7 +2396,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap)
   if (!try_create_glx_pixmap (ctx, tex_pixmap, FALSE))
     {
       tex_pixmap->winsys = NULL;
-      g_free (glx_tex_pixmap);
+      u_free (glx_tex_pixmap);
       return FALSE;
     }
 
@@ -2463,7 +2463,7 @@ _cogl_winsys_texture_pixmap_x11_free (CoglTexturePixmapX11 *tex_pixmap)
     cogl_object_unref (glx_tex_pixmap->glx_tex);
 
   tex_pixmap->winsys = NULL;
-  g_free (glx_tex_pixmap);
+  u_free (glx_tex_pixmap);
 }
 
 static CoglBool
diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c
index 6f5f6c8..b36a331 100644
--- a/cogl/winsys/cogl-winsys-sdl.c
+++ b/cogl/winsys/cogl-winsys-sdl.c
@@ -88,7 +88,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 {
   SDL_Quit ();
 
-  g_slice_free (CoglRendererSdl, renderer->winsys);
+  u_slice_free (CoglRendererSdl, renderer->winsys);
 }
 
 static CoglBool
@@ -123,7 +123,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
       return FALSE;
     }
 
-  renderer->winsys = g_slice_new0 (CoglRendererSdl);
+  renderer->winsys = u_slice_new0 (CoglRendererSdl);
 
   return TRUE;
 }
@@ -137,7 +137,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
 
   /* No need to destroy the surface - it is freed by SDL_Quit */
 
-  g_slice_free (CoglDisplaySdl, display->winsys);
+  u_slice_free (CoglDisplaySdl, display->winsys);
   display->winsys = NULL;
 }
 
@@ -166,7 +166,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
 
-  sdl_display = g_slice_new0 (CoglDisplaySdl);
+  sdl_display = u_slice_new0 (CoglDisplaySdl);
   display->winsys = sdl_display;
 
   set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config);
@@ -203,7 +203,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 #endif
 
     default:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 
   /* There's no way to know what size the application will need until
@@ -309,8 +309,8 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
 {
   CoglRenderer *renderer = context->display->renderer;
 
-  if (G_UNLIKELY (renderer->sdl_event_type_set == FALSE))
-    g_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
+  if (U_UNLIKELY (renderer->sdl_event_type_set == FALSE))
+    u_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
              "must be called during initialization");
 
   _cogl_renderer_add_native_filter (renderer,
diff --git a/cogl/winsys/cogl-winsys-sdl2.c b/cogl/winsys/cogl-winsys-sdl2.c
index c54e73b..1a65594 100644
--- a/cogl/winsys/cogl-winsys-sdl2.c
+++ b/cogl/winsys/cogl-winsys-sdl2.c
@@ -95,7 +95,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
 {
   SDL_VideoQuit ();
 
-  g_slice_free (CoglRendererSdl2, renderer->winsys);
+  u_slice_free (CoglRendererSdl2, renderer->winsys);
 }
 
 static CoglBool
@@ -111,7 +111,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
       return FALSE;
     }
 
-  renderer->winsys = g_slice_new0 (CoglRendererSdl2);
+  renderer->winsys = u_slice_new0 (CoglRendererSdl2);
 
   return TRUE;
 }
@@ -129,7 +129,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
   if (sdl_display->dummy_window)
     SDL_DestroyWindow (sdl_display->dummy_window);
 
-  g_slice_free (CoglDisplaySdl2, display->winsys);
+  u_slice_free (CoglDisplaySdl2, display->winsys);
   display->winsys = NULL;
 }
 
@@ -160,7 +160,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
 
-  sdl_display = g_slice_new0 (CoglDisplaySdl2);
+  sdl_display = u_slice_new0 (CoglDisplaySdl2);
   display->winsys = sdl_display;
 
   set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config);
@@ -218,7 +218,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
     case COGL_DRIVER_GL3:
       /* The first character of the version string will be a digit if
        * it's normal GL */
-      if (!g_ascii_isdigit (gl_version[0]))
+      if (!u_ascii_isdigit (gl_version[0]))
         {
           _cogl_set_error (error, COGL_WINSYS_ERROR,
                            COGL_WINSYS_ERROR_INIT,
@@ -238,7 +238,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
       break;
 
     case COGL_DRIVER_GLES2:
-      if (!g_str_has_prefix (gl_version, "OpenGL ES 2"))
+      if (!u_str_has_prefix (gl_version, "OpenGL ES 2"))
         {
           _cogl_set_error (error, COGL_WINSYS_ERROR,
                            COGL_WINSYS_ERROR_INIT,
@@ -249,7 +249,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
       break;
 
     case COGL_DRIVER_GLES1:
-      if (!g_str_has_prefix (gl_version, "OpenGL ES 1"))
+      if (!u_str_has_prefix (gl_version, "OpenGL ES 1"))
         {
           _cogl_set_error (error, COGL_WINSYS_ERROR,
                            COGL_WINSYS_ERROR_INIT,
@@ -260,7 +260,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
       break;
 
     default:
-      g_assert_not_reached ();
+      u_assert_not_reached ();
     }
 
   return TRUE;
@@ -301,7 +301,7 @@ flush_pending_resize_notifications_idle (void *user_data)
   _cogl_closure_disconnect (sdl_renderer->resize_notify_idle);
   sdl_renderer->resize_notify_idle = NULL;
 
-  g_list_foreach (context->framebuffers,
+  u_list_foreach (context->framebuffers,
                   flush_pending_notifications_cb,
                   NULL);
 }
@@ -386,10 +386,10 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
 {
   CoglRenderer *renderer = context->display->renderer;
 
-  context->winsys = g_new0 (CoglContextSdl2, 1);
+  context->winsys = u_new0 (CoglContextSdl2, 1);
 
-  if (G_UNLIKELY (renderer->sdl_event_type_set == FALSE))
-    g_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
+  if (U_UNLIKELY (renderer->sdl_event_type_set == FALSE))
+    u_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
              "must be called during initialization");
 
   if (!_cogl_context_update_features (context, error))
@@ -423,7 +423,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
                                        sdl_event_filter_cb,
                                        context);
 
-  g_free (context->winsys);
+  u_free (context->winsys);
 }
 
 static void
@@ -485,7 +485,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
       sdl_onscreen->window = NULL;
     }
 
-  g_slice_free (CoglOnscreenSdl2, sdl_onscreen);
+  u_slice_free (CoglOnscreenSdl2, sdl_onscreen);
   onscreen->winsys = NULL;
 }
 
@@ -525,7 +525,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
 
   SDL_SetWindowData (window, COGL_SDL_WINDOW_DATA_KEY, onscreen);
 
-  onscreen->winsys = g_slice_new (CoglOnscreenSdl2);
+  onscreen->winsys = u_slice_new (CoglOnscreenSdl2);
   sdl_onscreen = onscreen->winsys;
   sdl_onscreen->window = window;
 
diff --git a/cogl/winsys/cogl-winsys-stub.c b/cogl/winsys/cogl-winsys-stub.c
index 196d673..a8ba510 100644
--- a/cogl/winsys/cogl-winsys-stub.c
+++ b/cogl/winsys/cogl-winsys-stub.c
@@ -56,18 +56,18 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
                                         const char *name,
                                         CoglBool in_core)
 {
-  static GModule *module = NULL;
+  static UModule *module = NULL;
 
   /* this should find the right function if the program is linked against a
    * library providing it */
-  if (G_UNLIKELY (module == NULL))
-    module = g_module_open (NULL, 0);
+  if (U_UNLIKELY (module == NULL))
+    module = u_module_open (NULL, 0);
 
   if (module)
     {
       void *symbol;
 
-      if (g_module_symbol (module, name, &symbol))
+      if (u_module_symbol (module, name, &symbol))
         return symbol;
     }
 
diff --git a/cogl/winsys/cogl-winsys-wgl.c b/cogl/winsys/cogl-winsys-wgl.c
index 004b88c..797dd28 100644
--- a/cogl/winsys/cogl-winsys-wgl.c
+++ b/cogl/winsys/cogl-winsys-wgl.c
@@ -51,13 +51,13 @@
 #include "cogl-error-private.h"
 #include "cogl-poll-private.h"
 
-/* This magic handle will cause g_poll to wakeup when there is a
+/* This magic handle will cause u_poll to wakeup when there is a
  * pending message */
 #define WIN32_MSG_HANDLE 19981206
 
 typedef struct _CoglRendererWgl
 {
-  GModule *gl_module;
+  UModule *gl_module;
 
   /* Function pointers for GLX specific extensions */
 #define COGL_WINSYS_FEATURE_BEGIN(a, b, c, d, e)
@@ -109,7 +109,7 @@ typedef struct _CoglOnscreenWgl
   static const CoglFeatureFunction                                      \
   cogl_wgl_feature_ ## name ## _funcs[] = {
 #define COGL_WINSYS_FEATURE_FUNCTION(ret, name, args)                   \
-  { G_STRINGIFY (name), G_STRUCT_OFFSET (CoglRendererWgl, pf_ ## name) },
+  { G_STRINGIFY (name), U_STRUCT_OFFSET (CoglRendererWgl, pf_ ## name) },
 #define COGL_WINSYS_FEATURE_END()               \
   { NULL, 0 },                                  \
     };
@@ -155,10 +155,10 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
   if (proc == NULL)
     {
       if (wgl_renderer->gl_module == NULL)
-        wgl_renderer->gl_module = g_module_open ("opengl32", 0);
+        wgl_renderer->gl_module = u_module_open ("opengl32", 0);
 
       if (wgl_renderer->gl_module)
-        g_module_symbol (wgl_renderer->gl_module, name, &proc);
+        u_module_symbol (wgl_renderer->gl_module, name, &proc);
     }
 
   return proc;
@@ -173,16 +173,16 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
     _cogl_poll_renderer_remove_fd (renderer, WIN32_MSG_HANDLE);
 
   if (wgl_renderer->gl_module)
-    g_module_close (wgl_renderer->gl_module);
+    u_module_close (wgl_renderer->gl_module);
 
-  g_slice_free (CoglRendererWgl, renderer->winsys);
+  u_slice_free (CoglRendererWgl, renderer->winsys);
 }
 
 static CoglOnscreen *
 find_onscreen_for_hwnd (CoglContext *context, HWND hwnd)
 {
   CoglDisplayWgl *display_wgl = context->display->winsys;
-  GList *l;
+  UList *l;
 
   /* If the hwnd has Cogl's window class then we can lookup the
      onscreen pointer directly by reading the extra window data */
@@ -288,7 +288,7 @@ static CoglBool
 _cogl_winsys_renderer_connect (CoglRenderer *renderer,
                                CoglError **error)
 {
-  renderer->winsys = g_slice_new0 (CoglRendererWgl);
+  renderer->winsys = u_slice_new0 (CoglRendererWgl);
 
   if (renderer->win32_enable_event_retrieval)
     {
@@ -454,11 +454,11 @@ create_window_class (CoglDisplay *display, CoglError **error)
      destroyed */
 
   /* Generate a unique name containing the address of the display */
-  class_name_ascii = g_strdup_printf ("CoglWindow0x%0*" G_GINTPTR_MODIFIER "x",
+  class_name_ascii = u_strdup_printf ("CoglWindow0x%0*" G_GINTPTR_MODIFIER "x",
                                       sizeof (guintptr) * 2,
                                       (guintptr) display);
   /* Convert it to WCHARs */
-  class_name_wchar = g_malloc ((strlen (class_name_ascii) + 1) *
+  class_name_wchar = u_malloc ((strlen (class_name_ascii) + 1) *
                                sizeof (WCHAR));
   for (src = class_name_ascii, dst = class_name_wchar;
        *src;
@@ -480,8 +480,8 @@ create_window_class (CoglDisplay *display, CoglError **error)
   wndclass.lpszClassName = class_name_wchar;
   wgl_display->window_class = RegisterClassW (&wndclass);
 
-  g_free (class_name_wchar);
-  g_free (class_name_ascii);
+  u_free (class_name_wchar);
+  u_free (class_name_ascii);
 
   if (wgl_display->window_class == 0)
     {
@@ -593,7 +593,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
     UnregisterClassW ((LPWSTR) MAKEINTATOM (wgl_display->window_class),
                       GetModuleHandleW (NULL));
 
-  g_slice_free (CoglDisplayWgl, display->winsys);
+  u_slice_free (CoglDisplayWgl, display->winsys);
   display->winsys = NULL;
 }
 
@@ -605,7 +605,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
 
   _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
 
-  wgl_display = g_slice_new0 (CoglDisplayWgl);
+  wgl_display = u_slice_new0 (CoglDisplayWgl);
   display->winsys = wgl_display;
 
   if (!create_window_class (display, error))
@@ -653,7 +653,7 @@ get_wgl_extensions_string (HDC dc)
     char **extensions = _cogl_context_get_gl_extensions (ctx);
     CoglBool have_ext = _cogl_check_extension ("WGL_EXT_swap_control",
                                                extensions);
-    g_strfreev (extensions);
+    u_strfreev (extensions);
     if (have_ext)
       return "WGL_EXT_swap_control";
   }
@@ -687,11 +687,11 @@ update_winsys_features (CoglContext *context, CoglError **error)
   if (wgl_extensions)
     {
       char **split_extensions =
-        g_strsplit (wgl_extensions, " ", 0 /* max_tokens */);
+        u_strsplit (wgl_extensions, " ", 0 /* max_tokens */);
 
       COGL_NOTE (WINSYS, "  WGL Extensions: %s", wgl_extensions);
 
-      for (i = 0; i < G_N_ELEMENTS (winsys_feature_data); i++)
+      for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
         if (_cogl_feature_check (context->display->renderer,
                                  "WGL", winsys_feature_data + i, 0, 0,
                                  COGL_DRIVER_GL,
@@ -704,7 +704,7 @@ update_winsys_features (CoglContext *context, CoglError **error)
                               TRUE);
           }
 
-      g_strfreev (split_extensions);
+      u_strfreev (split_extensions);
     }
 
   /* We'll manually handle queueing dirty events in response to
@@ -719,7 +719,7 @@ update_winsys_features (CoglContext *context, CoglError **error)
 static CoglBool
 _cogl_winsys_context_init (CoglContext *context, CoglError **error)
 {
-  context->winsys = g_new0 (CoglContextWgl, 1);
+  context->winsys = u_new0 (CoglContextWgl, 1);
 
   cogl_win32_renderer_add_filter (context->display->renderer,
                                   win32_event_filter_cb,
@@ -735,7 +735,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
                                      win32_event_filter_cb,
                                      context);
 
-  g_free (context->winsys);
+  u_free (context->winsys);
 }
 
 static void
@@ -809,7 +809,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
       DestroyWindow (win32_onscreen->hwnd);
     }
 
-  g_slice_free (CoglOnscreenWgl, onscreen->winsys);
+  u_slice_free (CoglOnscreenWgl, onscreen->winsys);
   onscreen->winsys = NULL;
 }
 
@@ -882,7 +882,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
       SetWindowLongPtrW (hwnd, 0, (LONG_PTR) onscreen);
     }
 
-  onscreen->winsys = g_slice_new0 (CoglOnscreenWgl);
+  onscreen->winsys = u_slice_new0 (CoglOnscreenWgl);
   win32_onscreen = onscreen->winsys;
   wgl_onscreen = onscreen->winsys;
 
diff --git a/cogl/winsys/cogl-winsys.c b/cogl/winsys/cogl-winsys.c
index 8e8b6f1..c87c5ef 100644
--- a/cogl/winsys/cogl-winsys.c
+++ b/cogl/winsys/cogl-winsys.c
@@ -34,12 +34,12 @@
 
 #include "cogl-context-private.h"
 
-#include <gmodule.h>
+#include <umodule.h>
 
 uint32_t
 _cogl_winsys_error_domain (void)
 {
-  return g_quark_from_static_string ("cogl-winsys-error-quark");
+  return u_quark_from_static_string ("cogl-winsys-error-quark");
 }
 
 /* FIXME: we should distinguish renderer and context features */
diff --git a/configure.ac b/configure.ac
index 066577a..1bfce89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -529,8 +529,8 @@ AS_IF([test "x$enable_glib" = "xyes"],
         COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES gobject-2.0 gmodule-no-export-2.0"
       ],
       [
-        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/eglib/src"
-        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/eglib/src"
+        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/ulib/src"
+        COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/ulib/src"
         EXPERIMENTAL_CONFIG=yes
         EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
         enable_nls=no
@@ -1412,7 +1412,7 @@ LIBS="$save_libs"
 
 
 dnl ================================================================
-dnl eglib checks.
+dnl ulib checks.
 dnl ================================================================
 
 AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
@@ -1547,10 +1547,10 @@ build/win32/Makefile
 build/win32/vs9/Makefile
 build/win32/vs10/Makefile
 deps/Makefile
-deps/eglib/Makefile
-deps/eglib/src/Makefile
-deps/eglib/src/eglib-config.h
-deps/eglib/test/Makefile
+deps/ulib/Makefile
+deps/ulib/src/Makefile
+deps/ulib/src/ulib-config.h
+deps/ulib/test/Makefile
 test-fixtures/Makefile
 cogl/Makefile
 cogl/cogl2.pc
diff --git a/deps/Makefile.am b/deps/Makefile.am
index 759c810..04573f8 100644
--- a/deps/Makefile.am
+++ b/deps/Makefile.am
@@ -1,5 +1 @@
-SUBDIRS =
-
-if !USE_GLIB
-SUBDIRS += eglib
-endif
+SUBDIRS = ulib
diff --git a/deps/eglib/.gitignore b/deps/ulib/.gitignore
similarity index 100%
rename from deps/eglib/.gitignore
rename to deps/ulib/.gitignore
diff --git a/deps/eglib/Makefile.am b/deps/ulib/Makefile.am
similarity index 100%
rename from deps/eglib/Makefile.am
rename to deps/ulib/Makefile.am
diff --git a/deps/eglib/src/.gitignore b/deps/ulib/src/.gitignore
similarity index 100%
rename from deps/eglib/src/.gitignore
rename to deps/ulib/src/.gitignore
diff --git a/deps/ulib/src/Makefile.am b/deps/ulib/src/Makefile.am
new file mode 100644
index 0000000..83f7b41
--- /dev/null
+++ b/deps/ulib/src/Makefile.am
@@ -0,0 +1,83 @@
+noinst_LTLIBRARIES = libulib.la libulib-static.la
+
+win_files  = \
+       ulib-config.hw \
+       udate-win32.c udir-win32.c ufile-win32.c umisc-win32.c \
+       umodule-win32.c utimer-win32.c
+
+unix_files = \
+       udate-unix.c  udir-unix.c  ufile-unix.c  umisc-unix.c   \
+       umodule-unix.c utimer-unix.c
+
+# some unices and windows do not have an implementation of vasprintf
+# used by eglib, use provided implementation instead
+if NEED_VASPRINTF
+vasprintf_files = vasprintf.c
+else
+vaprinttf_files = foo.c
+endif
+
+if HOST_WIN32
+os_files = $(win_files)
+else
+os_files = $(unix_files)
+endif
+
+libulib_la_SOURCES = \
+       sort.frag.h     \
+       ulib.h          \
+       udebugkey.c     \
+       uquark.c        \
+       uarray.c        \
+       ubytearray.c    \
+       uerror.c        \
+       uhashtable.c    \
+       uiconv.c        \
+       umem.c          \
+       umodule.h       \
+       uoutput.c       \
+       uqsort.c        \
+       ustr.c          \
+       uslist.c        \
+       ustring.c       \
+       uptrarray.c     \
+       ulist.c         \
+       uhooklist.c     \
+       uqueue.c        \
+       upath.c         \
+       ushell.c        \
+       uspawn.c        \
+       ufile.c         \
+       ufile-posix.c   \
+       uutf8.c         \
+       uunicode.c      \
+       unicode-data.h  \
+       $(os_files)     \
+       $(vasprintf_files)
+
+AM_CPPFLAGS =                  \
+       -I$(top_builddir)       \
+       -I$(top_srcdir)         \
+       -I$(srcdir)             \
+       -Wall                   \
+       $(NULL)
+
+#libulib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+#libulib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+libulib_static_la_SOURCES=$(libulib_la_SOURCES)
+libulib_static_la_CFLAGS = $(libulib_la_CFLAGS)
+
+if HOST_WIN32
+libulib_la_LIBADD = -lm $(LIBICONV) -lpsapi
+else
+if PLATFORM_ANDROID
+libulib_la_LIBADD = -llog
+endif
+endif
+
+libulib_static_la_LIBADD = $(libulib_la_LIBADD) $(LIBICONV)
+libulib_static_la_LDFLAGS = -static
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = ulib-config.h.in $(win_files) $(unix_files)
diff --git a/deps/eglib/src/sort.frag.h b/deps/ulib/src/sort.frag.h
similarity index 95%
rename from deps/eglib/src/sort.frag.h
rename to deps/ulib/src/sort.frag.h
index 2cf5a9b..644e2d7 100644
--- a/deps/eglib/src/sort.frag.h
+++ b/deps/ulib/src/sort.frag.h
@@ -50,14 +50,14 @@ typedef list_node *digit;
 struct sort_info
 {
        int min_rank, n_ranks;
-       GCompareFunc func;
+       UCompareFunc func;
 
        /* Invariant: ranks[i] == NULL || length(ranks[i]) >= 2**(i+1) */
        list_node *ranks [MAX_RANKS]; /* ~ 128 bytes on 32bit, ~ 512 bytes on 64bit */
 };
 
 static inline void
-init_sort_info (struct sort_info *si, GCompareFunc func)
+init_sort_info (struct sort_info *si, UCompareFunc func)
 {
        si->min_rank = si->n_ranks = 0;
        si->func = func;
@@ -65,7 +65,7 @@ init_sort_info (struct sort_info *si, GCompareFunc func)
 }
 
 static inline list_node *
-merge_lists (list_node *first, list_node *second, GCompareFunc func)
+merge_lists (list_node *first, list_node *second, UCompareFunc func)
 {
        /* merge the two lists */
        list_node *list = NULL;
@@ -128,7 +128,7 @@ insert_list (struct sort_info *si, list_node* list, int rank)
 
        if (rank > si->n_ranks) {
                if (rank > MAX_RANKS) {
-                       g_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
+                       u_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
                        rank = MAX_RANKS;
                }
                list = merge_lists (sweep_up (si, NULL, si->n_ranks), list, si->func);
@@ -158,7 +158,7 @@ insert_list (struct sort_info *si, list_node* list, int rank)
 
 /* A non-recursive mergesort */
 static inline digit
-do_sort (list_node* list, GCompareFunc func)
+do_sort (list_node* list, UCompareFunc func)
 {
        struct sort_info si;
 
diff --git a/deps/eglib/src/garray.c b/deps/ulib/src/uarray.c
similarity index 67%
rename from deps/eglib/src/garray.c
rename to deps/ulib/src/uarray.c
index 0c8a876..bebd0ec 100644
--- a/deps/eglib/src/garray.c
+++ b/deps/ulib/src/uarray.c
@@ -29,7 +29,7 @@
 #include <config.h>
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
 #define INITIAL_CAPACITY 16
 
@@ -37,17 +37,17 @@
 #define element_length(p,i) ((i) * (p)->element_size)
 
 typedef struct {
-       GArray array;
-       gboolean clear_;
-       guint element_size;
-       gboolean zero_terminated;
-       guint capacity;
-} GArrayPriv;
+       UArray array;
+       uboolean clear_;
+       unsigned int element_size;
+       uboolean zero_terminated;
+       unsigned int capacity;
+} UArrayPriv;
 
 static void
-ensure_capacity (GArrayPriv *priv, guint capacity)
+ensure_capacity (UArrayPriv *priv, unsigned int capacity)
 {
-       guint new_capacity;
+       unsigned int new_capacity;
        
        if (capacity <= priv->capacity)
                return;
@@ -57,7 +57,7 @@ ensure_capacity (GArrayPriv *priv, guint capacity)
              new_capacity *= 2)
           ;
        
-       priv->array.data = g_realloc (priv->array.data, element_length (priv, new_capacity));
+       priv->array.data = u_realloc (priv->array.data, element_length (priv, new_capacity));
        
        if (priv->clear_) {
                memset (element_offset (priv, priv->capacity),
@@ -68,63 +68,63 @@ ensure_capacity (GArrayPriv *priv, guint capacity)
        priv->capacity = new_capacity;
 }
 
-GArray *
-g_array_new (gboolean zero_terminated,
-            gboolean clear_,
-            guint element_size)
+UArray *
+u_array_new (uboolean zero_terminated,
+            uboolean clear_,
+            unsigned int element_size)
 {
-       GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+       UArrayPriv *rv = u_new0 (UArrayPriv, 1);
        rv->zero_terminated = zero_terminated;
        rv->clear_ = clear_;
        rv->element_size = element_size;
 
        ensure_capacity (rv, INITIAL_CAPACITY);
 
-       return (GArray*)rv;
+       return (UArray*)rv;
 }
 
-GArray *
-g_array_sized_new (gboolean zero_terminated,
-            gboolean clear_,
-            guint element_size,
-                guint reserved_size)
+UArray *
+u_array_sized_new (uboolean zero_terminated,
+            uboolean clear_,
+            unsigned int element_size,
+                unsigned int reserved_size)
 {
-       GArrayPriv *rv = g_new0 (GArrayPriv, 1);
+       UArrayPriv *rv = u_new0 (UArrayPriv, 1);
        rv->zero_terminated = zero_terminated;
        rv->clear_ = clear_;
        rv->element_size = element_size;
 
        ensure_capacity (rv, reserved_size);
 
-       return (GArray*)rv;
+       return (UArray*)rv;
 }
 
-gchar*
-g_array_free (GArray *array,
-             gboolean free_segment)
+char*
+u_array_free (UArray *array,
+             uboolean free_segment)
 {
-       gchar* rv = NULL;
+       char* rv = NULL;
 
-       g_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
 
        if (free_segment)
-               g_free (array->data);
+               u_free (array->data);
        else
                rv = array->data;
 
-       g_free (array);
+       u_free (array);
 
        return rv;
 }
 
-GArray *
-g_array_append_vals (GArray *array,
-                    gconstpointer data,
-                    guint len)
+UArray *
+u_array_append_vals (UArray *array,
+                    const void * data,
+                    unsigned int len)
 {
-       GArrayPriv *priv = (GArrayPriv*)array;
+       UArrayPriv *priv = (UArrayPriv*)array;
 
-       g_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
 
        ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
   
@@ -143,16 +143,16 @@ g_array_append_vals (GArray *array,
        return array;
 }
 
-GArray*
-g_array_insert_vals (GArray *array,
-                    guint index_,
-                    gconstpointer data,
-                    guint len)
+UArray*
+u_array_insert_vals (UArray *array,
+                    unsigned int index_,
+                    const void * data,
+                    unsigned int len)
 {
-       GArrayPriv *priv = (GArrayPriv*)array;
-       guint extra = (priv->zero_terminated ? 1 : 0);
+       UArrayPriv *priv = (UArrayPriv*)array;
+       unsigned int extra = (priv->zero_terminated ? 1 : 0);
 
-       g_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
 
        ensure_capacity (priv, array->len + len + extra);
   
@@ -177,13 +177,13 @@ g_array_insert_vals (GArray *array,
        return array;
 }
 
-GArray*
-g_array_remove_index (GArray *array,
-                     guint index_)
+UArray*
+u_array_remove_index (UArray *array,
+                     unsigned int index_)
 {
-       GArrayPriv *priv = (GArrayPriv*)array;
+       UArrayPriv *priv = (UArrayPriv*)array;
 
-       g_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
 
        memmove (element_offset (priv, index_),
                 element_offset (priv, index_ + 1),
@@ -200,13 +200,13 @@ g_array_remove_index (GArray *array,
        return array;
 }
 
-GArray*
-g_array_remove_index_fast (GArray *array,
-                     guint index_)
+UArray*
+u_array_remove_index_fast (UArray *array,
+                     unsigned int index_)
 {
-       GArrayPriv *priv = (GArrayPriv*)array;
+       UArrayPriv *priv = (UArrayPriv*)array;
 
-       g_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
 
        memmove (element_offset (priv, index_),
                 element_offset (priv, array->len - 1),
@@ -223,13 +223,13 @@ g_array_remove_index_fast (GArray *array,
        return array;
 }
 
-GArray *
-g_array_set_size (GArray *array, gint length)
+UArray *
+u_array_set_size (UArray *array, int length)
 {
-       GArrayPriv *priv = (GArrayPriv*)array;
+       UArrayPriv *priv = (UArrayPriv*)array;
 
-       g_return_val_if_fail (array != NULL, NULL);
-       g_return_val_if_fail (length >= 0, NULL);
+       u_return_val_if_fail (array != NULL, NULL);
+       u_return_val_if_fail (length >= 0, NULL);
 
        if (length > priv->capacity) {
                // grow the array
diff --git a/deps/eglib/src/gbytearray.c b/deps/ulib/src/ubytearray.c
similarity index 67%
rename from deps/eglib/src/gbytearray.c
rename to deps/ulib/src/ubytearray.c
index 837e15e..adfe122 100644
--- a/deps/eglib/src/gbytearray.c
+++ b/deps/ulib/src/ubytearray.c
@@ -2,7 +2,7 @@
  * Arrays
  *
  * Author:
- *   Geoff Norton  (gnorton novell com)
+ *   Ueoff Norton  (gnorton novell com)
  *
  * (C) 2010 Novell, Inc.
  *
@@ -30,33 +30,33 @@
 #include <config.h>
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
-GByteArray *
-g_byte_array_new ()
+UByteArray *
+u_byte_array_new ()
 {
-       return (GByteArray *) g_array_new (FALSE, TRUE, 1);
+       return (UByteArray *) u_array_new (FALSE, TRUE, 1);
 }
 
-guint8*
-g_byte_array_free (GByteArray *array,
-                   gboolean free_segment)
+uint8_t*
+u_byte_array_free (UByteArray *array,
+                   uboolean free_segment)
 {
-       return (guint8*) g_array_free ((GArray *)array, free_segment);
+       return (uint8_t*) u_array_free ((UArray *)array, free_segment);
 }
 
-GByteArray *
-g_byte_array_append (GByteArray *array,
-                    const guint8 *data,
-                    guint len)
+UByteArray *
+u_byte_array_append (UByteArray *array,
+                    const uint8_t *data,
+                    unsigned int len)
 {
-       return (GByteArray *)g_array_append_vals ((GArray *)array, data, len);
+       return (UByteArray *)u_array_append_vals ((UArray *)array, data, len);
 }
 
-GByteArray *
-g_byte_array_set_size (GByteArray *array,
-                       guint len)
+UByteArray *
+u_byte_array_set_size (UByteArray *array,
+                       unsigned int len)
 {
-       g_array_set_size ((GArray*)array, len);
+       u_array_set_size ((UArray*)array, len);
         return array;
 }
diff --git a/deps/eglib/src/gdate-unix.c b/deps/ulib/src/udate-unix.c
similarity index 92%
rename from deps/eglib/src/gdate-unix.c
rename to deps/ulib/src/udate-unix.c
index 5d3dfc8..8be341c 100644
--- a/deps/eglib/src/gdate-unix.c
+++ b/deps/ulib/src/udate-unix.c
@@ -29,24 +29,24 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 #include <time.h>
 #include <errno.h>
 #include <sys/time.h>
 
 void
-g_get_current_time (GTimeVal *result)
+u_get_current_time (UTimeVal *result)
 {
        struct timeval tv;
 
-       g_return_if_fail (result != NULL);
+       u_return_if_fail (result != NULL);
        gettimeofday (&tv, NULL);
        result->tv_sec = tv.tv_sec;
        result->tv_usec = tv.tv_usec;
 }
 
 void
-g_usleep (gulong microseconds)
+u_usleep (unsigned long microseconds)
 {
        struct timespec req, rem;
 
diff --git a/deps/eglib/src/gdate-win32.c b/deps/ulib/src/udate-win32.c
similarity index 90%
rename from deps/eglib/src/gdate-win32.c
rename to deps/ulib/src/udate-win32.c
index 2b21698..e23d5c8 100644
--- a/deps/eglib/src/gdate-win32.c
+++ b/deps/ulib/src/udate-win32.c
@@ -29,24 +29,24 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
 #include <winsock2.h>
 
 void
-g_get_current_time (GTimeVal *result)
+u_get_current_time (UTimeVal *result)
 {
        long int l;
 
-       g_return_if_fail (result != NULL);
-       l = GetTickCount();
+       u_return_if_fail (result != NULL);
+       l = UetTickCount();
 
        result->tv_sec = l / 1000;
        result->tv_usec = (l % 1000) * 1000;
 }
 
 void
-g_usleep (gulong microseconds)
+u_usleep (unsigned long microseconds)
 {
        Sleep (microseconds/1000);
 }
diff --git a/deps/eglib/src/gdebugkey.c b/deps/ulib/src/udebugkey.c
similarity index 79%
rename from deps/eglib/src/gdebugkey.c
rename to deps/ulib/src/udebugkey.c
index 0cf79d4..9a8050b 100644
--- a/deps/eglib/src/gdebugkey.c
+++ b/deps/ulib/src/udebugkey.c
@@ -28,27 +28,27 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 
-guint
-g_parse_debug_string (const gchar *string,
-                      const GDebugKey *keys,
-                      guint nkeys)
+unsigned int
+u_parse_debug_string (const char *string,
+                      const UDebugKey *keys,
+                      unsigned int nkeys)
 {
-  char **strv = g_strsplit_set (string, ":;, \t", 0);
-  gboolean needs_invert = FALSE;
-  guint value = 0;
+  char **strv = u_strsplit_set (string, ":;, \t", 0);
+  uboolean needs_invert = FALSE;
+  unsigned int value = 0;
   int i;
 
   if (strcasecmp (string, "help") == 0)
     {
-      g_printerr ("Supported debug keys:\n");
+      u_printerr ("Supported debug keys:\n");
       for (i = 0; strv[i]; i++)
         {
-          g_printerr ("  %s:\n", keys[i].key);
+          u_printerr ("  %s:\n", keys[i].key);
         }
-      g_printerr ("  all\n");
-      g_printerr ("  help\n");
+      u_printerr ("  all\n");
+      u_printerr ("  help\n");
     }
 
   for (i = 0; strv[i]; i++)
@@ -65,7 +65,7 @@ g_parse_debug_string (const gchar *string,
   if (needs_invert)
     value = value ^ (~0);
 
-  g_strfreev (strv);
+  u_strfreev (strv);
 
   return value;
 }
diff --git a/deps/eglib/src/gdir-unix.c b/deps/ulib/src/udir-unix.c
similarity index 73%
rename from deps/eglib/src/gdir-unix.c
rename to deps/ulib/src/udir-unix.c
index 5dfb275..6a473a0 100644
--- a/deps/eglib/src/gdir-unix.c
+++ b/deps/ulib/src/udir-unix.c
@@ -28,7 +28,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -37,46 +37,46 @@
 #include <unistd.h>
 #include <dirent.h>
 
-struct _GDir {
+struct _UDir {
        DIR *dir;
 #ifndef HAVE_REWINDDIR
        char *path;
 #endif
 };
 
-GDir *
-g_dir_open (const gchar *path, guint flags, GError **error)
+UDir *
+u_dir_open (const char *path, unsigned int flags, UError **error)
 {
-       GDir *dir;
+       UDir *dir;
 
-       g_return_val_if_fail (path != NULL, NULL);
-       g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+       u_return_val_if_fail (path != NULL, NULL);
+       u_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
        (void) flags; /* this is not used */
-       dir = g_new (GDir, 1);
+       dir = u_new (UDir, 1);
        dir->dir = opendir (path);
        if (dir->dir == NULL) {
                if (error) {
-                       gint err = errno;
-                       *error = g_error_new (G_FILE_ERROR,
-                                              g_file_error_from_errno (err),
-                                              g_strerror (err));
+                       int err = errno;
+                       *error = u_error_new (U_FILE_ERROR,
+                                              u_file_error_from_errno (err),
+                                              u_strerror (err));
                }
-               g_free (dir);
+               u_free (dir);
                return NULL;
        }
 #ifndef HAVE_REWINDDIR
-       dir->path = g_strdup (path);
+       dir->path = u_strdup (path);
 #endif
        return dir;
 }
 
-const gchar *
-g_dir_read_name (GDir *dir)
+const char *
+u_dir_read_name (UDir *dir)
 {
        struct dirent *entry;
 
-       g_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
+       u_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
        do {
                entry = readdir (dir->dir);
                if (entry == NULL)
@@ -87,9 +87,9 @@ g_dir_read_name (GDir *dir)
 }
 
 void
-g_dir_rewind (GDir *dir)
+u_dir_rewind (UDir *dir)
 {
-       g_return_if_fail (dir != NULL && dir->dir != NULL);
+       u_return_if_fail (dir != NULL && dir->dir != NULL);
 #ifndef HAVE_REWINDDIR
        closedir (dir->dir);
        dir->dir = opendir (dir->path);
@@ -99,19 +99,19 @@ g_dir_rewind (GDir *dir)
 }
 
 void
-g_dir_close (GDir *dir)
+u_dir_close (UDir *dir)
 {
-       g_return_if_fail (dir != NULL && dir->dir != 0);
+       u_return_if_fail (dir != NULL && dir->dir != 0);
        closedir (dir->dir);
 #ifndef HAVE_REWINDDIR
-       g_free (dir->path);
+       u_free (dir->path);
 #endif
        dir->dir = NULL;
-       g_free (dir);
+       u_free (dir);
 }
 
 int
-g_mkdir_with_parents (const gchar *pathname, int mode)
+u_mkdir_with_parents (const char *pathname, int mode)
 {
        char *path, *d;
        int rv;
@@ -121,7 +121,7 @@ g_mkdir_with_parents (const gchar *pathname, int mode)
                return -1;
        }
        
-       d = path = g_strdup (pathname);
+       d = path = u_strdup (pathname);
        if (*d == '/')
                d++;
        
@@ -131,7 +131,7 @@ g_mkdir_with_parents (const gchar *pathname, int mode)
                  *d = '\0';
                  rv = mkdir (path, mode);
                  if (rv == -1 && errno != EEXIST) {
-                       g_free (path);
+                       u_free (path);
                        return -1;
                  }
 
@@ -145,7 +145,7 @@ g_mkdir_with_parents (const gchar *pathname, int mode)
                }
        }
        
-       g_free (path);
+       u_free (path);
        
        return 0;
 }
diff --git a/deps/eglib/src/gdir-win32.c b/deps/ulib/src/udir-win32.c
similarity index 68%
rename from deps/eglib/src/gdir-win32.c
rename to deps/ulib/src/udir-win32.c
index 1d61e34..0710e71 100644
--- a/deps/eglib/src/gdir-win32.c
+++ b/deps/ulib/src/udir-win32.c
@@ -28,7 +28,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -38,54 +38,54 @@
 
 #include <winsock2.h>
 
-struct _GDir {
+struct _UDir {
        HANDLE handle;
-       gchar* current;
-       gchar* next;
+       char* current;
+       char* next;
 };
 
-GDir *
-g_dir_open (const gchar *path, guint flags, GError **error)
+UDir *
+u_dir_open (const char *path, unsigned int flags, UError **error)
 {
-       GDir *dir;
-       gunichar2* path_utf16;
-       gunichar2* path_utf16_search;
+       UDir *dir;
+       uunichar2* path_utf16;
+       uunichar2* path_utf16_search;
        WIN32_FIND_DATAW find_data;
 
-       g_return_val_if_fail (path != NULL, NULL);
-       g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+       u_return_val_if_fail (path != NULL, NULL);
+       u_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-       dir = g_new0 (GDir, 1);
+       dir = u_new0 (UDir, 1);
        path_utf16 = u8to16 (path);
-       path_utf16_search = g_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(gunichar2));
+       path_utf16_search = u_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(uunichar2));
        wcscpy (path_utf16_search, path_utf16);
        wcscat (path_utf16_search, L"\\*");
 
        dir->handle = FindFirstFileW (path_utf16_search, &find_data);
        if (dir->handle == INVALID_HANDLE_VALUE) {
                if (error) {
-                       gint err = errno;
-                       *error = g_error_new (G_FILE_ERROR,
-                                              g_file_error_from_errno (err),
-                                              g_strerror (err));
+                       int err = errno;
+                       *error = u_error_new (U_FILE_ERROR,
+                                              u_file_error_from_errno (err),
+                                              u_strerror (err));
                }
-               g_free (path_utf16_search);
-               g_free (path_utf16);
-               g_free (dir);
+               u_free (path_utf16_search);
+               u_free (path_utf16);
+               u_free (dir);
                return NULL;
        }
-       g_free (path_utf16_search);
-       g_free (path_utf16);
+       u_free (path_utf16_search);
+       u_free (path_utf16);
 
        while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) 
find_data.cFileName, L"..") == 0)) {
                if (!FindNextFileW (dir->handle, &find_data)) {
                        if (error) {
-                               gint err = errno;
-                               *error = g_error_new (G_FILE_ERROR,
-                                                      g_file_error_from_errno (err),
-                                                      g_strerror (err));
+                               int err = errno;
+                               *error = u_error_new (U_FILE_ERROR,
+                                                      u_file_error_from_errno (err),
+                                                      u_strerror (err));
                        }
-                       g_free (dir);
+                       u_free (dir);
                        return NULL;
                }
        }
@@ -95,15 +95,15 @@ g_dir_open (const gchar *path, guint flags, GError **error)
        return dir;
 }
 
-const gchar *
-g_dir_read_name (GDir *dir)
+const char *
+u_dir_read_name (UDir *dir)
 {
        WIN32_FIND_DATAW find_data;
 
-       g_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
+       u_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
 
        if (dir->current)
-               g_free (dir->current);
+               u_free (dir->current);
        dir->current = NULL;
 
        dir->current = dir->next;
@@ -125,24 +125,24 @@ g_dir_read_name (GDir *dir)
 }
 
 void
-g_dir_rewind (GDir *dir)
+u_dir_rewind (UDir *dir)
 {
 }
 
 void
-g_dir_close (GDir *dir)
+u_dir_close (UDir *dir)
 {
-       g_return_if_fail (dir != NULL && dir->handle != 0);
+       u_return_if_fail (dir != NULL && dir->handle != 0);
        
        if (dir->current)
-               g_free (dir->current);
+               u_free (dir->current);
        dir->current = NULL;
        if (dir->next)
-               g_free (dir->next);
+               u_free (dir->next);
        dir->next = NULL;
        FindClose (dir->handle);
        dir->handle = 0;
-       g_free (dir);
+       u_free (dir);
 }
 
 
diff --git a/deps/eglib/src/gerror.c b/deps/ulib/src/uerror.c
similarity index 68%
rename from deps/eglib/src/gerror.c
rename to deps/ulib/src/uerror.c
index 927bb16..a36bfac 100644
--- a/deps/eglib/src/gerror.c
+++ b/deps/ulib/src/uerror.c
@@ -30,91 +30,91 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 
-GError *
-g_error_new (GQuark domain, gint code, const char *format, ...)
+UError *
+u_error_new (UQuark domain, int code, const char *format, ...)
 {
        va_list args;
-       GError *err = g_new (GError, 1);
+       UError *err = u_new (UError, 1);
        
        err->domain = domain;
        err->code = code;
 
        va_start (args, format);
        if (vasprintf (&err->message, format, args) == -1)
-               err->message = g_strdup_printf ("internal: invalid format string %s", format); 
+               err->message = u_strdup_printf ("internal: invalid format string %s", format); 
        va_end (args);
 
        return err;
 }
 
-GError *
-g_error_new_valist (GQuark domain, gint code, const char *format, va_list ap)
+UError *
+u_error_new_valist (UQuark domain, int code, const char *format, va_list ap)
 {
-       GError *err = g_new (GError, 1);
+       UError *err = u_new (UError, 1);
        
        err->domain = domain;
        err->code = code;
 
-        err->message = g_strdup_vprintf (format, ap);
+        err->message = u_strdup_vprintf (format, ap);
 
        return err;
 }
 
 void
-g_clear_error (GError **error)
+u_clear_error (UError **error)
 {
        if (error && *error) {
-               g_error_free (*error);
+               u_error_free (*error);
                *error = NULL;
        }
 }
 
 void
-g_error_free (GError *error)
+u_error_free (UError *error)
 {
-       g_return_if_fail (error != NULL);
+       u_return_if_fail (error != NULL);
        
-       g_free (error->message);
-       g_free (error);
+       u_free (error->message);
+       u_free (error);
 }
 
 void
-g_set_error (GError **err, GQuark domain, gint code, const gchar *format, ...)
+u_set_error (UError **err, UQuark domain, int code, const char *format, ...)
 {
        va_list args;
 
        if (err) {
                va_start (args, format);
-               *err = g_error_new_valist (domain, code, format, args);
+               *err = u_error_new_valist (domain, code, format, args);
                va_end (args);
        }
 }
 
 void
-g_propagate_error (GError **dest, GError *src)
+u_propagate_error (UError **dest, UError *src)
 {
        if (dest == NULL) {
                if (src)
-                       g_error_free (src);
+                       u_error_free (src);
        } else {
                *dest = src;
        }
 }
 
-GError *
-g_error_copy (const GError *error)
+UError *
+u_error_copy (const UError *error)
 {
-       GError *copy = g_new (GError, 1);
+       UError *copy = u_new (UError, 1);
         copy->domain = error->domain;
         copy->code = error->code;
-        copy->message = g_strdup (error->message);
+        copy->message = u_strdup (error->message);
         return copy;
 }
 
-gboolean
-g_error_matches (const GError *error, GQuark domain, gint code)
+uboolean
+u_error_matches (const UError *error, UQuark domain, int code)
 {
   if (error)
     {
diff --git a/deps/eglib/src/gfile-posix.c b/deps/ulib/src/ufile-posix.c
similarity index 69%
rename from deps/eglib/src/gfile-posix.c
rename to deps/ulib/src/ufile-posix.c
index fdc8982..57f27c9 100644
--- a/deps/eglib/src/gfile-posix.c
+++ b/deps/ulib/src/ufile-posix.c
@@ -26,7 +26,7 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
@@ -40,7 +40,7 @@
 #ifdef _MSC_VER
 #include <direct.h>
 #endif
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 int mkstemp (char *tmp_template);
 #endif
 
@@ -49,18 +49,18 @@ int mkstemp (char *tmp_template);
 #else
 #define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
 #endif
-gboolean
-g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error)
+uboolean
+u_file_get_contents (const char *filename, char **contents, size_t *length, UError **error)
 {
-       gchar *str;
+       char *str;
        int fd;
        struct stat st;
        long offset;
        int nread;
 
-       g_return_val_if_fail (filename != NULL, FALSE);
-       g_return_val_if_fail (contents != NULL, FALSE);
-       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+       u_return_val_if_fail (filename != NULL, FALSE);
+       u_return_val_if_fail (contents != NULL, FALSE);
+       u_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
        *contents = NULL;
        if (length)
@@ -70,11 +70,11 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
        if (fd == -1) {
                if (error != NULL) {
                        int err = errno;
-                       *error = g_error_new (G_FILE_ERROR,
-                                              g_file_error_from_errno (err),
+                       *error = u_error_new (U_FILE_ERROR,
+                                              u_file_error_from_errno (err),
                                               "Error opening file '%s': %s",
                                               filename,
-                                              g_strerror (err));
+                                              u_strerror (err));
                }
                return FALSE;
        }
@@ -82,17 +82,17 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
        if (fstat (fd, &st) != 0) {
                if (error != NULL) {
                        int err = errno;
-                       *error = g_error_new (G_FILE_ERROR,
-                                              g_file_error_from_errno (err),
+                       *error = u_error_new (U_FILE_ERROR,
+                                              u_file_error_from_errno (err),
                                               "Error in fstat() for file '%s': %s",
                                               filename,
-                                              g_strerror (err));
+                                              u_strerror (err));
                }
                close (fd);
                return FALSE;
        }
 
-       str = g_malloc (st.st_size + 1);
+       str = u_malloc (st.st_size + 1);
        offset = 0;
        do {
                nread = read (fd, str + offset, st.st_size - offset);
@@ -110,24 +110,24 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr
        return TRUE;
 }
 
-gint
-g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
+int
+u_file_open_tmp (const char *tmpl, char **name_used, UError **error)
 {
-       const static gchar *default_tmpl = ".XXXXXX";
-       gchar *t;
-       gint fd;
+       const static char *default_tmpl = ".XXXXXX";
+       char *t;
+       int fd;
        size_t len;
 
-       g_return_val_if_fail (error == NULL || *error == NULL, -1);
+       u_return_val_if_fail (error == NULL || *error == NULL, -1);
 
        if (tmpl == NULL)
                tmpl = default_tmpl;
 
-       if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) {
+       if (strchr (tmpl, U_DIR_SEPARATOR) != NULL) {
                if (error) {
-                       *error = g_error_new (G_FILE_ERROR,
-                                              G_FILE_ERROR_FAILED,
-                                              "Template should not have any " G_DIR_SEPARATOR_S);
+                       *error = u_error_new (U_FILE_ERROR,
+                                              U_FILE_ERROR_FAILED,
+                                              "Template should not have any " U_DIR_SEPARATOR_S);
                }
                return -1;
        }
@@ -135,55 +135,55 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
        len = strlen (tmpl);
        if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
                if (error) {
-                       *error = g_error_new (G_FILE_ERROR,
-                                              G_FILE_ERROR_FAILED,
+                       *error = u_error_new (U_FILE_ERROR,
+                                              U_FILE_ERROR_FAILED,
                                               "Template should end with XXXXXX");
                }
                return -1;
        }
 
-       t = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
+       t = u_build_filename (u_get_tmp_dir (), tmpl, NULL);
 
        fd = mkstemp (t);
 
        if (fd == -1) {
                if (error) {
                        int err = errno;
-                       *error = g_error_new (G_FILE_ERROR,
-                                              g_file_error_from_errno (err),
+                       *error = u_error_new (U_FILE_ERROR,
+                                              u_file_error_from_errno (err),
                                               "Error in mkstemp(): %s",
-                                              g_strerror (err));
+                                              u_strerror (err));
                }
-               g_free (t);
+               u_free (t);
                return -1;
        }
 
        if (name_used) {
                *name_used = t;
        } else {
-               g_free (t);
+               u_free (t);
        }
        return fd;
 }
 
-gchar *
-g_get_current_dir (void)
+char *
+u_get_current_dir (void)
 {
 #ifdef __native_client__
        char *buffer;
-       if ((buffer = g_getenv("NACL_PWD"))) {
-               buffer = g_strdup(buffer);
+       if ((buffer = u_getenv("NACL_PWD"))) {
+               buffer = u_strdup(buffer);
        } else {
-               buffer = g_strdup(".");
+               buffer = u_strdup(".");
        }
        return buffer;
 #else
        int s = 32;
        char *buffer = NULL, *r;
-       gboolean fail;
+       uboolean fail;
        
        do {
-               buffer = g_realloc (buffer, s);
+               buffer = u_realloc (buffer, s);
                r = getcwd (buffer, s);
                fail = (r == NULL && errno == ERANGE);
                if (fail) {
diff --git a/deps/eglib/src/gfile-unix.c b/deps/ulib/src/ufile-unix.c
similarity index 86%
rename from deps/eglib/src/gfile-unix.c
rename to deps/ulib/src/ufile-unix.c
index 4e17a08..ae630b5 100644
--- a/deps/eglib/src/gfile-unix.c
+++ b/deps/ulib/src/ufile-unix.c
@@ -26,7 +26,7 @@
  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
@@ -38,39 +38,39 @@
 #include <unistd.h>
 #endif
 
-gboolean
-g_file_test (const gchar *filename, GFileTest test)
+uboolean
+u_file_test (const char *filename, UFileTest test)
 {
        struct stat st;
-       gboolean have_stat;
+       uboolean have_stat;
 
        if (filename == NULL || test == 0)
                return FALSE;
 
        have_stat = FALSE;
 
-       if ((test & G_FILE_TEST_EXISTS) != 0) {
+       if ((test & U_FILE_TEST_EXISTS) != 0) {
                if (access (filename, F_OK) == 0)
                        return TRUE;
        }
 
-       if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+       if ((test & U_FILE_TEST_IS_EXECUTABLE) != 0) {
                if (access (filename, X_OK) == 0)
                        return TRUE;
        }
-       if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+       if ((test & U_FILE_TEST_IS_SYMLINK) != 0) {
                have_stat = (lstat (filename, &st) == 0);
                if (have_stat && S_ISLNK (st.st_mode))
                        return TRUE;
        }
 
-       if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+       if ((test & U_FILE_TEST_IS_REGULAR) != 0) {
                if (!have_stat)
                        have_stat = (stat (filename, &st) == 0);
                if (have_stat && S_ISREG (st.st_mode))
                        return TRUE;
        }
-       if ((test & G_FILE_TEST_IS_DIR) != 0) {
+       if ((test & U_FILE_TEST_IS_DIR) != 0) {
                if (!have_stat)
                        have_stat = (stat (filename, &st) == 0);
                if (have_stat && S_ISDIR (st.st_mode))
diff --git a/deps/eglib/src/gfile-win32.c b/deps/ulib/src/ufile-win32.c
similarity index 85%
rename from deps/eglib/src/gfile-win32.c
rename to deps/ulib/src/ufile-win32.c
index a2e41ea..81cde52 100644
--- a/deps/eglib/src/gfile-win32.c
+++ b/deps/ulib/src/ufile-win32.c
@@ -27,7 +27,7 @@
  */
 #include <config.h>
 #include <windows.h>
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -36,7 +36,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <io.h>
 #define open _open
 #ifndef S_ISREG
@@ -50,7 +50,7 @@
 int mkstemp (char *tmp_template)
 {
        int fd;
-       gunichar2* utf16_template;
+       uunichar2* utf16_template;
 
        utf16_template  = u8to16 (tmp_template);
 
@@ -64,7 +64,7 @@ int mkstemp (char *tmp_template)
        /* FIXME: this will crash if utf16_template == NULL */
        sprintf (tmp_template + strlen (tmp_template) - 6, "%S", utf16_template + wcslen (utf16_template) - 
6);
 
-       g_free (utf16_template);
+       u_free (utf16_template);
        return fd;
 }
 
@@ -72,27 +72,27 @@ int mkstemp (char *tmp_template)
 #pragma warning(disable:4701)
 #endif
 
-gboolean
-g_file_test (const gchar *filename, GFileTest test)
+uboolean
+u_file_test (const char *filename, UFileTest test)
 {
-       gunichar2* utf16_filename = NULL;
+       uunichar2* utf16_filename = NULL;
        DWORD attr;
        
        if (filename == NULL || test == 0)
                return FALSE;
 
        utf16_filename = u8to16 (filename);
-       attr = GetFileAttributesW (utf16_filename);
-       g_free (utf16_filename);
+       attr = UetFileAttributesW (utf16_filename);
+       u_free (utf16_filename);
        
        if (attr == INVALID_FILE_ATTRIBUTES)
                return FALSE;
 
-       if ((test & G_FILE_TEST_EXISTS) != 0) {
+       if ((test & U_FILE_TEST_EXISTS) != 0) {
                return TRUE;
        }
 
-       if ((test & G_FILE_TEST_IS_EXECUTABLE) != 0) {
+       if ((test & U_FILE_TEST_IS_EXECUTABLE) != 0) {
                size_t len = strlen (filename);
                if (len > 4 && strcmp (filename + len-3, "exe"))
                    return TRUE;
@@ -100,19 +100,19 @@ g_file_test (const gchar *filename, GFileTest test)
                return FALSE;
        }
 
-       if ((test & G_FILE_TEST_IS_REGULAR) != 0) {
+       if ((test & U_FILE_TEST_IS_REGULAR) != 0) {
                if (attr & (FILE_ATTRIBUTE_DEVICE|FILE_ATTRIBUTE_DIRECTORY))
                        return FALSE;
                return TRUE;
        }
 
-       if ((test & G_FILE_TEST_IS_DIR) != 0) {
+       if ((test & U_FILE_TEST_IS_DIR) != 0) {
                if (attr & FILE_ATTRIBUTE_DIRECTORY)
                        return TRUE;
        }
 
        /* make this last in case it is OR'd with something else */
-       if ((test & G_FILE_TEST_IS_SYMLINK) != 0) {
+       if ((test & U_FILE_TEST_IS_SYMLINK) != 0) {
                return FALSE;
        }
 
diff --git a/deps/eglib/src/gfile.c b/deps/ulib/src/ufile.c
similarity index 58%
rename from deps/eglib/src/gfile.c
rename to deps/ulib/src/ufile.c
index ab0c912..2cc476e 100644
--- a/deps/eglib/src/gfile.c
+++ b/deps/ulib/src/ufile.c
@@ -28,7 +28,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <stdio.h>
 #include <string.h>
 #ifdef HAVE_UNISTD_H
@@ -36,95 +36,95 @@
 #endif
 #include <errno.h>
 
-GQuark
-g_file_error_quark (void)
+UQuark
+u_file_error_quark (void)
 {
-       return g_quark_from_static_string ("g-file-error-quark");
+       return u_quark_from_static_string ("g-file-error-quark");
 }
 
-GFileError
-g_file_error_from_errno (gint err_no)
+UFileError
+u_file_error_from_errno (int err_no)
 {
        switch (err_no) {
        case EEXIST:
-               return G_FILE_ERROR_EXIST;
+               return U_FILE_ERROR_EXIST;
        case EISDIR:
-               return G_FILE_ERROR_ISDIR;
+               return U_FILE_ERROR_ISDIR;
        case EACCES:
-               return G_FILE_ERROR_ACCES;
+               return U_FILE_ERROR_ACCES;
        case ENAMETOOLONG:
-               return G_FILE_ERROR_NAMETOOLONG;
+               return U_FILE_ERROR_NAMETOOLONG;
        case ENOENT:
-               return G_FILE_ERROR_NOENT;
+               return U_FILE_ERROR_NOENT;
        case ENOTDIR:
-               return G_FILE_ERROR_NOTDIR;
+               return U_FILE_ERROR_NOTDIR;
        case ENXIO:
-               return G_FILE_ERROR_NXIO;
+               return U_FILE_ERROR_NXIO;
        case ENODEV:
-               return G_FILE_ERROR_NODEV;
+               return U_FILE_ERROR_NODEV;
        case EROFS:
-               return G_FILE_ERROR_ROFS;
+               return U_FILE_ERROR_ROFS;
 #ifdef ETXTBSY
        case ETXTBSY:
-               return G_FILE_ERROR_TXTBSY;
+               return U_FILE_ERROR_TXTBSY;
 #endif
        case EFAULT:
-               return G_FILE_ERROR_FAULT;
+               return U_FILE_ERROR_FAULT;
 #ifdef ELOOP
        case ELOOP:
-               return G_FILE_ERROR_LOOP;
+               return U_FILE_ERROR_LOOP;
 #endif
        case ENOSPC:
-               return G_FILE_ERROR_NOSPC;
+               return U_FILE_ERROR_NOSPC;
        case ENOMEM:
-               return G_FILE_ERROR_NOMEM;
+               return U_FILE_ERROR_NOMEM;
        case EMFILE:
-               return G_FILE_ERROR_MFILE;
+               return U_FILE_ERROR_MFILE;
        case ENFILE:
-               return G_FILE_ERROR_NFILE;
+               return U_FILE_ERROR_NFILE;
        case EBADF:
-               return G_FILE_ERROR_BADF;
+               return U_FILE_ERROR_BADF;
        case EINVAL:
-               return G_FILE_ERROR_INVAL;
+               return U_FILE_ERROR_INVAL;
        case EPIPE:
-               return G_FILE_ERROR_PIPE;
+               return U_FILE_ERROR_PIPE;
        case EAGAIN:
-               return G_FILE_ERROR_AGAIN;
+               return U_FILE_ERROR_AGAIN;
        case EINTR:
-               return G_FILE_ERROR_INTR;
+               return U_FILE_ERROR_INTR;
        case EIO:
-               return G_FILE_ERROR_IO;
+               return U_FILE_ERROR_IO;
        case EPERM:
-               return G_FILE_ERROR_PERM;
+               return U_FILE_ERROR_PERM;
        case ENOSYS:
-               return G_FILE_ERROR_NOSYS;
+               return U_FILE_ERROR_NOSYS;
        default:
-               return G_FILE_ERROR_FAILED;
+               return U_FILE_ERROR_FAILED;
        }
 }
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #define TMP_FILE_FORMAT "%.*s%s.tmp"
 #else
 #define TMP_FILE_FORMAT "%.*s.%s~"
 #endif
 
-gboolean
-g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **err)
+uboolean
+u_file_set_contents (const char *filename, const char *contents, ussize length, UError **err)
 {
        const char *name;
        char *path;
        FILE *fp;
        
-       if (!(name = strrchr (filename, G_DIR_SEPARATOR)))
+       if (!(name = strrchr (filename, U_DIR_SEPARATOR)))
                name = filename;
        else
                name++;
        
-       path = g_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
+       path = u_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
        if (!(fp = fopen (path, "wb"))) {
-               g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
-               g_free (path);
+               u_set_error (err, U_FILE_ERROR, u_file_error_from_errno (errno), "%s", u_strerror (errno));
+               u_free (path);
                return FALSE;
        }
        
@@ -132,9 +132,9 @@ g_file_set_contents (const gchar *filename, const gchar *contents, gssize length
                length = strlen (contents);
        
        if (fwrite (contents, 1, length, fp) < length) {
-               g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (ferror (fp)), "%s", g_strerror 
(ferror (fp)));
-               g_unlink (path);
-               g_free (path);
+               u_set_error (err, U_FILE_ERROR, u_file_error_from_errno (ferror (fp)), "%s", u_strerror 
(ferror (fp)));
+               u_unlink (path);
+               u_free (path);
                fclose (fp);
                
                return FALSE;
@@ -142,14 +142,14 @@ g_file_set_contents (const gchar *filename, const gchar *contents, gssize length
        
        fclose (fp);
        
-       if (g_rename (path, filename) != 0) {
-               g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno), "%s", g_strerror (errno));
-               g_unlink (path);
-               g_free (path);
+       if (u_rename (path, filename) != 0) {
+               u_set_error (err, U_FILE_ERROR, u_file_error_from_errno (errno), "%s", u_strerror (errno));
+               u_unlink (path);
+               u_free (path);
                return FALSE;
        }
        
-       g_free (path);
+       u_free (path);
        
        return TRUE;
 }
diff --git a/deps/eglib/src/ghashtable.c b/deps/ulib/src/uhashtable.c
similarity index 66%
rename from deps/eglib/src/ghashtable.c
rename to deps/ulib/src/uhashtable.c
index 35db6e6..2152325 100644
--- a/deps/eglib/src/ghashtable.c
+++ b/deps/ulib/src/uhashtable.c
@@ -30,37 +30,37 @@
 
 #include <stdio.h>
 #include <math.h>
-#include <glib.h>
+#include <ulib.h>
 
 typedef struct _Slot Slot;
 
 struct _Slot {
-       gpointer key;
-       gpointer value;
+       void * key;
+       void * value;
        Slot    *next;
 };
 
-static gpointer KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
+static void * KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
 
-struct _GHashTable {
-       GHashFunc      hash_func;
-       GEqualFunc     key_equal_func;
+struct _UHashTable {
+       UHashFunc      hash_func;
+       UEqualFunc     key_equal_func;
 
        Slot **table;
        int   table_size;
        int   in_use;
        int   threshold;
        int   last_rehash;
-       GDestroyNotify value_destroy_func, key_destroy_func;
+       UDestroyNotify value_destroy_func, key_destroy_func;
 };
 
 typedef struct {
-       GHashTable *ht;
+       UHashTable *ht;
        int slot_index;
        Slot *slot;
 } Iter;
 
-static const guint prime_tbl[] = {
+static const unsigned int prime_tbl[] = {
        11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237,
        1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627,
        47431, 71143, 106721, 160073, 240101, 360163,
@@ -68,7 +68,7 @@ static const guint prime_tbl[] = {
        6153409, 9230113, 13845163
 };
 
-static gboolean
+static uboolean
 test_prime (int x)
 {
        if ((x & 1) != 0) {
@@ -87,64 +87,64 @@ static int
 calc_prime (int x)
 {
        int i;
-       
-       for (i = (x & (~1))-1; i< G_MAXINT32; i += 2) {
+
+       for (i = (x & (~1))-1; i< U_MAXINT32; i += 2) {
                if (test_prime (i))
                        return i;
        }
        return x;
 }
 
-guint
-g_spaced_primes_closest (guint x)
+unsigned int
+u_spaced_primes_closest (unsigned int x)
 {
        int i;
-       
-       for (i = 0; i < G_N_ELEMENTS (prime_tbl); i++) {
+
+       for (i = 0; i < U_N_ELEMENTS (prime_tbl); i++) {
                if (x <= prime_tbl [i])
                        return prime_tbl [i];
        }
        return calc_prime (x);
 }
 
-GHashTable *
-g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func)
+UHashTable *
+u_hash_table_new (UHashFunc hash_func, UEqualFunc key_equal_func)
 {
-       GHashTable *hash;
+       UHashTable *hash;
 
        if (hash_func == NULL)
-               hash_func = g_direct_hash;
+               hash_func = u_direct_hash;
        if (key_equal_func == NULL)
-               key_equal_func = g_direct_equal;
-       hash = g_new0 (GHashTable, 1);
+               key_equal_func = u_direct_equal;
+       hash = u_new0 (UHashTable, 1);
 
        hash->hash_func = hash_func;
        hash->key_equal_func = key_equal_func;
 
-       hash->table_size = g_spaced_primes_closest (1);
-       hash->table = g_new0 (Slot *, hash->table_size);
+       hash->table_size = u_spaced_primes_closest (1);
+       hash->table = u_new0 (Slot *, hash->table_size);
        hash->last_rehash = hash->table_size;
-       
+
        return hash;
 }
 
-GHashTable *
-g_hash_table_new_full (GHashFunc hash_func, GEqualFunc key_equal_func,
-                      GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
+UHashTable *
+u_hash_table_new_full (UHashFunc hash_func, UEqualFunc key_equal_func,
+                      UDestroyNotify key_destroy_func, UDestroyNotify value_destroy_func)
 {
-       GHashTable *hash = g_hash_table_new (hash_func, key_equal_func);
+       UHashTable *hash = u_hash_table_new (hash_func, key_equal_func);
        if (hash == NULL)
                return NULL;
-       
+
        hash->key_destroy_func = key_destroy_func;
        hash->value_destroy_func = value_destroy_func;
-       
+
        return hash;
 }
 
 #if 0
 static void
-dump_hash_table (GHashTable *hash)
+dump_hash_table (UHashTable *hash)
 {
        int i;
 
@@ -152,8 +152,8 @@ dump_hash_table (GHashTable *hash)
                Slot *s;
 
                for (s = hash->table [i]; s != NULL; s = s->next){
-                       guint hashcode = (*hash->hash_func) (s->key);
-                       guint slot = (hashcode) % hash->table_size;
+                       unsigned int hashcode = (*hash->hash_func) (s->key);
+                       unsigned int slot = (hashcode) % hash->table_size;
                        printf ("key %p hash %x on slot %d correct slot %d tb size %d\n", s->key, hashcode, 
i, slot, hash->table_size);
                }
        }
@@ -162,7 +162,7 @@ dump_hash_table (GHashTable *hash)
 
 #ifdef SANITY_CHECK
 static void
-sanity_check (GHashTable *hash)
+sanity_check (UHashTable *hash)
 {
        int i;
 
@@ -170,13 +170,13 @@ sanity_check (GHashTable *hash)
                Slot *s;
 
                for (s = hash->table [i]; s != NULL; s = s->next){
-                       guint hashcode = (*hash->hash_func) (s->key);
-                       guint slot = (hashcode) % hash->table_size;
+                       unsigned int hashcode = (*hash->hash_func) (s->key);
+                       unsigned int slot = (hashcode) % hash->table_size;
                        if (slot != i) {
                                dump_hashcode_func = 1;
                                hashcode = (*hash->hash_func) (s->key);
                                dump_hashcode_func = 0;
-                               g_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size 
%d)", s->key, slot, i, hashcode, hash->table_size);
+                               u_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size 
%d)", s->key, slot, i, hashcode, hash->table_size);
                        }
                }
        }
@@ -188,7 +188,7 @@ sanity_check (GHashTable *hash)
 #endif
 
 static void
-do_rehash (GHashTable *hash)
+do_rehash (UHashTable *hash)
 {
        int current_size, i;
        Slot **table;
@@ -196,27 +196,27 @@ do_rehash (GHashTable *hash)
        /* printf ("Resizing diff=%d slots=%d\n", hash->in_use - hash->last_rehash, hash->table_size); */
        hash->last_rehash = hash->table_size;
        current_size = hash->table_size;
-       hash->table_size = g_spaced_primes_closest (hash->in_use);
+       hash->table_size = u_spaced_primes_closest (hash->in_use);
        /* printf ("New size: %d\n", hash->table_size); */
        table = hash->table;
-       hash->table = g_new0 (Slot *, hash->table_size);
-       
+       hash->table = u_new0 (Slot *, hash->table_size);
+
        for (i = 0; i < current_size; i++){
                Slot *s, *next;
 
                for (s = table [i]; s != NULL; s = next){
-                       guint hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
+                       unsigned int hashcode = ((*hash->hash_func) (s->key)) % hash->table_size;
                        next = s->next;
 
                        s->next = hash->table [hashcode];
                        hash->table [hashcode] = s;
                }
        }
-       g_free (table);
+       u_free (table);
 }
 
 static void
-rehash (GHashTable *hash)
+rehash (UHashTable *hash)
 {
        int diff = ABS (hash->last_rehash - hash->in_use);
 
@@ -230,13 +230,13 @@ rehash (GHashTable *hash)
 }
 
 void
-g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gboolean replace)
+u_hash_table_insert_replace (UHashTable *hash, void * key, void * value, uboolean replace)
 {
-       guint hashcode;
+       unsigned int hashcode;
        Slot *s;
-       GEqualFunc equal;
-       
-       g_return_if_fail (hash != NULL);
+       UEqualFunc equal;
+
+       u_return_if_fail (hash != NULL);
        sanity_check (hash);
 
        equal = hash->key_equal_func;
@@ -258,7 +258,7 @@ g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gbo
                        return;
                }
        }
-       s = g_new (Slot, 1);
+       s = u_new (Slot, 1);
        s->key = key;
        s->value = value;
        s->next = hash->table [hashcode];
@@ -267,69 +267,69 @@ g_hash_table_insert_replace (GHashTable *hash, gpointer key, gpointer value, gbo
        sanity_check (hash);
 }
 
-GList*
-g_hash_table_get_keys (GHashTable *hash)
+UList*
+u_hash_table_get_keys (UHashTable *hash)
 {
-       GHashTableIter iter;
-       GList *rv = NULL;
-       gpointer key;
+       UHashTableIter iter;
+       UList *rv = NULL;
+       void * key;
 
-       g_hash_table_iter_init (&iter, hash);
+       u_hash_table_iter_init (&iter, hash);
 
-       while (g_hash_table_iter_next (&iter, &key, NULL))
-               rv = g_list_prepend (rv, key);
+       while (u_hash_table_iter_next (&iter, &key, NULL))
+               rv = u_list_prepend (rv, key);
 
-       return g_list_reverse (rv);
+       return u_list_reverse (rv);
 }
 
-GList*
-g_hash_table_get_values (GHashTable *hash)
+UList*
+u_hash_table_get_values (UHashTable *hash)
 {
-       GHashTableIter iter;
-       GList *rv = NULL;
-       gpointer value;
+       UHashTableIter iter;
+       UList *rv = NULL;
+       void * value;
 
-       g_hash_table_iter_init (&iter, hash);
+       u_hash_table_iter_init (&iter, hash);
 
-       while (g_hash_table_iter_next (&iter, NULL, &value))
-               rv = g_list_prepend (rv, value);
+       while (u_hash_table_iter_next (&iter, NULL, &value))
+               rv = u_list_prepend (rv, value);
 
-       return g_list_reverse (rv);
+       return u_list_reverse (rv);
 }
 
 
-guint
-g_hash_table_size (GHashTable *hash)
+unsigned int
+u_hash_table_size (UHashTable *hash)
 {
-       g_return_val_if_fail (hash != NULL, 0);
-       
+       u_return_val_if_fail (hash != NULL, 0);
+
        return hash->in_use;
 }
 
-gpointer
-g_hash_table_lookup (GHashTable *hash, gconstpointer key)
+void *
+u_hash_table_lookup (UHashTable *hash, const void * key)
 {
-       gpointer orig_key, value;
-       
-       if (g_hash_table_lookup_extended (hash, key, &orig_key, &value))
+       void *orig_key, *value;
+
+       if (u_hash_table_lookup_extended (hash, key, &orig_key, &value))
                return value;
        else
                return NULL;
 }
 
-gboolean
-g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value)
+uboolean
+u_hash_table_lookup_extended (UHashTable *hash, const void * key, void * *orig_key, void * *value)
 {
-       GEqualFunc equal;
+       UEqualFunc equal;
        Slot *s;
-       guint hashcode;
-       
-       g_return_val_if_fail (hash != NULL, FALSE);
+       unsigned int hashcode;
+
+       u_return_val_if_fail (hash != NULL, FALSE);
        sanity_check (hash);
        equal = hash->key_equal_func;
 
        hashcode = ((*hash->hash_func) (key)) % hash->table_size;
-       
+
        for (s = hash->table [hashcode]; s != NULL; s = s->next){
                if ((*equal)(s->key, key)){
                        if (orig_key)
@@ -343,12 +343,12 @@ g_hash_table_lookup_extended (GHashTable *hash, gconstpointer key, gpointer *ori
 }
 
 void
-g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
+u_hash_table_foreach (UHashTable *hash, UHFunc func, void * user_data)
 {
        int i;
-       
-       g_return_if_fail (hash != NULL);
-       g_return_if_fail (func != NULL);
+
+       u_return_if_fail (hash != NULL);
+       u_return_if_fail (func != NULL);
 
        for (i = 0; i < hash->table_size; i++){
                Slot *s;
@@ -358,13 +358,13 @@ g_hash_table_foreach (GHashTable *hash, GHFunc func, gpointer user_data)
        }
 }
 
-gpointer
-g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
+void *
+u_hash_table_find (UHashTable *hash, UHRFunc predicate, void * user_data)
 {
        int i;
-       
-       g_return_val_if_fail (hash != NULL, NULL);
-       g_return_val_if_fail (predicate != NULL, NULL);
+
+       u_return_val_if_fail (hash != NULL, NULL);
+       u_return_val_if_fail (predicate != NULL, NULL);
 
        for (i = 0; i < hash->table_size; i++){
                Slot *s;
@@ -377,30 +377,30 @@ g_hash_table_find (GHashTable *hash, GHRFunc predicate, gpointer user_data)
 }
 
 void
-g_hash_table_remove_all (GHashTable *hash)
+u_hash_table_remove_all (UHashTable *hash)
 {
        int i;
-       
-       g_return_if_fail (hash != NULL);
+
+       u_return_if_fail (hash != NULL);
 
        for (i = 0; i < hash->table_size; i++){
                Slot *s;
 
                while (hash->table [i]) {
                        s = hash->table [i];
-                       g_hash_table_remove (hash, s->key);
+                       u_hash_table_remove (hash, s->key);
                }
        }
 }
 
-gboolean
-g_hash_table_remove (GHashTable *hash, gconstpointer key)
+uboolean
+u_hash_table_remove (UHashTable *hash, const void * key)
 {
-       GEqualFunc equal;
+       UEqualFunc equal;
        Slot *s, *last;
-       guint hashcode;
-       
-       g_return_val_if_fail (hash != NULL, FALSE);
+       unsigned int hashcode;
+
+       u_return_val_if_fail (hash != NULL, FALSE);
        sanity_check (hash);
        equal = hash->key_equal_func;
 
@@ -416,7 +416,7 @@ g_hash_table_remove (GHashTable *hash, gconstpointer key)
                                hash->table [hashcode] = s->next;
                        else
                                last->next = s->next;
-                       g_free (s);
+                       u_free (s);
                        hash->in_use--;
                        sanity_check (hash);
                        return TRUE;
@@ -427,14 +427,14 @@ g_hash_table_remove (GHashTable *hash, gconstpointer key)
        return FALSE;
 }
 
-guint
-g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
+unsigned int
+u_hash_table_foreach_remove (UHashTable *hash, UHRFunc func, void * user_data)
 {
        int i;
        int count = 0;
-       
-       g_return_val_if_fail (hash != NULL, 0);
-       g_return_val_if_fail (func != NULL, 0);
+
+       u_return_val_if_fail (hash != NULL, 0);
+       u_return_val_if_fail (func != NULL, 0);
 
        sanity_check (hash);
        for (i = 0; i < hash->table_size; i++){
@@ -456,7 +456,7 @@ g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
                                        last->next = s->next;
                                        n = last->next;
                                }
-                               g_free (s);
+                               u_free (s);
                                hash->in_use--;
                                count++;
                                s = n;
@@ -472,17 +472,17 @@ g_hash_table_foreach_remove (GHashTable *hash, GHRFunc func, gpointer user_data)
        return count;
 }
 
-gboolean
-g_hash_table_steal (GHashTable *hash, gconstpointer key)
+uboolean
+u_hash_table_steal (UHashTable *hash, const void * key)
 {
-       GEqualFunc equal;
+       UEqualFunc equal;
        Slot *s, *last;
-       guint hashcode;
-       
-       g_return_val_if_fail (hash != NULL, FALSE);
+       unsigned int hashcode;
+
+       u_return_val_if_fail (hash != NULL, FALSE);
        sanity_check (hash);
        equal = hash->key_equal_func;
-       
+
        hashcode = ((*hash->hash_func)(key)) % hash->table_size;
        last = NULL;
        for (s = hash->table [hashcode]; s != NULL; s = s->next){
@@ -491,7 +491,7 @@ g_hash_table_steal (GHashTable *hash, gconstpointer key)
                                hash->table [hashcode] = s->next;
                        else
                                last->next = s->next;
-                       g_free (s);
+                       u_free (s);
                        hash->in_use--;
                        sanity_check (hash);
                        return TRUE;
@@ -500,17 +500,17 @@ g_hash_table_steal (GHashTable *hash, gconstpointer key)
        }
        sanity_check (hash);
        return FALSE;
-       
+
 }
 
-guint
-g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
+unsigned int
+u_hash_table_foreach_steal (UHashTable *hash, UHRFunc func, void * user_data)
 {
        int i;
        int count = 0;
-       
-       g_return_val_if_fail (hash != NULL, 0);
-       g_return_val_if_fail (func != NULL, 0);
+
+       u_return_val_if_fail (hash != NULL, 0);
+       u_return_val_if_fail (func != NULL, 0);
 
        sanity_check (hash);
        for (i = 0; i < hash->table_size; i++){
@@ -528,7 +528,7 @@ g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
                                        last->next = s->next;
                                        n = last->next;
                                }
-                               g_free (s);
+                               u_free (s);
                                hash->in_use--;
                                count++;
                                s = n;
@@ -545,32 +545,32 @@ g_hash_table_foreach_steal (GHashTable *hash, GHRFunc func, gpointer user_data)
 }
 
 void
-g_hash_table_destroy (GHashTable *hash)
+u_hash_table_destroy (UHashTable *hash)
 {
        int i;
-       
-       g_return_if_fail (hash != NULL);
+
+       u_return_if_fail (hash != NULL);
 
        for (i = 0; i < hash->table_size; i++){
                Slot *s, *next;
 
                for (s = hash->table [i]; s != NULL; s = next){
                        next = s->next;
-                       
+
                        if (hash->key_destroy_func != NULL)
                                (*hash->key_destroy_func)(s->key);
                        if (hash->value_destroy_func != NULL)
                                (*hash->value_destroy_func)(s->value);
-                       g_free (s);
+                       u_free (s);
                }
        }
-       g_free (hash->table);
-       
-       g_free (hash);
+       u_free (hash->table);
+
+       u_free (hash);
 }
 
 void
-g_hash_table_print_stats (GHashTable *table)
+u_hash_table_print_stats (UHashTable *table)
 {
        int i, max_chain_index, chain_size, max_chain_size;
        Slot *node;
@@ -591,7 +591,7 @@ g_hash_table_print_stats (GHashTable *table)
 }
 
 void
-g_hash_table_iter_init (GHashTableIter *it, GHashTable *hash_table)
+u_hash_table_iter_init (UHashTableIter *it, UHashTable *hash_table)
 {
        Iter *iter = (Iter*)it;
 
@@ -600,14 +600,14 @@ g_hash_table_iter_init (GHashTableIter *it, GHashTable *hash_table)
        iter->slot_index = -1;
 }
 
-gboolean g_hash_table_iter_next (GHashTableIter *it, gpointer *key, gpointer *value)
+uboolean u_hash_table_iter_next (UHashTableIter *it, void * *key, void * *value)
 {
        Iter *iter = (Iter*)it;
 
-       GHashTable *hash = iter->ht;
+       UHashTable *hash = iter->ht;
 
-       g_assert (iter->slot_index != -2);
-       g_assert (sizeof (Iter) <= sizeof (GHashTableIter));
+       u_assert (iter->slot_index != -2);
+       u_assert (sizeof (Iter) <= sizeof (UHashTableIter));
 
        if (!iter->slot) {
                while (TRUE) {
@@ -631,40 +631,40 @@ gboolean g_hash_table_iter_next (GHashTableIter *it, gpointer *key, gpointer *va
        return TRUE;
 }
 
-gboolean
-g_direct_equal (gconstpointer v1, gconstpointer v2)
+uboolean
+u_direct_equal (const void * v1, const void * v2)
 {
        return v1 == v2;
 }
 
-guint
-g_direct_hash (gconstpointer v1)
+unsigned int
+u_direct_hash (const void * v1)
 {
-       return GPOINTER_TO_UINT (v1);
+       return U_POINTER_TO_UINT (v1);
 }
 
-gboolean
-g_int_equal (gconstpointer v1, gconstpointer v2)
+uboolean
+u_int_equal (const void * v1, const void * v2)
 {
-       return *(gint *)v1 == *(gint *)v2;
+       return *(int *)v1 == *(int *)v2;
 }
 
-guint
-g_int_hash (gconstpointer v1)
+unsigned int
+u_int_hash (const void * v1)
 {
-       return *(guint *)v1;
+       return *(unsigned int *)v1;
 }
 
-gboolean
-g_str_equal (gconstpointer v1, gconstpointer v2)
+uboolean
+u_str_equal (const void * v1, const void * v2)
 {
        return strcmp (v1, v2) == 0;
 }
 
-guint
-g_str_hash (gconstpointer v1)
+unsigned int
+u_str_hash (const void * v1)
 {
-       guint hash = 0;
+       unsigned int hash = 0;
        char *p = (char *) v1;
 
        while (*p++)
diff --git a/deps/eglib/src/ghooklist.c b/deps/ulib/src/uhooklist.c
similarity index 70%
rename from deps/eglib/src/ghooklist.c
rename to deps/ulib/src/uhooklist.c
index 88eba73..c71e8bb 100644
--- a/deps/eglib/src/ghooklist.c
+++ b/deps/ulib/src/uhooklist.c
@@ -28,26 +28,26 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 void
-g_hook_list_init (GHookList *hook_list,
-                  guint hook_size)
+u_hook_list_init (UHookList *hook_list,
+                  unsigned int hook_size)
 {
   hook_list->hooks = NULL;
 }
 
 void
-g_hook_list_invoke (GHookList *hook_list,
-                    gboolean may_recurse)
+u_hook_list_invoke (UHookList *hook_list,
+                    uboolean may_recurse)
 {
-  GHook *h;
+  UHook *h;
 
   if (may_recurse)
     {
       for (h = hook_list->hooks; h; h = h->next)
         {
-          GHookFunc func = h->func;
+          UHookFunc func = h->func;
           func (h->data);
         }
     }
@@ -55,7 +55,7 @@ g_hook_list_invoke (GHookList *hook_list,
     {
       for (h = hook_list->hooks; h && !h->in_call; h = h->next)
         {
-          GHookFunc func = h->func;
+          UHookFunc func = h->func;
           h->in_call = TRUE;
           func (h->data);
           h->in_call = FALSE;
@@ -64,25 +64,25 @@ g_hook_list_invoke (GHookList *hook_list,
 }
 
 void
-g_hook_list_clear (GHookList *hook_list)
+u_hook_list_clear (UHookList *hook_list)
 {
   while (hook_list->hooks)
-    g_hook_destroy_link (hook_list, hook_list->hooks);
+    u_hook_destroy_link (hook_list, hook_list->hooks);
 }
 
-GHook *
-g_hook_alloc (GHookList *hook_list)
+UHook *
+u_hook_alloc (UHookList *hook_list)
 {
-  return g_new (GHook, 1);
+  return u_new (UHook, 1);
 }
 
-GHook *
-g_hook_find_func_data (GHookList *hook_list,
-                       gboolean need_valids,
-                       gpointer func,
-                       gpointer data)
+UHook *
+u_hook_find_func_data (UHookList *hook_list,
+                       uboolean need_valids,
+                       void * func,
+                       void * data)
 {
-  GHook *h;
+  UHook *h;
 
   for (h = hook_list->hooks; h; h = h->next)
     {
@@ -94,8 +94,8 @@ g_hook_find_func_data (GHookList *hook_list,
 }
 
 void
-g_hook_destroy_link (GHookList *hook_list,
-                     GHook *hook)
+u_hook_destroy_link (UHookList *hook_list,
+                     UHook *hook)
 {
   if (hook_list->hooks == hook)
     hook_list->hooks = hook->next;
@@ -105,15 +105,15 @@ g_hook_destroy_link (GHookList *hook_list,
   if (hook->prev)
     hook->prev->next = hook->next;
 
-  g_free (hook);
+  u_free (hook);
 }
 
 void
-g_hook_prepend (GHookList *hook_list,
-                GHook *hook)
+u_hook_prepend (UHookList *hook_list,
+                UHook *hook)
 {
-  GHook *prev = hook_list->hooks ? hook_list->hooks->prev : NULL;
-  GHook *next = hook_list->hooks;
+  UHook *prev = hook_list->hooks ? hook_list->hooks->prev : NULL;
+  UHook *next = hook_list->hooks;
 
   hook->prev = prev;
   hook->next = next;
diff --git a/deps/eglib/src/giconv.c b/deps/ulib/src/uiconv.c
similarity index 73%
rename from deps/eglib/src/giconv.c
rename to deps/ulib/src/uiconv.c
index f9da4a6..1574625 100644
--- a/deps/eglib/src/giconv.c
+++ b/deps/ulib/src/uiconv.c
@@ -27,7 +27,7 @@
 #include <config.h>
 #endif
 
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #ifdef HAVE_ICONV_H
 #include <iconv.h>
@@ -44,37 +44,37 @@
 #define UNROLL_DECODE_UTF8 0
 #define UNROLL_ENCODE_UTF8 0
 
-typedef int (* Decoder) (char *inbuf, size_t inleft, gunichar *outchar);
-typedef int (* Encoder) (gunichar c, char *outbuf, size_t outleft);
+typedef int (* Decoder) (char *inbuf, size_t inleft, uunichar *outchar);
+typedef int (* Encoder) (uunichar c, char *outbuf, size_t outleft);
 
-struct _GIConv {
+struct _UIConv {
        Decoder decode;
        Encoder encode;
-       gunichar c;
+       uunichar c;
 #ifdef HAVE_ICONV
        iconv_t cd;
 #endif
 };
 
-static int decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf32be (gunichar c, char *outbuf, size_t outleft);
+static int decode_utf32be (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_utf32be (uunichar c, char *outbuf, size_t outleft);
 
-static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf32le (gunichar c, char *outbuf, size_t outleft);
+static int decode_utf32le (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_utf32le (uunichar c, char *outbuf, size_t outleft);
 
-static int decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf16be (gunichar c, char *outbuf, size_t outleft);
+static int decode_utf16be (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_utf16be (uunichar c, char *outbuf, size_t outleft);
 
-static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf16le (gunichar c, char *outbuf, size_t outleft);
+static int decode_utf16le (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_utf16le (uunichar c, char *outbuf, size_t outleft);
 
-static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_utf8 (gunichar c, char *outbuf, size_t outleft);
+static FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_utf8 (uunichar c, char *outbuf, size_t outleft);
 
-static int decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar);
-static int encode_latin1 (gunichar c, char *outbuf, size_t outleft);
+static int decode_latin1 (char *inbuf, size_t inleft, uunichar *outchar);
+static int encode_latin1 (uunichar c, char *outbuf, size_t outleft);
 
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+#if U_BYTE_ORDER == U_LITTLE_ENDIAN
 #define decode_utf32 decode_utf32le
 #define encode_utf32 encode_utf32le
 #define decode_utf16 decode_utf16le
@@ -109,43 +109,43 @@ static struct {
 };
 
 
-GIConv
-g_iconv_open (const char *to_charset, const char *from_charset)
+UIConv
+u_iconv_open (const char *to_charset, const char *from_charset)
 {
 #ifdef HAVE_ICONV
        iconv_t icd = (iconv_t) -1;
 #endif
        Decoder decoder = NULL;
        Encoder encoder = NULL;
-       GIConv cd;
-       guint i;
+       UIConv cd;
+       unsigned int i;
        
        if (!to_charset || !from_charset || !to_charset[0] || !from_charset[0]) {
                errno = EINVAL;
                
-               return (GIConv) -1;
+               return (UIConv) -1;
        }
        
-       for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
-               if (!g_ascii_strcasecmp (charsets[i].name, from_charset))
+       for (i = 0; i < U_N_ELEMENTS (charsets); i++) {
+               if (!u_ascii_strcasecmp (charsets[i].name, from_charset))
                        decoder = charsets[i].decoder;
                
-               if (!g_ascii_strcasecmp (charsets[i].name, to_charset))
+               if (!u_ascii_strcasecmp (charsets[i].name, to_charset))
                        encoder = charsets[i].encoder;
        }
        
        if (!encoder || !decoder) {
 #ifdef HAVE_ICONV
                if ((icd = iconv_open (to_charset, from_charset)) == (iconv_t) -1)
-                       return (GIConv) -1;
+                       return (UIConv) -1;
 #else
                errno = EINVAL;
                
-               return (GIConv) -1;
+               return (UIConv) -1;
 #endif
        }
        
-       cd = (GIConv) g_malloc (sizeof (struct _GIConv));
+       cd = (UIConv) u_malloc (sizeof (struct _UIConv));
        cd->decode = decoder;
        cd->encode = encoder;
        cd->c = -1;
@@ -158,30 +158,30 @@ g_iconv_open (const char *to_charset, const char *from_charset)
 }
 
 int
-g_iconv_close (GIConv cd)
+u_iconv_close (UIConv cd)
 {
 #ifdef HAVE_ICONV
        if (cd->cd != (iconv_t) -1)
                iconv_close (cd->cd);
 #endif
        
-       g_free (cd);
+       u_free (cd);
        
        return 0;
 }
 
-gsize
-g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
-        gchar **outbytes, gsize *outbytesleft)
+size_t
+u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
+        char **outbytes, size_t *outbytesleft)
 {
-       gsize inleft, outleft;
+       size_t inleft, outleft;
        char *inptr, *outptr;
-       gunichar c;
+       uunichar c;
        int rc = 0;
        
 #ifdef HAVE_ICONV
        if (cd->cd != (iconv_t) -1) {
-               /* Note: gsize may have a different size than size_t, so we need to
+               /* Note: size_t may have a different size than size_t, so we need to
                   remap inbytesleft and outbytesleft to size_t's. */
                size_t *outleftptr, *inleftptr;
                size_t n_outleft, n_inleft;
@@ -215,7 +215,7 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
        outleft = *outbytesleft;
        outptr = *outbytes;
        
-       if ((c = cd->c) != (gunichar) -1)
+       if ((c = cd->c) != (uunichar) -1)
                goto encode;
        
        while (inleft > 0) {
@@ -229,7 +229,7 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
                if ((rc = cd->encode (c, outptr, outleft)) < 0)
                        break;
                
-               c = (gunichar) -1;
+               c = (uunichar) -1;
                outleft -= rc;
                outptr += rc;
        }
@@ -252,10 +252,10 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
  */
 
 static int
-decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
+decode_utf32be (char *inbuf, size_t inleft, uunichar *outchar)
 {
        unsigned char *inptr = (unsigned char *) inbuf;
-       gunichar c;
+       uunichar c;
        
        if (inleft < 4) {
                errno = EINVAL;
@@ -278,10 +278,10 @@ decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar)
 }
 
 static int
-decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
+decode_utf32le (char *inbuf, size_t inleft, uunichar *outchar)
 {
        unsigned char *inptr = (unsigned char *) inbuf;
-       gunichar c;
+       uunichar c;
        
        if (inleft < 4) {
                errno = EINVAL;
@@ -304,7 +304,7 @@ decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar)
 }
 
 static int
-encode_utf32be (gunichar c, char *outbuf, size_t outleft)
+encode_utf32be (uunichar c, char *outbuf, size_t outleft)
 {
        unsigned char *outptr = (unsigned char *) outbuf;
        
@@ -322,7 +322,7 @@ encode_utf32be (gunichar c, char *outbuf, size_t outleft)
 }
 
 static int
-encode_utf32le (gunichar c, char *outbuf, size_t outleft)
+encode_utf32le (uunichar c, char *outbuf, size_t outleft)
 {
        unsigned char *outptr = (unsigned char *) outbuf;
        
@@ -340,11 +340,11 @@ encode_utf32le (gunichar c, char *outbuf, size_t outleft)
 }
 
 static int
-decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
+decode_utf16be (char *inbuf, size_t inleft, uunichar *outchar)
 {
        unsigned char *inptr = (unsigned char *) inbuf;
-       gunichar2 c;
-       gunichar u;
+       uunichar2 c;
+       uunichar u;
        
        if (inleft < 2) {
                errno = EINVAL;
@@ -387,11 +387,11 @@ decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar)
 }
 
 static int
-decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
+decode_utf16le (char *inbuf, size_t inleft, uunichar *outchar)
 {
        unsigned char *inptr = (unsigned char *) inbuf;
-       gunichar2 c;
-       gunichar u;
+       uunichar2 c;
+       uunichar u;
        
        if (inleft < 2) {
                errno = EINVAL;
@@ -434,11 +434,11 @@ decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar)
 }
 
 static int
-encode_utf16be (gunichar c, char *outbuf, size_t outleft)
+encode_utf16be (uunichar c, char *outbuf, size_t outleft)
 {
        unsigned char *outptr = (unsigned char *) outbuf;
-       gunichar2 ch;
-       gunichar c2;
+       uunichar2 ch;
+       uunichar c2;
        
        if (c < 0x10000) {
                if (outleft < 2) {
@@ -458,11 +458,11 @@ encode_utf16be (gunichar c, char *outbuf, size_t outleft)
                
                c2 = c - 0x10000;
                
-               ch = (gunichar2) ((c2 >> 10) + 0xd800);
+               ch = (uunichar2) ((c2 >> 10) + 0xd800);
                outptr[0] = (ch >> 8) & 0xff;
                outptr[1] = ch & 0xff;
                
-               ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+               ch = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
                outptr[2] = (ch >> 8) & 0xff;
                outptr[3] = ch & 0xff;
                
@@ -471,11 +471,11 @@ encode_utf16be (gunichar c, char *outbuf, size_t outleft)
 }
 
 static int
-encode_utf16le (gunichar c, char *outbuf, size_t outleft)
+encode_utf16le (uunichar c, char *outbuf, size_t outleft)
 {
        unsigned char *outptr = (unsigned char *) outbuf;
-       gunichar2 ch;
-       gunichar c2;
+       uunichar2 ch;
+       uunichar c2;
        
        if (c < 0x10000) {
                if (outleft < 2) {
@@ -495,11 +495,11 @@ encode_utf16le (gunichar c, char *outbuf, size_t outleft)
                
                c2 = c - 0x10000;
                
-               ch = (gunichar2) ((c2 >> 10) + 0xd800);
+               ch = (uunichar2) ((c2 >> 10) + 0xd800);
                outptr[0] = ch & 0xff;
                outptr[1] = (ch >> 8) & 0xff;
                
-               ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+               ch = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
                outptr[2] = ch & 0xff;
                outptr[3] = (ch >> 8) & 0xff;
                
@@ -508,10 +508,10 @@ encode_utf16le (gunichar c, char *outbuf, size_t outleft)
 }
 
 static FORCE_INLINE (int)
-decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
+decode_utf8 (char *inbuf, size_t inleft, uunichar *outchar)
 {
        unsigned char *inptr = (unsigned char *) inbuf;
-       gunichar u;
+       uunichar u;
        int n, i;
        
        u = *inptr;
@@ -567,7 +567,7 @@ decode_utf8 (char *inbuf, size_t inleft, gunichar *outchar)
 }
 
 static int
-encode_utf8 (gunichar c, char *outbuf, size_t outleft)
+encode_utf8 (uunichar c, char *outbuf, size_t outleft)
 {
        unsigned char *outptr = (unsigned char *) outbuf;
        int base, n, i;
@@ -619,14 +619,14 @@ encode_utf8 (gunichar c, char *outbuf, size_t outleft)
 }
 
 static int
-decode_latin1 (char *inbuf, size_t inleft, gunichar *outchar)
+decode_latin1 (char *inbuf, size_t inleft, uunichar *outchar)
 {
        *outchar = (unsigned char) *inbuf;
        return 1;
 }
 
 static int
-encode_latin1 (gunichar c, char *outbuf, size_t outleft)
+encode_latin1 (uunichar c, char *outbuf, size_t outleft)
 {
        if (outleft < 1) {
                errno = E2BIG;
@@ -648,28 +648,28 @@ encode_latin1 (gunichar c, char *outbuf, size_t outleft)
  * Simple conversion API
  */
 
-GQuark
-g_convert_error_quark (void)
+UQuark
+u_convert_error_quark (void)
 {
-       return g_quark_from_static_string ("g-convert-error-quark");
+       return u_quark_from_static_string ("g-convert-error-quark");
 }
 
-gchar *
-g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
-          gsize *bytes_read, gsize *bytes_written, GError **err)
+char *
+u_convert (const char *str, ussize len, const char *to_charset, const char *from_charset,
+          size_t *bytes_read, size_t *bytes_written, UError **err)
 {
-       gsize outsize, outused, outleft, inleft, grow, rc;
+       size_t outsize, outused, outleft, inleft, grow, rc;
        char *result, *outbuf, *inbuf;
-       gboolean flush = FALSE;
-       gboolean done = FALSE;
-       GIConv cd;
+       uboolean flush = FALSE;
+       uboolean done = FALSE;
+       UIConv cd;
        
-       g_return_val_if_fail (str != NULL, NULL);
-       g_return_val_if_fail (to_charset != NULL, NULL);
-       g_return_val_if_fail (from_charset != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (to_charset != NULL, NULL);
+       u_return_val_if_fail (from_charset != NULL, NULL);
        
-       if ((cd = g_iconv_open (to_charset, from_charset)) == (GIConv) -1) {
-               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION,
+       if ((cd = u_iconv_open (to_charset, from_charset)) == (UIConv) -1) {
+               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_NO_CONVERSION,
                             "Conversion from %s to %s not supported.",
                             from_charset, to_charset);
                
@@ -686,15 +686,15 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
        inbuf = (char *) str;
        
        outleft = outsize = MAX (inleft, 8);
-       outbuf = result = g_malloc (outsize + 4);
+       outbuf = result = u_malloc (outsize + 4);
        
        do {
                if (!flush)
-                       rc = g_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
+                       rc = u_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
                else
-                       rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
+                       rc = u_iconv (cd, NULL, NULL, &outbuf, &outleft);
                
-               if (rc == (gsize) -1) {
+               if (rc == (size_t) -1) {
                        switch (errno) {
                        case E2BIG:
                                /* grow our result buffer */
@@ -702,7 +702,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
                                outused = outbuf - result;
                                outsize += grow;
                                outleft += grow;
-                               result = g_realloc (result, outsize + 4);
+                               result = u_realloc (result, outsize + 4);
                                outbuf = result + outused;
                                break;
                        case EINVAL:
@@ -714,7 +714,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
                                break;
                        case EILSEQ:
                                /* illegal sequence in the input */
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", 
g_strerror (errno));
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", 
u_strerror (errno));
                                
                                if (bytes_read) {
                                        /* save offset of the illegal input sequence */
@@ -724,12 +724,12 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
                                if (bytes_written)
                                        *bytes_written = 0;
                                
-                               g_iconv_close (cd);
-                               g_free (result);
+                               u_iconv_close (cd);
+                               u_free (result);
                                return NULL;
                        default:
                                /* unknown errno */
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "%s", g_strerror 
(errno));
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_FAILED, "%s", u_strerror 
(errno));
                                
                                if (bytes_written)
                                        *bytes_written = 0;
@@ -737,8 +737,8 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
                                if (bytes_read)
                                        *bytes_read = 0;
                                
-                               g_iconv_close (cd);
-                               g_free (result);
+                               u_iconv_close (cd);
+                               u_free (result);
                                return NULL;
                        }
                } else if (flush) {
@@ -750,7 +750,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
                }
        } while (!done);
        
-       g_iconv_close (cd);
+       u_iconv_close (cd);
        
        /* Note: not all charsets can be null-terminated with a single
            null byte. UCS2, for example, needs 2 null bytes and UCS4
@@ -812,8 +812,8 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
  *    byte 5 = 128 + ((ud div 64) mod 64)
  *    byte 6 = 128 + (ud mod 64)
  **/
-gint
-g_unichar_to_utf8 (gunichar c, gchar *outbuf)
+int
+u_unichar_to_utf8 (uunichar c, char *outbuf)
 {
        int base, n, i;
        
@@ -854,28 +854,28 @@ g_unichar_to_utf8 (gunichar c, gchar *outbuf)
 }
 
 static FORCE_INLINE (int)
-g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf)
+u_unichar_to_utf16 (uunichar c, uunichar2 *outbuf)
 {
-       gunichar c2;
+       uunichar c2;
        
        if (c < 0xd800) {
                if (outbuf)
-                       *outbuf = (gunichar2) c;
+                       *outbuf = (uunichar2) c;
                
                return 1;
        } else if (c < 0xe000) {
                return -1;
        } else if (c < 0x10000) {
                if (outbuf)
-                       *outbuf = (gunichar2) c;
+                       *outbuf = (uunichar2) c;
                
                return 1;
        } else if (c < 0x110000) {
                if (outbuf) {
                        c2 = c - 0x10000;
                        
-                       outbuf[0] = (gunichar2) ((c2 >> 10) + 0xd800);
-                       outbuf[1] = (gunichar2) ((c2 & 0x3ff) + 0xdc00);
+                       outbuf[0] = (uunichar2) ((c2 >> 10) + 0xd800);
+                       outbuf[1] = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
                }
                
                return 2;
@@ -884,26 +884,26 @@ g_unichar_to_utf16 (gunichar c, gunichar2 *outbuf)
        }
 }
 
-gunichar *
-g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
+uunichar *
+u_utf8_to_ucs4_fast (const char *str, long len, long *items_written)
 {
-       gunichar *outbuf, *outptr;
+       uunichar *outbuf, *outptr;
        char *inptr;
-       glong n, i;
+       long n, i;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
-       n = g_utf8_strlen (str, len);
+       n = u_utf8_strlen (str, len);
        
        if (items_written)
                *items_written = n;
        
-       outptr = outbuf = g_malloc ((n + 1) * sizeof (gunichar));
+       outptr = outbuf = u_malloc ((n + 1) * sizeof (uunichar));
        inptr = (char *) str;
        
        for (i = 0; i < n; i++) {
-               *outptr++ = g_utf8_get_char (inptr);
-               inptr = g_utf8_next_char (inptr);
+               *outptr++ = u_utf8_get_char (inptr);
+               inptr = u_utf8_next_char (inptr);
        }
        
        *outptr = 0;
@@ -911,21 +911,21 @@ g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written)
        return outbuf;
 }
 
-static gunichar2 *
-eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean 
include_nuls, GError **err)
+static uunichar2 *
+eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *items_written, uboolean 
include_nuls, UError **err)
 {
-       gunichar2 *outbuf, *outptr;
+       uunichar2 *outbuf, *outptr;
        size_t outlen = 0;
        size_t inleft;
        char *inptr;
-       gunichar c;
+       uunichar c;
        int u, n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0) {
                if (include_nuls) {
-                       g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded 
nulls must pass the string length");
+                       u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_FAILED, "Conversions with embedded 
nulls must pass the string length");
                        return NULL;
                }
                
@@ -942,7 +942,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
                if (c == 0 && !include_nuls)
                        break;
                
-               if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
+               if ((u = u_unichar_to_utf16 (c, NULL)) < 0) {
                        errno = EILSEQ;
                        goto error;
                }
@@ -958,7 +958,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
        if (items_written)
                *items_written = outlen;
        
-       outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+       outptr = outbuf = u_malloc ((outlen + 1) * sizeof (uunichar2));
        inptr = (char *) str;
        inleft = len;
        
@@ -969,7 +969,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
                if (c == 0 && !include_nuls)
                        break;
                
-               outptr += g_unichar_to_utf16 (c, outptr);
+               outptr += u_unichar_to_utf16 (c, outptr);
                inleft -= n;
                inptr += n;
        }
@@ -980,12 +980,12 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
        
  error:
        if (errno == EILSEQ) {
-               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                             "Illegal byte sequence encounted in the input.");
        } else if (items_read) {
                /* partial input is ok if we can let our caller know... */
        } else {
-               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
                             "Partial byte sequence encountered in the input.");
        }
        
@@ -998,29 +998,29 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
        return NULL;
 }
 
-gunichar2 *
-g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+uunichar2 *
+u_utf8_to_utf16 (const char *str, long len, long *items_read, long *items_written, UError **err)
 {
        return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err);
 }
 
-gunichar2 *
-eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError 
**err)
+uunichar2 *
+eg_utf8_to_utf16_with_nuls (const char *str, long len, long *items_read, long *items_written, UError **err)
 {
        return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err);
 }
 
-gunichar *
-g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err)
+uunichar *
+u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written, UError **err)
 {
-       gunichar *outbuf, *outptr;
+       uunichar *outbuf, *outptr;
        size_t outlen = 0;
        size_t inleft;
        char *inptr;
-       gunichar c;
+       uunichar c;
        int n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0)
                len = strlen (str);
@@ -1031,13 +1031,13 @@ g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_wri
        while (inleft > 0) {
                if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
                        if (errno == EILSEQ) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                        } else if (items_read) {
                                /* partial input is ok if we can let our caller know... */
                                break;
                        } else {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
                                             "Partial byte sequence encountered in the input.");
                        }
                        
@@ -1062,7 +1062,7 @@ g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_wri
        if (items_read)
                *items_read = inptr - str;
        
-       outptr = outbuf = g_malloc (outlen + 4);
+       outptr = outbuf = u_malloc (outlen + 4);
        inptr = (char *) str;
        inleft = len;
        
@@ -1082,16 +1082,16 @@ g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_wri
        return outbuf;
 }
 
-gchar *
-g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+char *
+u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_written, UError **err)
 {
        char *inptr, *outbuf, *outptr;
        size_t outlen = 0;
        size_t inleft;
-       gunichar c;
+       uunichar c;
        int n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0) {
                len = 0;
@@ -1111,13 +1111,13 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
                        }
                        
                        if (errno == EILSEQ) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                        } else if (items_read) {
                                /* partial input is ok if we can let our caller know... */
                                break;
                        } else {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
                                             "Partial byte sequence encountered in the input.");
                        }
                        
@@ -1131,7 +1131,7 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
                } else if (c == 0)
                        break;
                
-               outlen += g_unichar_to_utf8 (c, NULL);
+               outlen += u_unichar_to_utf8 (c, NULL);
                inleft -= n;
                inptr += n;
        }
@@ -1142,7 +1142,7 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
        if (items_written)
                *items_written = outlen;
        
-       outptr = outbuf = g_malloc (outlen + 1);
+       outptr = outbuf = u_malloc (outlen + 1);
        inptr = (char *) str;
        inleft = len * 2;
        
@@ -1152,7 +1152,7 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
                else if (c == 0)
                        break;
                
-               outptr += g_unichar_to_utf8 (c, outptr);
+               outptr += u_unichar_to_utf8 (c, outptr);
                inleft -= n;
                inptr += n;
        }
@@ -1162,17 +1162,17 @@ g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *item
        return outbuf;
 }
 
-gunichar *
-g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err)
+uunichar *
+u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_written, UError **err)
 {
-       gunichar *outbuf, *outptr;
+       uunichar *outbuf, *outptr;
        size_t outlen = 0;
        size_t inleft;
        char *inptr;
-       gunichar c;
+       uunichar c;
        int n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0) {
                len = 0;
@@ -1192,13 +1192,13 @@ g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *item
                        }
                        
                        if (errno == EILSEQ) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                        } else if (items_read) {
                                /* partial input is ok if we can let our caller know... */
                                break;
                        } else {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
                                             "Partial byte sequence encountered in the input.");
                        }
                        
@@ -1223,7 +1223,7 @@ g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *item
        if (items_written)
                *items_written = outlen / 4;
        
-       outptr = outbuf = g_malloc (outlen + 4);
+       outptr = outbuf = u_malloc (outlen + 4);
        inptr = (char *) str;
        inleft = len * 2;
        
@@ -1243,20 +1243,20 @@ g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *item
        return outbuf;
 }
 
-gchar *
-g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+char *
+u_ucs4_to_utf8 (const uunichar *str, long len, long *items_read, long *items_written, UError **err)
 {
        char *outbuf, *outptr;
        size_t outlen = 0;
-       glong i;
+       long i;
        int n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0) {
                for (i = 0; str[i] != 0; i++) {
-                       if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                       if ((n = u_unichar_to_utf8 (str[i], NULL)) < 0) {
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                                
                                if (items_written)
@@ -1272,8 +1272,8 @@ g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_
                }
        } else {
                for (i = 0; i < len && str[i] != 0; i++) {
-                       if ((n = g_unichar_to_utf8 (str[i], NULL)) < 0) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                       if ((n = u_unichar_to_utf8 (str[i], NULL)) < 0) {
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                                
                                if (items_written)
@@ -1291,9 +1291,9 @@ g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_
        
        len = i;
        
-       outptr = outbuf = g_malloc (outlen + 1);
+       outptr = outbuf = u_malloc (outlen + 1);
        for (i = 0; i < len; i++)
-               outptr += g_unichar_to_utf8 (str[i], outptr);
+               outptr += u_unichar_to_utf8 (str[i], outptr);
        *outptr = 0;
        
        if (items_written)
@@ -1305,20 +1305,20 @@ g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_
        return outbuf;
 }
 
-gunichar2 *
-g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err)
+uunichar2 *
+u_ucs4_to_utf16 (const uunichar *str, long len, long *items_read, long *items_written, UError **err)
 {
-       gunichar2 *outbuf, *outptr;
+       uunichar2 *outbuf, *outptr;
        size_t outlen = 0;
-       glong i;
+       long i;
        int n;
        
-       g_return_val_if_fail (str != NULL, NULL);
+       u_return_val_if_fail (str != NULL, NULL);
        
        if (len < 0) {
                for (i = 0; str[i] != 0; i++) {
-                       if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                       if ((n = u_unichar_to_utf16 (str[i], NULL)) < 0) {
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                                
                                if (items_written)
@@ -1334,8 +1334,8 @@ g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items
                }
        } else {
                for (i = 0; i < len && str[i] != 0; i++) {
-                       if ((n = g_unichar_to_utf16 (str[i], NULL)) < 0) {
-                               g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+                       if ((n = u_unichar_to_utf16 (str[i], NULL)) < 0) {
+                               u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
                                             "Illegal byte sequence encounted in the input.");
                                
                                if (items_written)
@@ -1353,9 +1353,9 @@ g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items
        
        len = i;
        
-       outptr = outbuf = g_malloc ((outlen + 1) * sizeof (gunichar2));
+       outptr = outbuf = u_malloc ((outlen + 1) * sizeof (uunichar2));
        for (i = 0; i < len; i++)
-               outptr += g_unichar_to_utf16 (str[i], outptr);
+               outptr += u_unichar_to_utf16 (str[i], outptr);
        *outptr = 0;
        
        if (items_written)
diff --git a/deps/ulib/src/ulib-config.h.in b/deps/ulib/src/ulib-config.h.in
new file mode 100644
index 0000000..b7cfeb1
--- /dev/null
+++ b/deps/ulib/src/ulib-config.h.in
@@ -0,0 +1,19 @@
+#ifndef __ULIB_CONFIG_H
+#define __ULIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define U_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
+#define U_SEARCHPATH_SEPARATOR   '@SEARCHSEP@'
+#define U_DIR_SEPARATOR          '@PATHSEP@'
+#define U_DIR_SEPARATOR_S        "@PATHSEP@"
+#define U_OS_ OS@
+
+#if @HAVE_ALLOCA_H@ == 1
+#define U_HAVE_ALLOCA_H
+#endif
+
+typedef @PIDTYPE@ UPid;
+
+#endif
diff --git a/deps/ulib/src/ulib-config.hw b/deps/ulib/src/ulib-config.hw
new file mode 100644
index 0000000..e1881b2
--- /dev/null
+++ b/deps/ulib/src/ulib-config.hw
@@ -0,0 +1,76 @@
+#ifndef __ULIB_CONFIG_H
+#define __ULIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define U_OS_WIN32 1
+
+#ifdef _MSC_VER
+
+#include <io.h>
+
+#define U_GNUC_PRETTY_FUNCTION   __FUNCTION__
+#define U_GNUC_GNUSED
+#define U_BYTE_ORDER             1234
+#define U_GNUC_NORETURN
+#define U_BREAKPOINT()           __debugbreak()
+#define MAXPATHLEN 242
+
+typedef uintptr_t size_t;
+typedef intptr_t gssize;
+typedef int pid_t;
+
+#define U_DIR_SEPARATOR          '\\'
+#define U_DIR_SEPARATOR_S        "\\"
+#define U_SEARCHPATH_SEPARATOR_S ";"
+#define U_SEARCHPATH_SEPARATOR   ';'
+#define U_USIZE_FORMAT    "d"
+#define U_UINT64_FORMAT   "d"
+#define U_INT64_FORMAT    "d"
+#define U_POINTER_TO_INT(ptr)   ((int)(intptr_t) (ptr))
+#define U_POINTER_TO_UINT(ptr)  ((unsigned int)(intptr_t) (ptr))
+#define U_INT_TO_POINTER(v)     ((void *)(intptr_t) (v))
+#define U_UINT_TO_POINTER(v)    ((void *)(intptr_t) (v))
+
+/* VS 2010 and later have stdint.h */
+#if defined(_MSC_VER) && _MSC_VER < 1600
+#define INT32_MAX 2147483647
+#define INT32_MIN (~ INT32_MAX)
+#define INT64_MAX 9223372036854775807i64
+#define INT64_MIN (~INT64_MAX)
+#define UINT32_MAX 0xffffffffU
+#define UINT64_MAX 0xffffffffffffffffULL
+#endif
+
+#define STDOUT_FILENO (int)(intptr_t)stdout
+#define STDERR_FILENO (int)(intptr_t)stderr
+
+
+/* FIXME: what should this be ?*/
+#define X_OK 4 /* This is really read */
+#define WNOHANG 1
+#define F_SETFD 1
+#define FD_CLOEXEC 1
+
+#undef inline
+#define inline __inline
+
+#define strtok_r strtok_s
+
+#undef U_HAVE_UNISTD_H
+#undef U_HAVE_SYS_TIME_H
+#undef U_HAVE_SYS_WAIT_H
+#undef U_HAVE_PWD_H
+#undef U_HAVE_STRNDUP
+#define U_HAVE_GETOPT_H 1
+
+/* disable the following warnings
+ * C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is 
ignored.
+ * C4127: conditional expression is constant
+*/
+#pragma warning(disable:4100 4127)
+#endif
+
+typedef void * UPid;
+#endif
diff --git a/deps/ulib/src/ulib.h b/deps/ulib/src/ulib.h
new file mode 100644
index 0000000..9890f7e
--- /dev/null
+++ b/deps/ulib/src/ulib.h
@@ -0,0 +1,1285 @@
+#ifndef __ULIB_H
+#define __ULIB_H
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <stddef.h>
+#include <ctype.h>
+#include <limits.h>
+#include <float.h>
+
+#ifdef _MSC_VER
+#pragma include_alias(<ulib-config.h>, <ulib-config.hw>)
+#endif
+
+#include <stdint.h>
+#include <inttypes.h>
+
+#include <ulib-config.h>
+
+#ifdef U_HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#ifdef WIN32
+/* For alloca */
+#include <malloc.h>
+#endif
+
+#ifndef offsetof
+#   define offsetof(s_name,n_name) (size_t)(char *)&(((s_name*)0)->m_name)
+#endif
+
+#define __ULIB_X11 1
+
+#ifdef  __cplusplus
+#define U_BEGIN_DECLS  extern "C" {
+#define U_END_DECLS    }
+#else
+#define U_BEGIN_DECLS
+#define U_END_DECLS
+#endif
+
+U_BEGIN_DECLS
+
+#ifdef U_OS_WIN32
+/* MSC and Cross-compilatin will use this */
+int vasprintf (char **strp, const char *fmt, va_list ap);
+#endif
+
+
+/*
+ * Basic data types
+ */
+typedef ssize_t  ussize;
+typedef int32_t  uboolean;
+typedef uint16_t uunichar2;
+typedef uint32_t uunichar;
+
+
+/*
+ * Macros
+ */
+#define U_N_ELEMENTS(s)                   (sizeof(s) / sizeof ((s) [0]))
+#define U_STRINGIFY_ARG(arg)              #arg
+#define U_STRINGIFY(arg)                  U_STRINGIFY_ARG(arg)
+#define U_PASTE_ARGS(part0, part1)        part0 ## part1
+#define U_PASTE(part0, part1)             U_PASTE_ARGS (part0, part1)
+
+#ifndef FALSE
+#define FALSE                0
+#endif
+
+#ifndef TRUE
+#define TRUE                 1
+#endif
+
+#define U_MINSHORT           SHRT_MIN
+#define U_MAXSHORT           SHRT_MAX
+#define U_MAXUSHORT          USHRT_MAX
+#define U_MAXINT             INT_MAX
+#define U_MININT             INT_MIN
+#define U_MAXINT32           INT32_MAX
+#define U_MAXUINT32          UINT32_MAX
+#define U_MININT32           INT32_MIN
+#define U_MININT64           INT64_MIN
+#define U_MAXINT64          INT64_MAX
+#define U_MAXUINT64         UINT64_MAX
+#define U_MAXFLOAT           FLT_MAX
+
+#define U_UINT64_FORMAT     PRIu64
+#define U_INT64_FORMAT      PRId64
+#define U_UINT32_FORMAT     PRIu32
+#define U_INT32_FORMAT      PRId32
+
+#define U_LITTLE_ENDIAN 1234
+#define U_BIU_ENDIAN    4321
+#define U_STMT_START    do
+#define U_STMT_END      while (0)
+
+#define U_USEC_PER_SEC  1000000
+#define U_PI            3.141592653589793238462643383279502884L
+#define U_PI_2          1.570796326794896619231321691639751442L
+
+#define U_INT64_CONSTANT(val)   (val##LL)
+#define U_UINT64_CONSTANT(val)  (val##UL)
+
+#define U_POINTER_TO_INT(ptr)   ((int)(intptr_t)(ptr))
+#define U_POINTER_TO_UINT(ptr)  ((unsigned int)(uintptr_t)(ptr))
+#define U_INT_TO_POINTER(v)     ((void *)(intptr_t)(v))
+#define U_UINT_TO_POINTER(v)    ((void *)(uintptr_t)(v))
+
+#define U_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+
+#define U_STRLOC __FILE__ ":" U_STRINGIFY(__LINE__) ":"
+
+#define U_CONST_RETURN const
+
+#define U_BYTE_ORDER U_LITTLE_ENDIAN
+
+#if defined(__GNUC__)
+#  define U_GNUC_GNUSED                       __attribute__((__unused__))
+#  define U_GNUC_NORETURN                     __attribute__((__noreturn__))
+#  define U_LIKELY(expr)                      (__builtin_expect ((expr) != 0, 1))
+#  define U_UNLIKELY(expr)                    (__builtin_expect ((expr) != 0, 0))
+#  define U_GNUC_PRINTF(format_idx, arg_idx)  __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#else
+#  define U_GNUC_GNUSED
+#  define U_GNUC_NORETURN
+#  define U_LIKELY(expr) (expr)
+#  define U_UNLIKELY(expr) (expr)
+#  define U_GNUC_PRINTF(format_idx, arg_idx)
+#endif
+
+#if defined(__GNUC__)
+#  define U_STRFUNC ((const char *)(__PRETTY_FUNCTION__))
+#elif defined (_MSC_VER)
+#  define U_STRFUNC ((const char*) (__FUNCTION__))
+#else
+#  define U_STRFUNC ((const char*) (__func__))
+#endif
+
+#if defined (_MSC_VER)
+#  define U_VA_COPY(dest, src) ((dest) = (src))
+#else
+#  define U_VA_COPY(dest, src) va_copy (dest, src)
+#endif
+
+#ifdef OS_UNIX
+#define U_BREAKPOINT() U_STMT_START { raise (SIGTRAP); } U_STMT_END
+#else
+#define U_BREAKPOINT()
+#endif
+
+#if defined (__native_client__)
+#undef U_BREAKPOINT
+#define U_BREAKPOINT()
+#endif
+
+#ifndef ABS
+#define ABS(a)    ((a) > 0 ? (a) : -(a))
+#endif
+
+#ifndef MAX
+#define MAX(a,b)  (((a)>(b)) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b)  (((a)<(b)) ? (a) : (b))
+#endif
+
+#ifndef CLAMP
+#define CLAMP(a,low,high) (((a) < (low)) ? (low) : (((a) > (high)) ? (high) : (a)))
+#endif
+
+
+
+/*
+ * Allocation
+ */
+void u_free (void *ptr);
+void * u_realloc (void * obj, size_t size);
+void * u_malloc (size_t x);
+void * u_malloc0 (size_t x);
+void * u_try_malloc (size_t x);
+void * u_try_realloc (void * obj, size_t size);
+void * u_memdup (const void * mem, unsigned int byte_size);
+
+#define u_new(type,size)        ((type *) u_malloc (sizeof (type) * (size)))
+#define u_new0(type,size)       ((type *) u_malloc0 (sizeof (type)* (size)))
+#define u_newa(type,size)       ((type *) alloca (sizeof (type) * (size)))
+
+#define u_memmove(dest,src,len) memmove (dest, src, len)
+#define u_renew(struct_type, mem, n_structs) u_realloc (mem, sizeof (struct_type) * n_structs)
+#define u_alloca(size)         alloca (size)
+
+#define u_slice_new(type)         ((type *) u_malloc (sizeof (type)))
+#define u_slice_new0(type)        ((type *) u_malloc0 (sizeof (type)))
+#define u_slice_free(type, mem)   u_free (mem)
+#define u_slice_free1(size, mem)  u_free (mem)
+#define u_slice_alloc(size)       u_malloc (size)
+#define u_slice_alloc0(size)      u_malloc0 (size)
+#define u_slice_dup(type, mem)    u_memdup (mem, sizeof (type))
+#define u_slice_copy(size, mem)   u_memdup (mem, size)
+
+static inline char   *u_strdup (const char *str) { if (str) {return strdup (str);} return NULL; }
+char **u_strdupv (char **str_array);
+
+typedef struct {
+       void * (*malloc)      (size_t    n_bytes);
+       void * (*realloc)     (void * mem, size_t n_bytes);
+       void     (*free)        (void * mem);
+       void * (*calloc)      (size_t    n_blocks, size_t n_block_bytes);
+       void * (*try_malloc)  (size_t    n_bytes);
+       void * (*try_realloc) (void * mem, size_t n_bytes);
+} UMemVTable;
+
+#define u_mem_set_vtable(x)
+
+struct _UMemChunk {
+       unsigned int alloc_size;
+};
+
+typedef struct _UMemChunk UMemChunk;
+/*
+ * Misc.
+ */
+#define u_atexit(func) ((void) atexit (func))
+
+const char *    u_getenv(const char *variable);
+uboolean         u_setenv(const char *variable, const char *value, uboolean overwrite);
+void             u_unsetenv(const char *variable);
+
+char*           u_win32_getlocale(void);
+
+/*
+ * Precondition macros
+ */
+#define u_warn_if_fail(x)  U_STMT_START { if (!(x)) { u_warning ("%s:%d: assertion '%s' failed", __FILE__, 
__LINE__, #x); } } U_STMT_END
+#define u_warn_if_reached() u_warning ("%s:%d: code should not be reached!", __FILE__, __LINE__)
+
+#define u_return_if_fail(x)  U_STMT_START { if (!(x)) { u_critical ("%s:%d: assertion '%s' failed", 
__FILE__, __LINE__, #x); return; } } U_STMT_END
+#define u_return_val_if_fail(x,e)  U_STMT_START { if (!(x)) { u_critical ("%s:%d: assertion '%s' failed", 
__FILE__, __LINE__, #x); return (e); } } U_STMT_END
+#define u_return_if_reached(e) U_STMT_START { u_warning ("%s:%d: code should not be reached, returning!",  
__FILE__, __LINE__); return; } U_STMT_END
+#define u_return_val_if_reached(e) U_STMT_START { u_warning ("%s:%d: code should not be reached, 
returning!",  __FILE__, __LINE__); return (e); } U_STMT_END
+
+/*
+ * DebugKeys
+ */
+typedef struct _UDebugKey {
+       const char *key;
+       unsigned int         value;
+} UDebugKey;
+
+unsigned int   u_parse_debug_string (const char *string, const UDebugKey *keys, unsigned int nkeys);
+
+/*
+ * Quark
+ */
+
+typedef uint32_t UQuark;
+
+UQuark
+u_quark_from_static_string (const char *string);
+
+/*
+ * Errors
+ */
+typedef struct {
+       UQuark  domain;
+       int    code;
+       char  *message;
+} UError;
+
+void      u_clear_error (UError **error);
+void      u_error_free (UError *error);
+UError   *u_error_new  (UQuark domain, int code, const char *format, ...);
+UError   *u_error_new_valist (UQuark domain, int code, const char *format, va_list ap);
+void      u_set_error  (UError **err, UQuark domain, int code, const char *format, ...);
+void      u_propagate_error (UError **dest, UError *src);
+UError   *u_error_copy (const UError *error);
+uboolean  u_error_matches (const UError *error, UQuark domain, int code);
+
+/*
+ * Strings utility
+ */
+char       *u_strdup_printf  (const char *format, ...);
+char       *u_strdup_vprintf (const char *format, va_list args);
+char       *u_strndup        (const char *str, size_t n);
+const char *u_strerror       (int errnum);
+char       *u_strndup        (const char *str, size_t n);
+void         u_strfreev       (char **str_array);
+char       *u_strconcat      (const char *first, ...);
+char      **u_strsplit       (const char *string, const char *delimiter, int max_tokens);
+char      **u_strsplit_set   (const char *string, const char *delimiter, int max_tokens);
+char       *u_strreverse     (char *str);
+uboolean     u_str_has_prefix (const char *str, const char *prefix);
+uboolean     u_str_has_suffix (const char *str, const char *suffix);
+unsigned int        u_strv_length    (char **str_array);
+char       *u_strjoin        (const char *separator, ...);
+char       *u_strjoinv       (const char *separator, char **str_array);
+char       *u_strchug        (char *str);
+char       *u_strchomp       (char *str);
+void         u_strdown        (char *string);
+char       *u_strnfill       (size_t length, char fill_char);
+
+char       *u_strdelimit     (char *string, const char *delimiters, char new_delimiter);
+char       *u_strescape      (const char *source, const char *exceptions);
+
+char       *u_filename_to_uri   (const char *filename, const char *hostname, UError **error);
+char       *u_filename_from_uri (const char *uri, char **hostname, UError **error);
+
+int         u_printf          (char const *format, ...);
+int         u_fprintf         (FILE *file, char const *format, ...);
+int         u_sprintf         (char *string, char const *format, ...);
+int         u_snprintf        (char *string, unsigned long n, char const *format, ...);
+#define u_vprintf vprintf
+#define u_vfprintf vfprintf
+#define u_vsprintf vsprintf
+#define u_vsnprintf vsnprintf
+#define u_vasprintf vasprintf
+
+size_t   u_strlcpy            (char *dest, const char *src, size_t dest_size);
+char  *u_stpcpy             (char *dest, const char *src);
+
+
+char   u_ascii_tolower      (char c);
+char   u_ascii_toupper      (char c);
+char  *u_ascii_strdown      (const char *str, ussize len);
+char  *u_ascii_strup        (const char *str, ussize len);
+int    u_ascii_strncasecmp  (const char *s1, const char *s2, size_t n);
+int    u_ascii_strcasecmp   (const char *s1, const char *s2);
+int    u_ascii_xdigit_value (char c);
+#define u_ascii_isspace(c)   (isspace (c) != 0)
+#define u_ascii_isalpha(c)   (isalpha (c) != 0)
+#define u_ascii_isprint(c)   (isprint (c) != 0)
+#define u_ascii_isxdigit(c)  (isxdigit (c) != 0)
+
+/* FIXME: u_strcasecmp supports utf8 unicode stuff */
+#ifdef _MSC_VER
+#define u_strcasecmp stricmp
+#define u_strncasecmp strnicmp
+#define u_strstrip(a) u_strchug (u_strchomp (a))
+#else
+#define u_strcasecmp strcasecmp
+#define u_ascii_strtoull strtoull
+#define u_strncasecmp strncasecmp
+#define u_strstrip(a) u_strchug (u_strchomp (a))
+#endif
+#define u_ascii_strdup strdup
+
+
+#define        U_STR_DELIMITERS "_-|> <."
+
+/*
+ * String type
+ */
+typedef struct {
+       char *str;
+       size_t len;
+       size_t allocated_len;
+} UString;
+
+UString     *u_string_new           (const char *init);
+UString     *u_string_new_len       (const char *init, ussize len);
+UString     *u_string_sized_new     (size_t default_size);
+char       *u_string_free          (UString *string, uboolean free_segment);
+UString     *u_string_assign        (UString *string, const char *val);
+UString     *u_string_append        (UString *string, const char *val);
+void         u_string_printf        (UString *string, const char *format, ...);
+void         u_string_append_printf (UString *string, const char *format, ...);
+void         u_string_append_vprintf (UString *string, const char *format, va_list args);
+UString     *u_string_append_unichar (UString *string, uunichar c);
+UString     *u_string_append_c      (UString *string, char c);
+UString     *u_string_append        (UString *string, const char *val);
+UString     *u_string_append_len    (UString *string, const char *val, ussize len);
+UString     *u_string_truncate      (UString *string, size_t len);
+UString     *u_string_prepend       (UString *string, const char *val);
+UString     *u_string_insert        (UString *string, ussize pos, const char *val);
+UString     *u_string_set_size      (UString *string, size_t len);
+UString     *u_string_erase         (UString *string, ussize pos, ussize len);
+
+#define u_string_sprintfa u_string_append_printf
+
+typedef void     (*UFunc)          (void * data, void * user_data);
+typedef int     (*UCompareFunc)   (const void * a, const void * b);
+typedef int     (*UCompareDataFunc) (const void * a, const void * b, void * user_data);
+typedef void     (*UHFunc)         (void * key, void * value, void * user_data);
+typedef uboolean (*UHRFunc)        (void * key, void * value, void * user_data);
+typedef void     (*UDestroyNotify) (void * data);
+typedef unsigned int    (*UHashFunc)      (const void * key);
+typedef uboolean (*UEqualFunc)     (const void * a, const void * b);
+typedef void     (*UFreeFunc)      (void *       data);
+
+/*
+ * Lists
+ */
+typedef struct _USList USList;
+struct _USList {
+       void * data;
+       USList *next;
+};
+
+USList *u_slist_alloc         (void);
+USList *u_slist_append        (USList        *list,
+                              void *       data);
+USList *u_slist_prepend       (USList        *list,
+                              void *       data);
+void    u_slist_free          (USList        *list);
+void    u_slist_free_1        (USList        *list);
+USList *u_slist_copy          (USList        *list);
+USList *u_slist_concat        (USList        *list1,
+                              USList        *list2);
+void    u_slist_foreach       (USList        *list,
+                              UFunc          func,
+                              void *       user_data);
+USList *u_slist_last          (USList        *list);
+USList *u_slist_find          (USList        *list,
+                              const void *  data);
+USList *u_slist_find_custom   (USList       *list,
+                              const void *  data,
+                              UCompareFunc   func);
+USList *u_slist_remove        (USList        *list,
+                              const void *  data);
+USList *u_slist_remove_all    (USList        *list,
+                              const void *  data);
+USList *u_slist_reverse       (USList        *list);
+unsigned int   u_slist_length        (USList        *list);
+USList *u_slist_remove_link   (USList        *list,
+                              USList        *link);
+USList *u_slist_delete_link   (USList        *list,
+                              USList        *link);
+USList *u_slist_insert_sorted (USList        *list,
+                              void *       data,
+                              UCompareFunc   func);
+USList *u_slist_insert_before (USList        *list,
+                              USList        *sibling,
+                              void *       data);
+USList *u_slist_sort          (USList        *list,
+                              UCompareFunc   func);
+int    u_slist_index         (USList        *list,
+                              const void *  data);
+USList *u_slist_nth          (USList        *list,
+                              unsigned int           n);
+void * u_slist_nth_data     (USList         *list,
+                              unsigned int           n);
+
+#define u_slist_next(slist) ((slist) ? (((USList *) (slist))->next) : NULL)
+
+
+typedef struct _UList UList;
+struct _UList {
+  void * data;
+  UList *next;
+  UList *prev;
+};
+
+#define u_list_next(list) ((list) ? (((UList *) (list))->next) : NULL)
+#define u_list_previous(list) ((list) ? (((UList *) (list))->prev) : NULL)
+
+UList *u_list_alloc         (void);
+UList *u_list_append        (UList         *list,
+                            void *       data);
+UList *u_list_prepend       (UList         *list,
+                            void *       data);
+void   u_list_free          (UList         *list);
+void   u_list_free_full     (UList         *list,
+                             UDestroyNotify free_func);
+void   u_list_free_1        (UList         *list);
+UList *u_list_copy          (UList         *list);
+unsigned int  u_list_length        (UList         *list);
+int   u_list_index         (UList         *list,
+                            const void *  data);
+UList *u_list_nth           (UList         *list,
+                            unsigned int          n);
+void * u_list_nth_data      (UList         *list,
+                            unsigned int          n);
+UList *u_list_last          (UList         *list);
+UList *u_list_concat        (UList         *list1,
+                            UList         *list2);
+void   u_list_foreach       (UList         *list,
+                            UFunc          func,
+                            void *       user_data);
+UList *u_list_first         (UList         *list);
+UList *u_list_find          (UList         *list,
+                            const void *  data);
+UList *u_list_find_custom   (UList        *list,
+                            const void *  data,
+                            UCompareFunc   func);
+UList *u_list_remove        (UList         *list,
+                            const void *  data);
+UList *u_list_remove_all    (UList         *list,
+                            const void *  data);
+UList *u_list_reverse       (UList         *list);
+UList *u_list_remove_link   (UList         *list,
+                            UList         *link);
+UList *u_list_delete_link   (UList         *list,
+                            UList         *link);
+UList *u_list_insert_sorted (UList         *list,
+                            void *       data,
+                            UCompareFunc   func);
+UList *u_list_insert_before (UList         *list,
+                            UList         *sibling,
+                            void *       data);
+UList *u_list_sort          (UList         *sort,
+                            UCompareFunc   func);
+
+/*
+ * HookLists
+ */
+typedef void (*UHookFunc) (void * data);
+
+typedef struct _UHook UHook;
+typedef struct _UHookList UHookList;
+
+struct _UHook {
+  UHook        *next;
+  UHook        *prev;
+  void * data;
+  void * func;
+  uboolean in_call;
+};
+
+struct _UHookList {
+  UHook *hooks;
+};
+
+void
+u_hook_list_init (UHookList *hook_list,
+                  unsigned int hook_size);
+
+void
+u_hook_list_invoke (UHookList *hook_list,
+                    uboolean may_recurse);
+
+void
+u_hook_list_clear (UHookList *hook_list);
+
+UHook *
+u_hook_alloc (UHookList *hook_list);
+
+UHook *
+u_hook_find_func_data (UHookList *hook_list,
+                       uboolean need_valids,
+                       void * func,
+                       void * data);
+
+void
+u_hook_destroy_link (UHookList *hook_list,
+                     UHook *hook);
+
+void
+u_hook_prepend (UHookList *hook_list,
+                UHook *hook);
+
+
+/*
+ * Hashtables
+ */
+typedef struct _UHashTable UHashTable;
+typedef struct _UHashTableIter UHashTableIter;
+
+/* Private, but needed for stack allocation */
+struct _UHashTableIter
+{
+       void * dummy [8];
+};
+
+UHashTable     *u_hash_table_new             (UHashFunc hash_func, UEqualFunc key_equal_func);
+UHashTable     *u_hash_table_new_full        (UHashFunc hash_func, UEqualFunc key_equal_func,
+                                             UDestroyNotify key_destroy_func, UDestroyNotify 
value_destroy_func);
+void            u_hash_table_insert_replace  (UHashTable *hash, void * key, void * value, uboolean replace);
+unsigned int           u_hash_table_size            (UHashTable *hash);
+UList          *u_hash_table_get_keys        (UHashTable *hash);
+UList          *u_hash_table_get_values      (UHashTable *hash);
+void *        u_hash_table_lookup          (UHashTable *hash, const void * key);
+uboolean        u_hash_table_lookup_extended (UHashTable *hash, const void * key, void * *orig_key, void * 
*value);
+void            u_hash_table_foreach         (UHashTable *hash, UHFunc func, void * user_data);
+void *        u_hash_table_find            (UHashTable *hash, UHRFunc predicate, void * user_data);
+uboolean        u_hash_table_remove          (UHashTable *hash, const void * key);
+uboolean        u_hash_table_steal           (UHashTable *hash, const void * key);
+void            u_hash_table_remove_all      (UHashTable *hash);
+unsigned int           u_hash_table_foreach_remove  (UHashTable *hash, UHRFunc func, void * user_data);
+unsigned int           u_hash_table_foreach_steal   (UHashTable *hash, UHRFunc func, void * user_data);
+void            u_hash_table_destroy         (UHashTable *hash);
+void            u_hash_table_print_stats     (UHashTable *table);
+
+void            u_hash_table_iter_init       (UHashTableIter *iter, UHashTable *hash_table);
+uboolean        u_hash_table_iter_next       (UHashTableIter *iter, void * *key, void * *value);
+
+unsigned int           u_spaced_primes_closest      (unsigned int x);
+
+#define u_hash_table_insert(h,k,v)    u_hash_table_insert_replace ((h),(k),(v),FALSE)
+#define u_hash_table_replace(h,k,v)   u_hash_table_insert_replace ((h),(k),(v),TRUE)
+
+uboolean u_direct_equal (const void * v1, const void * v2);
+unsigned int    u_direct_hash  (const void * v1);
+uboolean u_int_equal    (const void * v1, const void * v2);
+unsigned int    u_int_hash     (const void * v1);
+uboolean u_str_equal    (const void * v1, const void * v2);
+unsigned int    u_str_hash     (const void * v1);
+
+/*
+ * ByteArray
+ */
+
+typedef struct _UByteArray UByteArray;
+struct _UByteArray {
+       uint8_t *data;
+       int len;
+};
+
+UByteArray *u_byte_array_new      (void);
+UByteArray *u_byte_array_append   (UByteArray *array, const uint8_t *data, unsigned int len);
+UByteArray *u_byte_array_set_size (UByteArray *array, unsigned int len);
+uint8_t     *u_byte_array_free     (UByteArray *array, uboolean free_segment);
+
+/*
+ * Array
+ */
+
+typedef struct _UArray UArray;
+struct _UArray {
+       char *data;
+       int len;
+};
+
+UArray *u_array_new               (uboolean zero_terminated, uboolean clear_, unsigned int element_size);
+UArray *u_array_sized_new         (uboolean zero_terminated, uboolean clear_, unsigned int element_size, 
unsigned int reserved_size);
+char*  u_array_free              (UArray *array, uboolean free_segment);
+UArray *u_array_append_vals       (UArray *array, const void * data, unsigned int len);
+UArray* u_array_insert_vals       (UArray *array, unsigned int index_, const void * data, unsigned int len);
+UArray* u_array_remove_index      (UArray *array, unsigned int index_);
+UArray* u_array_remove_index_fast (UArray *array, unsigned int index_);
+UArray *u_array_set_size          (UArray *array, int length);
+
+#define u_array_append_val(a,v)   (u_array_append_vals((a),&(v),1))
+#define u_array_insert_val(a,i,v) (u_array_insert_vals((a),(i),&(v),1))
+#define u_array_index(a,t,i)      (((t*)(a)->data)[(i)])
+
+/*
+ * QSort
+*/
+
+void u_qsort_with_data (void * base, size_t nmemb, size_t size, UCompareDataFunc compare, void * user_data);
+
+/*
+ * Pointer Array
+ */
+
+typedef struct _UPtrArray UPtrArray;
+struct _UPtrArray {
+       void * *pdata;
+       unsigned int len;
+};
+
+UPtrArray *u_ptr_array_new                (void);
+UPtrArray *u_ptr_array_sized_new          (unsigned int reserved_size);
+UPtrArray *u_ptr_array_new_with_free_func (UDestroyNotify element_free_func);
+void       u_ptr_array_add                (UPtrArray *array, void * data);
+uboolean   u_ptr_array_remove             (UPtrArray *array, void * data);
+void *   u_ptr_array_remove_index       (UPtrArray *array, unsigned int index);
+uboolean   u_ptr_array_remove_fast        (UPtrArray *array, void * data);
+void *   u_ptr_array_remove_index_fast  (UPtrArray *array, unsigned int index);
+void       u_ptr_array_sort               (UPtrArray *array, UCompareFunc compare_func);
+void       u_ptr_array_sort_with_data     (UPtrArray *array, UCompareDataFunc compare_func, void * 
user_data);
+void       u_ptr_array_set_size           (UPtrArray *array, int length);
+void *  *u_ptr_array_free               (UPtrArray *array, uboolean free_seg);
+void       u_ptr_array_foreach            (UPtrArray *array, UFunc func, void * user_data);
+#define    u_ptr_array_index(array,index) (array)->pdata[(index)]
+
+/*
+ * Queues
+ */
+typedef struct {
+       UList *head;
+       UList *tail;
+       unsigned int length;
+} UQueue;
+
+#define  U_QUEUE_INIT { NULL, NULL, 0 }
+
+void     u_queue_init      (UQueue   *queue);
+void * u_queue_peek_head (UQueue   *queue);
+void * u_queue_pop_head  (UQueue   *queue);
+void * u_queue_peek_tail (UQueue   *queue);
+void * u_queue_pop_tail  (UQueue   *queue);
+void     u_queue_push_head (UQueue   *queue,
+                           void *  data);
+void     u_queue_push_tail (UQueue   *queue,
+                           void *  data);
+uboolean u_queue_is_empty  (UQueue   *queue);
+UQueue  *u_queue_new       (void);
+void     u_queue_free      (UQueue   *queue);
+void     u_queue_foreach   (UQueue   *queue, UFunc func, void * user_data);
+UList   *u_queue_find      (UQueue   *queue, const void * data);
+void     u_queue_clear     (UQueue *queue);
+
+/*
+ * Messages
+ */
+#ifndef U_LOG_DOMAIN
+#define U_LOG_DOMAIN ((char*) 0)
+#endif
+
+typedef enum {
+       U_LOG_FLAU_RECURSION          = 1 << 0,
+       U_LOG_FLAU_FATAL              = 1 << 1,
+
+       U_LOG_LEVEL_ERROR             = 1 << 2,
+       U_LOG_LEVEL_CRITICAL          = 1 << 3,
+       U_LOG_LEVEL_WARNING           = 1 << 4,
+       U_LOG_LEVEL_MESSAGE           = 1 << 5,
+       U_LOG_LEVEL_INFO              = 1 << 6,
+       U_LOG_LEVEL_DEBUG             = 1 << 7,
+
+       U_LOG_LEVEL_MASK              = ~(U_LOG_FLAU_RECURSION | U_LOG_FLAU_FATAL)
+} ULogLevelFlags;
+
+void           u_print                (const char *format, ...);
+void           u_printerr             (const char *format, ...);
+ULogLevelFlags u_log_set_always_fatal (ULogLevelFlags fatal_mask);
+ULogLevelFlags u_log_set_fatal_mask   (const char *log_domain, ULogLevelFlags fatal_mask);
+void           u_logv                 (const char *log_domain, ULogLevelFlags log_level, const char *format, 
va_list args);
+void           u_log                  (const char *log_domain, ULogLevelFlags log_level, const char *format, 
...);
+void           u_assertion_message    (const char *format, ...) U_GNUC_NORETURN;
+
+#ifdef HAVE_C99_SUPPORT
+/* The for (;;) tells gc thats u_error () doesn't return, avoiding warnings */
+#define u_error(format, ...)    do { u_log (U_LOG_DOMAIN, U_LOG_LEVEL_ERROR, format, __VA_ARGS__); for (;;); 
} while (0)
+#define u_critical(format, ...) u_log (U_LOG_DOMAIN, U_LOG_LEVEL_CRITICAL, format, __VA_ARGS__)
+#define u_warning(format, ...)  u_log (U_LOG_DOMAIN, U_LOG_LEVEL_WARNING, format, __VA_ARGS__)
+#define u_message(format, ...)  u_log (U_LOG_DOMAIN, U_LOG_LEVEL_MESSAGE, format, __VA_ARGS__)
+#define u_debug(format, ...)    u_log (U_LOG_DOMAIN, U_LOG_LEVEL_DEBUG, format, __VA_ARGS__)
+#else   /* HAVE_C99_SUPPORT */
+#define u_error(...)    do { u_log (U_LOG_DOMAIN, U_LOG_LEVEL_ERROR, __VA_ARGS__); for (;;); } while (0)
+#define u_critical(...) u_log (U_LOG_DOMAIN, U_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define u_warning(...)  u_log (U_LOG_DOMAIN, U_LOG_LEVEL_WARNING, __VA_ARGS__)
+#define u_message(...)  u_log (U_LOG_DOMAIN, U_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#define u_debug(...)    u_log (U_LOG_DOMAIN, U_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#endif  /* ndef HAVE_C99_SUPPORT */
+#define u_log_set_handler(a,b,c,d)
+
+#define U_GNUC_INTERNAL
+
+/*
+ * Conversions
+ */
+
+UQuark u_convert_error_quark(void);
+
+
+/*
+ * Unicode Manipulation: most of this is not used by Mono by default, it is
+ * only used if the old collation code is activated, so this is only the
+ * bare minimum to build.
+ */
+
+typedef enum {
+       U_UNICODE_CONTROL,
+       U_UNICODE_FORMAT,
+       U_UNICODE_UNASSIGNED,
+       U_UNICODE_PRIVATE_USE,
+       U_UNICODE_SURROGATE,
+       U_UNICODE_LOWERCASE_LETTER,
+       U_UNICODE_MODIFIER_LETTER,
+       U_UNICODE_OTHER_LETTER,
+       U_UNICODE_TITLECASE_LETTER,
+       U_UNICODE_UPPERCASE_LETTER,
+       U_UNICODE_COMBININU_MARK,
+       U_UNICODE_ENCLOSINU_MARK,
+       U_UNICODE_NON_SPACINU_MARK,
+       U_UNICODE_DECIMAL_NUMBER,
+       U_UNICODE_LETTER_NUMBER,
+       U_UNICODE_OTHER_NUMBER,
+       U_UNICODE_CONNECT_PUNCTUATION,
+       U_UNICODE_DASH_PUNCTUATION,
+       U_UNICODE_CLOSE_PUNCTUATION,
+       U_UNICODE_FINAL_PUNCTUATION,
+       U_UNICODE_INITIAL_PUNCTUATION,
+       U_UNICODE_OTHER_PUNCTUATION,
+       U_UNICODE_OPEN_PUNCTUATION,
+       U_UNICODE_CURRENCY_SYMBOL,
+       U_UNICODE_MODIFIER_SYMBOL,
+       U_UNICODE_MATH_SYMBOL,
+       U_UNICODE_OTHER_SYMBOL,
+       U_UNICODE_LINE_SEPARATOR,
+       U_UNICODE_PARAGRAPH_SEPARATOR,
+       U_UNICODE_SPACE_SEPARATOR
+} UUnicodeType;
+
+typedef enum {
+       U_UNICODE_BREAK_MANDATORY,
+       U_UNICODE_BREAK_CARRIAGE_RETURN,
+       U_UNICODE_BREAK_LINE_FEED,
+       U_UNICODE_BREAK_COMBININU_MARK,
+       U_UNICODE_BREAK_SURROGATE,
+       U_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+       U_UNICODE_BREAK_INSEPARABLE,
+       U_UNICODE_BREAK_NON_BREAKING_GLUE,
+       U_UNICODE_BREAK_CONTINGENT,
+       U_UNICODE_BREAK_SPACE,
+       U_UNICODE_BREAK_AFTER,
+       U_UNICODE_BREAK_BEFORE,
+       U_UNICODE_BREAK_BEFORE_AND_AFTER,
+       U_UNICODE_BREAK_HYPHEN,
+       U_UNICODE_BREAK_NON_STARTER,
+       U_UNICODE_BREAK_OPEN_PUNCTUATION,
+       U_UNICODE_BREAK_CLOSE_PUNCTUATION,
+       U_UNICODE_BREAK_QUOTATION,
+       U_UNICODE_BREAK_EXCLAMATION,
+       U_UNICODE_BREAK_IDEOGRAPHIC,
+       U_UNICODE_BREAK_NUMERIC,
+       U_UNICODE_BREAK_INFIX_SEPARATOR,
+       U_UNICODE_BREAK_SYMBOL,
+       U_UNICODE_BREAK_ALPHABETIC,
+       U_UNICODE_BREAK_PREFIX,
+       U_UNICODE_BREAK_POSTFIX,
+       U_UNICODE_BREAK_COMPLEX_CONTEXT,
+       U_UNICODE_BREAK_AMBIGUOUS,
+       U_UNICODE_BREAK_UNKNOWN,
+       U_UNICODE_BREAK_NEXT_LINE,
+       U_UNICODE_BREAK_WORD_JOINER,
+       U_UNICODE_BREAK_HANGUL_L_JAMO,
+       U_UNICODE_BREAK_HANGUL_V_JAMO,
+       U_UNICODE_BREAK_HANGUL_T_JAMO,
+       U_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+       U_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
+} UUnicodeBreakType;
+
+uunichar       u_unichar_toupper (uunichar c);
+uunichar       u_unichar_tolower (uunichar c);
+uunichar       u_unichar_totitle (uunichar c);
+UUnicodeType   u_unichar_type    (uunichar c);
+uboolean       u_unichar_isspace (uunichar c);
+uboolean       u_unichar_isxdigit (uunichar c);
+int           u_unichar_xdigit_value (uunichar c);
+UUnicodeBreakType   u_unichar_break_type (uunichar c);
+
+#define  u_assert(x)     U_STMT_START { if (U_UNLIKELY (!(x))) u_assertion_message ("* Assertion at %s:%d, 
condition `%s' not met\n", __FILE__, __LINE__, #x);  } U_STMT_END
+#define  u_assert_not_reached() U_STMT_START { u_assertion_message ("* Assertion: should not be reached at 
%s:%d\n", __FILE__, __LINE__); } U_STMT_END
+
+#define u_assert_cmpstr(s1, cmp, s2) \
+  U_STMT_START { \
+    const char *_s1 = s1; \
+    const char *_s2 = s2; \
+    if (!(strcmp (_s1, _s2) cmp 0)) \
+      u_assertion_message ("* Assertion at %s:%d, condition \"%s\" " #cmp " \"%s\" failed\n", __FILE__, 
__LINE__, _s1, _s2); \
+  } U_STMT_END
+#define u_assert_cmpint(n1, cmp, n2) \
+  U_STMT_START { \
+    int _n1 = n1; \
+    int _n2 = n2; \
+    if (!(_n1 cmp _n2)) \
+      u_assertion_message ("* Assertion at %s:%d, condition %d " #cmp " %d failed\n", __FILE__, __LINE__, 
_n1, _n2); \
+  } U_STMT_END
+#define u_assert_cmpuint(n1, cmp, n2) \
+  U_STMT_START { \
+    int _n1 = n1; \
+    int _n2 = n2; \
+    if (!(_n1 cmp _n2)) \
+      u_assertion_message ("* Assertion at %s:%d, condition %u " #cmp " %u failed\n", __FILE__, __LINE__, 
_n1, _n2); \
+  } U_STMT_END
+#define u_assert_cmpfloat(n1, cmp, n2) \
+  U_STMT_START { \
+    float _n1 = n1; \
+    float _n2 = n2; \
+    if (!(_n1 cmp _n2)) \
+      u_assertion_message ("* Assertion at %s:%d, condition %f " #cmp " %f failed\n", __FILE__, __LINE__, 
_n1, _n2); \
+  } U_STMT_END
+
+/*
+ * Unicode conversion
+ */
+
+#define U_CONVERT_ERROR u_convert_error_quark()
+
+typedef enum {
+       U_CONVERT_ERROR_NO_CONVERSION,
+       U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+       U_CONVERT_ERROR_FAILED,
+       U_CONVERT_ERROR_PARTIAL_INPUT,
+       U_CONVERT_ERROR_BAD_URI,
+       U_CONVERT_ERROR_NOT_ABSOLUTE_PATH
+} UConvertError;
+
+char     *u_utf8_strup (const char *str, ussize len);
+char     *u_utf8_strdown (const char *str, ussize len);
+int       u_unichar_to_utf8 (uunichar c, char *outbuf);
+uunichar  *u_utf8_to_ucs4_fast (const char *str, long len, long *items_written);
+uunichar  *u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written, UError **err);
+uunichar2 *u_utf8_to_utf16 (const char *str, long len, long *items_read, long *items_written, UError **err);
+uunichar2 *eg_utf8_to_utf16_with_nuls (const char *str, long len, long *items_read, long *items_written, 
UError **err);
+char     *u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_written, UError 
**err);
+uunichar  *u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_written, UError 
**err);
+char     *u_ucs4_to_utf8  (const uunichar *str, long len, long *items_read, long *items_written, UError 
**err);
+uunichar2 *u_ucs4_to_utf16 (const uunichar *str, long len, long *items_read, long *items_written, UError 
**err);
+
+#define u8to16(str) u_utf8_to_utf16(str, (long)strlen(str), NULL, NULL, NULL)
+
+#ifdef U_OS_WIN32
+#define u16to8(str) u_utf16_to_utf8((uunichar2 *) (str), (long)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
+#else
+#define u16to8(str) u_utf16_to_utf8(str, (long)strlen(str), NULL, NULL, NULL)
+#endif
+
+/*
+ * Path
+ */
+char  *u_build_path           (const char *separator, const char *first_element, ...);
+#define u_build_filename(x, ...) u_build_path(U_DIR_SEPARATOR_S, x, __VA_ARGS__)
+char  *u_path_get_dirname     (const char *filename);
+char  *u_path_get_basename    (const char *filename);
+char  *u_find_program_in_path (const char *program);
+char  *u_get_current_dir      (void);
+uboolean u_path_is_absolute    (const char *filename);
+
+const char *u_get_home_dir    (void);
+const char *u_get_tmp_dir     (void);
+const char *u_get_user_name   (void);
+char *u_get_prgname           (void);
+void  u_set_prgname            (const char *prgname);
+
+/*
+ * Shell
+ */
+
+UQuark u_shell_error_get_quark (void);
+
+#define U_SHELL_ERROR u_shell_error_get_quark ()
+
+typedef enum {
+       U_SHELL_ERROR_BAD_QUOTING,
+       U_SHELL_ERROR_EMPTY_STRING,
+       U_SHELL_ERROR_FAILED
+} UShellError;
+
+
+uboolean  u_shell_parse_argv      (const char *command_line, int *argcp, char ***argvp, UError **error);
+char    *u_shell_unquote         (const char *quoted_string, UError **error);
+char    *u_shell_quote           (const char *unquoted_string);
+
+/*
+ * Spawn
+ */
+UQuark u_shell_error_get_quark (void);
+
+#define U_SPAWN_ERROR u_shell_error_get_quark ()
+
+typedef enum {
+       U_SPAWN_ERROR_FORK,
+       U_SPAWN_ERROR_READ,
+       U_SPAWN_ERROR_CHDIR,
+       U_SPAWN_ERROR_ACCES,
+       U_SPAWN_ERROR_PERM,
+       U_SPAWN_ERROR_TOO_BIG,
+       U_SPAWN_ERROR_NOEXEC,
+       U_SPAWN_ERROR_NAMETOOLONG,
+       U_SPAWN_ERROR_NOENT,
+       U_SPAWN_ERROR_NOMEM,
+       U_SPAWN_ERROR_NOTDIR,
+       U_SPAWN_ERROR_LOOP,
+       U_SPAWN_ERROR_TXTBUSY,
+       U_SPAWN_ERROR_IO,
+       U_SPAWN_ERROR_NFILE,
+       U_SPAWN_ERROR_MFILE,
+       U_SPAWN_ERROR_INVAL,
+       U_SPAWN_ERROR_ISDIR,
+       U_SPAWN_ERROR_LIBBAD,
+       U_SPAWN_ERROR_FAILED
+} USpawnError;
+
+typedef enum {
+       U_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
+       U_SPAWN_DO_NOT_REAP_CHILD      = 1 << 1,
+       U_SPAWN_SEARCH_PATH            = 1 << 2,
+       U_SPAWN_STDOUT_TO_DEV_NULL     = 1 << 3,
+       U_SPAWN_STDERR_TO_DEV_NULL     = 1 << 4,
+       U_SPAWN_CHILD_INHERITS_STDIN   = 1 << 5,
+       U_SPAWN_FILE_AND_ARGV_ZERO     = 1 << 6
+} USpawnFlags;
+
+typedef void (*USpawnChildSetupFunc) (void * user_data);
+
+uboolean u_spawn_command_line_sync (const char *command_line, char **standard_output, char **standard_error, 
int *exit_status, UError **error);
+uboolean u_spawn_async_with_pipes  (const char *working_directory, char **argv, char **envp, USpawnFlags 
flags, USpawnChildSetupFunc child_setup,
+                               void * user_data, UPid *child_pid, int *standard_input, int *standard_output, 
int *standard_error, UError **error);
+
+
+/*
+ * Timer
+ */
+typedef struct _UTimer UTimer;
+
+UTimer *u_timer_new (void);
+void u_timer_destroy (UTimer *timer);
+double u_timer_elapsed (UTimer *timer, unsigned long *microseconds);
+void u_timer_stop (UTimer *timer);
+void u_timer_start (UTimer *timer);
+
+/*
+ * Date and time
+ */
+typedef struct {
+       long tv_sec;
+       long tv_usec;
+} UTimeVal;
+
+void u_get_current_time (UTimeVal *result);
+void u_usleep (unsigned long microseconds);
+
+/*
+ * File
+ */
+
+UQuark u_file_error_quark (void);
+
+#define U_FILE_ERROR u_file_error_quark ()
+
+typedef enum {
+       U_FILE_ERROR_EXIST,
+       U_FILE_ERROR_ISDIR,
+       U_FILE_ERROR_ACCES,
+       U_FILE_ERROR_NAMETOOLONG,
+       U_FILE_ERROR_NOENT,
+       U_FILE_ERROR_NOTDIR,
+       U_FILE_ERROR_NXIO,
+       U_FILE_ERROR_NODEV,
+       U_FILE_ERROR_ROFS,
+       U_FILE_ERROR_TXTBSY,
+       U_FILE_ERROR_FAULT,
+       U_FILE_ERROR_LOOP,
+       U_FILE_ERROR_NOSPC,
+       U_FILE_ERROR_NOMEM,
+       U_FILE_ERROR_MFILE,
+       U_FILE_ERROR_NFILE,
+       U_FILE_ERROR_BADF,
+       U_FILE_ERROR_INVAL,
+       U_FILE_ERROR_PIPE,
+       U_FILE_ERROR_AGAIN,
+       U_FILE_ERROR_INTR,
+       U_FILE_ERROR_IO,
+       U_FILE_ERROR_PERM,
+       U_FILE_ERROR_NOSYS,
+       U_FILE_ERROR_FAILED
+} UFileError;
+
+typedef enum {
+       U_FILE_TEST_IS_REGULAR = 1 << 0,
+       U_FILE_TEST_IS_SYMLINK = 1 << 1,
+       U_FILE_TEST_IS_DIR = 1 << 2,
+       U_FILE_TEST_IS_EXECUTABLE = 1 << 3,
+       U_FILE_TEST_EXISTS = 1 << 4
+} UFileTest;
+
+
+uboolean   u_file_set_contents (const char *filename, const char *contents, ussize length, UError **error);
+uboolean   u_file_get_contents (const char *filename, char **contents, size_t *length, UError **error);
+UFileError u_file_error_from_errno (int err_no);
+int       u_file_open_tmp (const char *tmpl, char **name_used, UError **error);
+uboolean   u_file_test (const char *filename, UFileTest test);
+
+#define u_open open
+#define u_rename rename
+#define u_stat stat
+#define u_unlink unlink
+#define u_fopen fopen
+#define u_lstat lstat
+#define u_rmdir rmdir
+#define u_mkstemp mkstemp
+#define u_ascii_isdigit isdigit
+#define u_ascii_strtod strtod
+#define u_ascii_isalnum isalnum
+
+/*
+ * Pattern matching
+ */
+typedef struct _UPatternSpec UPatternSpec;
+UPatternSpec * u_pattern_spec_new (const char *pattern);
+void           u_pattern_spec_free (UPatternSpec *pspec);
+uboolean       u_pattern_match_string (UPatternSpec *pspec, const char *string);
+
+/*
+ * Directory
+ */
+typedef struct _UDir UDir;
+UDir        *u_dir_open (const char *path, unsigned int flags, UError **error);
+const char *u_dir_read_name (UDir *dir);
+void         u_dir_rewind (UDir *dir);
+void         u_dir_close (UDir *dir);
+
+int          u_mkdir_with_parents (const char *pathname, int mode);
+#define u_mkdir mkdir
+
+/*
+ * UMarkup
+ */
+
+UQuark u_markup_error_quark (void);
+
+#define U_MARKUP_ERROR u_markup_error_quark()
+
+typedef enum {
+       U_MARKUP_ERROR_BAD_UTF8,
+       U_MARKUP_ERROR_EMPTY,
+       U_MARKUP_ERROR_PARSE,
+       U_MARKUP_ERROR_UNKNOWN_ELEMENT,
+       U_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
+       U_MARKUP_ERROR_INVALID_CONTENT,
+       U_MARKUP_ERROR_MISSINU_ATTRIBUTE
+} UMarkupError;
+
+typedef struct _UMarkupParseContext UMarkupParseContext;
+
+typedef enum
+{
+       U_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
+       U_MARKUP_TREAT_CDATA_AS_TEXT              = 1 << 1
+} UMarkupParseFlags;
+
+typedef struct {
+       void (*start_element)  (UMarkupParseContext *context,
+                               const char *element_name,
+                               const char **attribute_names,
+                               const char **attribute_values,
+                               void * user_data,
+                               UError **error);
+
+       void (*end_element)    (UMarkupParseContext *context,
+                               const char         *element_name,
+                               void *             user_data,
+                               UError             **error);
+
+       void (*text)           (UMarkupParseContext *context,
+                               const char         *text,
+                               size_t                text_len,
+                               void *             user_data,
+                               UError             **error);
+
+       void (*passthrough)    (UMarkupParseContext *context,
+                               const char         *passthrough_text,
+                               size_t                text_len,
+                               void *             user_data,
+                               UError             **error);
+       void (*error)          (UMarkupParseContext *context,
+                               UError              *error,
+                               void *             user_data);
+} UMarkupParser;
+
+UMarkupParseContext *u_markup_parse_context_new   (const UMarkupParser *parser,
+                                                  UMarkupParseFlags flags,
+                                                  void * user_data,
+                                                  UDestroyNotify user_data_dnotify);
+void                 u_markup_parse_context_free  (UMarkupParseContext *context);
+uboolean             u_markup_parse_context_parse (UMarkupParseContext *context,
+                                                  const char *text, ussize text_len,
+                                                  UError **error);
+uboolean         u_markup_parse_context_end_parse (UMarkupParseContext *context,
+                                                  UError **error);
+
+/*
+ * Character set conversion
+ */
+typedef struct _UIConv *UIConv;
+
+size_t u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft, char **outbytes, size_t *outbytesleft);
+UIConv u_iconv_open (const char *to_charset, const char *from_charset);
+int u_iconv_close (UIConv cd);
+
+uboolean  u_get_charset        (U_CONST_RETURN char **charset);
+char    *u_locale_to_utf8     (const char *opsysstring, ussize len,
+                               size_t *bytes_read, size_t *bytes_written,
+                               UError **error);
+char    *u_locale_from_utf8   (const char *utf8string, ussize len, size_t *bytes_read,
+                               size_t *bytes_written, UError **error);
+char    *u_filename_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read,
+                               size_t *bytes_written, UError **error);
+char    *u_convert            (const char *str, ussize len,
+                               const char *to_codeset, const char *from_codeset,
+                               size_t *bytes_read, size_t *bytes_written, UError **error);
+
+/*
+ * Unicode manipulation
+ */
+extern const unsigned char u_utf8_jump_table[256];
+
+uboolean  u_utf8_validate      (const char *str, ussize max_len, const char **end);
+uunichar  u_utf8_get_char_validated (const char *str, ussize max_len);
+char    *u_utf8_find_prev_char (const char *str, const char *p);
+char    *u_utf8_prev_char     (const char *str);
+#define   u_utf8_next_char(p)  ((p) + u_utf8_jump_table[(unsigned char)(*p)])
+uunichar  u_utf8_get_char      (const char *src);
+long     u_utf8_strlen        (const char *str, ussize max);
+char    *u_utf8_offset_to_pointer (const char *str, long offset);
+long     u_utf8_pointer_to_offset (const char *str, const char *pos);
+
+/*
+ * priorities
+ */
+#define U_PRIORITY_DEFAULT 0
+#define U_PRIORITY_DEFAULT_IDLE 200
+
+/*
+ * Empty thread functions, not used by eglib
+ */
+#define u_thread_supported()   TRUE
+#define u_thread_init(x)       U_STMT_START { if (x != NULL) { u_error ("No vtable supported in 
u_thread_init"); } } U_STMT_END
+
+#define U_LOCK_DEFINE(name)        int name;
+#define U_LOCK_DEFINE_STATIC(name) static int name;
+#define U_LOCK_EXTERN(name)
+#define U_LOCK(name)
+#define U_TRYLOCK(name)
+#define U_UNLOCK(name)
+
+#define UUINT16_SWAP_LE_BE_CONSTANT(x) ((((uint16_t) x) >> 8) | ((((uint16_t) x) << 8)))
+
+#define UUINT16_SWAP_LE_BE(x) ((uint16_t) (((uint16_t) x) >> 8) | ((((uint16_t)(x)) & 0xff) << 8))
+#define UUINT32_SWAP_LE_BE(x) ((uint32_t) \
+                              ( (((uint32_t) (x)) << 24)| \
+                                ((((uint32_t) (x)) & 0xff0000) >> 8) | \
+                                ((((uint32_t) (x)) & 0xff00) << 8) | \
+                                (((uint32_t) (x)) >> 24)) )
+
+#define UUINT64_SWAP_LE_BE(x) ((uint64_t) (((uint64_t)(UUINT32_SWAP_LE_BE(((uint64_t)x) & 0xffffffff))) << 
32) | \
+                              UUINT32_SWAP_LE_BE(((uint64_t)x) >> 32))
+
+
+
+#if U_BYTE_ORDER == U_LITTLE_ENDIAN
+#   define UUINT64_FROM_BE(x) UUINT64_SWAP_LE_BE(x)
+#   define UUINT32_FROM_BE(x) UUINT32_SWAP_LE_BE(x)
+#   define UUINT16_FROM_BE(x) UUINT16_SWAP_LE_BE(x)
+#   define UUINT_FROM_BE(x)   UUINT32_SWAP_LE_BE(x)
+#   define UUINT64_FROM_LE(x) (x)
+#   define UUINT32_FROM_LE(x) (x)
+#   define UUINT16_FROM_LE(x) (x)
+#   define UUINT_FROM_LE(x)   (x)
+#   define UUINT64_TO_BE(x)   UUINT64_SWAP_LE_BE(x)
+#   define UUINT32_TO_BE(x)   UUINT32_SWAP_LE_BE(x)
+#   define UUINT16_TO_BE(x)   UUINT16_SWAP_LE_BE(x)
+#   define UUINT_TO_BE(x)     UUINT32_SWAP_LE_BE(x)
+#   define UUINT64_TO_LE(x)   (x)
+#   define UUINT32_TO_LE(x)   (x)
+#   define UUINT16_TO_LE(x)   (x)
+#   define UUINT_TO_LE(x)     (x)
+#else
+#   define UUINT64_FROM_BE(x) (x)
+#   define UUINT32_FROM_BE(x) (x)
+#   define UUINT16_FROM_BE(x) (x)
+#   define UUINT_FROM_BE(x)   (x)
+#   define UUINT64_FROM_LE(x) UUINT64_SWAP_LE_BE(x)
+#   define UUINT32_FROM_LE(x) UUINT32_SWAP_LE_BE(x)
+#   define UUINT16_FROM_LE(x) UUINT16_SWAP_LE_BE(x)
+#   define UUINT_FROM_LE(x)   UUINT32_SWAP_LE_BE(x)
+#   define UUINT64_TO_BE(x)   (x)
+#   define UUINT32_TO_BE(x)   (x)
+#   define UUINT16_TO_BE(x)   (x)
+#   define UUINT_TO_BE(x)     (x)
+#   define UUINT64_TO_LE(x)   UUINT64_SWAP_LE_BE(x)
+#   define UUINT32_TO_LE(x)   UUINT32_SWAP_LE_BE(x)
+#   define UUINT16_TO_LE(x)   UUINT16_SWAP_LE_BE(x)
+#   define UUINT_TO_LE(x)     UUINT32_SWAP_LE_BE(x)
+#endif
+
+#define UINT64_FROM_BE(x)   (UUINT64_TO_BE (x))
+#define UINT32_FROM_BE(x)   (UUINT32_TO_BE (x))
+#define UINT16_FROM_BE(x)   (UUINT16_TO_BE (x))
+#define UINT64_FROM_LE(x)   (UUINT64_TO_LE (x))
+#define UINT32_FROM_LE(x)   (UUINT32_TO_LE (x))
+#define UINT16_FROM_LE(x)   (UUINT16_TO_LE (x))
+
+#define _ULIB_MAJOR  2
+#define _ULIB_MIDDLE 4
+#define _ULIB_MINOR  0
+
+#define ULIB_CHECK_VERSION(a,b,c) ((a < _ULIB_MAJOR) || (a == _ULIB_MAJOR && (b < _ULIB_MIDDLE || (b == 
_ULIB_MIDDLE && c <= _ULIB_MINOR))))
+
+U_END_DECLS
+
+#endif
+
+
+
diff --git a/deps/eglib/src/glist.c b/deps/ulib/src/ulist.c
similarity index 63%
rename from deps/eglib/src/glist.c
rename to deps/ulib/src/ulist.c
index 0bf2113..b470595 100644
--- a/deps/eglib/src/glist.c
+++ b/deps/ulib/src/ulist.c
@@ -30,18 +30,18 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
-GList*
-g_list_alloc ()
+UList*
+u_list_alloc ()
 {
-       return g_new0 (GList, 1);
+       return u_new0 (UList, 1);
 }
 
-static inline GList*
-new_node (GList *prev, gpointer data, GList *next)
+static inline UList*
+new_node (UList *prev, void * data, UList *next)
 {
-       GList *node = g_list_alloc ();
+       UList *node = u_list_alloc ();
        node->data = data;
        node->prev = prev;
        node->next = next;
@@ -52,8 +52,8 @@ new_node (GList *prev, gpointer data, GList *next)
        return node;
 }
 
-static inline GList*
-disconnect_node (GList *node)
+static inline UList*
+disconnect_node (UList *node)
 {
        if (node->next)
                node->next->prev = node->prev;
@@ -62,60 +62,60 @@ disconnect_node (GList *node)
        return node;
 }
 
-GList *
-g_list_prepend (GList *list, gpointer data)
+UList *
+u_list_prepend (UList *list, void * data)
 {
        return new_node (list ? list->prev : NULL, data, list);
 }
 
 void
-g_list_free_1 (GList *list)
+u_list_free_1 (UList *list)
 {
-       g_free (list);
+       u_free (list);
 }
 
 void
-g_list_free (GList *list)
+u_list_free (UList *list)
 {
        while (list){
-               GList *next = list->next;
-               g_list_free_1 (list);
+               UList *next = list->next;
+               u_list_free_1 (list);
                list = next;
        }
 }
 
 void
-g_list_free_full (GList *list, GDestroyNotify free_func)
+u_list_free_full (UList *list, UDestroyNotify free_func)
 {
        while (list){
-               GList *next = list->next;
+               UList *next = list->next;
                 free_func (list->data);
-               g_list_free_1 (list);
+               u_list_free_1 (list);
                list = next;
        }
 }
 
-GList*
-g_list_append (GList *list, gpointer data)
+UList*
+u_list_append (UList *list, void * data)
 {
-       GList *node = new_node (g_list_last (list), data, NULL);
+       UList *node = new_node (u_list_last (list), data, NULL);
        return list ? list : node;
 }
 
-GList *
-g_list_concat (GList *list1, GList *list2)
+UList *
+u_list_concat (UList *list1, UList *list2)
 {
        if (list1 && list2) {
-               list2->prev = g_list_last (list1);
+               list2->prev = u_list_last (list1);
                list2->prev->next = list2;
        }
        return list1 ? list1 : list2;
 }
 
-guint
-g_list_length (GList *list)
+unsigned int
+u_list_length (UList *list)
 {
-       guint length = 0;
+       unsigned int length = 0;
 
        while (list) {
                length ++;
@@ -125,24 +125,24 @@ g_list_length (GList *list)
        return length;
 }
 
-GList*
-g_list_remove (GList *list, gconstpointer data)
+UList*
+u_list_remove (UList *list, const void * data)
 {
-       GList *current = g_list_find (list, data);
+       UList *current = u_list_find (list, data);
        if (!current)
                return list;
 
        if (current == list)
                list = list->next;
-       g_list_free_1 (disconnect_node (current));
+       u_list_free_1 (disconnect_node (current));
 
        return list;
 }
 
-GList*
-g_list_remove_all (GList *list, gconstpointer data)
+UList*
+u_list_remove_all (UList *list, const void * data)
 {
-       GList *current = g_list_find (list, data);
+       UList *current = u_list_find (list, data);
 
        if (!current)
                return list;
@@ -150,16 +150,16 @@ g_list_remove_all (GList *list, gconstpointer data)
        while (current) {
                if (current == list)
                        list = list->next;
-               g_list_free_1 (disconnect_node (current));
+               u_list_free_1 (disconnect_node (current));
 
-               current = g_list_find (list, data);
+               current = u_list_find (list, data);
        }
 
        return list;
 }
 
-GList*
-g_list_remove_link (GList *list, GList *link)
+UList*
+u_list_remove_link (UList *list, UList *link)
 {
        if (list == link)
                list = list->next;
@@ -171,17 +171,17 @@ g_list_remove_link (GList *list, GList *link)
        return list;
 }
 
-GList*
-g_list_delete_link (GList *list, GList *link)
+UList*
+u_list_delete_link (UList *list, UList *link)
 {
-       list = g_list_remove_link (list, link);
-       g_list_free_1 (link);
+       list = u_list_remove_link (list, link);
+       u_list_free_1 (link);
 
        return list;
 }
 
-GList*
-g_list_find (GList *list, gconstpointer data)
+UList*
+u_list_find (UList *list, const void * data)
 {
        while (list){
                if (list->data == data)
@@ -193,8 +193,8 @@ g_list_find (GList *list, gconstpointer data)
        return NULL;
 }
 
-GList*
-g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func)
+UList*
+u_list_find_custom (UList *list, const void * data, UCompareFunc func)
 {
        if (!func)
                return NULL;
@@ -209,10 +209,10 @@ g_list_find_custom (GList *list, gconstpointer data, GCompareFunc func)
        return NULL;
 }
 
-GList*
-g_list_reverse (GList *list)
+UList*
+u_list_reverse (UList *list)
 {
-       GList *reverse = NULL;
+       UList *reverse = NULL;
 
        while (list) {
                reverse = list;
@@ -225,8 +225,8 @@ g_list_reverse (GList *list)
        return reverse;
 }
 
-GList*
-g_list_first (GList *list)
+UList*
+u_list_first (UList *list)
 {
        if (!list)
                return NULL;
@@ -237,8 +237,8 @@ g_list_first (GList *list)
        return list;
 }
 
-GList*
-g_list_last (GList *list)
+UList*
+u_list_last (UList *list)
 {
        if (!list)
                return NULL;
@@ -249,12 +249,12 @@ g_list_last (GList *list)
        return list;
 }
 
-GList*
-g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
+UList*
+u_list_insert_sorted (UList *list, void * data, UCompareFunc func)
 {
-       GList *prev = NULL;
-       GList *current;
-       GList *node;
+       UList *prev = NULL;
+       UList *current;
+       UList *node;
 
        if (!func)
                return list;
@@ -270,18 +270,18 @@ g_list_insert_sorted (GList *list, gpointer data, GCompareFunc func)
        return list == current ? node : list;
 }
 
-GList*
-g_list_insert_before (GList *list, GList *sibling, gpointer data)
+UList*
+u_list_insert_before (UList *list, UList *sibling, void * data)
 {
        if (sibling) {
-               GList *node = new_node (sibling->prev, data, sibling);
+               UList *node = new_node (sibling->prev, data, sibling);
                return list == sibling ? node : list;
        }
-       return g_list_append (list, data);
+       return u_list_append (list, data);
 }
 
 void
-g_list_foreach (GList *list, GFunc func, gpointer user_data)
+u_list_foreach (UList *list, UFunc func, void * user_data)
 {
        while (list){
                (*func) (list->data, user_data);
@@ -289,10 +289,10 @@ g_list_foreach (GList *list, GFunc func, gpointer user_data)
        }
 }
 
-gint
-g_list_index (GList *list, gconstpointer data)
+int
+u_list_index (UList *list, const void * data)
 {
-       gint index = 0;
+       int index = 0;
 
        while (list){
                if (list->data == data)
@@ -305,8 +305,8 @@ g_list_index (GList *list, gconstpointer data)
        return -1;
 }
 
-GList*
-g_list_nth (GList *list, guint n)
+UList*
+u_list_nth (UList *list, unsigned int n)
 {
        for (; list; list = list->next) {
                if (n == 0)
@@ -316,20 +316,20 @@ g_list_nth (GList *list, guint n)
        return list;
 }
 
-gpointer
-g_list_nth_data (GList *list, guint n)
+void *
+u_list_nth_data (UList *list, unsigned int n)
 {
-       GList *node = g_list_nth (list, n);
+       UList *node = u_list_nth (list, n);
        return node ? node->data : NULL;
 }
 
-GList*
-g_list_copy (GList *list)
+UList*
+u_list_copy (UList *list)
 {
-       GList *copy = NULL;
+       UList *copy = NULL;
 
        if (list) {
-               GList *tmp = new_node (NULL, list->data, NULL);
+               UList *tmp = new_node (NULL, list->data, NULL);
                copy = tmp;
 
                for (list = list->next; list; list = list->next)
@@ -339,13 +339,13 @@ g_list_copy (GList *list)
        return copy;
 }
 
-typedef GList list_node;
+typedef UList list_node;
 #include "sort.frag.h"
 
-GList*
-g_list_sort (GList *list, GCompareFunc func)
+UList*
+u_list_sort (UList *list, UCompareFunc func)
 {
-       GList *current;
+       UList *current;
        if (!list || !list->next)
                return list;
        list = do_sort (list, func);
diff --git a/deps/eglib/src/gmem.c b/deps/ulib/src/umem.c
similarity index 76%
rename from deps/eglib/src/gmem.c
rename to deps/ulib/src/umem.c
index a59a438..763d059 100644
--- a/deps/eglib/src/gmem.c
+++ b/deps/ulib/src/umem.c
@@ -30,67 +30,67 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 
 void
-g_free (void *ptr)
+u_free (void *ptr)
 {
        if (ptr != NULL)
                free (ptr);
 }
 
-gpointer
-g_memdup (gconstpointer mem, guint byte_size)
+void *
+u_memdup (const void * mem, unsigned int byte_size)
 {
-       gpointer ptr;
+       void * ptr;
 
        if (mem == NULL)
                return NULL;
 
-       ptr = g_malloc (byte_size);
+       ptr = u_malloc (byte_size);
        if (ptr != NULL)
                memcpy (ptr, mem, byte_size);
 
        return ptr;
 }
 
-gpointer g_realloc (gpointer obj, gsize size)
+void * u_realloc (void * obj, size_t size)
 {
-       gpointer ptr;
+       void * ptr;
        if (!size) {
-               g_free (obj);
+               u_free (obj);
                return 0;
        }
        ptr = realloc (obj, size);
        if (ptr)
                return ptr;
-       g_error ("Could not allocate %i bytes", size);
+       u_error ("Could not allocate %i bytes", size);
 }
 
-gpointer 
-g_malloc (gsize x) 
+void * 
+u_malloc (size_t x) 
 { 
-       gpointer ptr;
+       void * ptr;
        if (!x)
                return 0;
        ptr = malloc (x);
        if (ptr) 
                return ptr;
-       g_error ("Could not allocate %i bytes", x);
+       u_error ("Could not allocate %i bytes", x);
 }
 
-gpointer g_malloc0 (gsize x) 
+void * u_malloc0 (size_t x) 
 { 
-       gpointer ptr; 
+       void * ptr; 
        if (!x) 
                return 0; 
        ptr = calloc(1,x); 
        if (ptr) 
                return ptr; 
-       g_error ("Could not allocate %i bytes", x);
+       u_error ("Could not allocate %i bytes", x);
 }
 
-gpointer g_try_malloc (gsize x) 
+void * u_try_malloc (size_t x) 
 {
        if (x)
                return malloc (x);
@@ -98,10 +98,10 @@ gpointer g_try_malloc (gsize x)
 }
 
 
-gpointer g_try_realloc (gpointer obj, gsize size)
+void * u_try_realloc (void * obj, size_t size)
 { 
        if (!size) {
-               g_free (obj);
+               u_free (obj);
                return 0;
        } 
        return realloc (obj, size);
diff --git a/deps/eglib/src/gmisc-unix.c b/deps/ulib/src/umisc-unix.c
similarity index 75%
rename from deps/eglib/src/gmisc-unix.c
rename to deps/ulib/src/umisc-unix.c
index 860b930..e8a3422 100644
--- a/deps/eglib/src/gmisc-unix.c
+++ b/deps/ulib/src/umisc-unix.c
@@ -28,7 +28,7 @@
 
 #include <config.h>
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 #include <pthread.h>
 
 #ifdef HAVE_PWD_H
@@ -40,46 +40,46 @@
 #endif
 
 
-const gchar *
-g_getenv(const gchar *variable)
+const char *
+u_getenv(const char *variable)
 {
        return getenv(variable);
 }
 
-gboolean
-g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+uboolean
+u_setenv(const char *variable, const char *value, uboolean overwrite)
 {
        return setenv(variable, value, overwrite) == 0;
 }
 
 void
-g_unsetenv(const gchar *variable)
+u_unsetenv(const char *variable)
 {
        unsetenv(variable);
 }
 
-gchar*
-g_win32_getlocale(void)
+char*
+u_win32_getlocale(void)
 {
        return NULL;
 }
 
-gboolean
-g_path_is_absolute (const char *filename)
+uboolean
+u_path_is_absolute (const char *filename)
 {
-       g_return_val_if_fail (filename != NULL, FALSE);
+       u_return_val_if_fail (filename != NULL, FALSE);
 
        return (*filename == '/');
 }
 
 static pthread_mutex_t pw_lock = PTHREAD_MUTEX_INITIALIZER;
-static const gchar *home_dir;
-static const gchar *user_name;
+static const char *home_dir;
+static const char *user_name;
 
 static void
 get_pw_data (void)
 {
-#ifdef HAVE_GETPWUID_R
+#ifdef HAVE_UETPWUID_R
        struct passwd pw;
        struct passwd *result;
        char buf [4096];
@@ -93,33 +93,33 @@ get_pw_data (void)
                pthread_mutex_unlock (&pw_lock);
                return;
        }
-#ifdef HAVE_GETPWUID_R
+#ifdef HAVE_UETPWUID_R
        if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
-               home_dir = g_strdup (pw.pw_dir);
-               user_name = g_strdup (pw.pw_name);
+               home_dir = u_strdup (pw.pw_dir);
+               user_name = u_strdup (pw.pw_name);
        }
 #endif
        if (home_dir == NULL)
-               home_dir = g_getenv ("HOME");
+               home_dir = u_getenv ("HOME");
 
        if (user_name == NULL) {
-               user_name = g_getenv ("USER");
+               user_name = u_getenv ("USER");
                if (user_name == NULL)
                        user_name = "somebody";
        }
        pthread_mutex_unlock (&pw_lock);
 }
 
-/* Give preference to /etc/passwd than HOME */
-const gchar *
-g_get_home_dir (void)
+/* Uive preference to /etc/passwd than HOME */
+const char *
+u_get_home_dir (void)
 {
        get_pw_data ();
        return home_dir;
 }
 
 const char *
-g_get_user_name (void)
+u_get_user_name (void)
 {
        get_pw_data ();
        return user_name;
@@ -129,17 +129,17 @@ static const char *tmp_dir;
 
 static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
 
-const gchar *
-g_get_tmp_dir (void)
+const char *
+u_get_tmp_dir (void)
 {
        if (tmp_dir == NULL){
                pthread_mutex_lock (&tmp_lock);
                if (tmp_dir == NULL){
-                       tmp_dir = g_getenv ("TMPDIR");
+                       tmp_dir = u_getenv ("TMPDIR");
                        if (tmp_dir == NULL){
-                               tmp_dir = g_getenv ("TMP");
+                               tmp_dir = u_getenv ("TMP");
                                if (tmp_dir == NULL){
-                                       tmp_dir = g_getenv ("TEMP");
+                                       tmp_dir = u_getenv ("TEMP");
                                        if (tmp_dir == NULL)
                                                tmp_dir = "/tmp";
                                }
diff --git a/deps/eglib/src/gmisc-win32.c b/deps/ulib/src/umisc-win32.c
similarity index 62%
rename from deps/eglib/src/gmisc-win32.c
rename to deps/ulib/src/umisc-win32.c
index 35bb43d..a1b218b 100644
--- a/deps/eglib/src/gmisc-win32.c
+++ b/deps/ulib/src/umisc-win32.c
@@ -30,78 +30,78 @@
 #include <config.h>
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
 #include <windows.h>
 #include <direct.h>
 #include <io.h>
 
-const gchar *
-g_getenv(const gchar *variable)
+const char *
+u_getenv(const char *variable)
 {
-       gunichar2 *var, *buffer;
-       gchar* val = NULL;
-       gint32 buffer_size = 1024;
-       gint32 retval;
+       uunichar2 *var, *buffer;
+       char* val = NULL;
+       int32_tbuffer_size = 1024;
+       int32_tretval;
        var = u8to16(variable); 
-       buffer = g_malloc(buffer_size*sizeof(gunichar2));
-       retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+       buffer = u_malloc(buffer_size*sizeof(uunichar2));
+       retval = UetEnvironmentVariableW (var, buffer, buffer_size);
        if (retval != 0) {
                if (retval > buffer_size) {
-                       g_free (buffer);
+                       u_free (buffer);
                        buffer_size = retval;
-                       buffer = g_malloc(buffer_size*sizeof(gunichar2));
-                       retval = GetEnvironmentVariableW (var, buffer, buffer_size);
+                       buffer = u_malloc(buffer_size*sizeof(uunichar2));
+                       retval = UetEnvironmentVariableW (var, buffer, buffer_size);
                }
                val = u16to8 (buffer);
        } else {
-               if (GetLastError () != ERROR_ENVVAR_NOT_FOUND){
-                       val = g_malloc (1);
+               if (UetLastError () != ERROR_ENVVAR_NOT_FOUND){
+                       val = u_malloc (1);
                        *val = 0;
                }
        }
-       g_free(var);
-       g_free(buffer);
+       u_free(var);
+       u_free(buffer);
        return val; 
 }
 
-gboolean
-g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
+uboolean
+u_setenv(const char *variable, const char *value, uboolean overwrite)
 {
-       gunichar2 *var, *val;
-       gboolean result;
+       uunichar2 *var, *val;
+       uboolean result;
        var = u8to16(variable); 
        val = u8to16(value);
        result = (SetEnvironmentVariableW(var, val) != 0) ? TRUE : FALSE;
-       g_free(var);
-       g_free(val);
+       u_free(var);
+       u_free(val);
        return result;
 }
 
 void
-g_unsetenv(const gchar *variable)
+u_unsetenv(const char *variable)
 {
-       gunichar2 *var;
+       uunichar2 *var;
        var = u8to16(variable); 
        SetEnvironmentVariableW(var, L"");
-       g_free(var);
+       u_free(var);
 }
 
-gchar*
-g_win32_getlocale(void)
+char*
+u_win32_getlocale(void)
 {
-       LCID lcid = GetThreadLocale();
-       gchar buf[19];
-       gint ccBuf = GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+       LCID lcid = UetThreadLocale();
+       char buf[19];
+       int ccBuf = UetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
        buf[ccBuf - 1] = '-';
-       ccBuf += GetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+       ccBuf += UetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
        return strdup(buf);
 }
 
-gboolean
-g_path_is_absolute (const char *filename)
+uboolean
+u_path_is_absolute (const char *filename)
 {
-       g_return_val_if_fail (filename != NULL, FALSE);
+       u_return_val_if_fail (filename != NULL, FALSE);
 
        if (filename[0] != '\0' && filename[1] != '\0') {
                if (filename[1] == ':' && filename[2] != '\0' &&
@@ -116,16 +116,16 @@ g_path_is_absolute (const char *filename)
        return FALSE;
 }
 
-const gchar *
-g_get_home_dir (void)
+const char *
+u_get_home_dir (void)
 {
        /* FIXME */
-       const gchar *drive = g_getenv ("HOMEDRIVE");
-       const gchar *path = g_getenv ("HOMEPATH");
-       gchar *home_dir = NULL;
+       const char *drive = u_getenv ("HOMEDRIVE");
+       const char *path = u_getenv ("HOMEPATH");
+       char *home_dir = NULL;
        
        if (drive && path) {
-               home_dir = g_malloc(strlen(drive) + strlen(path) +1);
+               home_dir = u_malloc(strlen(drive) + strlen(path) +1);
                if (home_dir) {
                        sprintf(home_dir, "%s%s", drive, path);
                }
@@ -135,26 +135,26 @@ g_get_home_dir (void)
 }
 
 const char *
-g_get_user_name (void)
+u_get_user_name (void)
 {
-       const char * retName = g_getenv ("USER");
+       const char * retName = u_getenv ("USER");
        if (!retName)
-               retName = g_getenv ("USERNAME");
+               retName = u_getenv ("USERNAME");
        return retName;
 }
 
 static const char *tmp_dir;
 
-const gchar *
-g_get_tmp_dir (void)
+const char *
+u_get_tmp_dir (void)
 {
        if (tmp_dir == NULL){
                if (tmp_dir == NULL){
-                       tmp_dir = g_getenv ("TMPDIR");
+                       tmp_dir = u_getenv ("TMPDIR");
                        if (tmp_dir == NULL){
-                               tmp_dir = g_getenv ("TMP");
+                               tmp_dir = u_getenv ("TMP");
                                if (tmp_dir == NULL){
-                                       tmp_dir = g_getenv ("TEMP");
+                                       tmp_dir = u_getenv ("TEMP");
                                        if (tmp_dir == NULL)
                                                tmp_dir = "C:\\temp";
                                }
diff --git a/deps/eglib/src/gmodule-unix.c b/deps/ulib/src/umodule-unix.c
similarity index 61%
rename from deps/eglib/src/gmodule-unix.c
rename to deps/ulib/src/umodule-unix.c
index 9dd5eaa..07baef4 100644
--- a/deps/eglib/src/gmodule-unix.c
+++ b/deps/ulib/src/umodule-unix.c
@@ -30,45 +30,45 @@
  */
 #include <config.h>
 
-#include <glib.h>
-#include <gmodule.h>
+#include <ulib.h>
+#include <umodule.h>
 
-#if defined(G_OS_UNIX) && defined(HAVE_DLFCN_H)
+#if defined(U_OS_UNIX) && defined(HAVE_DLFCN_H)
 #include <dlfcn.h>
 
 /* For Linux and Solaris, need to add others as we port this */
 #define LIBPREFIX "lib"
 #define LIBSUFFIX ".so"
 
-struct _GModule {
+struct _UModule {
        void *handle;
 };
 
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
+UModule *
+u_module_open (const char *file, UModuleFlags flags)
 {
        int f = 0;
-       GModule *module;
+       UModule *module;
        void *handle;
-       
-       flags &= G_MODULE_BIND_MASK;
-       if ((flags & G_MODULE_BIND_LAZY) != 0)
+
+       flags &= U_MODULE_BIND_MASK;
+       if ((flags & U_MODULE_BIND_LAZY) != 0)
                f |= RTLD_LAZY;
-       if ((flags & G_MODULE_BIND_LOCAL) != 0)
+       if ((flags & U_MODULE_BIND_LOCAL) != 0)
                f |= RTLD_LOCAL;
 
        handle = dlopen (file, f);
        if (handle == NULL)
                return NULL;
-       
-       module = g_new (GModule,1);
+
+       module = u_new (UModule,1);
        module->handle = handle;
-       
+
        return module;
 }
 
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+uboolean
+u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
 {
        if (symbol_name == NULL || symbol == NULL)
                return FALSE;
@@ -80,14 +80,14 @@ g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
        return (*symbol != NULL);
 }
 
-const gchar *
-g_module_error (void)
+const char *
+u_module_error (void)
 {
        return dlerror ();
 }
 
-gboolean
-g_module_close (GModule *module)
+uboolean
+u_module_close (UModule *module)
 {
        void *handle;
        if (module == NULL || module->handle == NULL)
@@ -95,124 +95,124 @@ g_module_close (GModule *module)
 
        handle = module->handle;
        module->handle = NULL;
-       g_free (module);
+       u_free (module);
        return (0 == dlclose (handle));
 }
 
-#elif defined (G_OS_WIN32)
+#elif defined (U_OS_WIN32)
 #include <windows.h>
 #include <psapi.h>
 
 #define LIBSUFFIX ".dll"
 #define LIBPREFIX ""
 
-struct _GModule {
+struct _UModule {
        HMODULE handle;
        int main_module;
 };
 
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
+UModule *
+u_module_open (const char *file, UModuleFlags flags)
 {
-       GModule *module;
-       module = g_malloc (sizeof (GModule));
+       UModule *module;
+       module = u_malloc (sizeof (UModule));
        if (module == NULL)
                return NULL;
 
        if (file != NULL) {
-               gunichar2 *file16;
-               file16 = u8to16(file); 
+               uunichar2 *file16;
+               file16 = u8to16(file);
                module->main_module = FALSE;
                module->handle = LoadLibrary (file16);
-               g_free(file16);
+               u_free(file16);
                if (!module->handle) {
-                       g_free (module);
+                       u_free (module);
                        return NULL;
                }
-                       
+
        } else {
                module->main_module = TRUE;
-               module->handle = GetModuleHandle (NULL);
+               module->handle = UetModuleHandle (NULL);
        }
 
        return module;
 }
 
-static gpointer
-w32_find_symbol (const gchar *symbol_name)
+static void *
+w32_find_symbol (const char *symbol_name)
 {
        HMODULE *modules;
        DWORD buffer_size = sizeof (HMODULE) * 1024;
        DWORD needed, i;
 
-       modules = (HMODULE *) g_malloc (buffer_size);
+       modules = (HMODULE *) u_malloc (buffer_size);
 
        if (modules == NULL)
                return NULL;
 
-       if (!EnumProcessModules (GetCurrentProcess (), modules,
+       if (!EnumProcessModules (UetCurrentProcess (), modules,
                                 buffer_size, &needed)) {
-               g_free (modules);
+               u_free (modules);
                return NULL;
        }
 
        /* check whether the supplied buffer was too small, realloc, retry */
        if (needed > buffer_size) {
-               g_free (modules);
+               u_free (modules);
 
                buffer_size = needed;
-               modules = (HMODULE *) g_malloc (buffer_size);
+               modules = (HMODULE *) u_malloc (buffer_size);
 
                if (modules == NULL)
                        return NULL;
 
-               if (!EnumProcessModules (GetCurrentProcess (), modules,
+               if (!EnumProcessModules (UetCurrentProcess (), modules,
                                         buffer_size, &needed)) {
-                       g_free (modules);
+                       u_free (modules);
                        return NULL;
                }
        }
 
        for (i = 0; i < needed / sizeof (HANDLE); i++) {
-               gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+               void * proc = (void *)(intptr_t)UetProcAddress (modules [i], symbol_name);
                if (proc != NULL) {
-                       g_free (modules);
+                       u_free (modules);
                        return proc;
                }
        }
 
-       g_free (modules);
+       u_free (modules);
        return NULL;
 }
 
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+uboolean
+u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
 {
        if (module == NULL || symbol_name == NULL || symbol == NULL)
                return FALSE;
 
        if (module->main_module) {
-               *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+               *symbol = (void *)(intptr_t)UetProcAddress (module->handle, symbol_name);
                if (*symbol != NULL)
                        return TRUE;
 
                *symbol = w32_find_symbol (symbol_name);
                return *symbol != NULL;
        } else {
-               *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+               *symbol = (void *)(intptr_t)UetProcAddress (module->handle, symbol_name);
                return *symbol != NULL;
        }
 }
 
-const gchar *
-g_module_error (void)
+const char *
+u_module_error (void)
 {
-       gchar* ret = NULL;
+       char* ret = NULL;
        TCHAR* buf = NULL;
-       DWORD code = GetLastError ();
+       DWORD code = UetLastError ();
 
-       FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, 
-               code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+       FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+               code, MAKELANGID(LANU_NEUTRAL, SUBLANU_DEFAULT), buf, 0, NULL);
 
        ret = u16to8 (buf);
        LocalFree(buf);
@@ -220,8 +220,8 @@ g_module_error (void)
        return ret;
 }
 
-gboolean
-g_module_close (GModule *module)
+uboolean
+u_module_close (UModule *module)
 {
        HMODULE handle;
        int main_module;
@@ -232,7 +232,7 @@ g_module_close (GModule *module)
        handle = module->handle;
        main_module = module->main_module;
        module->handle = NULL;
-       g_free (module);
+       u_free (module);
        return (main_module ? 1 : (0 == FreeLibrary (handle)));
 }
 
@@ -241,50 +241,50 @@ g_module_close (GModule *module)
 #define LIBSUFFIX ""
 #define LIBPREFIX ""
 
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
+UModule *
+u_module_open (const char *file, UModuleFlags flags)
 {
-       g_error ("%s", "g_module_open not implemented on this platform");
+       u_error ("%s", "u_module_open not implemented on this platform");
        return NULL;
 }
 
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+uboolean
+u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
 {
-       g_error ("%s", "g_module_open not implemented on this platform");
+       u_error ("%s", "u_module_open not implemented on this platform");
        return FALSE;
 }
 
-const gchar *
-g_module_error (void)
+const char *
+u_module_error (void)
 {
-       g_error ("%s", "g_module_open not implemented on this platform");
+       u_error ("%s", "u_module_open not implemented on this platform");
        return NULL;
 }
 
-gboolean
-g_module_close (GModule *module)
+uboolean
+u_module_close (UModule *module)
 {
-       g_error ("%s", "g_module_open not implemented on this platform");
+       u_error ("%s", "u_module_open not implemented on this platform");
        return FALSE;
 }
 #endif
 
-gchar *
-g_module_build_path (const gchar *directory, const gchar *module_name)
+char *
+u_module_build_path (const char *directory, const char *module_name)
 {
        char *lib_prefix = "";
-       
+
        if (module_name == NULL)
                return NULL;
 
        if (strncmp (module_name, "lib", 3) != 0)
                lib_prefix = LIBPREFIX;
-       
-       if (directory && *directory){ 
-               
-               return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+
+       if (directory && *directory){
+
+               return u_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
        }
-       return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name); 
+       return u_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
 }
 
diff --git a/deps/eglib/src/gmodule-win32.c b/deps/ulib/src/umodule-win32.c
similarity index 69%
rename from deps/eglib/src/gmodule-win32.c
rename to deps/ulib/src/umodule-win32.c
index 7dcaa05..f3a05a1 100644
--- a/deps/eglib/src/gmodule-win32.c
+++ b/deps/ulib/src/umodule-win32.c
@@ -31,7 +31,7 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <gmodule.h>
 #include <windows.h>
 #include <psapi.h>
@@ -39,114 +39,114 @@
 #define LIBSUFFIX ".dll"
 #define LIBPREFIX ""
 
-struct _GModule {
+struct _UModule {
        HMODULE handle;
        int main_module;
 };
 
-GModule *
-g_module_open (const gchar *file, GModuleFlags flags)
+UModule *
+u_module_open (const char *file, UModuleFlags flags)
 {
-       GModule *module;
-       module = g_malloc (sizeof (GModule));
+       UModule *module;
+       module = u_malloc (sizeof (UModule));
        if (module == NULL)
                return NULL;
 
        if (file != NULL) {
-               gunichar2 *file16;
+               uunichar2 *file16;
                file16 = u8to16(file); 
                module->main_module = FALSE;
                module->handle = LoadLibraryW (file16);
-               g_free(file16);
+               u_free(file16);
                if (!module->handle) {
-                       g_free (module);
+                       u_free (module);
                        return NULL;
                }
                        
        } else {
                module->main_module = TRUE;
-               module->handle = GetModuleHandle (NULL);
+               module->handle = UetModuleHandle (NULL);
        }
 
        return module;
 }
 
-static gpointer
-w32_find_symbol (const gchar *symbol_name)
+static void *
+w32_find_symbol (const char *symbol_name)
 {
        HMODULE *modules;
        DWORD buffer_size = sizeof (HMODULE) * 1024;
        DWORD needed, i;
 
-       modules = (HMODULE *) g_malloc (buffer_size);
+       modules = (HMODULE *) u_malloc (buffer_size);
 
        if (modules == NULL)
                return NULL;
 
-       if (!EnumProcessModules (GetCurrentProcess (), modules,
+       if (!EnumProcessModules (UetCurrentProcess (), modules,
                                 buffer_size, &needed)) {
-               g_free (modules);
+               u_free (modules);
                return NULL;
        }
 
        /* check whether the supplied buffer was too small, realloc, retry */
        if (needed > buffer_size) {
-               g_free (modules);
+               u_free (modules);
 
                buffer_size = needed;
-               modules = (HMODULE *) g_malloc (buffer_size);
+               modules = (HMODULE *) u_malloc (buffer_size);
 
                if (modules == NULL)
                        return NULL;
 
-               if (!EnumProcessModules (GetCurrentProcess (), modules,
+               if (!EnumProcessModules (UetCurrentProcess (), modules,
                                         buffer_size, &needed)) {
-                       g_free (modules);
+                       u_free (modules);
                        return NULL;
                }
        }
 
        for (i = 0; i < needed / sizeof (HANDLE); i++) {
-               gpointer proc = (gpointer)(intptr_t)GetProcAddress (modules [i], symbol_name);
+               void * proc = (void *)(intptr_t)UetProcAddress (modules [i], symbol_name);
                if (proc != NULL) {
-                       g_free (modules);
+                       u_free (modules);
                        return proc;
                }
        }
 
-       g_free (modules);
+       u_free (modules);
        return NULL;
 }
 
-gboolean
-g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
+uboolean
+u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
 {
        if (module == NULL || symbol_name == NULL || symbol == NULL)
                return FALSE;
 
        if (module->main_module) {
-               *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+               *symbol = (void *)(intptr_t)UetProcAddress (module->handle, symbol_name);
                if (*symbol != NULL)
                        return TRUE;
 
                *symbol = w32_find_symbol (symbol_name);
                return *symbol != NULL;
        } else {
-               *symbol = (gpointer)(intptr_t)GetProcAddress (module->handle, symbol_name);
+               *symbol = (void *)(intptr_t)UetProcAddress (module->handle, symbol_name);
                return *symbol != NULL;
        }
 }
 
-const gchar *
-g_module_error (void)
+const char *
+u_module_error (void)
 {
-       gchar* ret = NULL;
+       char* ret = NULL;
        TCHAR* buf = NULL;
-       DWORD code = GetLastError ();
+       DWORD code = UetLastError ();
 
        /* FIXME: buf must not be NULL! */
        FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, 
-               code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 0, NULL);
+               code, MAKELANGID(LANU_NEUTRAL, SUBLANU_DEFAULT), buf, 0, NULL);
 
        ret = u16to8 (buf);
        LocalFree(buf);
@@ -154,8 +154,8 @@ g_module_error (void)
        return ret;
 }
 
-gboolean
-g_module_close (GModule *module)
+uboolean
+u_module_close (UModule *module)
 {
        HMODULE handle;
        int main_module;
@@ -166,12 +166,12 @@ g_module_close (GModule *module)
        handle = module->handle;
        main_module = module->main_module;
        module->handle = NULL;
-       g_free (module);
+       u_free (module);
        return (main_module ? 1 : (0 == FreeLibrary (handle)));
 }
 
-gchar *
-g_module_build_path (const gchar *directory, const gchar *module_name)
+char *
+u_module_build_path (const char *directory, const char *module_name)
 {
        char *lib_prefix = "";
        
@@ -183,7 +183,7 @@ g_module_build_path (const gchar *directory, const gchar *module_name)
        
        if (directory && *directory){ 
                
-               return g_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+               return u_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
        }
-       return g_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name); 
+       return u_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name); 
 }
diff --git a/deps/ulib/src/umodule.h b/deps/ulib/src/umodule.h
new file mode 100644
index 0000000..0c78fab
--- /dev/null
+++ b/deps/ulib/src/umodule.h
@@ -0,0 +1,37 @@
+#ifndef __ULIB_UMODULE_H
+#define __ULIB_UMODULE_H
+
+#include <ulib.h>
+
+#define U_MODULE_IMPORT extern
+#ifdef U_OS_WIN32
+#define U_MODULE_EXPORT __declspec(dllexport)
+#else
+#define U_MODULE_EXPORT
+#endif
+
+U_BEGIN_DECLS
+
+/*
+ * Modules
+ */
+typedef enum {
+       U_MODULE_BIND_LAZY = 0x01,
+       U_MODULE_BIND_LOCAL = 0x02,
+       U_MODULE_BIND_MASK = 0x03
+} UModuleFlags;
+typedef struct _UModule UModule;
+
+UModule *u_module_open (const char *file, UModuleFlags flags);
+uboolean u_module_symbol (UModule *module, const char *symbol_name,
+                         void * *symbol);
+const char *u_module_error (void);
+uboolean u_module_close (UModule *module);
+char *  u_module_build_path (const char *directory, const char *module_name);
+
+extern char *gmodule_libprefix;
+extern char *gmodule_libsuffix;
+
+U_END_DECLS
+
+#endif
diff --git a/deps/eglib/src/unicode-data.h b/deps/ulib/src/unicode-data.h
similarity index 97%
rename from deps/eglib/src/unicode-data.h
rename to deps/ulib/src/unicode-data.h
index 1cd75f3..3ff4397 100644
--- a/deps/eglib/src/unicode-data.h
+++ b/deps/ulib/src/unicode-data.h
@@ -1,32 +1,32 @@
 /*
 This file is automatically generated by ucd.exe.
 The source for this generator should be in Mono repository
-(mcs/class/corlib/Mono.Globalization.Unicode directory).
+(mcs/class/corlib/Mono.Ulobalization.Unicode directory).
 */
 
 #ifndef __UNICODE_DATA_H
 #define __UNICODE_DATA_H
 
-#include <glib.h>
+#include <ulib.h>
 
 
 /* ======== Structures ======== */
 typedef struct {
-       guint32 codepoint;
-       guint32 upper;
-       guint32 title;
+       uint32_t codepoint;
+       uint32_t upper;
+       uint32_t title;
 } SimpleTitlecaseMapping;
 typedef struct {
-       guint32 start;
-       guint32 end;
+       uint32_t start;
+       uint32_t end;
 } CodePointRange;
 typedef struct {
-       guint32 upper;
-       guint32 lower;
+       uint32_t upper;
+       uint32_t lower;
 } SimpleCaseMapping;
 
 /* ======== Unicode Categories ======== */
-static const guint8 unicode_category_ranges_count = 11;
+static const uint8_t unicode_category_ranges_count = 11;
 static const CodePointRange unicode_category_ranges [] = {
 {0x000000, 0x003400},
 {0x004DC0, 0x004E00},
@@ -40,7 +40,7 @@ static const CodePointRange unicode_category_ranges [] = {
 {0x02F800, 0x02FA40},
 {0x0E0000, 0x0E0200},
 {0, 0}};
-static const guint8 unicode_category_table0 [] = {
+static const uint8_t unicode_category_table0 [] = {
        /* ==== 0-3400 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -875,14 +875,14 @@ static const guint8 unicode_category_table0 [] = {
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        0};
-static const guint8 unicode_category_table1 [] = {
+static const uint8_t unicode_category_table1 [] = {
        /* ==== 4DC0-4E00 ==== */
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        0};
-static const guint8 unicode_category_table2 [] = {
+static const uint8_t unicode_category_table2 [] = {
        /* ==== A000-AA80 ==== */
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,6,7,7,7,7,7,7,7,7,7,7,
@@ -1051,7 +1051,7 @@ static const guint8 unicode_category_table2 [] = {
        7,7,7,12,7,7,7,7,7,7,7,7,12,10,0,0,
        13,13,13,13,13,13,13,13,13,13,0,0,21,21,21,21,
        0};
-static const guint8 unicode_category_table3 [] = {
+static const uint8_t unicode_category_table3 [] = {
        /* ==== F900-10000 ==== */
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
@@ -1165,7 +1165,7 @@ static const guint8 unicode_category_table3 [] = {
        0,0,7,7,7,7,7,7,0,0,7,7,7,0,0,0,
        23,23,25,24,26,23,23,0,26,25,25,25,25,26,26,0,
        0,0,0,0,0,0,0,0,0,1,1,1,26,26,0};
-static const guint8 unicode_category_table4 [] = {
+static const uint8_t unicode_category_table4 [] = {
        /* ==== 10000-104C0 ==== */
        7,7,7,7,7,7,7,7,7,7,7,7,0,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
@@ -1242,7 +1242,7 @@ static const guint8 unicode_category_table4 [] = {
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,
        13,13,13,13,13,13,13,13,13,13,0};
-static const guint8 unicode_category_table5 [] = {
+static const uint8_t unicode_category_table5 [] = {
        /* ==== 10800-10A80 ==== */
        7,7,7,7,7,7,0,0,7,0,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
@@ -1282,7 +1282,7 @@ static const guint8 unicode_category_table5 [] = {
        7,7,7,7,0,0,0,0,12,12,12,0,0,0,0,12,
        15,15,15,15,15,15,15,15,0,0,0,0,0,0,0,0,
        21,21,21,21,21,21,21,21,21,0};
-static const guint8 unicode_category_table6 [] = {
+static const uint8_t unicode_category_table6 [] = {
        /* ==== 12000-12480 ==== */
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
@@ -1356,7 +1356,7 @@ static const guint8 unicode_category_table6 [] = {
        14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
        14,14,14,0,0,0,0,0,0,0,0,0,0,0,0,0,
        21,21,21,21,0};
-static const guint8 unicode_category_table7 [] = {
+static const uint8_t unicode_category_table7 [] = {
        /* ==== 1D000-1D800 ==== */
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
@@ -1487,7 +1487,7 @@ static const guint8 unicode_category_table7 [] = {
        13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
        13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
        0};
-static const guint8 unicode_category_table8 [] = {
+static const uint8_t unicode_category_table8 [] = {
        /* ==== 1F000-1F0C0 ==== */
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
@@ -1499,7 +1499,7 @@ static const guint8 unicode_category_table8 [] = {
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,
        26,26,26,26,0};
-static const guint8 unicode_category_table9 [] = {
+static const uint8_t unicode_category_table9 [] = {
        /* ==== 2F800-2FA40 ==== */
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
@@ -1535,7 +1535,7 @@ static const guint8 unicode_category_table9 [] = {
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
        7,7,7,7,7,7,7,7,7,7,7,7,7,7,0};
-static const guint8 unicode_category_table10 [] = {
+static const uint8_t unicode_category_table10 [] = {
        /* ==== E0000-E0200 ==== */
        0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1569,7 +1569,7 @@ static const guint8 unicode_category_table10 [] = {
        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
        0};
-static const guint8 *unicode_category [11]  = {
+static const uint8_t *unicode_category [11]  = {
        unicode_category_table0,
        unicode_category_table1,
        unicode_category_table2,
@@ -1583,7 +1583,7 @@ static const guint8 *unicode_category [11]  = {
        unicode_category_table10
 };
 
-static const guint8 simple_case_map_ranges_count = 9;
+static const uint8_t simple_case_map_ranges_count = 9;
 static const CodePointRange simple_case_map_ranges [] = {
 {0x000040, 0x000600},
 {0x001000, 0x0010D0},
@@ -1595,7 +1595,7 @@ static const CodePointRange simple_case_map_ranges [] = {
 {0x00FF20, 0x00FF80},
 {0x010400, 0x010480},
 {0, 0}};
-static const guint16 simple_upper_case_mapping_lowarea_table0 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table0 [] = {
        /* ==== 40-600 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1689,7 +1689,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table0 [] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table1 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table1 [] = {
        /* ==== 1000-10D0 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1704,7 +1704,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table1 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table2 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table2 [] = {
        /* ==== 1D00-2000 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1754,7 +1754,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table2 [] = {
        0x1FD8,0x1FD9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0x1FE8,0x1FE9,0,0,0,0x1FEC,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0x1FFC,0,0,0,0,0,0,0,0,0,0,0,0};
-static const guint16 simple_upper_case_mapping_lowarea_table3 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table3 [] = {
        /* ==== 2100-21C0 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1769,7 +1769,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table3 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_upper_case_mapping_lowarea_table4 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table4 [] = {
        /* ==== 2480-2500 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1780,7 +1780,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table4 [] = {
        0x24C6,0x24C7,0x24C8,0x24C9,0x24CA,0x24CB,0x24CC,0x24CD,0x24CE,0x24CF,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_upper_case_mapping_lowarea_table5 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table5 [] = {
        /* ==== 2C00-2D80 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1806,7 +1806,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table5 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_upper_case_mapping_lowarea_table6 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table6 [] = {
        /* ==== A640-A7C0 ==== */
        0,0xA640,0,0xA642,0,0xA644,0,0xA646,0,0xA648,0,0xA64A,0,0xA64C,0,0xA64E,
        0,0xA650,0,0xA652,0,0xA654,0,0xA656,0,0xA658,0,0xA65A,0,0xA65C,0,0xA65E,
@@ -1829,7 +1829,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table6 [] = {
        0,0xA760,0,0xA762,0,0xA764,0,0xA766,0,0xA768,0,0xA76A,0,0xA76C,0,0xA76E,
        0,0,0,0,0,0,0,0,0,0,0xA779,0,0xA77B,0,0,0xA77E,
        0,0xA780,0,0xA782,0,0xA784,0,0xA786,0,0,0,0,0xA78B,0};
-static const guint16 simple_upper_case_mapping_lowarea_table7 [] = {
+static const uint16_t simple_upper_case_mapping_lowarea_table7 [] = {
        /* ==== FF20-FF80 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1838,7 +1838,7 @@ static const guint16 simple_upper_case_mapping_lowarea_table7 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 *simple_upper_case_mapping_lowarea [] = {
+static const uint16_t *simple_upper_case_mapping_lowarea [] = {
        simple_upper_case_mapping_lowarea_table0,
        simple_upper_case_mapping_lowarea_table1,
        simple_upper_case_mapping_lowarea_table2,
@@ -1849,7 +1849,7 @@ static const guint16 *simple_upper_case_mapping_lowarea [] = {
        simple_upper_case_mapping_lowarea_table7};
 static const int simple_upper_case_mapping_lowarea_table_count = 8;
 
-static const guint32 simple_upper_case_mapping_higharea_table0 [] = {
+static const uint32_t simple_upper_case_mapping_higharea_table0 [] = {
        /* ==== 10400-10480 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1860,10 +1860,10 @@ static const guint32 simple_upper_case_mapping_higharea_table0 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint32 *simple_upper_case_mapping_higharea [] = {
+static const uint32_t *simple_upper_case_mapping_higharea [] = {
        simple_upper_case_mapping_higharea_table0};
 
-static const guint16 simple_lower_case_mapping_lowarea_table0 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table0 [] = {
        /* ==== 40-600 ==== */
        0,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
        0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0,0,0,0,0,
@@ -1957,7 +1957,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table0 [] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table1 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table1 [] = {
        /* ==== 1000-10D0 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -1972,7 +1972,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table1 [] = {
        
0x2D00,0x2D01,0x2D02,0x2D03,0x2D04,0x2D05,0x2D06,0x2D07,0x2D08,0x2D09,0x2D0A,0x2D0B,0x2D0C,0x2D0D,0x2D0E,0x2D0F,
        
0x2D10,0x2D11,0x2D12,0x2D13,0x2D14,0x2D15,0x2D16,0x2D17,0x2D18,0x2D19,0x2D1A,0x2D1B,0x2D1C,0x2D1D,0x2D1E,0x2D1F,
        0x2D20,0x2D21,0x2D22,0x2D23,0x2D24,0x2D25,0};
-static const guint16 simple_lower_case_mapping_lowarea_table2 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table2 [] = {
        /* ==== 1D00-2000 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -2022,7 +2022,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table2 [] = {
        0,0,0,0,0,0,0,0,0x1FD0,0x1FD1,0x1F76,0x1F77,0,0,0,0,
        0,0,0,0,0,0,0,0,0x1FE0,0x1FE1,0x1F7A,0x1F7B,0x1FE5,0,0,0,
        0,0,0,0,0,0,0,0,0x1F78,0x1F79,0x1F7C,0x1F7D,0x1FF3,0,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table3 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table3 [] = {
        /* ==== 2100-21C0 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -2037,7 +2037,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table3 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_lower_case_mapping_lowarea_table4 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table4 [] = {
        /* ==== 2480-2500 ==== */
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -2048,7 +2048,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table4 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_lower_case_mapping_lowarea_table5 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table5 [] = {
        /* ==== 2C00-2D80 ==== */
        
0x2C30,0x2C31,0x2C32,0x2C33,0x2C34,0x2C35,0x2C36,0x2C37,0x2C38,0x2C39,0x2C3A,0x2C3B,0x2C3C,0x2C3D,0x2C3E,0x2C3F,
        
0x2C40,0x2C41,0x2C42,0x2C43,0x2C44,0x2C45,0x2C46,0x2C47,0x2C48,0x2C49,0x2C4A,0x2C4B,0x2C4C,0x2C4D,0x2C4E,0x2C4F,
@@ -2074,7 +2074,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table5 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 simple_lower_case_mapping_lowarea_table6 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table6 [] = {
        /* ==== A640-A7C0 ==== */
        0xA641,0,0xA643,0,0xA645,0,0xA647,0,0xA649,0,0xA64B,0,0xA64D,0,0xA64F,0,
        0xA651,0,0xA653,0,0xA655,0,0xA657,0,0xA659,0,0xA65B,0,0xA65D,0,0xA65F,0,
@@ -2097,7 +2097,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table6 [] = {
        0xA761,0,0xA763,0,0xA765,0,0xA767,0,0xA769,0,0xA76B,0,0xA76D,0,0xA76F,0,
        0,0,0,0,0,0,0,0,0,0xA77A,0,0xA77C,0,0x1D79,0xA77F,0,
        0xA781,0,0xA783,0,0xA785,0,0xA787,0,0,0,0,0xA78C,0,0};
-static const guint16 simple_lower_case_mapping_lowarea_table7 [] = {
+static const uint16_t simple_lower_case_mapping_lowarea_table7 [] = {
        /* ==== FF20-FF80 ==== */
        
0,0xFF41,0xFF42,0xFF43,0xFF44,0xFF45,0xFF46,0xFF47,0xFF48,0xFF49,0xFF4A,0xFF4B,0xFF4C,0xFF4D,0xFF4E,0xFF4F,
        0xFF50,0xFF51,0xFF52,0xFF53,0xFF54,0xFF55,0xFF56,0xFF57,0xFF58,0xFF59,0xFF5A,0,0,0,0,0,
@@ -2106,7 +2106,7 @@ static const guint16 simple_lower_case_mapping_lowarea_table7 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint16 *simple_lower_case_mapping_lowarea [] = {
+static const uint16_t *simple_lower_case_mapping_lowarea [] = {
        simple_lower_case_mapping_lowarea_table0,
        simple_lower_case_mapping_lowarea_table1,
        simple_lower_case_mapping_lowarea_table2,
@@ -2117,7 +2117,7 @@ static const guint16 *simple_lower_case_mapping_lowarea [] = {
        simple_lower_case_mapping_lowarea_table7};
 static const int simple_lower_case_mapping_lowarea_table_count = 8;
 
-static const guint32 simple_lower_case_mapping_higharea_table0 [] = {
+static const uint32_t simple_lower_case_mapping_higharea_table0 [] = {
        /* ==== 10400-10480 ==== */
        
0x10428,0x10429,0x1042A,0x1042B,0x1042C,0x1042D,0x1042E,0x1042F,0x10430,0x10431,0x10432,0x10433,0x10434,0x10435,0x10436,0x10437,
        
0x10438,0x10439,0x1043A,0x1043B,0x1043C,0x1043D,0x1043E,0x1043F,0x10440,0x10441,0x10442,0x10443,0x10444,0x10445,0x10446,0x10447,
@@ -2128,7 +2128,7 @@ static const guint32 simple_lower_case_mapping_higharea_table0 [] = {
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
        0};
-static const guint32 *simple_lower_case_mapping_higharea [] = {
+static const uint32_t *simple_lower_case_mapping_higharea [] = {
        simple_lower_case_mapping_higharea_table0};
 
 
@@ -2146,7 +2146,7 @@ static const SimpleTitlecaseMapping simple_titlecase_mapping [] = {
        {0x0001F2, 0x0001F1, 0x0001F2},
        {0x0001F3, 0x0001F1, 0x0001F2}
 };
-static const guint8 simple_titlecase_mapping_count = 12;
+static const uint8_t simple_titlecase_mapping_count = 12;
 
 #endif
 
diff --git a/deps/eglib/src/goutput.c b/deps/ulib/src/uoutput.c
similarity index 62%
rename from deps/eglib/src/goutput.c
rename to deps/ulib/src/uoutput.c
index aff9f46..20d2abd 100644
--- a/deps/eglib/src/goutput.c
+++ b/deps/ulib/src/uoutput.c
@@ -29,31 +29,31 @@
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
 /* The current fatal levels, error is always fatal */
-static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
+static ULogLevelFlags fatal = U_LOG_LEVEL_ERROR;
 
 #if PLATFORM_ANDROID
 #include <android/log.h>
 
 static android_LogPriority
-to_android_priority (GLogLevelFlags log_level)
+to_android_priority (ULogLevelFlags log_level)
 {
-       switch (log_level & G_LOG_LEVEL_MASK)
+       switch (log_level & U_LOG_LEVEL_MASK)
        {
-               case G_LOG_LEVEL_ERROR:     return ANDROID_LOG_FATAL;
-               case G_LOG_LEVEL_CRITICAL:  return ANDROID_LOG_ERROR;
-               case G_LOG_LEVEL_WARNING:   return ANDROID_LOG_WARN;
-               case G_LOG_LEVEL_MESSAGE:   return ANDROID_LOG_INFO;
-               case G_LOG_LEVEL_INFO:      return ANDROID_LOG_DEBUG;
-               case G_LOG_LEVEL_DEBUG:     return ANDROID_LOG_VERBOSE;
+               case U_LOG_LEVEL_ERROR:     return ANDROID_LOG_FATAL;
+               case U_LOG_LEVEL_CRITICAL:  return ANDROID_LOG_ERROR;
+               case U_LOG_LEVEL_WARNING:   return ANDROID_LOG_WARN;
+               case U_LOG_LEVEL_MESSAGE:   return ANDROID_LOG_INFO;
+               case U_LOG_LEVEL_INFO:      return ANDROID_LOG_DEBUG;
+               case U_LOG_LEVEL_DEBUG:     return ANDROID_LOG_VERBOSE;
        }
        return ANDROID_LOG_UNKNOWN;
 }
 
 static void 
-out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+out_vfprintf (FILE *ignore, const char *format, va_list args)
 {
        /* TODO: provide a proper app name */
        __android_log_vprint (ANDROID_LOG_ERROR, "mono", format, args);
@@ -62,36 +62,36 @@ out_vfprintf (FILE *ignore, const gchar *format, va_list args)
 #include <asl.h>
 
 static int
-to_asl_priority (GLogLevelFlags log_level)
+to_asl_priority (ULogLevelFlags log_level)
 {
-       switch (log_level & G_LOG_LEVEL_MASK)
+       switch (log_level & U_LOG_LEVEL_MASK)
        {
-               case G_LOG_LEVEL_ERROR:     return ASL_LEVEL_CRIT;
-               case G_LOG_LEVEL_CRITICAL:  return ASL_LEVEL_ERR;
-               case G_LOG_LEVEL_WARNING:   return ASL_LEVEL_WARNING;
-               case G_LOG_LEVEL_MESSAGE:   return ASL_LEVEL_NOTICE;
-               case G_LOG_LEVEL_INFO:      return ASL_LEVEL_INFO;
-               case G_LOG_LEVEL_DEBUG:     return ASL_LEVEL_DEBUG;
+               case U_LOG_LEVEL_ERROR:     return ASL_LEVEL_CRIT;
+               case U_LOG_LEVEL_CRITICAL:  return ASL_LEVEL_ERR;
+               case U_LOG_LEVEL_WARNING:   return ASL_LEVEL_WARNING;
+               case U_LOG_LEVEL_MESSAGE:   return ASL_LEVEL_NOTICE;
+               case U_LOG_LEVEL_INFO:      return ASL_LEVEL_INFO;
+               case U_LOG_LEVEL_DEBUG:     return ASL_LEVEL_DEBUG;
        }
        return ASL_LEVEL_ERR;
 }
 
 static void
-out_vfprintf (FILE *ignore, const gchar *format, va_list args)
+out_vfprintf (FILE *ignore, const char *format, va_list args)
 {
        asl_vlog (NULL, NULL, ASL_LEVEL_WARNING, format, args);
 }
 
 #else
 static void 
-out_vfprintf (FILE *file, const gchar *format, va_list args)
+out_vfprintf (FILE *file, const char *format, va_list args)
 {
        vfprintf (file, format, args);
 }
 #endif
 
 void
-g_print (const gchar *format, ...)
+u_print (const char *format, ...)
 {
        va_list args;
 
@@ -103,7 +103,7 @@ g_print (const gchar *format, ...)
 }
 
 void
-g_printerr (const gchar *format, ...)
+u_printerr (const char *format, ...)
 {
        va_list args;
 
@@ -114,29 +114,29 @@ g_printerr (const gchar *format, ...)
        va_end (args);
 }
 
-GLogLevelFlags
-g_log_set_always_fatal (GLogLevelFlags fatal_mask)
+ULogLevelFlags
+u_log_set_always_fatal (ULogLevelFlags fatal_mask)
 {
-       GLogLevelFlags old_fatal = fatal;
+       ULogLevelFlags old_fatal = fatal;
 
        fatal |= fatal_mask;
        
        return old_fatal;
 }
 
-GLogLevelFlags
-g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
+ULogLevelFlags
+u_log_set_fatal_mask (const char *log_domain, ULogLevelFlags fatal_mask)
 {
        /*
-        * Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
-        * if we decide to set G_LOG_DOMAIN (we probably should) we should implement
+        * Mono does not use a U_LOG_DOMAIN currently, so we just assume things are fatal
+        * if we decide to set U_LOG_DOMAIN (we probably should) we should implement
         * this.
         */
        return fatal_mask;
 }
 
 void
-g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
+u_logv (const char *log_domain, ULogLevelFlags log_level, const char *format, va_list args)
 {
 #if PLATFORM_ANDROID
        __android_log_vprint (to_android_priority (log_level), log_domain, format, args);
@@ -148,7 +148,7 @@ g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format,
        if (vasprintf (&msg, format, args) < 0)
                return;
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
        printf ("%s%s%s\n",
             log_domain != NULL ? log_domain : "",
             log_domain != NULL ? ": " : "",
@@ -177,22 +177,22 @@ g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format,
 }
 
 void
-g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
+u_log (const char *log_domain, ULogLevelFlags log_level, const char *format, ...)
 {
        va_list args;
 
        va_start (args, format);
-       g_logv (log_domain, log_level, format, args);
+       u_logv (log_domain, log_level, format, args);
        va_end (args);
 }
 
 void
-g_assertion_message (const gchar *format, ...)
+u_assertion_message (const char *format, ...)
 {
        va_list args;
 
        va_start (args, format);
-       g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+       u_logv (U_LOG_DOMAIN, U_LOG_LEVEL_ERROR, format, args);
        va_end (args);
        abort ();
 }
diff --git a/deps/eglib/src/gpath.c b/deps/ulib/src/upath.c
similarity index 70%
rename from deps/eglib/src/gpath.c
rename to deps/ulib/src/upath.c
index 5302f42..e817794 100644
--- a/deps/eglib/src/gpath.c
+++ b/deps/ulib/src/upath.c
@@ -27,10 +27,10 @@
  */
 #include <config.h>
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 #include <errno.h>
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <direct.h> 
 #endif
 
@@ -38,18 +38,18 @@
 #include <unistd.h>
 #endif
 
-gchar *
-g_build_path (const gchar *separator, const gchar *first_element, ...)
+char *
+u_build_path (const char *separator, const char *first_element, ...)
 {
        const char *elem, *next, *endptr;
-       gboolean trimmed;
-       GString *path;
+       uboolean trimmed;
+       UString *path;
        va_list args;
        size_t slen;
        
-       g_return_val_if_fail (separator != NULL, NULL);
+       u_return_val_if_fail (separator != NULL, NULL);
        
-       path = g_string_sized_new (48);
+       path = u_string_sized_new (48);
        slen = strlen (separator);
        
        va_start (args, first_element);
@@ -68,7 +68,7 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
                
                /* append elem, not including any trailing separators */
                if (endptr > elem)
-                       g_string_append_len (path, elem, endptr - elem);
+                       u_string_append_len (path, elem, endptr - elem);
                
                /* get the next element */
                do {
@@ -81,23 +81,23 @@ g_build_path (const gchar *separator, const gchar *first_element, ...)
                } while (*next == '\0');
                
                if (next || trimmed)
-                       g_string_append_len (path, separator, slen);
+                       u_string_append_len (path, separator, slen);
        }
        va_end (args);
        
-       return g_string_free (path, FALSE);
+       return u_string_free (path, FALSE);
 }
 
-static gchar*
-strrchr_seperator (const gchar* filename)
+static char*
+strrchr_seperator (const char* filename)
 {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
        char *p2;
 #endif
        char *p;
 
-       p = strrchr (filename, G_DIR_SEPARATOR);
-#ifdef G_OS_WIN32
+       p = strrchr (filename, U_DIR_SEPARATOR);
+#ifdef U_OS_WIN32
        p2 = strrchr (filename, '/');
        if (p2 > p)
                p = p2;
@@ -106,57 +106,57 @@ strrchr_seperator (const gchar* filename)
        return p;
 }
 
-gchar *
-g_path_get_dirname (const gchar *filename)
+char *
+u_path_get_dirname (const char *filename)
 {
        char *p, *r;
        size_t count;
-       g_return_val_if_fail (filename != NULL, NULL);
+       u_return_val_if_fail (filename != NULL, NULL);
 
        p = strrchr_seperator (filename);
        if (p == NULL)
-               return g_strdup (".");
+               return u_strdup (".");
        if (p == filename)
-               return g_strdup ("/");
+               return u_strdup ("/");
        count = p - filename;
-       r = g_malloc (count + 1);
+       r = u_malloc (count + 1);
        strncpy (r, filename, count);
        r [count] = 0;
 
        return r;
 }
 
-gchar *
-g_path_get_basename (const char *filename)
+char *
+u_path_get_basename (const char *filename)
 {
        char *r;
-       g_return_val_if_fail (filename != NULL, NULL);
+       u_return_val_if_fail (filename != NULL, NULL);
 
        /* Empty filename -> . */
        if (!*filename)
-               return g_strdup (".");
+               return u_strdup (".");
 
        /* No separator -> filename */
        r = strrchr_seperator (filename);
        if (r == NULL)
-               return g_strdup (filename);
+               return u_strdup (filename);
 
        /* Trailing slash, remove component */
        if (r [1] == 0){
-               char *copy = g_strdup (filename);
+               char *copy = u_strdup (filename);
                copy [r-filename] = 0;
                r = strrchr_seperator (copy);
 
                if (r == NULL){
-                       g_free (copy);                  
-                       return g_strdup ("/");
+                       u_free (copy);                  
+                       return u_strdup ("/");
                }
-               r = g_strdup (&r[1]);
-               g_free (copy);
+               r = u_strdup (&r[1]);
+               u_free (copy);
                return r;
        }
 
-       return g_strdup (&r[1]);
+       return u_strdup (&r[1]);
 }
 
 #ifndef HAVE_STRTOK_R
@@ -213,84 +213,84 @@ cont:
 }
 #endif
 
-gchar *
-g_find_program_in_path (const gchar *program)
+char *
+u_find_program_in_path (const char *program)
 {
        char *p;
        char *x, *l;
-       gchar *curdir = NULL;
+       char *curdir = NULL;
        char *save = NULL;
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
        char *program_exe;
        char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
        int listx;
-       gboolean hasSuffix;
+       uboolean hasSuffix;
 #endif
 
-       g_return_val_if_fail (program != NULL, NULL);
-       x = p = g_strdup (g_getenv ("PATH"));
+       u_return_val_if_fail (program != NULL, NULL);
+       x = p = u_strdup (u_getenv ("PATH"));
 
        if (x == NULL || *x == '\0') {
-               curdir = g_get_current_dir ();
+               curdir = u_get_current_dir ();
                x = curdir;
        }
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
        /* see if program already has a suffix */
        listx = 0;
        hasSuffix = FALSE;
        while (!hasSuffix && suffix_list[listx]) {
-               hasSuffix = g_str_has_suffix(program,suffix_list[listx++]);
+               hasSuffix = u_str_has_suffix(program,suffix_list[listx++]);
        }
 #endif
 
-       while ((l = strtok_r (x, G_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
+       while ((l = strtok_r (x, U_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
                char *probe_path; 
                
                x = NULL;
-               probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program, NULL);
+               probe_path = u_build_path (U_DIR_SEPARATOR_S, l, program, NULL);
                if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions 
test */
-                       g_free (curdir);
-                       g_free (p);
+                       u_free (curdir);
+                       u_free (p);
                        return probe_path;
                }
-               g_free (probe_path);
+               u_free (probe_path);
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
                /* check for program with a suffix attached */
                if (!hasSuffix) {
                        listx = 0;
                        while (suffix_list[listx]) {
-                               program_exe = g_strjoin(NULL,program,suffix_list[listx],NULL);
-                               probe_path = g_build_path (G_DIR_SEPARATOR_S, l, program_exe, NULL);
+                               program_exe = u_strjoin(NULL,program,suffix_list[listx],NULL);
+                               probe_path = u_build_path (U_DIR_SEPARATOR_S, l, program_exe, NULL);
                                if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read 
permissions test */
-                                       g_free (curdir);
-                                       g_free (p);
-                                       g_free (program_exe);
+                                       u_free (curdir);
+                                       u_free (p);
+                                       u_free (program_exe);
                                        return probe_path;
                                }
                                listx++;
-                               g_free (probe_path);
-                               g_free (program_exe);
+                               u_free (probe_path);
+                               u_free (program_exe);
                        }
                }
 #endif
        }
-       g_free (curdir);
-       g_free (p);
+       u_free (curdir);
+       u_free (p);
        return NULL;
 }
 
 static char *name;
 
 void
-g_set_prgname (const gchar *prgname)
+u_set_prgname (const char *prgname)
 {
-       name = g_strdup (prgname);
+       name = u_strdup (prgname);
 }
 
-gchar *
-g_get_prgname (void)
+char *
+u_get_prgname (void)
 {
        return name;
 }
diff --git a/deps/eglib/src/gptrarray.c b/deps/ulib/src/uptrarray.c
similarity index 50%
rename from deps/eglib/src/gptrarray.c
rename to deps/ulib/src/uptrarray.c
index 1caa354..81d2b76 100644
--- a/deps/eglib/src/gptrarray.c
+++ b/deps/ulib/src/uptrarray.c
@@ -32,21 +32,21 @@
 #include <config.h>
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
-typedef struct _GPtrArrayPriv {
-       gpointer *pdata;
-       guint len;
-       guint size;
-        GDestroyNotify element_free_func;
-} GPtrArrayPriv;
+typedef struct _UPtrArrayPriv {
+       void * *pdata;
+       unsigned int len;
+       unsigned int size;
+        UDestroyNotify element_free_func;
+} UPtrArrayPriv;
 
 static void 
-g_ptr_array_grow(GPtrArrayPriv *array, guint length)
+u_ptr_array_grow(UPtrArrayPriv *array, unsigned int length)
 {
-       guint new_length = array->len + length;
+       unsigned int new_length = array->len + length;
 
-       g_return_if_fail(array != NULL);
+       u_return_if_fail(array != NULL);
 
        if(new_length <= array->size) {
                return;
@@ -59,102 +59,102 @@ g_ptr_array_grow(GPtrArrayPriv *array, guint length)
        }
 
        array->size = MAX(array->size, 16);
-       array->pdata = g_realloc(array->pdata, array->size * sizeof(gpointer));
+       array->pdata = u_realloc(array->pdata, array->size * sizeof(void *));
 }
 
-GPtrArray *
-g_ptr_array_new(void)
+UPtrArray *
+u_ptr_array_new(void)
 {
-       return g_ptr_array_sized_new(0);
+       return u_ptr_array_sized_new(0);
 }
 
-GPtrArray *
-g_ptr_array_sized_new(guint reserved_size)
+UPtrArray *
+u_ptr_array_sized_new(unsigned int reserved_size)
 {
-       GPtrArrayPriv *array = g_new0(GPtrArrayPriv, 1);
+       UPtrArrayPriv *array = u_new0(UPtrArrayPriv, 1);
 
        array->pdata = NULL;
        array->len = 0;
        array->size = 0;
 
        if(reserved_size > 0) {
-               g_ptr_array_grow(array, reserved_size);
+               u_ptr_array_grow(array, reserved_size);
        }
 
-       return (GPtrArray *)array;
+       return (UPtrArray *)array;
 }
 
-GPtrArray *
-g_ptr_array_new_with_free_func(GDestroyNotify element_free_func)
+UPtrArray *
+u_ptr_array_new_with_free_func(UDestroyNotify element_free_func)
 {
-  GPtrArrayPriv *array = (GPtrArrayPriv *)g_ptr_array_sized_new (0);
+  UPtrArrayPriv *array = (UPtrArrayPriv *)u_ptr_array_sized_new (0);
   array->element_free_func = element_free_func;
-  return (GPtrArray *)array;
+  return (UPtrArray *)array;
 }
 
-gpointer *
-g_ptr_array_free(GPtrArray *array, gboolean free_seg)
+void * *
+u_ptr_array_free(UPtrArray *array, uboolean free_seg)
 {
-       gpointer *data = NULL;
+       void * *data = NULL;
        
-       g_return_val_if_fail(array != NULL, NULL);
+       u_return_val_if_fail(array != NULL, NULL);
 
        if(free_seg) {
-                GPtrArrayPriv *priv = (GPtrArrayPriv *)array;
-                gpointer *pdata = priv->pdata;
+                UPtrArrayPriv *priv = (UPtrArrayPriv *)array;
+                void * *pdata = priv->pdata;
 
                 if (priv->element_free_func) {
-                        GDestroyNotify free_func = priv->element_free_func;
+                        UDestroyNotify free_func = priv->element_free_func;
                         int i;
 
                         for (i = priv->len - 1; i > 0; i--)
                                 free_func (pdata[i]);
                 }
-               g_free(pdata);
+               u_free(pdata);
        } else {
                data = array->pdata;
        }
 
-       g_free(array);
+       u_free(array);
        
        return data;
 }
 
 void
-g_ptr_array_set_size(GPtrArray *array, gint length)
+u_ptr_array_set_size(UPtrArray *array, int length)
 {
-       g_return_if_fail(array != NULL);
+       u_return_if_fail(array != NULL);
 
        if((size_t)length > array->len) {
-               g_ptr_array_grow((GPtrArrayPriv *)array, length);
+               u_ptr_array_grow((UPtrArrayPriv *)array, length);
                memset(array->pdata + array->len, 0, (length - array->len) 
-                       * sizeof(gpointer));
+                       * sizeof(void *));
        }
 
        array->len = length;
 }
 
 void
-g_ptr_array_add(GPtrArray *array, gpointer data)
+u_ptr_array_add(UPtrArray *array, void * data)
 {
-       g_return_if_fail(array != NULL);
-       g_ptr_array_grow((GPtrArrayPriv *)array, 1);
+       u_return_if_fail(array != NULL);
+       u_ptr_array_grow((UPtrArrayPriv *)array, 1);
        array->pdata[array->len++] = data;
 }
 
-gpointer
-g_ptr_array_remove_index(GPtrArray *array, guint index)
+void *
+u_ptr_array_remove_index(UPtrArray *array, unsigned int index)
 {
-       gpointer removed_node;
+       void * removed_node;
        
-       g_return_val_if_fail(array != NULL, NULL);
-       g_return_val_if_fail(index >= 0 || index < array->len, NULL);
+       u_return_val_if_fail(array != NULL, NULL);
+       u_return_val_if_fail(index >= 0 || index < array->len, NULL);
 
        removed_node = array->pdata[index];
 
        if(index != array->len - 1) {
-               g_memmove(array->pdata + index, array->pdata + index + 1,
-                       (array->len - index - 1) * sizeof(gpointer));
+               u_memmove(array->pdata + index, array->pdata + index + 1,
+                       (array->len - index - 1) * sizeof(void *));
        }
        
        array->len--;
@@ -163,19 +163,19 @@ g_ptr_array_remove_index(GPtrArray *array, guint index)
        return removed_node;
 }
 
-gpointer
-g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
+void *
+u_ptr_array_remove_index_fast(UPtrArray *array, unsigned int index)
 {
-       gpointer removed_node;
+       void * removed_node;
 
-       g_return_val_if_fail(array != NULL, NULL);
-       g_return_val_if_fail(index >= 0 || index < array->len, NULL);
+       u_return_val_if_fail(array != NULL, NULL);
+       u_return_val_if_fail(index >= 0 || index < array->len, NULL);
 
        removed_node = array->pdata[index];
 
        if(index != array->len - 1) {
-               g_memmove(array->pdata + index, array->pdata + array->len - 1,
-                       sizeof(gpointer));
+               u_memmove(array->pdata + index, array->pdata + array->len - 1,
+                       sizeof(void *));
        }
 
        array->len--;
@@ -184,16 +184,16 @@ g_ptr_array_remove_index_fast(GPtrArray *array, guint index)
        return removed_node;
 }
 
-gboolean
-g_ptr_array_remove(GPtrArray *array, gpointer data)
+uboolean
+u_ptr_array_remove(UPtrArray *array, void * data)
 {
-       guint i;
+       unsigned int i;
 
-       g_return_val_if_fail(array != NULL, FALSE);
+       u_return_val_if_fail(array != NULL, FALSE);
 
        for(i = 0; i < array->len; i++) {
                if(array->pdata[i] == data) {
-                       g_ptr_array_remove_index(array, i);
+                       u_ptr_array_remove_index(array, i);
                        return TRUE;
                }
        }
@@ -201,12 +201,12 @@ g_ptr_array_remove(GPtrArray *array, gpointer data)
        return FALSE;
 }
 
-gboolean
-g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
+uboolean
+u_ptr_array_remove_fast(UPtrArray *array, void * data)
 {
-       guint i;
+       unsigned int i;
 
-       g_return_val_if_fail(array != NULL, FALSE);
+       u_return_val_if_fail(array != NULL, FALSE);
 
        for(i = 0; i < array->len; i++) {
                if(array->pdata[i] == data) {
@@ -223,26 +223,26 @@ g_ptr_array_remove_fast(GPtrArray *array, gpointer data)
 }
 
 void 
-g_ptr_array_foreach(GPtrArray *array, GFunc func, gpointer user_data)
+u_ptr_array_foreach(UPtrArray *array, UFunc func, void * user_data)
 {
-       guint i;
+       unsigned int i;
 
        for(i = 0; i < array->len; i++) {
-               func(g_ptr_array_index(array, i), user_data);
+               func(u_ptr_array_index(array, i), user_data);
        }
 }
 
 void
-g_ptr_array_sort(GPtrArray *array, GCompareFunc compare)
+u_ptr_array_sort(UPtrArray *array, UCompareFunc compare)
 {
-       g_return_if_fail(array != NULL);
-       qsort(array->pdata, array->len, sizeof(gpointer), compare);
+       u_return_if_fail(array != NULL);
+       qsort(array->pdata, array->len, sizeof(void *), compare);
 }
 
 void
-g_ptr_array_sort_with_data (GPtrArray *array, GCompareDataFunc compare, gpointer user_data)
+u_ptr_array_sort_with_data (UPtrArray *array, UCompareDataFunc compare, void * user_data)
 {
-       g_return_if_fail (array != NULL);
+       u_return_if_fail (array != NULL);
        
-       g_qsort_with_data (array->pdata, array->len, sizeof (gpointer), compare, user_data);
+       u_qsort_with_data (array->pdata, array->len, sizeof (void *), compare, user_data);
 }
diff --git a/deps/eglib/src/gqsort.c b/deps/ulib/src/uqsort.c
similarity index 97%
rename from deps/eglib/src/gqsort.c
rename to deps/ulib/src/uqsort.c
index 771edb8..784870c 100644
--- a/deps/eglib/src/gqsort.c
+++ b/deps/ulib/src/uqsort.c
@@ -29,7 +29,7 @@
 #include <config.h>
 
 #include <stdlib.h>
-#include <glib.h>
+#include <ulib.h>
 
 /* Any segment <= this threshold will be sorted using insertion
  * sort. OpenBSD seems to use a value of 7 so we'll go with that for
@@ -69,7 +69,7 @@ typedef struct _QSortStack {
 #define SWAP_INIT() swaplong = (((char *) base) - ((char *) 0)) % sizeof (long) == 0 && (size % sizeof 
(long)) == 0
 
 void
-g_qsort_with_data (gpointer base, size_t nmemb, size_t size, GCompareDataFunc compare, gpointer user_data)
+u_qsort_with_data (void * base, size_t nmemb, size_t size, UCompareDataFunc compare, void * user_data)
 {
        QSortStack stack[STACK_SIZE], *sp;
        register char *i, *k, *mid;
diff --git a/deps/eglib/src/gquark.c b/deps/ulib/src/uquark.c
similarity index 73%
rename from deps/eglib/src/gquark.c
rename to deps/ulib/src/uquark.c
index 7a88885..c741738 100644
--- a/deps/eglib/src/gquark.c
+++ b/deps/ulib/src/uquark.c
@@ -28,30 +28,30 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 
-static GHashTable *_quark_hash_table;
-static guint32 _next_quark;
+static UHashTable *_quark_hash_table;
+static uint32_t _next_quark;
 
-GQuark
-g_quark_from_static_string (const gchar *string)
+UQuark
+u_quark_from_static_string (const char *string)
 {
   void *quark_ptr;
 
-  if (G_UNLIKELY (_quark_hash_table == NULL))
+  if (U_UNLIKELY (_quark_hash_table == NULL))
     {
-      _quark_hash_table = g_hash_table_new (g_str_hash, g_str_equal);
+      _quark_hash_table = u_hash_table_new (u_str_hash, u_str_equal);
       _next_quark++;
     }
 
-  quark_ptr = g_hash_table_lookup (_quark_hash_table, string);
+  quark_ptr = u_hash_table_lookup (_quark_hash_table, string);
   if (!quark_ptr)
     {
-      GQuark new_quark = _next_quark++;
-      g_hash_table_insert (_quark_hash_table,
-                           (gpointer)string, GUINT_TO_POINTER (new_quark));
+      UQuark new_quark = _next_quark++;
+      u_hash_table_insert (_quark_hash_table,
+                           (void *)string, U_UINT_TO_POINTER (new_quark));
       return new_quark;
     }
   else
-    return GPOINTER_TO_UINT (quark_ptr);
+    return U_POINTER_TO_UINT (quark_ptr);
 }
diff --git a/deps/eglib/src/gqueue.c b/deps/ulib/src/uqueue.c
similarity index 64%
rename from deps/eglib/src/gqueue.c
rename to deps/ulib/src/uqueue.c
index 68302c4..781d27a 100644
--- a/deps/eglib/src/gqueue.c
+++ b/deps/ulib/src/uqueue.c
@@ -32,30 +32,30 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
 void
-g_queue_init (GQueue *queue)
+u_queue_init (UQueue *queue)
 {
        queue->head = NULL;
        queue->tail = NULL;
        queue->length = 0;
 }
 
-gpointer
-g_queue_peek_head (GQueue *queue)
+void *
+u_queue_peek_head (UQueue *queue)
 {
-        g_return_val_if_fail (queue, NULL);
+        u_return_val_if_fail (queue, NULL);
         return queue->head ? queue->head->data : NULL;
 }
 
-gpointer
-g_queue_pop_head (GQueue *queue)
+void *
+u_queue_pop_head (UQueue *queue)
 {
-       gpointer result;
-       GList *old_head;
+       void * result;
+       UList *old_head;
 
-        g_return_val_if_fail (queue, NULL);
+        u_return_val_if_fail (queue, NULL);
 
        if (!queue->head)
                return NULL;
@@ -63,7 +63,7 @@ g_queue_pop_head (GQueue *queue)
        result = queue->head->data;
        old_head = queue->head;
        queue->head = old_head->next;
-       g_list_free_1 (old_head);
+       u_list_free_1 (old_head);
 
        if (--queue->length)
                queue->head->prev = NULL;
@@ -73,20 +73,20 @@ g_queue_pop_head (GQueue *queue)
        return result;
 }
 
-gpointer
-g_queue_peek_tail (GQueue *queue)
+void *
+u_queue_peek_tail (UQueue *queue)
 {
-        g_return_val_if_fail (queue, NULL);
+        u_return_val_if_fail (queue, NULL);
         return queue->tail ? queue->tail->data : NULL;
 }
 
-gpointer
-g_queue_pop_tail (GQueue *queue)
+void *
+u_queue_pop_tail (UQueue *queue)
 {
-       gpointer result;
-       GList *old_tail;
+       void * result;
+       UList *old_tail;
 
-        g_return_val_if_fail (queue, NULL);
+        u_return_val_if_fail (queue, NULL);
 
        if (!queue->tail)
                return NULL;
@@ -101,24 +101,24 @@ g_queue_pop_tail (GQueue *queue)
                 queue->head = NULL;
 
         queue->length--;
-       g_list_free_1 (old_tail);
+       u_list_free_1 (old_tail);
 
         return result;
 }
 
-gboolean
-g_queue_is_empty (GQueue *queue)
+uboolean
+u_queue_is_empty (UQueue *queue)
 {
-        g_return_val_if_fail (queue, TRUE);
+        u_return_val_if_fail (queue, TRUE);
        return queue->length == 0;
 }
 
 void
-g_queue_push_head (GQueue *queue, gpointer head)
+u_queue_push_head (UQueue *queue, void * head)
 {
-        g_return_if_fail (queue);
+        u_return_if_fail (queue);
 
-       queue->head = g_list_prepend (queue->head, head);
+       queue->head = u_list_prepend (queue->head, head);
 
        if (!queue->tail)
                queue->tail = queue->head;
@@ -127,11 +127,11 @@ g_queue_push_head (GQueue *queue, gpointer head)
 }
 
 void
-g_queue_push_tail (GQueue *queue, gpointer data)
+u_queue_push_tail (UQueue *queue, void * data)
 {
-        g_return_if_fail (queue);
+        u_return_if_fail (queue);
 
-       queue->tail = g_list_append (queue->tail, data);
+       queue->tail = u_list_append (queue->tail, data);
        if (queue->head == NULL)
                queue->head = queue->tail;
        else
@@ -139,34 +139,34 @@ g_queue_push_tail (GQueue *queue, gpointer data)
        queue->length++;
 }
 
-GQueue *
-g_queue_new (void)
+UQueue *
+u_queue_new (void)
 {
-       return g_new0 (GQueue, 1);
+       return u_new0 (UQueue, 1);
 }
 
 void
-g_queue_free (GQueue *queue)
+u_queue_free (UQueue *queue)
 {
-        g_return_if_fail (queue);
+        u_return_if_fail (queue);
 
-       g_list_free (queue->head);
-       g_free (queue);
+       u_list_free (queue->head);
+       u_free (queue);
 }
 
 void
-g_queue_foreach (GQueue *queue, GFunc func, gpointer user_data)
+u_queue_foreach (UQueue *queue, UFunc func, void * user_data)
 {
-        g_return_if_fail (queue);
-        g_return_if_fail (func);
+        u_return_if_fail (queue);
+        u_return_if_fail (func);
 
-       g_list_foreach (queue->head, func, user_data);
+       u_list_foreach (queue->head, func, user_data);
 }
 
-GList *
-g_queue_find (GQueue *queue, gconstpointer data)
+UList *
+u_queue_find (UQueue *queue, const void * data)
 {
-        GList *l;
+        UList *l;
 
         for (l = queue->head; l; l = l->next)
                 if (l->data == data)
@@ -176,11 +176,11 @@ g_queue_find (GQueue *queue, gconstpointer data)
 }
 
 void
-g_queue_clear (GQueue *queue)
+u_queue_clear (UQueue *queue)
 {
-        g_return_if_fail (queue);
+        u_return_if_fail (queue);
 
-        g_list_free (queue->head);
+        u_list_free (queue->head);
         queue->length = 0;
         queue->head = NULL;
         queue->tail = NULL;
diff --git a/deps/eglib/src/gshell.c b/deps/ulib/src/ushell.c
similarity index 62%
rename from deps/eglib/src/gshell.c
rename to deps/ulib/src/ushell.c
index c2ea5b5..96568cf 100644
--- a/deps/eglib/src/gshell.c
+++ b/deps/ulib/src/ushell.c
@@ -29,25 +29,25 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
-GQuark
-g_shell_error_get_quark (void)
+UQuark
+u_shell_error_get_quark (void)
 {
-       return g_quark_from_static_string ("g-shell-error-quark");
+       return u_quark_from_static_string ("g-shell-error-quark");
 }
 
 static int
-split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
+split_cmdline (const char *cmdline, UPtrArray *array, UError **error)
 {
-       gchar *ptr;
-       gchar c;
-       gboolean escaped = FALSE, fresh = TRUE;
-       gchar quote_char = '\0';
-       GString *str;
+       char *ptr;
+       char c;
+       uboolean escaped = FALSE, fresh = TRUE;
+       char quote_char = '\0';
+       UString *str;
 
-       str = g_string_new ("");
-       ptr = (gchar *) cmdline;
+       str = u_string_new ("");
+       ptr = (char *) cmdline;
        while ((c = *ptr++) != '\0') {
                if (escaped) {
                        /*
@@ -56,28 +56,28 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
                         */
                        if (quote_char == '\"'){
                                if (!(c == '$' || c == '`' || c == '"' || c == '\\'))
-                                       g_string_append_c (str, '\\');
-                               g_string_append_c (str, c);
+                                       u_string_append_c (str, '\\');
+                               u_string_append_c (str, c);
                        } else {
-                               if (!g_ascii_isspace (c))
-                                       g_string_append_c (str, c);
+                               if (!u_ascii_isspace (c))
+                                       u_string_append_c (str, c);
                        }
                        escaped = FALSE;
                } else if (quote_char) {
                        if (c == quote_char) {
                                quote_char = '\0';
-                               if (fresh && (g_ascii_isspace (*ptr) || *ptr == '\0')){
-                                       g_ptr_array_add (array, g_string_free (str, FALSE));
-                                       str = g_string_new ("");
+                               if (fresh && (u_ascii_isspace (*ptr) || *ptr == '\0')){
+                                       u_ptr_array_add (array, u_string_free (str, FALSE));
+                                       str = u_string_new ("");
                                }
                        } else if (c == '\\'){
                                escaped = TRUE;
                        } else 
-                               g_string_append_c (str, c);
-               } else if (g_ascii_isspace (c)) {
+                               u_string_append_c (str, c);
+               } else if (u_ascii_isspace (c)) {
                        if (str->len > 0) {
-                               g_ptr_array_add (array, g_string_free (str, FALSE));
-                               str = g_string_new ("");
+                               u_ptr_array_add (array, u_string_free (str, FALSE));
+                               str = u_string_new ("");
                        }
                } else if (c == '\\') {
                        escaped = TRUE;
@@ -85,61 +85,61 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error)
                        fresh = str->len == 0;
                        quote_char = c;
                } else {
-                       g_string_append_c (str, c);
+                       u_string_append_c (str, c);
                }
        }
 
        if (escaped) {
                if (error)
-                       *error = g_error_new (G_SHELL_ERROR,
-                                              G_SHELL_ERROR_BAD_QUOTING,
+                       *error = u_error_new (U_SHELL_ERROR,
+                                              U_SHELL_ERROR_BAD_QUOTING,
                                               "Unfinished escape.");
-               g_string_free (str, TRUE);
+               u_string_free (str, TRUE);
                return -1;
        }
 
        if (quote_char) {
                if (error)
-                       *error = g_error_new (G_SHELL_ERROR,
-                                              G_SHELL_ERROR_BAD_QUOTING,
+                       *error = u_error_new (U_SHELL_ERROR,
+                                              U_SHELL_ERROR_BAD_QUOTING,
                                               "Unfinished quote.");
-               g_string_free (str, TRUE);
+               u_string_free (str, TRUE);
                return -1;
        }
 
        if (str->len > 0) {
-               g_ptr_array_add (array, g_string_free (str, FALSE));
+               u_ptr_array_add (array, u_string_free (str, FALSE));
        } else {
-               g_string_free (str, TRUE);
+               u_string_free (str, TRUE);
        }
-       g_ptr_array_add (array, NULL);
+       u_ptr_array_add (array, NULL);
        return 0;
 }
 
-gboolean
-g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error)
+uboolean
+u_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError **error)
 {
-       GPtrArray *array;
-       gint argc;
-       gchar **argv;
+       UPtrArray *array;
+       int argc;
+       char **argv;
 
-       g_return_val_if_fail (command_line, FALSE);
-       g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+       u_return_val_if_fail (command_line, FALSE);
+       u_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-       array = g_ptr_array_new();
+       array = u_ptr_array_new();
        if (split_cmdline (command_line, array, error)) {
-               g_ptr_array_add (array, NULL);
-               g_strfreev ((gchar **) array->pdata);
-               g_ptr_array_free (array, FALSE);
+               u_ptr_array_add (array, NULL);
+               u_strfreev ((char **) array->pdata);
+               u_ptr_array_free (array, FALSE);
                return FALSE;
        }
 
        argc = array->len;
-       argv = (gchar **) array->pdata;
+       argv = (char **) array->pdata;
 
        if (argc == 1) {
-               g_strfreev (argv);
-               g_ptr_array_free (array, FALSE);
+               u_strfreev (argv);
+               u_ptr_array_free (array, FALSE);
                return FALSE;
        }
 
@@ -150,32 +150,32 @@ g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GErr
        if (argvp) {
                *argvp = argv;
        } else {
-               g_strfreev (argv);
+               u_strfreev (argv);
        }
 
-       g_ptr_array_free (array, FALSE);
+       u_ptr_array_free (array, FALSE);
        return TRUE;
 }
 
-gchar *
-g_shell_quote (const gchar *unquoted_string)
+char *
+u_shell_quote (const char *unquoted_string)
 {
-       GString *result = g_string_new ("'");
-       const gchar *p;
+       UString *result = u_string_new ("'");
+       const char *p;
        
        for (p = unquoted_string; *p; p++){
                if (*p == '\'')
-                       g_string_append (result, "'\\'");
-               g_string_append_c (result, *p);
+                       u_string_append (result, "'\\'");
+               u_string_append_c (result, *p);
        }
-       g_string_append_c (result, '\'');
-       return g_string_free (result, FALSE);
+       u_string_append_c (result, '\'');
+       return u_string_free (result, FALSE);
 }
 
-gchar *
-g_shell_unquote (const gchar *quoted_string, GError **error)
+char *
+u_shell_unquote (const char *quoted_string, UError **error)
 {
-       GString *result;
+       UString *result;
        const char *p;
        int do_unquote = 0;
 
@@ -191,10 +191,10 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
        }
        
        if (!do_unquote)
-               return g_strdup (quoted_string);
+               return u_strdup (quoted_string);
 
        /* We do need to unquote */
-       result = g_string_new ("");
+       result = u_string_new ("");
        for (p = quoted_string; *p; p++){
 
                if (*p == '\''){
@@ -202,10 +202,10 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
                        for (p++; *p; p++){
                                if (*p == '\'')
                                        break;
-                               g_string_append_c (result, *p);
+                               u_string_append_c (result, *p);
                        }
                        if (!*p){
-                               g_set_error (error, 0, 0, "Open quote");
+                               u_set_error (error, 0, 0, "Open quote");
                                return NULL;
                        }
                } else if (*p == '"'){
@@ -216,7 +216,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
                                if (*p == '\\'){
                                        p++;
                                        if (*p == 0){
-                                               g_set_error (error, 0, 0, "Open quote");
+                                               u_set_error (error, 0, 0, "Open quote");
                                                return NULL;
                                        }
                                        switch (*p){
@@ -226,28 +226,28 @@ g_shell_unquote (const gchar *quoted_string, GError **error)
                                        case '`':
                                                break;
                                        default:
-                                               g_string_append_c (result, '\\');
+                                               u_string_append_c (result, '\\');
                                                break;
                                        }
                                } 
-                               g_string_append_c (result, *p);
+                               u_string_append_c (result, *p);
                        }
                        if (!*p){
-                               g_set_error (error, 0, 0, "Open quote");
+                               u_set_error (error, 0, 0, "Open quote");
                                return NULL;
                        }
                } else if (*p == '\\'){
                        char c = *(++p);
                        if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
-                               g_string_append_c (result, '\\');
+                               u_string_append_c (result, '\\');
                        if (c == 0)
                                break;
                        else
-                               g_string_append_c (result, c);
+                               u_string_append_c (result, c);
                } else
-                       g_string_append_c (result, *p);
+                       u_string_append_c (result, *p);
        }
-       return g_string_free (result, FALSE);
+       return u_string_free (result, FALSE);
 }
 
 #if JOINT_TEST
@@ -282,7 +282,7 @@ main ()
        int i;
        
        while (*s){
-               char *r1 = g_shell_unquote (*s, NULL);
+               char *r1 = u_shell_unquote (*s, NULL);
                char *r2 = g2_shell_unquote (*s, NULL);
                char *ok = r1 == r2 ? "ok" : (r1 != NULL && r2 != NULL && strcmp (r1, r2) == 0) ? "ok" : 
"fail";
                
@@ -298,7 +298,7 @@ main ()
        
        for (i = 32; i < 255; i++){
                buffer [2] = i;
-               printf ("%d [%s] -> [%s]\n", i, buffer, g_shell_unquote (buffer, NULL));
+               printf ("%d [%s] -> [%s]\n", i, buffer, u_shell_unquote (buffer, NULL));
        }
 }
 #endif
diff --git a/deps/eglib/src/gslist.c b/deps/ulib/src/uslist.c
similarity index 61%
rename from deps/eglib/src/gslist.c
rename to deps/ulib/src/uslist.c
index 1b12e47..dd44460 100644
--- a/deps/eglib/src/gslist.c
+++ b/deps/ulib/src/uslist.c
@@ -31,31 +31,31 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
-GSList*
-g_slist_alloc (void)
+USList*
+u_slist_alloc (void)
 {
-       return g_new0 (GSList, 1);
+       return u_new0 (USList, 1);
 }
 
 void
-g_slist_free_1 (GSList *list)
+u_slist_free_1 (USList *list)
 {
-       g_free (list);
+       u_free (list);
 }
 
-GSList*
-g_slist_append (GSList *list, gpointer data)
+USList*
+u_slist_append (USList *list, void * data)
 {
-       return g_slist_concat (list, g_slist_prepend (NULL, data));
+       return u_slist_concat (list, u_slist_prepend (NULL, data));
 }
 
 /* This is also a list node constructor. */
-GSList*
-g_slist_prepend (GSList *list, gpointer data)
+USList*
+u_slist_prepend (USList *list, void * data)
 {
-       GSList *head = g_slist_alloc ();
+       USList *head = u_slist_alloc ();
        head->data = data;
        head->next = list;
 
@@ -66,10 +66,10 @@ g_slist_prepend (GSList *list, gpointer data)
  * Insert the given data in a new node after the current node. 
  * Return new node.
  */
-static inline GSList *
-insert_after (GSList *list, gpointer data)
+static inline USList *
+insert_after (USList *list, void * data)
 {
-       list->next = g_slist_prepend (list->next, data);
+       list->next = u_slist_prepend (list->next, data);
        return list->next;
 }
 
@@ -78,10 +78,10 @@ insert_after (GSList *list, gpointer data)
  * If the list is empty, or the first node contains 'data', return NULL.
  * If no node contains 'data', return the last node.
  */
-static inline GSList*
-find_prev (GSList *list, gconstpointer data)
+static inline USList*
+find_prev (USList *list, const void * data)
 {
-       GSList *prev = NULL;
+       USList *prev = NULL;
        while (list) {
                if (list->data == data)
                        break;
@@ -92,10 +92,10 @@ find_prev (GSList *list, gconstpointer data)
 }
 
 /* like 'find_prev', but searches for node 'link' */
-static inline GSList*
-find_prev_link (GSList *list, GSList *link)
+static inline USList*
+find_prev_link (USList *list, USList *link)
 {
-       GSList *prev = NULL;
+       USList *prev = NULL;
        while (list) {
                if (list == link)
                        break;
@@ -105,37 +105,37 @@ find_prev_link (GSList *list, GSList *link)
        return prev;
 }
 
-GSList*
-g_slist_insert_before (GSList *list, GSList *sibling, gpointer data)
+USList*
+u_slist_insert_before (USList *list, USList *sibling, void * data)
 {
-       GSList *prev = find_prev_link (list, sibling);
+       USList *prev = find_prev_link (list, sibling);
 
        if (!prev)
-               return g_slist_prepend (list, data);
+               return u_slist_prepend (list, data);
 
        insert_after (prev, data);
        return list;
 }
 
 void
-g_slist_free (GSList *list)
+u_slist_free (USList *list)
 {
        while (list) {
-               GSList *next = list->next;
-               g_slist_free_1 (list);
+               USList *next = list->next;
+               u_slist_free_1 (list);
                list = next;
        }
 }
 
-GSList*
-g_slist_copy (GSList *list)
+USList*
+u_slist_copy (USList *list)
 {
-       GSList *copy, *tmp;
+       USList *copy, *tmp;
 
        if (!list)
                return NULL;
 
-       copy = g_slist_prepend (NULL, list->data);
+       copy = u_slist_prepend (NULL, list->data);
        tmp = copy;
 
        for (list = list->next; list; list = list->next)
@@ -144,18 +144,18 @@ g_slist_copy (GSList *list)
        return copy;
 }
 
-GSList*
-g_slist_concat (GSList *list1, GSList *list2)
+USList*
+u_slist_concat (USList *list1, USList *list2)
 {
        if (!list1)
                return list2;
 
-       g_slist_last (list1)->next = list2;
+       u_slist_last (list1)->next = list2;
        return list1;
 }
 
 void
-g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
+u_slist_foreach (USList *list, UFunc func, void * user_data)
 {
        while (list) {
                (*func) (list->data, user_data);
@@ -163,8 +163,8 @@ g_slist_foreach (GSList *list, GFunc func, gpointer user_data)
        }
 }
 
-GSList*
-g_slist_last (GSList *list)
+USList*
+u_slist_last (USList *list)
 {
        if (!list)
                return NULL;
@@ -175,8 +175,8 @@ g_slist_last (GSList *list)
        return list;
 }
 
-GSList*
-g_slist_find (GSList *list, gconstpointer data)
+USList*
+u_slist_find (USList *list, const void * data)
 {
        for (; list; list = list->next)
                if (list->data == data)
@@ -184,8 +184,8 @@ g_slist_find (GSList *list, gconstpointer data)
        return NULL;
 }
 
-GSList *
-g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func)
+USList *
+u_slist_find_custom (USList *list, const void * data, UCompareFunc func)
 {
        if (!func)
                return NULL;
@@ -200,10 +200,10 @@ g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func)
        return NULL;
 }
 
-guint
-g_slist_length (GSList *list)
+unsigned int
+u_slist_length (USList *list)
 {
-       guint length = 0;
+       unsigned int length = 0;
 
        while (list) {
                length ++;
@@ -213,32 +213,32 @@ g_slist_length (GSList *list)
        return length;
 }
 
-GSList*
-g_slist_remove (GSList *list, gconstpointer data)
+USList*
+u_slist_remove (USList *list, const void * data)
 {
-       GSList *prev = find_prev (list, data);
-       GSList *current = prev ? prev->next : list;
+       USList *prev = find_prev (list, data);
+       USList *current = prev ? prev->next : list;
 
        if (current) {
                if (prev)
                        prev->next = current->next;
                else
                        list = current->next;
-               g_slist_free_1 (current);
+               u_slist_free_1 (current);
        }
 
        return list;
 }
 
-GSList*
-g_slist_remove_all (GSList *list, gconstpointer data)
+USList*
+u_slist_remove_all (USList *list, const void * data)
 {
-       GSList *next = list;
-       GSList *prev = NULL;
-       GSList *current;
+       USList *next = list;
+       USList *prev = NULL;
+       USList *current;
 
        while (next) {
-               GSList *tmp_prev = find_prev (next, data);
+               USList *tmp_prev = find_prev (next, data);
                if (tmp_prev)
                        prev = tmp_prev;
                current = prev ? prev->next : list;
@@ -252,17 +252,17 @@ g_slist_remove_all (GSList *list, gconstpointer data)
                        prev->next = next;
                else
                        list = next;
-               g_slist_free_1 (current);
+               u_slist_free_1 (current);
        }
 
        return list;
 }
 
-GSList*
-g_slist_remove_link (GSList *list, GSList *link)
+USList*
+u_slist_remove_link (USList *list, USList *link)
 {
-       GSList *prev = find_prev_link (list, link);
-       GSList *current = prev ? prev->next : list;
+       USList *prev = find_prev_link (list, link);
+       USList *current = prev ? prev->next : list;
 
        if (current) {
                if (prev)
@@ -275,21 +275,21 @@ g_slist_remove_link (GSList *list, GSList *link)
        return list;
 }
 
-GSList*
-g_slist_delete_link (GSList *list, GSList *link)
+USList*
+u_slist_delete_link (USList *list, USList *link)
 {
-       list = g_slist_remove_link (list, link);
-       g_slist_free_1 (link);
+       list = u_slist_remove_link (list, link);
+       u_slist_free_1 (link);
 
        return list;
 }
 
-GSList*
-g_slist_reverse (GSList *list)
+USList*
+u_slist_reverse (USList *list)
 {
-       GSList *prev = NULL;
+       USList *prev = NULL;
        while (list){
-               GSList *next = list->next;
+               USList *next = list->next;
                list->next = prev;
                prev = list;
                list = next;
@@ -298,16 +298,16 @@ g_slist_reverse (GSList *list)
        return prev;
 }
 
-GSList*
-g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
+USList*
+u_slist_insert_sorted (USList *list, void * data, UCompareFunc func)
 {
-       GSList *prev = NULL;
+       USList *prev = NULL;
        
        if (!func)
                return list;
 
        if (!list || func (list->data, data) > 0)
-               return g_slist_prepend (list, data);
+               return u_slist_prepend (list, data);
 
        /* Invariant: func (prev->data, data) <= 0) */
        for (prev = list; prev->next; prev = prev->next)
@@ -319,10 +319,10 @@ g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func)
        return list;
 }
 
-gint
-g_slist_index (GSList *list, gconstpointer data)
+int
+u_slist_index (USList *list, const void * data)
 {
-       gint index = 0;
+       int index = 0;
        
        while (list) {
                if (list->data == data)
@@ -335,8 +335,8 @@ g_slist_index (GSList *list, gconstpointer data)
        return -1;
 }
 
-GSList*
-g_slist_nth (GSList *list, guint n)
+USList*
+u_slist_nth (USList *list, unsigned int n)
 {
        for (; list; list = list->next) {
                if (n == 0)
@@ -346,18 +346,18 @@ g_slist_nth (GSList *list, guint n)
        return list;
 }
 
-gpointer
-g_slist_nth_data (GSList *list, guint n)
+void *
+u_slist_nth_data (USList *list, unsigned int n)
 {
-       GSList *node = g_slist_nth (list, n);
+       USList *node = u_slist_nth (list, n);
        return node ? node->data : NULL;
 }
 
-typedef GSList list_node;
+typedef USList list_node;
 #include "sort.frag.h"
 
-GSList*
-g_slist_sort (GSList *list, GCompareFunc func)
+USList*
+u_slist_sort (USList *list, UCompareFunc func)
 {
        if (!list || !list->next)
                return list;
diff --git a/deps/eglib/src/gspawn.c b/deps/ulib/src/uspawn.c
similarity index 77%
rename from deps/eglib/src/gspawn.c
rename to deps/ulib/src/uspawn.c
index 3bb9390..8d01e19 100644
--- a/deps/eglib/src/gspawn.c
+++ b/deps/ulib/src/uspawn.c
@@ -32,7 +32,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 
-#include <glib.h>
+#include <ulib.h>
 
 #ifdef HAVE_UNISTD_H
 #ifndef __USE_GNU
@@ -49,7 +49,7 @@
 #include <sys/wait.h>
 #endif
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <io.h>
 #include <winsock2.h>
 #define open _open
@@ -60,9 +60,9 @@
 #define pipe(x) _pipe(x, 256, 0)
 #endif
 
-#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_SPAWN_ERROR, 1, msg, 
__VA_ARGS__); } while (0)
-#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_SPAWN_ERROR, 
1, msg, __VA_ARGS__); } while (0)
-#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_SPAWN_ERROR, 
status, msg, __VA_ARGS__); } while (0)
+#define set_error(msg, ...) do { if (error != NULL) *error = u_error_new (U_SPAWN_ERROR, 1, msg, 
__VA_ARGS__); } while (0)
+#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = u_error_new (U_SPAWN_ERROR, 
1, msg, __VA_ARGS__); } while (0)
+#define set_error_status(status,msg, ...) do { if (error != NULL) *error = u_error_new (U_SPAWN_ERROR, 
status, msg, __VA_ARGS__); } while (0)
 #define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
 #define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
 
@@ -71,7 +71,7 @@
  * arm-apple-darwin9.  We'll manually define the symbol on Apple as it does
  * in fact exist on all implementations (so far) 
  */
-gchar ***_NSGetEnviron();
+char ***_NSGetEnviron();
 #define environ (*_NSGetEnviron())
 #elif defined(_MSC_VER)
 /* MS defines this in stdlib.h */
@@ -79,16 +79,16 @@ gchar ***_NSGetEnviron();
 extern char **environ;
 #endif
 
-GQuark
-g_spawn_error_get_quark (void)
+UQuark
+u_spawn_error_get_quark (void)
 {
-       return g_quark_from_static_string ("g-spawn-error-quark");
+       return u_quark_from_static_string ("g-spawn-error-quark");
 }
 
 
-#ifndef G_OS_WIN32
+#ifndef U_OS_WIN32
 static int
-safe_read (int fd, gchar *buffer, gint count, GError **error)
+safe_read (int fd, char *buffer, int count, UError **error)
 {
        int res;
 
@@ -98,27 +98,27 @@ safe_read (int fd, gchar *buffer, gint count, GError **error)
 }
 
 static int
-read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error)
+read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error)
 {
        fd_set rfds;
        int res;
-       gboolean out_closed;
-       gboolean err_closed;
-       GString *out = NULL;
-       GString *err = NULL;
-       gchar *buffer = NULL;
-       gint nread;
+       uboolean out_closed;
+       uboolean err_closed;
+       UString *out = NULL;
+       UString *err = NULL;
+       char *buffer = NULL;
+       int nread;
 
        out_closed = (outfd < 0);
        err_closed = (errfd < 0);
        if (out_str) {
                *out_str = NULL;
-               out = g_string_new ("");
+               out = u_string_new ("");
        }       
 
        if (err_str) {
                *err_str = NULL;
-               err = g_string_new ("");
+               err = u_string_new ("");
        }       
 
        do {
@@ -143,7 +143,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err
                res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
                if (res > 0) {
                        if (buffer == NULL)
-                               buffer = g_malloc (1024);
+                               buffer = u_malloc (1024);
                        if (!out_closed && FD_ISSET (outfd, &rfds)) {
                                nread = safe_read (outfd, buffer, 1024, error);
                                if (nread < 0) {
@@ -151,7 +151,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err
                                        close (outfd);
                                        return -1;
                                }
-                               g_string_append_len (out, buffer, nread);
+                               u_string_append_len (out, buffer, nread);
                                if (nread <= 0) {
                                        out_closed = TRUE;
                                        close (outfd);
@@ -165,7 +165,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err
                                        close (outfd);
                                        return -1;
                                }
-                               g_string_append_len (err, buffer, nread);
+                               u_string_append_len (err, buffer, nread);
                                if (nread <= 0) {
                                        err_closed = TRUE;
                                        close (errfd);
@@ -174,18 +174,18 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err
                }
        } while (res > 0 || (res == -1 && errno == EINTR));
 
-       g_free (buffer);
+       u_free (buffer);
        if (out_str)
-               *out_str = g_string_free (out, FALSE);
+               *out_str = u_string_free (out, FALSE);
 
        if (err_str)
-               *err_str = g_string_free (err, FALSE);
+               *err_str = u_string_free (err, FALSE);
 
        return 0;
 }
 
-static gboolean
-create_pipe (int *fds, GError **error)
+static uboolean
+create_pipe (int *fds, UError **error)
 {
        if (pipe (fds) == -1) {
                set_error ("%s", "Error creating pipe.");
@@ -193,7 +193,7 @@ create_pipe (int *fds, GError **error)
        }
        return TRUE;
 }
-#endif /* G_OS_WIN32 */
+#endif /* U_OS_WIN32 */
 
 static int
 write_all (int fd, const void *vbuf, size_t n)
@@ -216,24 +216,24 @@ write_all (int fd, const void *vbuf, size_t n)
        return nwritten;
 }
 
-gboolean
-g_spawn_command_line_sync (const gchar *command_line,
-                               gchar **standard_output,
-                               gchar **standard_error,
-                               gint *exit_status,
-                               GError **error)
+uboolean
+u_spawn_command_line_sync (const char *command_line,
+                               char **standard_output,
+                               char **standard_error,
+                               int *exit_status,
+                               UError **error)
 {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #else
        pid_t pid;
-       gchar **argv;
-       gint argc;
+       char **argv;
+       int argc;
        int stdout_pipe [2] = { -1, -1 };
        int stderr_pipe [2] = { -1, -1 };
        int status;
        int res;
        
-       if (!g_shell_parse_argv (command_line, &argc, &argv, error))
+       if (!u_shell_parse_argv (command_line, &argc, &argv, error))
                return FALSE;
 
        if (standard_output && !create_pipe (stdout_pipe, error))
@@ -248,7 +248,7 @@ g_spawn_command_line_sync (const gchar *command_line,
 
        pid = fork ();
        if (pid == 0) {
-               gint i;
+               int i;
 
                if (standard_output) {
                        close (stdout_pipe [0]);
@@ -262,22 +262,22 @@ g_spawn_command_line_sync (const gchar *command_line,
                for (i = getdtablesize () - 1; i >= 3; i--)
                        close (i);
 
-               /* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
-               if (!g_path_is_absolute (argv [0])) {
-                       gchar *arg0;
+               /* U_SPAWN_SEARCH_PATH is always enabled for u_spawn_command_line_sync */
+               if (!u_path_is_absolute (argv [0])) {
+                       char *arg0;
 
-                       arg0 = g_find_program_in_path (argv [0]);
+                       arg0 = u_find_program_in_path (argv [0]);
                        if (arg0 == NULL) {
                                exit (1);
                        }
-                       //g_free (argv [0]);
+                       //u_free (argv [0]);
                        argv [0] = arg0;
                }
                execv (argv [0], argv);
                exit (1); /* TODO: What now? */
        }
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        if (standard_output)
                close (stdout_pipe [1]);
 
@@ -304,22 +304,22 @@ g_spawn_command_line_sync (const gchar *command_line,
 
 /*
  * This is the only use we have in mono/metadata
-!g_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, 
&ch_in, &ch_out, NULL, NULL)
+!u_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, U_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, 
&ch_in, &ch_out, NULL, NULL)
 */
-gboolean
-g_spawn_async_with_pipes (const gchar *working_directory,
-                       gchar **argv,
-                       gchar **envp,
-                       GSpawnFlags flags,
-                       GSpawnChildSetupFunc child_setup,
-                       gpointer user_data,
-                       GPid *child_pid,
-                       gint *standard_input,
-                       gint *standard_output,
-                       gint *standard_error,
-                       GError **error)
+uboolean
+u_spawn_async_with_pipes (const char *working_directory,
+                       char **argv,
+                       char **envp,
+                       USpawnFlags flags,
+                       USpawnChildSetupFunc child_setup,
+                       void * user_data,
+                       UPid *child_pid,
+                       int *standard_input,
+                       int *standard_output,
+                       int *standard_error,
+                       UError **error)
 {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #else
        pid_t pid;
        int info_pipe [2];
@@ -328,7 +328,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
        int err_pipe [2] = { -1, -1 };
        int status;
 
-       g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
+       u_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
 
        if (!create_pipe (info_pipe, error))
                return FALSE;
@@ -363,18 +363,18 @@ g_spawn_async_with_pipes (const gchar *working_directory,
 
        if (pid == 0) {
                /* No zombie left behind */
-               if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+               if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
                        pid = fork ();
                }
 
                if (pid != 0) {
                        exit (pid == -1 ? 1 : 0);
                }  else {
-                       gint i;
+                       int i;
                        int fd;
-                       gchar *arg0;
-                       gchar **actual_args;
-                       gint unused;
+                       char *arg0;
+                       char **actual_args;
+                       int unused;
 
                        close (info_pipe [0]);
                        close (in_pipe [1]);
@@ -387,7 +387,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
                         */
                        fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
 
-                       if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+                       if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
                                pid = getpid ();
                                NO_INTR (unused, write_all (info_pipe [1], &pid, sizeof (pid_t)));
                        }
@@ -400,31 +400,31 @@ g_spawn_async_with_pipes (const gchar *working_directory,
 
                        if (standard_output) {
                                dup2 (out_pipe [1], STDOUT_FILENO);
-                       } else if ((flags & G_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
+                       } else if ((flags & U_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
                                fd = open ("/dev/null", O_WRONLY);
                                dup2 (fd, STDOUT_FILENO);
                        }
 
                        if (standard_error) {
                                dup2 (err_pipe [1], STDERR_FILENO);
-                       } else if ((flags & G_SPAWN_STDERR_TO_DEV_NULL) != 0) {
+                       } else if ((flags & U_SPAWN_STDERR_TO_DEV_NULL) != 0) {
                                fd = open ("/dev/null", O_WRONLY);
                                dup2 (fd, STDERR_FILENO);
                        }
 
                        if (standard_input) {
                                dup2 (in_pipe [0], STDIN_FILENO);
-                       } else if ((flags & G_SPAWN_CHILD_INHERITS_STDIN) == 0) {
+                       } else if ((flags & U_SPAWN_CHILD_INHERITS_STDIN) == 0) {
                                fd = open ("/dev/null", O_RDONLY);
                                dup2 (fd, STDIN_FILENO);
                        }
 
-                       if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
+                       if ((flags & U_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
                                for (i = getdtablesize () - 1; i >= 3; i--)
                                        close (i);
                        }
 
-                       actual_args = ((flags & G_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
+                       actual_args = ((flags & U_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
                        if (envp == NULL)
                                envp = environ;
 
@@ -432,8 +432,8 @@ g_spawn_async_with_pipes (const gchar *working_directory,
                                child_setup (user_data);
 
                        arg0 = argv [0];
-                       if (!g_path_is_absolute (arg0) || (flags & G_SPAWN_SEARCH_PATH) != 0) {
-                               arg0 = g_find_program_in_path (argv [0]);
+                       if (!u_path_is_absolute (arg0) || (flags & U_SPAWN_SEARCH_PATH) != 0) {
+                               arg0 = u_find_program_in_path (argv [0]);
                                if (arg0 == NULL) {
                                        int err = ENOENT;
                                        write_all (info_pipe [1], &err, sizeof (int));
@@ -445,7 +445,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
                        write_all (info_pipe [1], &errno, sizeof (int));
                        exit (0);
                }
-       } else if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+       } else if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
                int w;
                /* Wait for the first child if two are created */
                NO_INTR (w, waitpid (pid, &status, 0));
@@ -463,7 +463,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
        close (out_pipe [1]);
        close (err_pipe [1]);
 
-       if ((flags & G_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+       if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
                int x;
                NO_INTR (x, read (info_pipe [0], &pid, sizeof (pid_t))); /* if we read < sizeof (pid_t)... */
        }
diff --git a/deps/eglib/src/gstr.c b/deps/ulib/src/ustr.c
similarity index 66%
rename from deps/eglib/src/gstr.c
rename to deps/ulib/src/ustr.c
index e8e449c..ed1494c 100644
--- a/deps/eglib/src/gstr.c
+++ b/deps/ulib/src/ustr.c
@@ -30,17 +30,17 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
-#include <glib.h>
+#include <ulib.h>
 
 /* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
-gchar *
-g_strndup (const gchar *str, gsize n)
+char *
+u_strndup (const char *str, size_t n)
 {
 #ifdef HAVE_STRNDUP
        return strndup (str, n);
 #else
        if (str) {
-               char *retval = g_malloc(n+1);
+               char *retval = u_malloc(n+1);
                if (retval) {
                        strncpy(retval, str, n)[n] = 0;
                }
@@ -51,54 +51,54 @@ g_strndup (const gchar *str, gsize n)
 }
 
 void
-g_strfreev (gchar **str_array)
+u_strfreev (char **str_array)
 {
-       gchar **orig = str_array;
+       char **orig = str_array;
        if (str_array == NULL)
                return;
        while (*str_array != NULL){
-               g_free (*str_array);
+               u_free (*str_array);
                str_array++;
        }
-       g_free (orig);
+       u_free (orig);
 }
 
-gchar **
-g_strdupv (gchar **str_array)
+char **
+u_strdupv (char **str_array)
 {
-       guint length;
-       gchar **ret;
-       guint i;
+       unsigned int length;
+       char **ret;
+       unsigned int i;
 
        if (!str_array)
                return NULL;
 
-       length = g_strv_length(str_array);
-       ret = g_new0(gchar *, length + 1);
+       length = u_strv_length(str_array);
+       ret = u_new0(char *, length + 1);
        for (i = 0; str_array[i]; i++) {
-               ret[i] = g_strdup(str_array[i]);
+               ret[i] = u_strdup(str_array[i]);
        }
        ret[length] = NULL;
        return ret;
 }
 
-guint
-g_strv_length(gchar **str_array)
+unsigned int
+u_strv_length(char **str_array)
 {
-       gint length = 0;
-       g_return_val_if_fail(str_array != NULL, 0);
+       int length = 0;
+       u_return_val_if_fail(str_array != NULL, 0);
        for(length = 0; str_array[length] != NULL; length++);
        return length;
 }
 
-gboolean
-g_str_has_suffix(const gchar *str, const gchar *suffix)
+uboolean
+u_str_has_suffix(const char *str, const char *suffix)
 {
        size_t str_length;
        size_t suffix_length;
        
-       g_return_val_if_fail(str != NULL, FALSE);
-       g_return_val_if_fail(suffix != NULL, FALSE);
+       u_return_val_if_fail(str != NULL, FALSE);
+       u_return_val_if_fail(suffix != NULL, FALSE);
 
        str_length = strlen(str);
        suffix_length = strlen(suffix);
@@ -108,14 +108,14 @@ g_str_has_suffix(const gchar *str, const gchar *suffix)
                FALSE;
 }
 
-gboolean
-g_str_has_prefix(const gchar *str, const gchar *prefix)
+uboolean
+u_str_has_prefix(const char *str, const char *prefix)
 {
        size_t str_length;
        size_t prefix_length;
        
-       g_return_val_if_fail(str != NULL, FALSE);
-       g_return_val_if_fail(prefix != NULL, FALSE);
+       u_return_val_if_fail(str != NULL, FALSE);
+       u_return_val_if_fail(prefix != NULL, FALSE);
 
        str_length = strlen(str);
        prefix_length = strlen(prefix);
@@ -125,8 +125,8 @@ g_str_has_prefix(const gchar *str, const gchar *prefix)
                FALSE;
 }
 
-gchar *
-g_strdup_vprintf (const gchar *format, va_list args)
+char *
+u_strdup_vprintf (const char *format, va_list args)
 {
        int n;
        char *ret;
@@ -138,10 +138,10 @@ g_strdup_vprintf (const gchar *format, va_list args)
        return ret;
 }
 
-gchar *
-g_strdup_printf (const gchar *format, ...)
+char *
+u_strdup_printf (const char *format, ...)
 {
-       gchar *ret;
+       char *ret;
        va_list args;
        int n;
 
@@ -154,19 +154,19 @@ g_strdup_printf (const gchar *format, ...)
        return ret;
 }
 
-const gchar *
-g_strerror (gint errnum)
+const char *
+u_strerror (int errnum)
 {
        return strerror (errnum);
 }
 
-gchar *
-g_strconcat (const gchar *first, ...)
+char *
+u_strconcat (const char *first, ...)
 {
        va_list args;
        size_t total = 0;
        char *s, *ret;
-       g_return_val_if_fail (first != NULL, NULL);
+       u_return_val_if_fail (first != NULL, NULL);
 
        total += strlen (first);
        va_start (args, first);
@@ -175,7 +175,7 @@ g_strconcat (const gchar *first, ...)
        }
        va_end (args);
        
-       ret = g_malloc (total + 1);
+       ret = u_malloc (total + 1);
        if (ret == NULL)
                return NULL;
 
@@ -191,29 +191,29 @@ g_strconcat (const gchar *first, ...)
 }
 
 static void
-add_to_vector (gchar ***vector, int size, gchar *token)
+add_to_vector (char ***vector, int size, char *token)
 {
        *vector = *vector == NULL ? 
-               (gchar **)g_malloc(2 * sizeof(*vector)) :
-               (gchar **)g_realloc(*vector, (size + 1) * sizeof(*vector));
+               (char **)u_malloc(2 * sizeof(*vector)) :
+               (char **)u_realloc(*vector, (size + 1) * sizeof(*vector));
                
        (*vector)[size - 1] = token;
 }
 
-gchar ** 
-g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+char ** 
+u_strsplit (const char *string, const char *delimiter, int max_tokens)
 {
-       const gchar *c;
-       gchar *token, **vector;
-       gint size = 1;
+       const char *c;
+       char *token, **vector;
+       int size = 1;
        
-       g_return_val_if_fail (string != NULL, NULL);
-       g_return_val_if_fail (delimiter != NULL, NULL);
-       g_return_val_if_fail (delimiter[0] != 0, NULL);
+       u_return_val_if_fail (string != NULL, NULL);
+       u_return_val_if_fail (delimiter != NULL, NULL);
+       u_return_val_if_fail (delimiter[0] != 0, NULL);
        
        if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
-               vector = (gchar **)g_malloc (2 * sizeof(vector));
-               vector[0] = g_strdup ("");
+               vector = (char **)u_malloc (2 * sizeof(vector));
+               vector[0] = u_strdup ("");
                size++;
                string += strlen (delimiter);
        } else {
@@ -223,7 +223,7 @@ g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
        while (*string && !(max_tokens > 0 && size >= max_tokens)) {
                c = string;
                if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
-                       token = g_strdup ("");
+                       token = u_strdup ("");
                        string += strlen (delimiter);
                } else {
                        while (*string && strncmp (string, delimiter, strlen (delimiter)) != 0) {
@@ -231,8 +231,8 @@ g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
                        }
 
                        if (*string) {
-                               gsize toklen = (string - c);
-                               token = g_strndup (c, toklen);
+                               size_t toklen = (string - c);
+                               token = u_strndup (c, toklen);
 
                                /* Need to leave a trailing empty
                                 * token if the delimiter is the last
@@ -242,7 +242,7 @@ g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
                                        string += strlen (delimiter);
                                }
                        } else {
-                               token = g_strdup (c);
+                               token = u_strdup (c);
                        }
                }
                        
@@ -252,16 +252,16 @@ g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
 
        if (*string) {
                if (strcmp (string, delimiter) == 0)
-                       add_to_vector (&vector, size, g_strdup (""));
+                       add_to_vector (&vector, size, u_strdup (""));
                else {
                        /* Add the rest of the string as the last element */
-                       add_to_vector (&vector, size, g_strdup (string));
+                       add_to_vector (&vector, size, u_strdup (string));
                }
                size++;
        }
        
        if (vector == NULL) {
-               vector = (gchar **) g_malloc (2 * sizeof (vector));
+               vector = (char **) u_malloc (2 * sizeof (vector));
                vector [0] = NULL;
        } else if (size > 0) {
                vector[size - 1] = NULL;
@@ -270,8 +270,8 @@ g_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
        return vector;
 }
 
-static gboolean
-charcmp (gchar testchar, const gchar *compare)
+static uboolean
+charcmp (char testchar, const char *compare)
 {
        while(*compare) {
                if (*compare == testchar) {
@@ -283,20 +283,20 @@ charcmp (gchar testchar, const gchar *compare)
        return FALSE;
 }
 
-gchar ** 
-g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
+char ** 
+u_strsplit_set (const char *string, const char *delimiter, int max_tokens)
 {
-       const gchar *c;
-       gchar *token, **vector;
-       gint size = 1;
+       const char *c;
+       char *token, **vector;
+       int size = 1;
        
-       g_return_val_if_fail (string != NULL, NULL);
-       g_return_val_if_fail (delimiter != NULL, NULL);
-       g_return_val_if_fail (delimiter[0] != 0, NULL);
+       u_return_val_if_fail (string != NULL, NULL);
+       u_return_val_if_fail (delimiter != NULL, NULL);
+       u_return_val_if_fail (delimiter[0] != 0, NULL);
        
        if (charcmp (*string, delimiter)) {
-               vector = (gchar **)g_malloc (2 * sizeof(vector));
-               vector[0] = g_strdup ("");
+               vector = (char **)u_malloc (2 * sizeof(vector));
+               vector[0] = u_strdup ("");
                size++;
                string++;
        } else {
@@ -306,11 +306,11 @@ g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
        c = string;
        while (*string && !(max_tokens > 0 && size >= max_tokens)) {
                if (charcmp (*string, delimiter)) {
-                       gsize toklen = (string - c);
+                       size_t toklen = (string - c);
                        if (toklen == 0) {
-                               token = g_strdup ("");
+                               token = u_strdup ("");
                        } else {
-                               token = g_strndup (c, toklen);
+                               token = u_strndup (c, toklen);
                        }
                        
                        c = string + 1;
@@ -325,25 +325,25 @@ g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
        if (max_tokens > 0 && size >= max_tokens) {
                if (*string) {
                        /* Add the rest of the string as the last element */
-                       add_to_vector (&vector, size, g_strdup (string));
+                       add_to_vector (&vector, size, u_strdup (string));
                        size++;
                }
        } else {
                if (*c) {
                        /* Fill in the trailing last token */
-                       add_to_vector (&vector, size, g_strdup (c));
+                       add_to_vector (&vector, size, u_strdup (c));
                        size++;
                } else {
                        /* Need to leave a trailing empty token if the
                         * delimiter is the last part of the string
                         */
-                       add_to_vector (&vector, size, g_strdup (""));
+                       add_to_vector (&vector, size, u_strdup (""));
                        size++;
                }
        }
        
        if (vector == NULL) {
-               vector = (gchar **) g_malloc (2 * sizeof (vector));
+               vector = (char **) u_malloc (2 * sizeof (vector));
                vector [0] = NULL;
        } else if (size > 0) {
                vector[size - 1] = NULL;
@@ -352,11 +352,11 @@ g_strsplit_set (const gchar *string, const gchar *delimiter, gint max_tokens)
        return vector;
 }
 
-gchar *
-g_strreverse (gchar *str)
+char *
+u_strreverse (char *str)
 {
        size_t i, j;
-       gchar c;
+       char c;
 
        if (str == NULL)
                return NULL;
@@ -373,8 +373,8 @@ g_strreverse (gchar *str)
        return str;
 }
 
-gchar *
-g_strjoin (const gchar *separator, ...)
+char *
+u_strjoin (const char *separator, ...)
 {
        va_list args;
        char *res, *s, *r;
@@ -394,28 +394,28 @@ g_strjoin (const gchar *separator, ...)
        va_end (args);
 
        if (len == 0)
-               return g_strdup ("");
+               return u_strdup ("");
        
        /* Remove the last separator */
        if (slen > 0 && len > 0)
                len -= slen;
 
-       res = g_malloc (len + 1);
+       res = u_malloc (len + 1);
        va_start (args, separator);
        s = va_arg (args, char *);
-       r = g_stpcpy (res, s);
+       r = u_stpcpy (res, s);
        for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
                if (separator != NULL)
-                       r = g_stpcpy (r, separator);
-               r = g_stpcpy (r, s);
+                       r = u_stpcpy (r, separator);
+               r = u_stpcpy (r, s);
        }
        va_end (args);
 
        return res;
 }
 
-gchar *
-g_strjoinv (const gchar *separator, gchar **str_array)
+char *
+u_strjoinv (const char *separator, char **str_array)
 {
        char *res, *r;
        size_t slen, len, i;
@@ -432,27 +432,27 @@ g_strjoinv (const gchar *separator, gchar **str_array)
        }
 
        if (len == 0)
-               return g_strdup ("");
+               return u_strdup ("");
 
        if (slen > 0 && len > 0)
                len -= slen;
 
-       res = g_malloc (len + 1);
-       r = g_stpcpy (res, str_array [0]);
+       res = u_malloc (len + 1);
+       r = u_stpcpy (res, str_array [0]);
        for (i = 1; str_array [i] != NULL; i++){
                if (separator != NULL)
-                       r = g_stpcpy (r, separator);
-               r = g_stpcpy (r, str_array [i]);
+                       r = u_stpcpy (r, separator);
+               r = u_stpcpy (r, str_array [i]);
        }
 
        return res;
 }
 
-gchar *
-g_strchug (gchar *str)
+char *
+u_strchug (char *str)
 {
        size_t len;
-       gchar *tmp;
+       char *tmp;
 
        if (str == NULL)
                return NULL;
@@ -466,10 +466,10 @@ g_strchug (gchar *str)
        return str;
 }
 
-gchar *
-g_strchomp (gchar *str)
+char *
+u_strchomp (char *str)
 {
-       gchar *tmp;
+       char *tmp;
 
        if (str == NULL)
                return NULL;
@@ -480,11 +480,11 @@ g_strchomp (gchar *str)
        return str;
 }
 
-gint
-g_printf(gchar const *format, ...)
+int
+u_printf(char const *format, ...)
 {
        va_list args;
-       gint ret;
+       int ret;
 
        va_start(args, format);
        ret = vprintf(format, args);
@@ -493,11 +493,11 @@ g_printf(gchar const *format, ...)
        return ret;
 }
 
-gint
-g_fprintf(FILE *file, gchar const *format, ...)
+int
+u_fprintf(FILE *file, char const *format, ...)
 {
        va_list args;
-       gint ret;
+       int ret;
 
        va_start(args, format);
        ret = vfprintf(file, format, args);
@@ -506,11 +506,11 @@ g_fprintf(FILE *file, gchar const *format, ...)
        return ret;
 }
 
-gint
-g_sprintf(gchar *string, gchar const *format, ...)
+int
+u_sprintf(char *string, char const *format, ...)
 {
        va_list args;
-       gint ret;
+       int ret;
 
        va_start(args, format);
        ret = vsprintf(string, format, args);
@@ -519,11 +519,11 @@ g_sprintf(gchar *string, gchar const *format, ...)
        return ret;
 }
 
-gint
-g_snprintf(gchar *string, gulong n, gchar const *format, ...)
+int
+u_snprintf(char *string, unsigned long n, char const *format, ...)
 {
        va_list args;
-       gint ret;
+       int ret;
        
        va_start(args, format);
        ret = vsnprintf(string, n, format, args);
@@ -535,7 +535,7 @@ g_snprintf(gchar *string, gulong n, gchar const *format, ...)
 static const char hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
                                  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
 
-static gboolean
+static uboolean
 char_needs_encoding (char c)
 {
        if (((unsigned char)c) >= 0x80)
@@ -549,27 +549,27 @@ char_needs_encoding (char c)
        return TRUE;
 }
 
-gchar *
-g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
+char *
+u_filename_to_uri (const char *filename, const char *hostname, UError **error)
 {
        size_t n;
        char *ret, *rp;
        const char *p;
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
        const char *uriPrefix = "file:///";
 #else
        const char *uriPrefix = "file://";
 #endif
        
-       g_return_val_if_fail (filename != NULL, NULL);
+       u_return_val_if_fail (filename != NULL, NULL);
 
        if (hostname != NULL)
-               g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled");
+               u_warning ("%s", "eglib: u_filename_to_uri: hostname not handled");
 
-       if (!g_path_is_absolute (filename)){
+       if (!u_path_is_absolute (filename)){
                if (error != NULL) {
-                       *error = g_error_new (G_CONVERT_ERROR,
-                                              G_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
+                       *error = u_error_new (U_CONVERT_ERROR,
+                                              U_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
                                               "Not an absolute filename");
                 }
                
@@ -578,7 +578,7 @@ g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
        
        n = strlen (uriPrefix) + 1;
        for (p = filename; *p; p++){
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
                if (*p == '\\') {
                        n++;
                        continue;
@@ -589,10 +589,10 @@ g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error)
                else
                        n++;
        }
-       ret = g_malloc (n);
+       ret = u_malloc (n);
        strcpy (ret, uriPrefix);
        for (p = filename, rp = ret + strlen (ret); *p; p++){
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
                if (*p == '\\') {
                        *rp++ = '/';
                        continue;
@@ -618,26 +618,26 @@ decode (char p)
                return p - 'A';
        if (p >= 'a' && p <= 'f')
                return p - 'a';
-       g_assert_not_reached ();
+       u_assert_not_reached ();
        return 0;
 }
 
-gchar *
-g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
+char *
+u_filename_from_uri (const char *uri, char **hostname, UError **error)
 {
        const char *p;
        char *r, *result;
        int flen = 0;
        
-       g_return_val_if_fail (uri != NULL, NULL);
+       u_return_val_if_fail (uri != NULL, NULL);
 
        if (hostname != NULL)
-               g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled");
+               u_warning ("%s", "eglib: u_filename_from_uri: hostname not handled");
 
        if (strncmp (uri, "file:///", 8) != 0){
                if (error != NULL) {
-                       *error = g_error_new (G_CONVERT_ERROR,
-                                              G_CONVERT_ERROR_BAD_URI,
+                       *error = u_error_new (U_CONVERT_ERROR,
+                                              U_CONVERT_ERROR_BAD_URI,
                                               "URI does not start with the file: scheme");
                 }
                return NULL;
@@ -649,8 +649,8 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
                                p += 2;
                        } else {
                                if (error != NULL) {
-                                       *error = g_error_new (G_CONVERT_ERROR,
-                                                              G_CONVERT_ERROR_BAD_URI,
+                                       *error = u_error_new (U_CONVERT_ERROR,
+                                                              U_CONVERT_ERROR_BAD_URI,
                                                               "URI contains an invalid escape sequence");
                                 }
                                return NULL;
@@ -658,14 +658,14 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
                } 
                flen++;
        }
-#ifndef G_OS_WIN32
+#ifndef U_OS_WIN32
        flen++;
 #endif
 
-       result = g_malloc (flen + 1);
+       result = u_malloc (flen + 1);
        result [flen] = 0;
 
-#ifndef G_OS_WIN32
+#ifndef U_OS_WIN32
        *result = '/';
        r = result + 1;
 #else
@@ -684,77 +684,77 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error)
 }
 
 void
-g_strdown (gchar *string)
+u_strdown (char *string)
 {
-       g_return_if_fail (string != NULL);
+       u_return_if_fail (string != NULL);
 
        while (*string){
-               *string = (gchar)tolower (*string);
+               *string = (char)tolower (*string);
                string++;
        }
 }
 
-gchar
-g_ascii_tolower (gchar c)
+char
+u_ascii_tolower (char c)
 {
        return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
 }
 
-gchar *
-g_ascii_strdown (const gchar *str, gssize len)
+char *
+u_ascii_strdown (const char *str, ussize len)
 {
        char *ret;
        int i;
        
-       g_return_val_if_fail  (str != NULL, NULL);
+       u_return_val_if_fail  (str != NULL, NULL);
 
        if (len == -1)
                len = strlen (str);
        
-       ret = g_malloc (len + 1);
+       ret = u_malloc (len + 1);
        for (i = 0; i < len; i++)
-               ret [i] = (guchar) g_ascii_tolower (str [i]);
+               ret [i] = (unsigned char) u_ascii_tolower (str [i]);
        ret [i] = 0;
        
        return ret;
 }
 
-gchar
-g_ascii_toupper (gchar c)
+char
+u_ascii_toupper (char c)
 {
        return c >= 'a' && c <= 'z' ? c + ('A' - 'a') : c;
 }
 
-gchar *
-g_ascii_strup (const gchar *str, gssize len)
+char *
+u_ascii_strup (const char *str, ussize len)
 {
        char *ret;
        int i;
        
-       g_return_val_if_fail  (str != NULL, NULL);
+       u_return_val_if_fail  (str != NULL, NULL);
 
        if (len == -1)
                len = strlen (str);
        
-       ret = g_malloc (len + 1);
+       ret = u_malloc (len + 1);
        for (i = 0; i < len; i++)
-               ret [i] = (guchar) g_ascii_toupper (str [i]);
+               ret [i] = (unsigned char) u_ascii_toupper (str [i]);
        ret [i] = 0;
        
        return ret;
 }
 
-gint
-g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
+int
+u_ascii_strncasecmp (const char *s1, const char *s2, size_t n)
 {
-       gsize i;
+       size_t i;
        
-       g_return_val_if_fail (s1 != NULL, 0);
-       g_return_val_if_fail (s2 != NULL, 0);
+       u_return_val_if_fail (s1 != NULL, 0);
+       u_return_val_if_fail (s2 != NULL, 0);
 
        for (i = 0; i < n; i++) {
-               gchar c1 = g_ascii_tolower (*s1++);
-               gchar c2 = g_ascii_tolower (*s2++);
+               char c1 = u_ascii_tolower (*s1++);
+               char c2 = u_ascii_tolower (*s2++);
                
                if (c1 != c2)
                        return c1 - c2;
@@ -763,18 +763,18 @@ g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n)
        return 0;
 }
 
-gint
-g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
+int
+u_ascii_strcasecmp (const char *s1, const char *s2)
 {
        const char *sp1 = s1;
        const char *sp2 = s2;
        
-       g_return_val_if_fail (s1 != NULL, 0);
-       g_return_val_if_fail (s2 != NULL, 0);
+       u_return_val_if_fail (s1 != NULL, 0);
+       u_return_val_if_fail (s2 != NULL, 0);
        
        while (*sp1 != '\0') {
-               char c1 = g_ascii_tolower (*sp1++);
-               char c2 = g_ascii_tolower (*sp2++);
+               char c1 = u_ascii_tolower (*sp1++);
+               char c2 = u_ascii_tolower (*sp2++);
                
                if (c1 != c2)
                        return c1 - c2;
@@ -783,15 +783,15 @@ g_ascii_strcasecmp (const gchar *s1, const gchar *s2)
        return (*sp1) - (*sp2);
 }
 
-gchar *
-g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
+char *
+u_strdelimit (char *string, const char *delimiters, char new_delimiter)
 {
-       gchar *ptr;
+       char *ptr;
 
-       g_return_val_if_fail (string != NULL, NULL);
+       u_return_val_if_fail (string != NULL, NULL);
 
        if (delimiters == NULL)
-               delimiters = G_STR_DELIMITERS;
+               delimiters = U_STR_DELIMITERS;
 
        for (ptr = string; *ptr; ptr++) {
                if (strchr (delimiters, *ptr))
@@ -801,19 +801,19 @@ g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter)
        return string;
 }
 
-gsize 
-g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
+size_t 
+u_strlcpy (char *dest, const char *src, size_t dest_size)
 {
 #ifdef HAVE_STRLCPY
        return strlcpy (dest, src, dest_size);
 #else
-       gchar *d;
-       const gchar *s;
-       gchar c;
-       gsize len;
+       char *d;
+       const char *s;
+       char c;
+       size_t len;
        
-       g_return_val_if_fail (src != NULL, 0);
-       g_return_val_if_fail (dest != NULL, 0);
+       u_return_val_if_fail (src != NULL, 0);
+       u_return_val_if_fail (dest != NULL, 0);
 
        len = dest_size;
        if (len == 0)
@@ -836,11 +836,11 @@ g_strlcpy (gchar *dest, const gchar *src, gsize dest_size)
 #endif
 }
 
-gchar *
-g_stpcpy (gchar *dest, const char *src)
+char *
+u_stpcpy (char *dest, const char *src)
 {
-       g_return_val_if_fail (dest != NULL, dest);
-       g_return_val_if_fail (src != NULL, dest);
+       u_return_val_if_fail (dest != NULL, dest);
+       u_return_val_if_fail (src != NULL, dest);
 
 #if HAVE_STPCPY
        return stpcpy (dest, src);
@@ -854,7 +854,7 @@ g_stpcpy (gchar *dest, const char *src)
 #endif
 }
 
-static const gchar escaped_dflt [256] = {
+static const char escaped_dflt [256] = {
        1, 1, 1, 1, 1, 1, 1, 1, 'b', 't', 'n', 1, 'f', 'r', 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        0, 0, '"', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -873,24 +873,24 @@ static const gchar escaped_dflt [256] = {
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
 };
 
-gchar *
-g_strescape (const gchar *source, const gchar *exceptions)
+char *
+u_strescape (const char *source, const char *exceptions)
 {
-       gchar escaped [256];
-       const gchar *ptr;
-       gchar c;
-       gchar op;
-       gchar *result;
-       gchar *res_ptr;
+       char escaped [256];
+       const char *ptr;
+       char c;
+       char op;
+       char *result;
+       char *res_ptr;
 
-       g_return_val_if_fail (source != NULL, NULL);
+       u_return_val_if_fail (source != NULL, NULL);
 
        memcpy (escaped, escaped_dflt, 256);
        if (exceptions != NULL) {
                for (ptr = exceptions; *ptr; ptr++)
                        escaped [(int) *ptr] = 0;
        }
-       result = g_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
+       result = u_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
        res_ptr = result;
        for (ptr = source; *ptr; ptr++) {
                c = *ptr;
@@ -912,8 +912,8 @@ g_strescape (const gchar *source, const gchar *exceptions)
        return result;
 }
 
-gint
-g_ascii_xdigit_value (gchar c)
+int
+u_ascii_xdigit_value (char c)
 {
        return ((isxdigit (c) == 0) ? -1 :
                ((c >= '0' && c <= '9') ? (c - '0') :
@@ -921,10 +921,10 @@ g_ascii_xdigit_value (gchar c)
                  (c - 'A' + 10))));
 }
 
-gchar *
-g_strnfill (gsize length, gchar fill_char)
+char *
+u_strnfill (size_t length, char fill_char)
 {
-       gchar *ret = g_new (gchar, length + 1);
+       char *ret = u_new (char, length + 1);
 
        memset (ret, fill_char, length);
        ret [length] = 0;
diff --git a/deps/eglib/src/gstring.c b/deps/ulib/src/ustring.c
similarity index 51%
rename from deps/eglib/src/gstring.c
rename to deps/ulib/src/ustring.c
index 38dfc45..c918433 100644
--- a/deps/eglib/src/gstring.c
+++ b/deps/ulib/src/ustring.c
@@ -30,26 +30,26 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
-#define GROW_IF_NECESSARY(s,l) { \
+#define UROW_IF_NECESSARY(s,l) { \
        if(s->len + l >= s->allocated_len) { \
                s->allocated_len = (s->allocated_len + l + 16) * 2; \
-               s->str = g_realloc(s->str, s->allocated_len); \
+               s->str = u_realloc(s->str, s->allocated_len); \
        } \
 }
 
-GString *
-g_string_new_len (const gchar *init, gssize len)
+UString *
+u_string_new_len (const char *init, ussize len)
 {
-       GString *ret = g_new (GString, 1);
+       UString *ret = u_new (UString, 1);
 
        if (init == NULL)
                ret->len = 0;
        else
                ret->len = len < 0 ? strlen(init) : len;
        ret->allocated_len = MAX(ret->len + 1, 16);
-       ret->str = g_malloc(ret->allocated_len);
+       ret->str = u_malloc(ret->allocated_len);
        if (init)
                memcpy(ret->str, init, ret->len);
        ret->str[ret->len] = 0;
@@ -57,18 +57,18 @@ g_string_new_len (const gchar *init, gssize len)
        return ret;
 }
 
-GString *
-g_string_new (const gchar *init)
+UString *
+u_string_new (const char *init)
 {
-       return g_string_new_len(init, -1);
+       return u_string_new_len(init, -1);
 }
 
-GString *
-g_string_sized_new (gsize default_size)
+UString *
+u_string_sized_new (size_t default_size)
 {
-       GString *ret = g_new (GString, 1);
+       UString *ret = u_new (UString, 1);
 
-       ret->str = g_malloc (default_size);
+       ret->str = u_malloc (default_size);
        ret->str [0] = 0;
        ret->len = 0;
        ret->allocated_len = default_size;
@@ -76,49 +76,49 @@ g_string_sized_new (gsize default_size)
        return ret;
 }
 
-gchar *
-g_string_free (GString *string, gboolean free_segment)
+char *
+u_string_free (UString *string, uboolean free_segment)
 {
-       gchar *data;
+       char *data;
        
-       g_return_val_if_fail (string != NULL, NULL);
+       u_return_val_if_fail (string != NULL, NULL);
 
        data = string->str;
-       g_free(string);
+       u_free(string);
        
        if(!free_segment) {
                return data;
        }
 
-       g_free(data);
+       u_free(data);
        return NULL;
 }
 
-GString *
-g_string_assign (GString *string, const gchar *val)
+UString *
+u_string_assign (UString *string, const char *val)
 {
-       g_return_val_if_fail(string != NULL, NULL);
-       g_return_val_if_fail(val != NULL, string);
+       u_return_val_if_fail(string != NULL, NULL);
+       u_return_val_if_fail(val != NULL, string);
        
         if (string->str == val)
           return string;
 
-        g_string_truncate (string, 0);
-        g_string_append (string, val);
+        u_string_truncate (string, 0);
+        u_string_append (string, val);
         return string;
 }
 
-GString *
-g_string_append_len (GString *string, const gchar *val, gssize len)
+UString *
+u_string_append_len (UString *string, const char *val, ussize len)
 {
-       g_return_val_if_fail(string != NULL, NULL);
-       g_return_val_if_fail(val != NULL, string);
+       u_return_val_if_fail(string != NULL, NULL);
+       u_return_val_if_fail(val != NULL, string);
 
        if(len < 0) {
                len = strlen(val);
        }
 
-       GROW_IF_NECESSARY(string, len);
+       UROW_IF_NECESSARY(string, len);
        memcpy(string->str + string->len, val, len);
        string->len += len;
        string->str[string->len] = 0;
@@ -126,21 +126,21 @@ g_string_append_len (GString *string, const gchar *val, gssize len)
        return string;
 }
 
-GString *
-g_string_append (GString *string, const gchar *val)
+UString *
+u_string_append (UString *string, const char *val)
 {
-       g_return_val_if_fail(string != NULL, NULL);
-       g_return_val_if_fail(val != NULL, string);
+       u_return_val_if_fail(string != NULL, NULL);
+       u_return_val_if_fail(val != NULL, string);
 
-       return g_string_append_len(string, val, -1);
+       return u_string_append_len(string, val, -1);
 }
 
-GString *
-g_string_append_c (GString *string, gchar c)
+UString *
+u_string_append_c (UString *string, char c)
 {
-       g_return_val_if_fail(string != NULL, NULL);
+       u_return_val_if_fail(string != NULL, NULL);
 
-       GROW_IF_NECESSARY(string, 1);
+       UROW_IF_NECESSARY(string, 1);
        
        string->str[string->len] = c;
        string->str[string->len + 1] = 0;
@@ -149,49 +149,49 @@ g_string_append_c (GString *string, gchar c)
        return string;
 }
 
-GString *
-g_string_append_unichar (GString *string, gunichar c)
+UString *
+u_string_append_unichar (UString *string, uunichar c)
 {
-       gchar utf8[6];
-       gint len;
+       char utf8[6];
+       int len;
        
-       g_return_val_if_fail (string != NULL, NULL);
+       u_return_val_if_fail (string != NULL, NULL);
        
-       if ((len = g_unichar_to_utf8 (c, utf8)) <= 0)
+       if ((len = u_unichar_to_utf8 (c, utf8)) <= 0)
                return string;
        
-       return g_string_append_len (string, utf8, len);
+       return u_string_append_len (string, utf8, len);
 }
 
-GString *
-g_string_prepend (GString *string, const gchar *val)
+UString *
+u_string_prepend (UString *string, const char *val)
 {
-       gssize len;
+       ussize len;
        
-       g_return_val_if_fail (string != NULL, string);
-       g_return_val_if_fail (val != NULL, string);
+       u_return_val_if_fail (string != NULL, string);
+       u_return_val_if_fail (val != NULL, string);
 
        len = strlen (val);
        
-       GROW_IF_NECESSARY(string, len); 
+       UROW_IF_NECESSARY(string, len); 
        memmove(string->str + len, string->str, string->len + 1);
        memcpy(string->str, val, len);
 
        return string;
 }
 
-GString *
-g_string_insert (GString *string, gssize pos, const gchar *val)
+UString *
+u_string_insert (UString *string, ussize pos, const char *val)
 {
-       gssize len;
+       ussize len;
        
-       g_return_val_if_fail (string != NULL, string);
-       g_return_val_if_fail (val != NULL, string);
-       g_return_val_if_fail (pos <= string->len, string);
+       u_return_val_if_fail (string != NULL, string);
+       u_return_val_if_fail (val != NULL, string);
+       u_return_val_if_fail (pos <= string->len, string);
 
        len = strlen (val);
        
-       GROW_IF_NECESSARY(string, len); 
+       UROW_IF_NECESSARY(string, len); 
        memmove(string->str + pos + len, string->str + pos, string->len - pos - len + 1);
        memcpy(string->str + pos, val, len);
 
@@ -199,57 +199,57 @@ g_string_insert (GString *string, gssize pos, const gchar *val)
 }
 
 void
-g_string_append_printf (GString *string, const gchar *format, ...)
+u_string_append_printf (UString *string, const char *format, ...)
 {
        char *ret;
        va_list args;
        
-       g_return_if_fail (string != NULL);
-       g_return_if_fail (format != NULL);
+       u_return_if_fail (string != NULL);
+       u_return_if_fail (format != NULL);
 
        va_start (args, format);
-       ret = g_strdup_vprintf (format, args);
+       ret = u_strdup_vprintf (format, args);
        va_end (args);
-       g_string_append (string, ret);
+       u_string_append (string, ret);
 
-       g_free (ret);
+       u_free (ret);
 }
 
 void
-g_string_append_vprintf (GString *string, const gchar *format, va_list args)
+u_string_append_vprintf (UString *string, const char *format, va_list args)
 {
        char *ret;
 
-       g_return_if_fail (string != NULL);
-       g_return_if_fail (format != NULL);
+       u_return_if_fail (string != NULL);
+       u_return_if_fail (format != NULL);
 
-       ret = g_strdup_vprintf (format, args);
-       g_string_append (string, ret);
-       g_free (ret);
+       ret = u_strdup_vprintf (format, args);
+       u_string_append (string, ret);
+       u_free (ret);
 }
 
 void
-g_string_printf (GString *string, const gchar *format, ...)
+u_string_printf (UString *string, const char *format, ...)
 {
        va_list args;
        
-       g_return_if_fail (string != NULL);
-       g_return_if_fail (format != NULL);
+       u_return_if_fail (string != NULL);
+       u_return_if_fail (format != NULL);
 
-       g_free (string->str);
+       u_free (string->str);
        
        va_start (args, format);
-       string->str = g_strdup_vprintf (format, args);
+       string->str = u_strdup_vprintf (format, args);
        va_end (args);
 
        string->len = strlen (string->str);
        string->allocated_len = string->len+1;
 }
 
-GString *
-g_string_truncate (GString *string, gsize len)
+UString *
+u_string_truncate (UString *string, size_t len)
 {
-       g_return_val_if_fail (string != NULL, string);
+       u_return_val_if_fail (string != NULL, string);
 
        /* Silent return */
        if (len >= string->len)
@@ -260,22 +260,22 @@ g_string_truncate (GString *string, gsize len)
        return string;
 }
 
-GString *
-g_string_set_size (GString *string, gsize len)
+UString *
+u_string_set_size (UString *string, size_t len)
 {
-       g_return_val_if_fail (string != NULL, string);
+       u_return_val_if_fail (string != NULL, string);
 
-       GROW_IF_NECESSARY(string, len);
+       UROW_IF_NECESSARY(string, len);
        
        string->len = len;
        string->str[len] = 0;
        return string;
 }
 
-GString *
-g_string_erase (GString *string, gssize pos, gssize len)
+UString *
+u_string_erase (UString *string, ussize pos, ussize len)
 {
-       g_return_val_if_fail (string != NULL, string);
+       u_return_val_if_fail (string != NULL, string);
 
        /* Silent return */
        if (pos >= string->len)
diff --git a/deps/eglib/src/gtimer-unix.c b/deps/ulib/src/utimer-unix.c
similarity index 79%
rename from deps/eglib/src/gtimer-unix.c
rename to deps/ulib/src/utimer-unix.c
index 901f921..c895d20 100644
--- a/deps/eglib/src/gtimer-unix.c
+++ b/deps/ulib/src/utimer-unix.c
@@ -28,54 +28,54 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <sys/time.h>
 
-struct _GTimer {
+struct _UTimer {
        struct timeval start;
        struct timeval stop;
 };
 
-GTimer *g_timer_new (void)
+UTimer *u_timer_new (void)
 {
-       GTimer *timer;
+       UTimer *timer;
 
-       timer = g_new0 (GTimer, 1);
-       g_timer_start (timer);
+       timer = u_new0 (UTimer, 1);
+       u_timer_start (timer);
        return timer;
 }
 
 void
-g_timer_destroy (GTimer *timer)
+u_timer_destroy (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
-       g_free (timer);
+       u_return_if_fail (timer != NULL);
+       u_free (timer);
 }
 
 void
-g_timer_start (GTimer *timer)
+u_timer_start (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
+       u_return_if_fail (timer != NULL);
        gettimeofday (&timer->start, NULL);
        memset (&timer->stop, 0, sizeof (struct timeval));
 }
 
 void
-g_timer_stop (GTimer *timer)
+u_timer_stop (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
+       u_return_if_fail (timer != NULL);
        gettimeofday (&timer->stop, NULL);
 }
 
-gdouble
-g_timer_elapsed (GTimer *timer, gulong *microseconds)
+double
+u_timer_elapsed (UTimer *timer, unsigned long *microseconds)
 {
        struct timeval tv;
-       gulong seconds;
+       unsigned long seconds;
        long usec;
-       gdouble result;
+       double result;
 
-       g_return_val_if_fail (timer != NULL, 0.0);
+       u_return_val_if_fail (timer != NULL, 0.0);
 
        if (timer->stop.tv_sec == 0 && timer->stop.tv_usec == 0) {
                gettimeofday (&tv, NULL);
diff --git a/deps/eglib/src/gtimer-win32.c b/deps/ulib/src/utimer-win32.c
similarity index 73%
rename from deps/eglib/src/gtimer-win32.c
rename to deps/ulib/src/utimer-win32.c
index 2025eee..b181ab8 100644
--- a/deps/eglib/src/gtimer-win32.c
+++ b/deps/ulib/src/utimer-win32.c
@@ -28,51 +28,51 @@
 
 #include <config.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <windows.h>
 
-struct _GTimer {
-       guint64 start;
-       guint64 stop;
+struct _UTimer {
+       uint64_t start;
+       uint64_t stop;
 };
 
-GTimer *g_timer_new (void)
+UTimer *u_timer_new (void)
 {
-       GTimer *timer;
+       UTimer *timer;
 
-       timer = g_new0 (GTimer, 1);
-       g_timer_start (timer);
+       timer = u_new0 (UTimer, 1);
+       u_timer_start (timer);
        return timer;
 }
 
 void
-g_timer_destroy (GTimer *timer)
+u_timer_destroy (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
-       g_free (timer);
+       u_return_if_fail (timer != NULL);
+       u_free (timer);
 }
 
 void
-g_timer_start (GTimer *timer)
+u_timer_start (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
+       u_return_if_fail (timer != NULL);
 
        QueryPerformanceCounter ((LARGE_INTEGER*)&timer->start);
 }
 
 void
-g_timer_stop (GTimer *timer)
+u_timer_stop (UTimer *timer)
 {
-       g_return_if_fail (timer != NULL);
+       u_return_if_fail (timer != NULL);
 
        QueryPerformanceCounter ((LARGE_INTEGER*)&timer->stop);
 }
 
-gdouble
-g_timer_elapsed (GTimer *timer, gulong *microseconds)
+double
+u_timer_elapsed (UTimer *timer, unsigned long *microseconds)
 {
-       static guint64 freq = 0;
-       guint64 delta, stop;
+       static uint64_t freq = 0;
+       uint64_t delta, stop;
 
        if (freq == 0) {
                if (!QueryPerformanceFrequency ((LARGE_INTEGER *)&freq))
@@ -89,9 +89,9 @@ g_timer_elapsed (GTimer *timer, gulong *microseconds)
        delta = stop - timer->start;
 
        if (microseconds)
-               *microseconds = (gulong) (delta * (1000000.0 / freq));
+               *microseconds = (unsigned long) (delta * (1000000.0 / freq));
 
-       return (gdouble) delta / (gdouble) freq;
+       return (double) delta / (double) freq;
 }
 
 
diff --git a/deps/eglib/src/gunicode.c b/deps/ulib/src/uunicode.c
similarity index 65%
rename from deps/eglib/src/gunicode.c
rename to deps/ulib/src/uunicode.c
index c3a9000..b6de165 100644
--- a/deps/eglib/src/gunicode.c
+++ b/deps/ulib/src/uunicode.c
@@ -1,5 +1,5 @@
 /*
- * gunicode.c: Some Unicode routines 
+ * gunicode.c: Some Unicode routines
  *
  * Author:
  *   Miguel de Icaza (miguel novell com)
@@ -35,11 +35,11 @@
  */
 #include <config.h>
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 #include <unicode-data.h>
 #include <errno.h>
 
-#if defined(_MSC_VER) || defined(G_OS_WIN32)
+#if defined(_MSC_VER) || defined(U_OS_WIN32)
 /* FIXME */
 #  define CODESET 1
 #  include <windows.h>
@@ -53,18 +53,18 @@
 #endif
 
 static const char *my_charset;
-static gboolean is_utf8;
+static uboolean is_utf8;
 
 /*
  * Character set conversion
  */
 
-GUnicodeType 
-g_unichar_type (gunichar c)
+UUnicodeType
+u_unichar_type (uunichar c)
 {
        int i;
 
-       guint16 cp = (guint16) c;
+       uint16_t cp = (uint16_t) c;
        for (i = 0; i < unicode_category_ranges_count; i++) {
                if (cp < unicode_category_ranges [i].start)
                        continue;
@@ -84,33 +84,33 @@ g_unichar_type (gunichar c)
        // 100000-10FFFD OtherPrivateUse
        */
        if (0x3400 <= cp && cp < 0x4DB5)
-               return G_UNICODE_OTHER_LETTER;
+               return U_UNICODE_OTHER_LETTER;
        if (0x4E00 <= cp && cp < 0x9FC3)
-               return G_UNICODE_OTHER_LETTER;
+               return U_UNICODE_OTHER_LETTER;
        if (0xAC00<= cp && cp < 0xD7A3)
-               return G_UNICODE_OTHER_LETTER;
+               return U_UNICODE_OTHER_LETTER;
        if (0xD800 <= cp && cp < 0xDFFF)
-               return G_UNICODE_SURROGATE;
+               return U_UNICODE_SURROGATE;
        if (0xE000 <= cp && cp < 0xF8FF)
-               return G_UNICODE_PRIVATE_USE;
+               return U_UNICODE_PRIVATE_USE;
        /* since the argument is UTF-16, we cannot check beyond FFFF */
 
        /* It should match any of above */
        return 0;
 }
 
-GUnicodeBreakType
-g_unichar_break_type (gunichar c)
+UUnicodeBreakType
+u_unichar_break_type (uunichar c)
 {
        // MOONLIGHT_FIXME
-       return G_UNICODE_BREAK_UNKNOWN;
+       return U_UNICODE_BREAK_UNKNOWN;
 }
 
-gunichar
-g_unichar_case (gunichar c, gboolean upper)
+uunichar
+u_unichar_case (uunichar c, uboolean upper)
 {
-       gint8 i, i2;
-       guint32 cp = (guint32) c, v;
+       int8_t i, i2;
+       uint32_t cp = (uint32_t) c, v;
 
        for (i = 0; i < simple_case_map_ranges_count; i++) {
                if (cp < simple_case_map_ranges [i].start)
@@ -118,38 +118,38 @@ g_unichar_case (gunichar c, gboolean upper)
                if (simple_case_map_ranges [i].end <= cp)
                        continue;
                if (c < 0x10000) {
-                       const guint16 *tab = upper ? simple_upper_case_mapping_lowarea [i] : 
simple_lower_case_mapping_lowarea [i];
+                       const uint16_t *tab = upper ? simple_upper_case_mapping_lowarea [i] : 
simple_lower_case_mapping_lowarea [i];
                        v = tab [cp - simple_case_map_ranges [i].start];
                } else {
-                       const guint32 *tab;
-                       i2 = (gint8)(i - (upper ? simple_upper_case_mapping_lowarea_table_count : 
simple_lower_case_mapping_lowarea_table_count));
+                       const uint32_t *tab;
+                       i2 = (int8_t)(i - (upper ? simple_upper_case_mapping_lowarea_table_count : 
simple_lower_case_mapping_lowarea_table_count));
                        tab = upper ? simple_upper_case_mapping_higharea [i2] : 
simple_lower_case_mapping_higharea [i2];
                        v = tab [cp - simple_case_map_ranges [i].start];
                }
-               return v != 0 ? (gunichar) v : c;
+               return v != 0 ? (uunichar) v : c;
        }
        return c;
 }
 
-gunichar
-g_unichar_toupper (gunichar c)
+uunichar
+u_unichar_toupper (uunichar c)
 {
-       return g_unichar_case (c, TRUE);
+       return u_unichar_case (c, TRUE);
 }
 
-gunichar
-g_unichar_tolower (gunichar c)
+uunichar
+u_unichar_tolower (uunichar c)
 {
-       return g_unichar_case (c, FALSE);
+       return u_unichar_case (c, FALSE);
 }
 
-gunichar
-g_unichar_totitle (gunichar c)
+uunichar
+u_unichar_totitle (uunichar c)
 {
-       guint8 i;
-       guint32 cp;
+       uint8_t i;
+       uint32_t cp;
 
-       cp = (guint32) c;
+       cp = (uint32_t) c;
        for (i = 0; i < simple_titlecase_mapping_count; i++) {
                if (simple_titlecase_mapping [i].codepoint == cp)
                        return simple_titlecase_mapping [i].title;
@@ -157,18 +157,18 @@ g_unichar_totitle (gunichar c)
                        /* it is ordered, hence no more match */
                        break;
        }
-       return g_unichar_toupper (c);
+       return u_unichar_toupper (c);
 }
 
-gboolean
-g_unichar_isxdigit (gunichar c)
+uboolean
+u_unichar_isxdigit (uunichar c)
 {
-       return (g_unichar_xdigit_value (c) != -1);
+       return (u_unichar_xdigit_value (c) != -1);
 
 }
 
-gint
-g_unichar_xdigit_value (gunichar c)
+int
+u_unichar_xdigit_value (uunichar c)
 {
        if (c >= 0x30 && c <= 0x39) /*0-9*/
                return (c - 0x30);
@@ -179,13 +179,13 @@ g_unichar_xdigit_value (gunichar c)
        return -1;
 }
 
-gboolean
-g_unichar_isspace (gunichar c)
+uboolean
+u_unichar_isspace (uunichar c)
 {
-       GUnicodeType type = g_unichar_type (c);
-       if (type == G_UNICODE_LINE_SEPARATOR ||
-           type == G_UNICODE_PARAGRAPH_SEPARATOR ||
-           type == G_UNICODE_SPACE_SEPARATOR)
+       UUnicodeType type = u_unichar_type (c);
+       if (type == U_UNICODE_LINE_SEPARATOR ||
+           type == U_UNICODE_PARAGRAPH_SEPARATOR ||
+           type == U_UNICODE_SPACE_SEPARATOR)
                return TRUE;
 
        return FALSE;
@@ -195,26 +195,26 @@ g_unichar_isspace (gunichar c)
 /*
  * This is broken, and assumes an UTF8 system, but will do for eglib's first user
  */
-gchar *
-g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError 
**error)
+char *
+u_filename_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read, size_t *bytes_written, UError 
**error)
 {
        char *res;
-       
+
        if (len == -1)
                len = strlen (utf8string);
 
-       res = g_malloc (len + 1);
-       g_strlcpy (res, utf8string, len + 1);
+       res = u_malloc (len + 1);
+       u_strlcpy (res, utf8string, len + 1);
        return res;
 }
 
-gboolean
-g_get_charset (G_CONST_RETURN char **charset)
+uboolean
+u_get_charset (U_CONST_RETURN char **charset)
 {
        if (my_charset == NULL) {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
                static char buf [14];
-               sprintf (buf, "CP%u", GetACP ());
+               sprintf (buf, "CP%u", UetACP ());
                my_charset = buf;
                is_utf8 = FALSE;
 #else
@@ -229,25 +229,25 @@ g_get_charset (G_CONST_RETURN char **charset)
                is_utf8 = strcmp (my_charset, "UTF-8") == 0;
 #endif
        }
-       
+
        if (charset != NULL)
                *charset = my_charset;
 
        return is_utf8;
 }
 
-gchar *
-g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError 
**error)
+char *
+u_locale_to_utf8 (const char *opsysstring, ussize len, size_t *bytes_read, size_t *bytes_written, UError 
**error)
 {
-       g_get_charset (NULL);
+       u_get_charset (NULL);
 
-       return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
+       return u_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
 }
 
-gchar *
-g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError 
**error)
+char *
+u_locale_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read, size_t *bytes_written, UError 
**error)
 {
-       g_get_charset (NULL);
+       u_get_charset (NULL);
 
-       return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
+       return u_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
 }
diff --git a/deps/eglib/src/gutf8.c b/deps/ulib/src/uutf8.c
similarity index 77%
rename from deps/eglib/src/gutf8.c
rename to deps/ulib/src/uutf8.c
index e6a47ac..1b82380 100644
--- a/deps/eglib/src/gutf8.c
+++ b/deps/ulib/src/uutf8.c
@@ -12,7 +12,7 @@
 #include <config.h>
 
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 
 /*
  * Index into the table below with the first byte of a UTF-8 sequence to get
@@ -22,7 +22,7 @@
  * as-is for anyone who may want to do such conversion, which was allowed in
  * earlier algorithms.
 */
-const guchar g_utf8_jump_table[256] = {
+const unsigned char u_utf8_jump_table[256] = {
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -33,35 +33,35 @@ const guchar g_utf8_jump_table[256] = {
        3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1
 };
 
-static gchar *
-utf8_case_conv (const gchar *str, gssize len, gboolean upper)
+static char *
+utf8_case_conv (const char *str, ussize len, uboolean upper)
 {
-       gunichar *ustr;
-       glong i, ulen;
-       gchar *utf8;
+       uunichar *ustr;
+       long i, ulen;
+       char *utf8;
        
-       ustr = g_utf8_to_ucs4_fast (str, (glong) len, &ulen);
+       ustr = u_utf8_to_ucs4_fast (str, (long) len, &ulen);
        for (i = 0; i < ulen; i++)
-               ustr[i] = upper ? g_unichar_toupper (ustr[i]) : g_unichar_tolower (ustr[i]);
-       utf8 = g_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
-       g_free (ustr);
+               ustr[i] = upper ? u_unichar_toupper (ustr[i]) : u_unichar_tolower (ustr[i]);
+       utf8 = u_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
+       u_free (ustr);
        
        return utf8;
 }
 
-gchar *
-g_utf8_strup (const gchar *str, gssize len)
+char *
+u_utf8_strup (const char *str, ussize len)
 {
        return utf8_case_conv (str, len, TRUE);
 }
 
-gchar *
-g_utf8_strdown (const gchar *str, gssize len)
+char *
+u_utf8_strdown (const char *str, ussize len)
 {
        return utf8_case_conv (str, len, FALSE);
 }
 
-static gboolean
+static uboolean
 utf8_validate (const unsigned char *inptr, size_t len)
 {
        const unsigned char *ptr = inptr + len;
@@ -108,7 +108,7 @@ utf8_validate (const unsigned char *inptr, size_t len)
 }
 
 /**
- * g_utf8_validate:
+ * u_utf8_validate:
  * @str: a utf-8 encoded string
  * @max_len: max number of bytes to validate (or -1 to validate the entire null-terminated string)
  * @end: output parameter to mark the end of the valid input
@@ -122,20 +122,20 @@ utf8_validate (const unsigned char *inptr, size_t len)
  *
  * Return value: %TRUE if @str is valid or %FALSE otherwise.
  **/
-gboolean
-g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
+uboolean
+u_utf8_validate (const char *str, ussize max_len, const char **end)
 {
-       guchar *inptr = (guchar *) str;
-       gboolean valid = TRUE;
-       guint length, min;
-       gssize n = 0;
+       unsigned char *inptr = (unsigned char *) str;
+       uboolean valid = TRUE;
+       unsigned int length, min;
+       ussize n = 0;
        
        if (max_len == 0)
                return FALSE;
        
        if (max_len < 0) {
                while (*inptr != 0) {
-                       length = g_utf8_jump_table[*inptr];
+                       length = u_utf8_jump_table[*inptr];
                        if (!utf8_validate (inptr, length)) {
                                valid = FALSE;
                                break;
@@ -152,7 +152,7 @@ g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
                                break;
                        }
                        
-                       length = g_utf8_jump_table[*inptr];
+                       length = u_utf8_jump_table[*inptr];
                        min = MIN (length, max_len - n);
                        
                        if (!utf8_validate (inptr, min)) {
@@ -171,16 +171,16 @@ g_utf8_validate (const gchar *str, gssize max_len, const gchar **end)
        }
        
        if (end != NULL)
-               *end = (gchar *) inptr;
+               *end = (char *) inptr;
        
        return valid;
 }
 
-gunichar
-g_utf8_get_char_validated (const gchar *str, gssize max_len)
+uunichar
+u_utf8_get_char_validated (const char *str, ussize max_len)
 {
        unsigned char *inptr = (unsigned char *) str;
-       gunichar u = *inptr;
+       uunichar u = *inptr;
        int n, i;
        
        if (max_len == 0)
@@ -227,23 +227,23 @@ g_utf8_get_char_validated (const gchar *str, gssize max_len)
        return u;
 }
 
-glong
-g_utf8_strlen (const gchar *str, gssize max_len)
+long
+u_utf8_strlen (const char *str, ussize max_len)
 {
-       const guchar *inptr = (const guchar *) str;
-       glong clen = 0, len = 0, n;
+       const unsigned char *inptr = (const unsigned char *) str;
+       long clen = 0, len = 0, n;
        
        if (max_len == 0)
                return 0;
        
        if (max_len < 0) {
                while (*inptr) {
-                       inptr += g_utf8_jump_table[*inptr];
+                       inptr += u_utf8_jump_table[*inptr];
                        len++;
                }
        } else {
                while (len < max_len && *inptr) {
-                       n = g_utf8_jump_table[*inptr];
+                       n = u_utf8_jump_table[*inptr];
                        if ((clen + n) > max_len)
                                break;
                        
@@ -256,11 +256,11 @@ g_utf8_strlen (const gchar *str, gssize max_len)
        return len;
 }
 
-gunichar
-g_utf8_get_char (const gchar *src)
+uunichar
+u_utf8_get_char (const char *src)
 {
        unsigned char *inptr = (unsigned char *) src;
-       gunichar u = *inptr;
+       uunichar u = *inptr;
        int n, i;
        
        if (u < 0x80) {
@@ -289,41 +289,41 @@ g_utf8_get_char (const gchar *src)
        return u;
 }
 
-gchar *
-g_utf8_find_prev_char (const gchar *str, const gchar *p)
+char *
+u_utf8_find_prev_char (const char *str, const char *p)
 {
        while (p > str) {
                p--;
                if ((*p & 0xc0) != 0xb0)
-                       return (gchar *)p;
+                       return (char *)p;
        }
        return NULL;
 }
 
-gchar *
-g_utf8_prev_char (const gchar *str)
+char *
+u_utf8_prev_char (const char *str)
 {
-       const gchar *p = str;
+       const char *p = str;
        do {
                p--;
        } while ((*p & 0xc0) == 0xb0);
        
-       return (gchar *)p;
+       return (char *)p;
 }
 
-gchar *
-g_utf8_offset_to_pointer (const gchar *str, glong offset)
+char *
+u_utf8_offset_to_pointer (const char *str, long offset)
 {
-       const gchar *p = str;
+       const char *p = str;
 
        if (offset > 0) {
                do {
-                       p = g_utf8_next_char (p);
+                       p = u_utf8_next_char (p);
                        offset --;
                } while (offset > 0);
        }
        else if (offset < 0) {
-               const gchar *jump = str;
+               const char *jump = str;
                do {
                        // since the minimum size of a character is 1
                        // we know we can step back at least offset bytes
@@ -338,22 +338,22 @@ g_utf8_offset_to_pointer (const gchar *str, glong offset)
                        // by going forward
                        p = jump;
                        do {
-                               p = g_utf8_next_char (p);
+                               p = u_utf8_next_char (p);
                                offset ++;
                        } while (p < jump);
                        
                } while (offset < 0);
        }
        
-       return (gchar *)p;
+       return (char *)p;
 }
 
-glong
-g_utf8_pointer_to_offset (const gchar *str, const gchar *pos)
+long
+u_utf8_pointer_to_offset (const char *str, const char *pos)
 {
-       const gchar *inptr, *inend;
-       glong offset = 0;
-       glong sign = 1;
+       const char *inptr, *inend;
+       long offset = 0;
+       long sign = 1;
        
        if (pos == str)
                return 0;
@@ -368,7 +368,7 @@ g_utf8_pointer_to_offset (const gchar *str, const gchar *pos)
        }
        
        do {
-               inptr = g_utf8_next_char (inptr);
+               inptr = u_utf8_next_char (inptr);
                offset++;
        } while (inptr < inend);
        
diff --git a/deps/eglib/src/vasprintf.c b/deps/ulib/src/vasprintf.c
similarity index 100%
rename from deps/eglib/src/vasprintf.c
rename to deps/ulib/src/vasprintf.c
diff --git a/deps/eglib/test/.gitignore b/deps/ulib/test/.gitignore
similarity index 100%
rename from deps/eglib/test/.gitignore
rename to deps/ulib/test/.gitignore
diff --git a/deps/eglib/test/Makefile.am b/deps/ulib/test/Makefile.am
similarity index 65%
rename from deps/eglib/test/Makefile.am
rename to deps/ulib/test/Makefile.am
index 024af90..e7f8ee6 100644
--- a/deps/eglib/test/Makefile.am
+++ b/deps/ulib/test/Makefile.am
@@ -34,16 +34,16 @@ AM_CPPFLAGS =                       \
        -Wall                   \
        $(NULL)
 
-test_eglib_SOURCES = $(SOURCES)
+test_ulib_SOURCES = $(SOURCES)
 
-test_eglib_CFLAGS = -DEGLIB_TESTS=1 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
-test_eglib_LDADD = ../src/libeglib.la $(LIBICONV)
+test_ulib_CFLAGS = -DULIB_TESTS=1 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
+test_ulib_LDADD = ../src/libulib.la $(LIBICONV)
 
-run-eglib: all
-       srcdir=`readlink -f $(srcdir)` ./test-eglib
+run-ulib: all
+       srcdir=`readlink -f $(srcdir)` ./test-ulib
 
-noinst_PROGRAMS = test-eglib
+noinst_PROGRAMS = test-ulib
 
-run-both: run-eglib
+run-both: run-ulib
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/deps/eglib/test/README b/deps/ulib/test/README
similarity index 97%
rename from deps/eglib/test/README
rename to deps/ulib/test/README
index 7c28d03..268010a 100644
--- a/deps/eglib/test/README
+++ b/deps/ulib/test/README
@@ -9,7 +9,7 @@ EGlib Unit Testing
 ===============================================================================
 
 Tests are easy to write, but must be grouped in to logical cases. For instance,
-the GPtrArray group has a number of tests that cover the entire GPtrArray
+the UPtrArray group has a number of tests that cover the entire UPtrArray
 implementation.
 
 These logical case groups should be in a single C file, and must have
diff --git a/deps/eglib/test/UTF-8.txt b/deps/ulib/test/UTF-8.txt
similarity index 100%
rename from deps/eglib/test/UTF-8.txt
rename to deps/ulib/test/UTF-8.txt
diff --git a/deps/eglib/test/array.c b/deps/ulib/test/array.c
similarity index 51%
rename from deps/eglib/test/array.c
rename to deps/ulib/test/array.c
index 37d5486..fd0a683 100644
--- a/deps/eglib/test/array.c
+++ b/deps/ulib/test/array.c
@@ -1,26 +1,26 @@
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 /* example from glib documentation */
 RESULT
 test_array_big ()
 {
-       GArray *garray;
-       gint i;
+       UArray *garray;
+       int i;
 
-       /* We create a new array to store gint values.
+       /* We create a new array to store int values.
           We don't want it zero-terminated or cleared to 0's. */
-       garray = g_array_new (FALSE, FALSE, sizeof (gint));
+       garray = u_array_new (FALSE, FALSE, sizeof (int));
        for (i = 0; i < 10000; i++)
-               g_array_append_val (garray, i);
+               u_array_append_val (garray, i);
 
        for (i = 0; i < 10000; i++)
-               if (g_array_index (garray, gint, i) != i)
+               if (u_array_index (garray, int, i) != i)
                        return FAILED ("array value didn't match");
-       
-       g_array_free (garray, TRUE);
+
+       u_array_free (garray, TRUE);
 
        return NULL;
 }
@@ -28,16 +28,16 @@ test_array_big ()
 RESULT
 test_array_index ()
 {
-       GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+       UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
        int v;
 
        v = 27;
-       g_array_append_val (array, v);
+       u_array_append_val (array, v);
 
-       if (27 != g_array_index (array, int, 0))
+       if (27 != u_array_index (array, int, 0))
                return FAILED ("");
 
-       g_array_free (array, TRUE);
+       u_array_free (array, TRUE);
 
        return NULL;
 }
@@ -45,19 +45,19 @@ test_array_index ()
 RESULT
 test_array_append_zero_terminated ()
 {
-       GArray *array = g_array_new (TRUE, FALSE, sizeof (int));
+       UArray *array = u_array_new (TRUE, FALSE, sizeof (int));
        int v;
 
        v = 27;
-       g_array_append_val (array, v);
+       u_array_append_val (array, v);
 
-       if (27 != g_array_index (array, int, 0))
-               return FAILED ("g_array_append_val failed");
+       if (27 != u_array_index (array, int, 0))
+               return FAILED ("u_array_append_val failed");
 
-       if (0 != g_array_index (array, int, 1))
+       if (0 != u_array_index (array, int, 1))
                return FAILED ("zero_terminated didn't append a zero element");
 
-       g_array_free (array, TRUE);
+       u_array_free (array, TRUE);
 
        return NULL;
 }
@@ -65,7 +65,7 @@ test_array_append_zero_terminated ()
 RESULT
 test_array_append ()
 {
-       GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+       UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
        int v;
 
        if (0 != array->len)
@@ -73,12 +73,12 @@ test_array_append ()
 
        v = 27;
 
-       g_array_append_val (array, v);
+       u_array_append_val (array, v);
 
        if (1 != array->len)
                return FAILED ("array append failed");
 
-       g_array_free (array, TRUE);
+       u_array_free (array, TRUE);
 
        return NULL;
 }
@@ -86,66 +86,66 @@ test_array_append ()
 RESULT
 test_array_insert_val ()
 {
-       GArray *array = g_array_new (FALSE, FALSE, sizeof (gpointer));
-       gpointer ptr0, ptr1, ptr2, ptr3;
+       UArray *array = u_array_new (FALSE, FALSE, sizeof (void *));
+       void *ptr0, *ptr1, *ptr2, *ptr3;
 
-       g_array_insert_val (array, 0, array);
+       u_array_insert_val (array, 0, array);
 
-       if (array != g_array_index (array, gpointer, 0))
+       if (array != u_array_index (array, void *, 0))
                return FAILED ("1 The value in the array is incorrect");
 
-       g_array_insert_val (array, 1, array);
-       if (array != g_array_index (array, gpointer, 1))
+       u_array_insert_val (array, 1, array);
+       if (array != u_array_index (array, void *, 1))
                return FAILED ("2 The value in the array is incorrect");
 
-       g_array_insert_val (array, 2, array);
-       if (array != g_array_index (array, gpointer, 2))
+       u_array_insert_val (array, 2, array);
+       if (array != u_array_index (array, void *, 2))
                return FAILED ("3 The value in the array is incorrect");
-       
-       g_array_free (array, TRUE);
-       array = g_array_new (FALSE, FALSE, sizeof (gpointer));
+
+       u_array_free (array, TRUE);
+       array = u_array_new (FALSE, FALSE, sizeof (void *));
        ptr0 = array;
        ptr1 = array + 1;
        ptr2 = array + 2;
        ptr3 = array + 3;
 
-       g_array_insert_val (array, 0, ptr0);
-       g_array_insert_val (array, 1, ptr1);
-       g_array_insert_val (array, 2, ptr2);
-       g_array_insert_val (array, 1, ptr3);
-       if (ptr0 != g_array_index (array, gpointer, 0))
+       u_array_insert_val (array, 0, ptr0);
+       u_array_insert_val (array, 1, ptr1);
+       u_array_insert_val (array, 2, ptr2);
+       u_array_insert_val (array, 1, ptr3);
+       if (ptr0 != u_array_index (array, void *, 0))
                return FAILED ("4 The value in the array is incorrect");
-       if (ptr3 != g_array_index (array, gpointer, 1))
+       if (ptr3 != u_array_index (array, void *, 1))
                return FAILED ("5 The value in the array is incorrect");
-       if (ptr1 != g_array_index (array, gpointer, 2))
+       if (ptr1 != u_array_index (array, void *, 2))
                return FAILED ("6 The value in the array is incorrect");
-       if (ptr2 != g_array_index (array, gpointer, 3))
+       if (ptr2 != u_array_index (array, void *, 3))
                return FAILED ("7 The value in the array is incorrect");
 
-       g_array_free (array, TRUE);
+       u_array_free (array, TRUE);
        return NULL;
 }
 
 RESULT
 test_array_remove ()
 {
-       GArray *array = g_array_new (FALSE, FALSE, sizeof (int));
+       UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
        int v[] = {30, 29, 28, 27, 26, 25};
 
-       g_array_append_vals (array, v, 6);
+       u_array_append_vals (array, v, 6);
 
        if (6 != array->len)
                return FAILED ("append_vals fail");
 
-       g_array_remove_index (array, 3);
+       u_array_remove_index (array, 3);
 
        if (5 != array->len)
                return FAILED ("remove_index failed to update length");
 
-       if (26 != g_array_index (array, int, 3))
+       if (26 != u_array_index (array, int, 3))
                return FAILED ("remove_index failed to update the array");
 
-       g_array_free (array, TRUE);
+       u_array_free (array, TRUE);
 
        return NULL;
 }
diff --git a/deps/eglib/test/dir.c b/deps/ulib/test/dir.c
similarity index 69%
rename from deps/eglib/test/dir.c
rename to deps/ulib/test/dir.c
index f871121..592cd9f 100644
--- a/deps/eglib/test/dir.c
+++ b/deps/ulib/test/dir.c
@@ -1,11 +1,11 @@
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef G_OS_UNIX
+#ifdef U_OS_UNIX
 #include <pthread.h>
 #endif
 #include "test.h"
@@ -14,50 +14,50 @@
 RESULT
 test_dir ()
 {
-       GDir *dir;
-       GError *error;
-       const gchar *name;
+       UDir *dir;
+       UError *error;
+       const char *name;
 
        /*
-       dir = g_dir_open (NULL, 0, NULL);
+       dir = u_dir_open (NULL, 0, NULL);
        */
-       dir = g_dir_open ("", 0, NULL);
+       dir = u_dir_open ("", 0, NULL);
        if (dir != NULL)
                return FAILED ("1 Should be an error");
 
-       dir = g_dir_open ("", 9, NULL);
+       dir = u_dir_open ("", 9, NULL);
        if (dir != NULL)
                return FAILED ("2 Should be an error");
 
        error = NULL;
-       dir = g_dir_open (".ljasdslakjd", 9, &error);
+       dir = u_dir_open (".ljasdslakjd", 9, &error);
        if (dir != NULL)
                return FAILED ("3 opendir should fail");
        if (error == NULL)
                return FAILED ("4 got no error");
-       g_error_free (error);
+       u_error_free (error);
        error = NULL;
-       dir = g_dir_open (g_get_tmp_dir (), 9, &error);
+       dir = u_dir_open (u_get_tmp_dir (), 9, &error);
        if (dir == NULL)
                return FAILED ("5 opendir should succeed");
        if (error != NULL)
                return FAILED ("6 got an error");
        name = NULL;
-       name = g_dir_read_name (dir);
+       name = u_dir_read_name (dir);
        if (name == NULL)
                return FAILED ("7 didn't read a file name");
-       while ((name = g_dir_read_name (dir)) != NULL) {
+       while ((name = u_dir_read_name (dir)) != NULL) {
                if (strcmp (name, ".") == 0)
                        return FAILED (". directory found");
                if (strcmp (name, "..") == 0)
                        return FAILED (".. directory found");
        }
-       g_dir_close (dir);
+       u_dir_close (dir);
        return OK;
 }
 
 static Test dir_tests [] = {
-       {"g_dir_*", test_dir},
+       {"u_dir_*", test_dir},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/driver.c b/deps/ulib/test/driver.c
similarity index 83%
rename from deps/eglib/test/driver.c
rename to deps/ulib/test/driver.c
index 23e7638..5b70ca3 100644
--- a/deps/eglib/test/driver.c
+++ b/deps/ulib/test/driver.c
@@ -1,5 +1,5 @@
 /*
- * EGLib Unit Test Driver
+ * ULib Unit Test Driver
  *
  * Author:
  *   Aaron Bockover (abockover novell com)
@@ -44,20 +44,20 @@
 #endif
 
 typedef struct _StringArray {
-       gchar **strings;
-       gint length;
+       char **strings;
+       int length;
 } StringArray;
 
 static StringArray *
-string_array_append(StringArray *array, gchar *string)
+string_array_append(StringArray *array, char *string)
 {
        if(array == NULL) {
-               array = g_new0(StringArray, 1);
+               array = u_new0(StringArray, 1);
                array->length = 1;
-               array->strings = g_malloc(sizeof(gchar *) * 2);
+               array->strings = u_malloc(sizeof(char *) * 2);
        } else {
                array->length++;
-               array->strings = g_realloc(array->strings, sizeof(gchar *) 
+               array->strings = u_realloc(array->strings, sizeof(char *) 
                        * (array->length + 1));
        }
        
@@ -67,18 +67,18 @@ string_array_append(StringArray *array, gchar *string)
        return array;
 }
 
-gint global_passed = 0, global_tests = 0;
+int global_passed = 0, global_tests = 0;
 
 static void
 string_array_free(StringArray *array)
 {
-       g_free(array->strings);
-       g_free(array);
+       u_free(array->strings);
+       u_free(array);
 }
 
 static void print_help(char *s)
 {
-       gint i;
+       int i;
        
        printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
        printf("OPTIONS are:\n");
@@ -102,16 +102,16 @@ static void print_help(char *s)
        printf("\n");
 }
 
-gint main(gint argc, gchar **argv)
+int main(int argc, char **argv)
 {
-       gint i, j, c, iterations = 1;
+       int i, j, c, iterations = 1;
        StringArray *tests_to_run = NULL;
-       gdouble time_start;
-       gboolean report_time = FALSE;
-       gboolean quiet = FALSE;
-       gboolean global_failure = FALSE;
-       gboolean no_final_time_labels = FALSE;
-       gboolean debug = FALSE;
+       double time_start;
+       uboolean report_time = FALSE;
+       uboolean quiet = FALSE;
+       uboolean global_failure = FALSE;
+       uboolean no_final_time_labels = FALSE;
+       uboolean debug = FALSE;
 
 #if HAVE_GETOPT_H
        static struct option long_options [] = {
@@ -158,17 +158,17 @@ gint main(gint argc, gchar **argv)
        time_start = get_timestamp();
        
        for(j = 0; test_groups[j].name != NULL; j++) {
-               gboolean run = TRUE;
-               gchar *tests = NULL;
-               gchar *group = NULL;
+               uboolean run = TRUE;
+               char *tests = NULL;
+               char *group = NULL;
                
                if(tests_to_run != NULL) {
-                       gint k;
+                       int k;
                        run = FALSE;
                        
                        for(k = 0; k < tests_to_run->length; k++) {     
-                               gchar *user = tests_to_run->strings[k];
-                               const gchar *table = test_groups[j].name;
+                               char *user = tests_to_run->strings[k];
+                               const char *table = test_groups[j].name;
                                size_t user_len = strlen(user);
                                size_t table_len = strlen(table);
                                
@@ -185,8 +185,8 @@ gint main(gint argc, gchar **argv)
                }
        
                if(run) {
-                       gboolean passed;
-                       gchar **split = NULL;
+                       uboolean passed;
+                       char **split = NULL;
                        
                        if(debug && test_groups[j].handler != fake_tests_init) {
                                printf("Skipping %s, in driver debug mode\n", 
@@ -199,7 +199,7 @@ gint main(gint argc, gchar **argv)
                        if(group != NULL) {
                                split = eg_strsplit(group, ":", -1);    
                                if(split != NULL) {
-                                       gint m;
+                                       int m;
                                        for(m = 0; split[m] != NULL; m++) {
                                                if(m == 1) {
                                                        tests = strdup(split[m]);
@@ -214,7 +214,7 @@ gint main(gint argc, gchar **argv)
                                iterations, quiet, report_time, tests);
 
                        if(tests != NULL) {
-                               g_free(tests);
+                               u_free(tests);
                        }
 
                        if(!passed && !global_failure) {
@@ -224,13 +224,13 @@ gint main(gint argc, gchar **argv)
        }
        
        if(!quiet) {
-               gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
+               double pass_percentage = ((double)global_passed / (double)global_tests) * 100.0;
                printf("=============================\n");
                printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK", 
global_passed, global_tests, pass_percentage);
        }
        
        if(report_time) {
-               gdouble duration = get_timestamp() - time_start;
+               double duration = get_timestamp() - time_start;
                if(no_final_time_labels) {
                        printf("%g\n", duration);
                } else {
diff --git a/deps/ulib/test/endian.c b/deps/ulib/test/endian.c
new file mode 100644
index 0000000..820e331
--- /dev/null
+++ b/deps/ulib/test/endian.c
@@ -0,0 +1,38 @@
+#include "test.h"
+
+RESULT
+test_swap ()
+{
+       uint32_t a = 0xabcdef01, res32;
+       uint64_t b = (((uint64_t)a) << 32) | a, res64;
+       uint64_t b_expect = (((uint64_t)0x1efcdab) << 32) | 0x01efcdab;
+       uint16_t c = 0xabcd, res16;
+       
+       res32 = UUINT32_SWAP_LE_BE (a);
+       if (res32 != 0x01efcdab)
+               return FAILED ("UUINT32_SWAP_LE_BE returned 0x%x", res32);
+       res32 = UUINT32_SWAP_LE_BE (1);
+       if (res32 != 0x1000000)
+               return FAILED ("UUINT32_SWAP_LE_BE returned 0x%x", res32);
+
+       res64 = UUINT64_SWAP_LE_BE(b);
+       if (res64 != b_expect)
+               return FAILED ("UUINT64_SWAP_LE_BE returned 0x%llx (had=0x%llx)", res64, b);
+       res16 = UUINT16_SWAP_LE_BE(c);
+       if (res16 != 0xcdab)
+               return FAILED ("UUINT16_SWAP_LE_BE returned 0x%x", (uint32_t) res16);   
+       
+       return OK;
+}
+
+/*
+ * test initialization
+ */
+
+static Test endian_tests [] = {
+       {"swap", test_swap},
+       {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(endian_tests_init, endian_tests)
+
diff --git a/deps/eglib/test/fake.c b/deps/ulib/test/fake.c
similarity index 100%
rename from deps/eglib/test/fake.c
rename to deps/ulib/test/fake.c
diff --git a/deps/eglib/test/file.c b/deps/ulib/test/file.c
similarity index 57%
rename from deps/eglib/test/file.c
rename to deps/ulib/test/file.c
index 411c945..e19bb86 100644
--- a/deps/eglib/test/file.c
+++ b/deps/ulib/test/file.c
@@ -1,5 +1,5 @@
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdlib.h>
 #ifdef HAVE_UNISTD_H
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include "test.h"
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <io.h>
 #define close _close
 #endif
@@ -16,27 +16,27 @@
 RESULT
 test_file_get_contents ()
 {
-       GError *error;
-       gchar *content;
-       gboolean ret;
-       gsize length;
-#ifdef G_OS_WIN32
-       const gchar *filename = "c:\\Windows\\system.ini";
+       UError *error;
+       char *content;
+       uboolean ret;
+       size_t length;
+#ifdef U_OS_WIN32
+       const char *filename = "c:\\Windows\\system.ini";
 #else
-       const gchar *filename = "/etc/hosts";
+       const char *filename = "/etc/hosts";
 #endif
 
        /*
        filename != NULL
-       ret = g_file_get_contents (NULL, NULL, NULL, NULL);
+       ret = u_file_get_contents (NULL, NULL, NULL, NULL);
        contents != NULL
-       ret = g_file_get_contents ("", NULL, NULL, NULL);
+       ret = u_file_get_contents ("", NULL, NULL, NULL);
        error no such file and fails for 'error' not being null too
-       ret = g_file_get_contents ("", &content, NULL, &error);
+       ret = u_file_get_contents ("", &content, NULL, &error);
        */
 
        error = NULL;
-       ret = g_file_get_contents ("", &content, NULL, &error);
+       ret = u_file_get_contents ("", &content, NULL, &error);
        if (ret)
                return FAILED ("HAH!");
        if (error == NULL)
@@ -44,9 +44,9 @@ test_file_get_contents ()
        if (content != NULL)
                return FAILED ("Content is uninitialized");
 
-       g_error_free (error);
+       u_error_free (error);
        error = NULL;
-       ret = g_file_get_contents (filename, &content, &length, &error);
+       ret = u_file_get_contents (filename, &content, &length, &error);
        if (!ret)
                return FAILED ("The error is %d %s\n", error->code, error->message);
        if (error != NULL)
@@ -55,7 +55,7 @@ test_file_get_contents ()
                return FAILED ("Content is NULL");
        if (strlen (content) != length)
                return FAILED ("length is %d but the string is %d", length, strlen (content));
-       g_free (content);
+       u_free (content);
 
        return OK;
 }
@@ -63,37 +63,37 @@ test_file_get_contents ()
 RESULT
 test_open_tmp ()
 {
-       GError *error;
-       gint fd;
-       gchar *name = GINT_TO_POINTER (-1);
+       UError *error;
+       int fd;
+       char *name = U_INT_TO_POINTER (-1);
 
        /*
         * Okay, this works, but creates a .xxx file in /tmp on every run. Disabled.
-        * fd = g_file_open_tmp (NULL, NULL, NULL);
+        * fd = u_file_open_tmp (NULL, NULL, NULL);
         * if (fd < 0)
         *      return FAILED ("Default failed.");
         * close (fd);
        */
        error = NULL;
-       fd = g_file_open_tmp ("invalidtemplate", NULL, &error);
+       fd = u_file_open_tmp ("invalidtemplate", NULL, &error);
        if (fd != -1)
                return FAILED ("The template was invalid and accepted");
        if (error == NULL)
                return FAILED ("No error returned.");
-       g_error_free (error);
+       u_error_free (error);
 
        error = NULL;
-       fd = g_file_open_tmp ("i/nvalidtemplate", &name, &error);
+       fd = u_file_open_tmp ("i/nvalidtemplate", &name, &error);
        if (fd != -1)
                return FAILED ("The template was invalid and accepted");
        if (error == NULL)
                return FAILED ("No error returned.");
        if (name == NULL)
                return FAILED ("'name' is not reset");
-       g_error_free (error);
+       u_error_free (error);
 
        error = NULL;
-       fd = g_file_open_tmp ("valid-XXXXXX", &name, &error);
+       fd = u_file_open_tmp ("valid-XXXXXX", &name, &error);
        if (fd == -1)
                return FAILED ("This should be valid");
        if (error != NULL)
@@ -102,124 +102,124 @@ test_open_tmp ()
                return FAILED ("No name returned.");
        close (fd);
        unlink (name);
-       g_free (name);
+       u_free (name);
        return OK;
 }
 
 RESULT
 test_file ()
 {
-       gboolean res;
-       const gchar *tmp;
-       gchar *path;
+       uboolean res;
+       const char *tmp;
+       char *path;
 
-#ifndef G_OS_WIN32 /* FIXME */
-       gchar *sympath;
-       gint ignored;
+#ifndef U_OS_WIN32 /* FIXME */
+       char *sympath;
+       int ignored;
 #endif
 
-       res = g_file_test (NULL, 0);
+       res = u_file_test (NULL, 0);
        if (res)
                return FAILED ("Should return FALSE HERE");
 
-       res = g_file_test ("file.c", 0);
+       res = u_file_test ("file.c", 0);
        if (res)
                return FAILED ("Should return FALSE HERE");
 
-       tmp = g_get_tmp_dir ();
-       res = g_file_test (tmp, G_FILE_TEST_EXISTS);
+       tmp = u_get_tmp_dir ();
+       res = u_file_test (tmp, U_FILE_TEST_EXISTS);
        if (!res)
                return FAILED ("tmp does not exist.");
-       res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR);
+       res = u_file_test (tmp, U_FILE_TEST_IS_REGULAR);
        if (res)
                return FAILED ("tmp is regular");
 
-       res = g_file_test (tmp, G_FILE_TEST_IS_DIR);
+       res = u_file_test (tmp, U_FILE_TEST_IS_DIR);
        if (!res)
                return FAILED ("tmp is not a directory");
-       res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE);
+       res = u_file_test (tmp, U_FILE_TEST_IS_EXECUTABLE);
        if (!res)
                return FAILED ("tmp is not a executable");
 
-       res = g_file_test (tmp, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (tmp, U_FILE_TEST_EXISTS | U_FILE_TEST_IS_SYMLINK);
        if (!res)
                return FAILED ("2 tmp does not exist.");
-       res = g_file_test (tmp, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (tmp, U_FILE_TEST_IS_REGULAR | U_FILE_TEST_IS_SYMLINK);
        if (res)
                return FAILED ("2 tmp is regular");
 
-       res = g_file_test (tmp, G_FILE_TEST_IS_DIR | G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (tmp, U_FILE_TEST_IS_DIR | U_FILE_TEST_IS_SYMLINK);
        if (!res)
                return FAILED ("2 tmp is not a directory");
-       res = g_file_test (tmp, G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (tmp, U_FILE_TEST_IS_EXECUTABLE | U_FILE_TEST_IS_SYMLINK);
        if (!res)
                return FAILED ("2 tmp is not a executable");
 
-       close (g_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
-       res = g_file_test (path, G_FILE_TEST_EXISTS);
+       close (u_file_open_tmp (NULL, &path, NULL)); /* create an empty file */
+       res = u_file_test (path, U_FILE_TEST_EXISTS);
        if (!res)
                return FAILED ("3 %s should exist", path);
-       res = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+       res = u_file_test (path, U_FILE_TEST_IS_REGULAR);
        /* This is strange. Empty file is reported as not existing! */
        if (!res)
                return FAILED ("3 %s IS_REGULAR", path);
-       res = g_file_test (path, G_FILE_TEST_IS_DIR);
+       res = u_file_test (path, U_FILE_TEST_IS_DIR);
        if (res)
                return FAILED ("3 %s should not be a directory", path);
-       res = g_file_test (path, G_FILE_TEST_IS_EXECUTABLE);
+       res = u_file_test (path, U_FILE_TEST_IS_EXECUTABLE);
        if (res)
                return FAILED ("3 %s should not be executable", path);
-       res = g_file_test (path, G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (path, U_FILE_TEST_IS_SYMLINK);
        if (res)
                return FAILED ("3 %s should not be a symlink", path);
 
-#ifndef G_OS_WIN32 /* FIXME */
-       sympath = g_strconcat (path, "-link", NULL);
+#ifndef U_OS_WIN32 /* FIXME */
+       sympath = u_strconcat (path, "-link", NULL);
        ignored = symlink (path, sympath);
-       res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+       res = u_file_test (sympath, U_FILE_TEST_EXISTS);
        if (!res)
                return FAILED ("4 %s should not exist", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+       res = u_file_test (sympath, U_FILE_TEST_IS_REGULAR);
        if (!res)
                return FAILED ("4 %s should not be a regular file", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+       res = u_file_test (sympath, U_FILE_TEST_IS_DIR);
        if (res)
                return FAILED ("4 %s should not be a directory", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+       res = u_file_test (sympath, U_FILE_TEST_IS_EXECUTABLE);
        if (res)
                return FAILED ("4 %s should not be executable", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (sympath, U_FILE_TEST_IS_SYMLINK);
        if (!res)
                return FAILED ("4 %s should be a symlink", sympath);
 
        unlink (path);
 
-       res = g_file_test (sympath, G_FILE_TEST_EXISTS);
+       res = u_file_test (sympath, U_FILE_TEST_EXISTS);
        if (res)
                return FAILED ("5 %s should exist", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_REGULAR);
+       res = u_file_test (sympath, U_FILE_TEST_IS_REGULAR);
        if (res)
                return FAILED ("5 %s should be a regular file", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_DIR);
+       res = u_file_test (sympath, U_FILE_TEST_IS_DIR);
        if (res)
                return FAILED ("5 %s should not be a directory", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_EXECUTABLE);
+       res = u_file_test (sympath, U_FILE_TEST_IS_EXECUTABLE);
        if (res)
                return FAILED ("5 %s should not be executable", sympath);
-       res = g_file_test (sympath, G_FILE_TEST_IS_SYMLINK);
+       res = u_file_test (sympath, U_FILE_TEST_IS_SYMLINK);
        if (!res)
                return FAILED ("5 %s should be a symlink", sympath);
        unlink (sympath);
-       g_free (sympath);
+       u_free (sympath);
 #endif
-       g_free (path);
+       u_free (path);
        return OK;
 }
 
 static Test file_tests [] = {
-       {"g_file_get_contents", test_file_get_contents},
-       {"g_file_open_tmp", test_open_tmp},
-       {"g_file_test", test_file},
+       {"u_file_get_contents", test_file_get_contents},
+       {"u_file_open_tmp", test_open_tmp},
+       {"u_file_test", test_file},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/hashtable.c b/deps/ulib/test/hashtable.c
similarity index 51%
rename from deps/eglib/test/hashtable.c
rename to deps/ulib/test/hashtable.c
index 8eb9885..ea395b3 100644
--- a/deps/eglib/test/hashtable.c
+++ b/deps/ulib/test/hashtable.c
@@ -1,46 +1,46 @@
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 int foreach_count = 0;
 int foreach_fail = 0;
 
-void foreach (gpointer key, gpointer value, gpointer user_data)
+void foreach (void * key, void * value, void * user_data)
 {
        foreach_count++;
-       if (GPOINTER_TO_INT (user_data) != 'a')
+       if (U_POINTER_TO_INT (user_data) != 'a')
                foreach_fail = 1;
 }
 
 RESULT hash_t1 (void)
 {
-       GHashTable *t = g_hash_table_new (g_str_hash, g_str_equal);
+       UHashTable *t = u_hash_table_new (u_str_hash, u_str_equal);
 
        foreach_count = 0;
        foreach_fail = 0;
-       g_hash_table_insert (t, "hello", "world");
-       g_hash_table_insert (t, "my", "god");
+       u_hash_table_insert (t, "hello", "world");
+       u_hash_table_insert (t, "my", "god");
 
-       g_hash_table_foreach (t, foreach, GINT_TO_POINTER('a'));
+       u_hash_table_foreach (t, foreach, U_INT_TO_POINTER('a'));
        if (foreach_count != 2)
                return FAILED ("did not find all keys, got %d expected 2", foreach_count);
        if (foreach_fail)
                return FAILED("failed to pass the user-data to foreach");
-       
-       if (!g_hash_table_remove (t, "my"))
+
+       if (!u_hash_table_remove (t, "my"))
                return FAILED ("did not find known key");
-       if (g_hash_table_size (t) != 1)
+       if (u_hash_table_size (t) != 1)
                return FAILED ("unexpected size");
-       g_hash_table_insert(t, "hello", "moon");
-       if (strcmp (g_hash_table_lookup (t, "hello"), "moon") != 0)
+       u_hash_table_insert(t, "hello", "moon");
+       if (strcmp (u_hash_table_lookup (t, "hello"), "moon") != 0)
                return FAILED ("did not replace world with moon");
-               
-       if (!g_hash_table_remove (t, "hello"))
+
+       if (!u_hash_table_remove (t, "hello"))
                return FAILED ("did not find known key");
-       if (g_hash_table_size (t) != 0)
+       if (u_hash_table_size (t) != 0)
                return FAILED ("unexpected size");
-       g_hash_table_destroy (t);
+       u_hash_table_destroy (t);
 
        return OK;
 }
@@ -52,45 +52,45 @@ RESULT hash_t2 (void)
 
 RESULT hash_default (void)
 {
-       GHashTable *hash = g_hash_table_new (NULL, NULL);
+       UHashTable *hash = u_hash_table_new (NULL, NULL);
 
        if (hash == NULL)
-               return FAILED ("g_hash_table_new should return a valid hash");
+               return FAILED ("u_hash_table_new should return a valid hash");
 
-       g_hash_table_destroy (hash);
+       u_hash_table_destroy (hash);
        return NULL;
 }
 
 RESULT
 hash_null_lookup (void)
 {
-       GHashTable *hash = g_hash_table_new (NULL, NULL);
-       gpointer ok, ov;
-               
-       g_hash_table_insert (hash, NULL, GINT_TO_POINTER (1));
-       g_hash_table_insert (hash, GINT_TO_POINTER(1), GINT_TO_POINTER(2));
+       UHashTable *hash = u_hash_table_new (NULL, NULL);
+       void *ok, *ov;
+
+       u_hash_table_insert (hash, NULL, U_INT_TO_POINTER (1));
+       u_hash_table_insert (hash, U_INT_TO_POINTER(1), U_INT_TO_POINTER(2));
 
-       if (!g_hash_table_lookup_extended (hash, NULL, &ok, &ov))
+       if (!u_hash_table_lookup_extended (hash, NULL, &ok, &ov))
                return FAILED ("Did not find the NULL");
        if (ok != NULL)
                return FAILED ("Incorrect key found");
-       if (ov != GINT_TO_POINTER (1))
+       if (ov != U_INT_TO_POINTER (1))
                return FAILED ("Got wrong value %p\n", ov);
 
-       if (!g_hash_table_lookup_extended (hash, GINT_TO_POINTER(1), &ok, &ov))
+       if (!u_hash_table_lookup_extended (hash, U_INT_TO_POINTER(1), &ok, &ov))
                return FAILED ("Did not find the 1");
-       if (ok != GINT_TO_POINTER(1))
+       if (ok != U_INT_TO_POINTER(1))
                return FAILED ("Incorrect key found");
-       if (ov != GINT_TO_POINTER (2))
+       if (ov != U_INT_TO_POINTER (2))
                return FAILED ("Got wrong value %p\n", ov);
-       
-       g_hash_table_destroy (hash);
+
+       u_hash_table_destroy (hash);
 
        return NULL;
 }
 
 static void
-counter (gpointer key, gpointer value, gpointer user_data)
+counter (void * key, void * value, void * user_data)
 {
        int *counter = (int *) user_data;
 
@@ -99,66 +99,66 @@ counter (gpointer key, gpointer value, gpointer user_data)
 
 RESULT hash_grow (void)
 {
-       GHashTable *hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+       UHashTable *hash = u_hash_table_new_full (u_str_hash, u_str_equal, u_free, u_free);
        int i, count = 0;
-       
+
        for (i = 0; i < 1000; i++)
-               g_hash_table_insert (hash, g_strdup_printf ("%d", i), g_strdup_printf ("x-%d", i));
+               u_hash_table_insert (hash, u_strdup_printf ("%d", i), u_strdup_printf ("x-%d", i));
 
        for (i = 0; i < 1000; i++){
                char buffer [30];
-               gpointer value;
-               
+               void * value;
+
                sprintf (buffer, "%d", i);
 
-               value = g_hash_table_lookup (hash, buffer);
+               value = u_hash_table_lookup (hash, buffer);
                sprintf (buffer, "x-%d", i);
                if (strcmp (value, buffer) != 0){
                        return FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
                }
        }
 
-       if (g_hash_table_size (hash) != 1000)
-               return FAILED ("Did not find 1000 elements on the hash, found %d\n", g_hash_table_size 
(hash));
+       if (u_hash_table_size (hash) != 1000)
+               return FAILED ("Did not find 1000 elements on the hash, found %d\n", u_hash_table_size 
(hash));
 
        /* Now do the manual count, lets not trust the internals */
-       g_hash_table_foreach (hash, counter, &count);
+       u_hash_table_foreach (hash, counter, &count);
        if (count != 1000){
                return FAILED ("Foreach count is not 1000");
        }
 
-       g_hash_table_destroy (hash);
+       u_hash_table_destroy (hash);
        return NULL;
 }
 
 RESULT hash_iter (void)
 {
-#if !defined(GLIB_MAJOR_VERSION) || GLIB_CHECK_VERSION(2, 16, 0)
-       GHashTable *hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
-       GHashTableIter iter;
+#if !defined(ULIB_MAJOR_VERSION) || ULIB_CHECK_VERSION(2, 16, 0)
+       UHashTable *hash = u_hash_table_new_full (u_direct_hash, u_direct_equal, NULL, NULL);
+       UHashTableIter iter;
        int i, sum, keys_sum, values_sum;
-       gpointer key, value;
+       void *key, *value;
 
        sum = 0;
        for (i = 0; i < 1000; i++) {
                sum += i;
-               g_hash_table_insert (hash, GUINT_TO_POINTER (i), GUINT_TO_POINTER (i));
+               u_hash_table_insert (hash, U_UINT_TO_POINTER (i), U_UINT_TO_POINTER (i));
        }
 
        keys_sum = values_sum = 0;
-       g_hash_table_iter_init (&iter, hash);
-       while (g_hash_table_iter_next (&iter, &key, &value)) {
+       u_hash_table_iter_init (&iter, hash);
+       while (u_hash_table_iter_next (&iter, &key, &value)) {
                if (key != value)
                        return FAILED ("key != value");
-               keys_sum += GPOINTER_TO_UINT (key);
-               values_sum += GPOINTER_TO_UINT (value);
+               keys_sum += U_POINTER_TO_UINT (key);
+               values_sum += U_POINTER_TO_UINT (value);
        }
        if (keys_sum != sum || values_sum != sum)
                return FAILED ("Did not find all key-value pairs");
-       g_hash_table_destroy (hash);
+       u_hash_table_destroy (hash);
        return NULL;
 #else
-       /* GHashTableIter was added in glib 2.16 */
+       /* UHashTableIter was added in glib 2.16 */
        return NULL;
 #endif
 }
diff --git a/deps/ulib/test/list.c b/deps/ulib/test/list.c
new file mode 100644
index 0000000..ab52f65
--- /dev/null
+++ b/deps/ulib/test/list.c
@@ -0,0 +1,438 @@
+#include <stdio.h>
+#include <string.h>
+#include <ulib.h>
+#include "test.h"
+
+RESULT
+test_list_length ()
+{
+       UList *list = u_list_prepend (NULL, "foo");
+
+       if (u_list_length (list) != 1)
+               return FAILED ("length failed. #1");
+
+       list = u_list_prepend (list, "bar");
+       if (u_list_length (list) != 2)
+               return FAILED ("length failed. #2");
+
+       list = u_list_append (list, "bar");
+       if (u_list_length (list) != 3)
+               return FAILED ("length failed. #3");
+
+       u_list_free (list);
+       return NULL;
+}
+
+RESULT
+test_list_nth ()
+{
+       char *foo = "foo";
+       char *bar = "bar";
+       char *baz = "baz";
+       UList *nth, *list;
+       list = u_list_prepend (NULL, baz);
+       list = u_list_prepend (list, bar);
+       list = u_list_prepend (list, foo);
+
+       nth = u_list_nth (list, 0);
+       if (nth->data != foo)
+               return FAILED ("nth failed. #0");
+
+       nth = u_list_nth (list, 1);
+       if (nth->data != bar)
+               return FAILED ("nth failed. #1");
+       
+       nth = u_list_nth (list, 2);
+       if (nth->data != baz)
+               return FAILED ("nth failed. #2");
+
+       nth = u_list_nth (list, 3);
+       if (nth)
+               return FAILED ("nth failed. #3: %s", nth->data);
+
+       u_list_free (list);
+       return OK;
+}
+
+RESULT
+test_list_index ()
+{
+       int i;
+       char *foo = "foo";
+       char *bar = "bar";
+       char *baz = "baz";
+       UList *list;
+       list = u_list_prepend (NULL, baz);
+       list = u_list_prepend (list, bar);
+       list = u_list_prepend (list, foo);
+
+       i = u_list_index (list, foo);
+       if (i != 0)
+               return FAILED ("index failed. #0: %d", i);
+
+       i = u_list_index (list, bar);
+       if (i != 1)
+               return FAILED ("index failed. #1: %d", i);
+       
+       i = u_list_index (list, baz);
+       if (i != 2)
+               return FAILED ("index failed. #2: %d", i);
+
+       u_list_free (list);
+       return OK;
+}
+
+RESULT
+test_list_append ()
+{
+       UList *list = u_list_prepend (NULL, "first");
+       if (u_list_length (list) != 1)
+               return FAILED ("Prepend failed");
+
+       list = u_list_append (list, "second");
+
+       if (u_list_length (list) != 2)
+               return FAILED ("Append failed");
+
+       u_list_free (list);
+       return OK;
+}
+
+RESULT
+test_list_last ()
+{
+       UList *foo = u_list_prepend (NULL, "foo");
+       UList *bar = u_list_prepend (NULL, "bar");
+       UList *last;
+       
+       foo = u_list_concat (foo, bar);
+       last = u_list_last (foo);
+
+       if (last != bar)
+               return FAILED ("last failed. #1");
+
+       foo = u_list_concat (foo, u_list_prepend (NULL, "baz"));
+       foo = u_list_concat (foo, u_list_prepend (NULL, "quux"));
+
+       last = u_list_last (foo);       
+       if (strcmp ("quux", last->data))
+               return FAILED ("last failed. #2");
+
+       u_list_free (foo);
+
+       return OK;
+}
+
+RESULT
+test_list_concat ()
+{
+       UList *foo = u_list_prepend (NULL, "foo");
+       UList *bar = u_list_prepend (NULL, "bar");
+       UList *list = u_list_concat (foo, bar);
+
+       if (u_list_length (list) != 2)
+               return FAILED ("Concat failed. #1");
+
+       if (strcmp (list->data, "foo"))
+               return FAILED ("Concat failed. #2");
+
+       if (strcmp (list->next->data, "bar"))
+               return FAILED ("Concat failed. #3");
+
+       if (u_list_first (list) != foo)
+               return FAILED ("Concat failed. #4");
+       
+       if (u_list_last (list) != bar)
+               return FAILED ("Concat failed. #5");
+
+       u_list_free (list);
+
+       return OK;
+}
+
+
+static int
+compare (const void * a, const void * b)
+{
+       char *foo = (char *) a;
+       char *bar = (char *) b;
+
+       if (strlen (foo) < strlen (bar))
+               return -1;
+
+       return 1;
+}
+
+RESULT
+test_list_insert_sorted ()
+{
+       UList *list = u_list_prepend (NULL, "a");
+       list = u_list_append (list, "aaa");
+
+       /* insert at the middle */
+       list = u_list_insert_sorted (list, "aa", compare);
+       if (strcmp ("aa", list->next->data))
+               return FAILED ("insert_sorted failed. #1");
+
+       /* insert at the beginning */
+       list = u_list_insert_sorted (list, "", compare);
+       if (strcmp ("", list->data))
+               return FAILED ("insert_sorted failed. #2");             
+
+       /* insert at the end */
+       list = u_list_insert_sorted (list, "aaaa", compare);
+       if (strcmp ("aaaa", u_list_last (list)->data))
+               return FAILED ("insert_sorted failed. #3");
+
+       u_list_free (list);
+       return OK;
+}
+
+RESULT
+test_list_copy ()
+{
+       int i, length;
+       UList *list, *copy;
+       list = u_list_prepend (NULL, "a");
+       list = u_list_append  (list, "aa");
+       list = u_list_append  (list, "aaa");
+       list = u_list_append  (list, "aaaa");
+
+       length = u_list_length (list);
+       copy = u_list_copy (list);
+
+       for (i = 0; i < length; i++)
+               if (strcmp (u_list_nth (list, i)->data,
+                           u_list_nth (copy, i)->data))
+                       return FAILED ("copy failed.");
+
+       u_list_free (list);
+       u_list_free (copy);     
+       return OK;
+}
+
+RESULT
+test_list_reverse ()
+{
+       unsigned int i, length;
+       UList *list, *reverse;
+       list = u_list_prepend (NULL, "a");
+       list = u_list_append  (list, "aa");
+       list = u_list_append  (list, "aaa");
+       list = u_list_append  (list, "aaaa");
+
+       length  = u_list_length (list);
+       reverse = u_list_reverse (u_list_copy (list));
+
+       if (u_list_length (reverse) != length)
+               return FAILED ("reverse failed #1");
+
+       for (i = 0; i < length; i++){
+               unsigned int j = length - i - 1;
+               if (strcmp (u_list_nth (list, i)->data,
+                           u_list_nth (reverse, j)->data))
+                       return FAILED ("reverse failed. #2");
+       }
+
+       u_list_free (list);
+       u_list_free (reverse);  
+       return OK;
+}
+
+RESULT
+test_list_remove ()
+{
+       UList *list = u_list_prepend (NULL, "three");
+       char *one = "one";
+       list = u_list_prepend (list, "two");
+       list = u_list_prepend (list, one);
+
+       list = u_list_remove (list, one);
+
+       if (u_list_length (list) != 2)
+               return FAILED ("Remove failed");
+
+       if (strcmp ("two", list->data) != 0)
+               return FAILED ("Remove failed");
+
+       u_list_free (list);
+       return OK;
+}
+
+RESULT
+test_list_remove_link ()
+{
+       UList *foo = u_list_prepend (NULL, "a");
+       UList *bar = u_list_prepend (NULL, "b");
+       UList *baz = u_list_prepend (NULL, "c");
+       UList *list = foo;
+
+       foo = u_list_concat (foo, bar);
+       foo = u_list_concat (foo, baz); 
+
+       list = u_list_remove_link (list, bar);
+
+       if (u_list_length (list) != 2)
+               return FAILED ("remove_link failed #1");
+
+       if (bar->next != NULL)
+               return FAILED ("remove_link failed #2");
+
+       u_list_free (list);     
+       u_list_free (bar);
+       return OK;
+}
+
+RESULT
+test_list_insert_before ()
+{
+       UList *foo, *bar, *baz;
+
+       foo = u_list_prepend (NULL, "foo");
+       foo = u_list_insert_before (foo, NULL, "bar");
+       bar = u_list_last (foo);
+
+       if (strcmp (bar->data, "bar"))
+               return FAILED ("1");
+
+       baz = u_list_insert_before (foo, bar, "baz");
+       if (foo != baz)
+               return FAILED ("2");
+
+       if (strcmp (u_list_nth_data (foo, 1), "baz"))
+               return FAILED ("3: %s", u_list_nth_data (foo, 1));      
+
+       u_list_free (foo);
+       return OK;
+}
+
+#define N_ELEMS 101
+
+static int intcompare (const void * p1, const void * p2)
+{
+       return U_POINTER_TO_INT (p1) - U_POINTER_TO_INT (p2);
+}
+
+static uboolean verify_sort (UList *list, int len)
+{
+       int prev;
+
+       if (list->prev)
+               return FALSE;
+
+       prev = U_POINTER_TO_INT (list->data);
+       len--;
+       for (list = list->next; list; list = list->next) {
+               int curr = U_POINTER_TO_INT (list->data);
+               if (prev > curr)
+                       return FALSE;
+               prev = curr;
+
+               if (!list->prev || list->prev->next != list)
+                       return FALSE;
+
+               if (len == 0)
+                       return FALSE;
+               len--;
+       }
+       return len == 0;
+}
+
+RESULT
+test_list_sort ()
+{
+       int i, j, mul;
+       UList *list = NULL;
+
+       for (i = 0; i < N_ELEMS; ++i)
+               list = u_list_prepend (list, U_INT_TO_POINTER (i));
+       list = u_list_sort (list, intcompare);
+       if (!verify_sort (list, N_ELEMS))
+               return FAILED ("decreasing list");
+
+       u_list_free (list);
+
+       list = NULL;
+       for (i = 0; i < N_ELEMS; ++i)
+               list = u_list_prepend (list, U_INT_TO_POINTER (-i));
+       list = u_list_sort (list, intcompare);
+       if (!verify_sort (list, N_ELEMS))
+               return FAILED ("increasing list");
+
+       u_list_free (list);
+
+       list = u_list_prepend (NULL, U_INT_TO_POINTER (0));
+       for (i = 1; i < N_ELEMS; ++i) {
+               list = u_list_prepend (list, U_INT_TO_POINTER (i));
+               list = u_list_prepend (list, U_INT_TO_POINTER (-i));
+       }
+       list = u_list_sort (list, intcompare);
+       if (!verify_sort (list, 2*N_ELEMS-1))
+               return FAILED ("alternating list");
+
+       u_list_free (list);
+
+       list = NULL;
+       mul = 1;
+       for (i = 1; i < N_ELEMS; ++i) {
+               mul = -mul;
+               for (j = 0; j < i; ++j)
+                       list = u_list_prepend (list, U_INT_TO_POINTER (mul * j));
+       }
+       list = u_list_sort (list, intcompare);
+       if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
+               return FAILED ("wavering list");
+
+       u_list_free (list);
+
+       return OK;
+}
+
+static int
+find_custom (const void * a, const void * b)
+{
+       return(strcmp (a, b));
+}
+
+RESULT
+test_list_find_custom ()
+{
+       UList *list = NULL, *found;
+       char *foo = "foo";
+       char *bar = "bar";
+       char *baz = "baz";
+       
+       list = u_list_prepend (list, baz);
+       list = u_list_prepend (list, bar);
+       list = u_list_prepend (list, foo);
+       
+       found = u_list_find_custom (list, baz, find_custom);
+       
+       if (found == NULL)
+               return FAILED ("Find failed");
+       
+       u_list_free (list);
+       
+       return OK;
+}
+
+static Test list_tests [] = {
+       {       "length", test_list_length},
+       {          "nth", test_list_nth},
+       {        "index", test_list_index},     
+       {         "last", test_list_last},      
+       {       "append", test_list_append},
+       {       "concat", test_list_concat},
+       {"insert_sorted", test_list_insert_sorted},
+       {"insert_before", test_list_insert_before},
+       {         "copy", test_list_copy},
+       {      "reverse", test_list_reverse},
+       {       "remove", test_list_remove},
+       {  "remove_link", test_list_remove_link},
+       {  "remove_link", test_list_remove_link},
+       {         "sort", test_list_sort},
+       {  "find_custom", test_list_find_custom},
+       {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
diff --git a/deps/eglib/test/memory.c b/deps/ulib/test/memory.c
similarity index 50%
rename from deps/eglib/test/memory.c
rename to deps/ulib/test/memory.c
index db7db08..7be283f 100644
--- a/deps/eglib/test/memory.c
+++ b/deps/ulib/test/memory.c
@@ -1,31 +1,31 @@
 
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 RESULT
 test_memory_zero_size_allocations ()
 {
-       gpointer p;
+       void * p;
 
-       p = g_malloc (0);
+       p = u_malloc (0);
         if (p)
-                return FAILED ("Calling g_malloc with size zero should return NULL.");
+                return FAILED ("Calling u_malloc with size zero should return NULL.");
 
-       p = g_malloc0 (0);
+       p = u_malloc0 (0);
         if (p)
-                return FAILED ("Calling g_malloc0 with size zero should return NULL.");
+                return FAILED ("Calling u_malloc0 with size zero should return NULL.");
 
-       p = g_realloc (NULL, 0);
+       p = u_realloc (NULL, 0);
         if (p)
-                return FAILED ("Calling g_realloc with size zero should return NULL.");
+                return FAILED ("Calling u_realloc with size zero should return NULL.");
 
-       p = g_new (int, 0);
+       p = u_new (int, 0);
         if (p)
-                return FAILED ("Calling g_new with size zero should return NULL.");
+                return FAILED ("Calling u_new with size zero should return NULL.");
 
-       p = g_new0 (int, 0);
+       p = u_new0 (int, 0);
         if (p)
-                return FAILED ("Calling g_new0 with size zero should return NULL.");
+                return FAILED ("Calling u_new0 with size zero should return NULL.");
 
         return OK;
 }
diff --git a/deps/eglib/test/module.c b/deps/ulib/test/module.c
similarity index 61%
rename from deps/eglib/test/module.c
rename to deps/ulib/test/module.c
index a283637..1f796d3 100644
--- a/deps/eglib/test/module.c
+++ b/deps/ulib/test/module.c
@@ -1,6 +1,6 @@
 #include <config.h>
-#include <glib.h>
-#include <gmodule.h>
+#include <ulib.h>
+#include <umodule.h>
 #include <string.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
@@ -8,54 +8,54 @@
 #endif
 #include "test.h"
 
-#if defined (G_OS_WIN32)
-#define EXTERNAL_SYMBOL "GetProcAddress"
+#if defined (U_OS_WIN32)
+#define EXTERNAL_SYMBOL "UetProcAddress"
 #else
 #define EXTERNAL_SYMBOL "system"
 #endif
 
-void G_MODULE_EXPORT
+void U_MODULE_EXPORT
 dummy_test_export ()
 {
 }
 
-/* test for g_module_open (NULL, ...) */
+/* test for u_module_open (NULL, ...) */
 RESULT
 test_module_symbol_null ()
 {
-       gpointer proc = GINT_TO_POINTER (42);
+       void * proc = U_INT_TO_POINTER (42);
 
-       GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
+       UModule *m = u_module_open (NULL, U_MODULE_BIND_LAZY);
 
        if (m == NULL)
                return FAILED ("bind to main module failed. #0");
 
-       if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
+       if (u_module_symbol (m, "__unlikely_\nexistent__", &proc))
                return FAILED ("non-existent symbol lookup failed. #1");
 
        if (proc)
                return FAILED ("non-existent symbol lookup failed. #2");
 
-       if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
+       if (!u_module_symbol (m, EXTERNAL_SYMBOL, &proc))
                return FAILED ("external lookup failed. #3");
 
        if (!proc)
                return FAILED ("external lookup failed. #4");
 
-       if (!g_module_symbol (m, "dummy_test_export", &proc))
+       if (!u_module_symbol (m, "dummy_test_export", &proc))
                return FAILED ("in-proc lookup failed. #5");
 
        if (!proc)
                return FAILED ("in-proc lookup failed. #6");
 
-       if (!g_module_close (m))
+       if (!u_module_close (m))
                return FAILED ("close failed. #7");
 
        return OK;
 }
 
 static Test module_tests [] = {
-       {"g_module_symbol_null", test_module_symbol_null},
+       {"u_module_symbol_null", test_module_symbol_null},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/path.c b/deps/ulib/test/path.c
similarity index 60%
rename from deps/eglib/test/path.c
rename to deps/ulib/test/path.c
index e3832a0..717d0cf 100644
--- a/deps/eglib/test/path.c
+++ b/deps/ulib/test/path.c
@@ -1,16 +1,16 @@
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef G_OS_UNIX
+#ifdef U_OS_UNIX
 #include <pthread.h>
 #endif
 #include "test.h"
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <direct.h>
 #define chdir _chdir
 #endif
@@ -23,80 +23,80 @@ test_buildpath ()
        char *buffer = "var/private";
        char *dir = "/";
        
-       s = g_build_path ("/", "hola///", "//mundo", NULL);
+       s = u_build_path ("/", "hola///", "//mundo", NULL);
        if (strcmp (s, "hola/mundo") != 0)
                return FAILED ("1 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("/", "hola/", "/mundo", NULL);
+       s = u_build_path ("/", "hola/", "/mundo", NULL);
        if (strcmp (s, "hola/mundo") != 0)
                return FAILED ("2 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("/", "hola/", "mundo", NULL);
+       s = u_build_path ("/", "hola/", "mundo", NULL);
        if (strcmp (s, "hola/mundo") != 0)
                return FAILED ("3 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("/", "hola", "/mundo", NULL);
+       s = u_build_path ("/", "hola", "/mundo", NULL);
        if (strcmp (s, "hola/mundo") != 0)
                return FAILED ("4 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("/", "/hello", "world/", NULL);
+       s = u_build_path ("/", "/hello", "world/", NULL);
        if (strcmp (s, "/hello/world/") != 0)
                return FAILED ("5 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
        
        /* Now test multi-char-separators */
-       s = g_build_path ("**", "hello", "world", NULL);
+       s = u_build_path ("**", "hello", "world", NULL);
        if (strcmp (s, "hello**world") != 0)
                return FAILED ("6 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("**", "hello**", "world", NULL);
+       s = u_build_path ("**", "hello**", "world", NULL);
        if (strcmp (s, "hello**world") != 0)
                return FAILED ("7 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("**", "hello**", "**world", NULL);
+       s = u_build_path ("**", "hello**", "**world", NULL);
        if (strcmp (s, "hello**world") != 0)
                return FAILED ("8 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
        
-       s = g_build_path ("**", "hello**", "**world", NULL);
+       s = u_build_path ("**", "hello**", "**world", NULL);
        if (strcmp (s, "hello**world") != 0)
                return FAILED ("9 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("1234567890", "hello", "world", NULL);
+       s = u_build_path ("1234567890", "hello", "world", NULL);
        if (strcmp (s, "hello1234567890world") != 0)
                return FAILED ("10 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
+       s = u_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
        if (strcmp (s, "hello1234567890world") != 0)
                return FAILED ("11 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
+       s = u_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
        if (strcmp (s, "hello1234567890world") != 0)
                return FAILED ("12 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
        /* Multiple */
-       s = g_build_path ("/", "a", "b", "c", "d", NULL);
+       s = u_build_path ("/", "a", "b", "c", "d", NULL);
        if (strcmp (s, "a/b/c/d") != 0)
                return FAILED ("13 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_build_path ("/", "/a", "", "/c/", NULL);
+       s = u_build_path ("/", "/a", "", "/c/", NULL);
        if (strcmp (s, "/a/c/") != 0)
                return FAILED ("14 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
        /* Null */
-       s = g_build_path ("/", NULL, NULL);
+       s = u_build_path ("/", NULL, NULL);
        if (s == NULL)
                return FAILED ("must get a non-NULL return");
        if (s [0] != 0)
@@ -107,11 +107,11 @@ test_buildpath ()
        // and caused all kinds of random errors.
        dir = "//";
        dir++;
-       s = g_build_filename (dir, buffer, NULL);
+       s = u_build_filename (dir, buffer, NULL);
        if (s [0] != '/')
                return FAILED ("Must have a '/' at the start");
 
-       g_free (s);
+       u_free (s);
        return OK;
 }
 
@@ -120,26 +120,26 @@ test_buildfname ()
 {
        char *s;
        
-       s = g_build_filename ("a", "b", "c", "d", NULL);
-#ifdef G_OS_WIN32
+       s = u_build_filename ("a", "b", "c", "d", NULL);
+#ifdef U_OS_WIN32
        if (strcmp (s, "a\\b\\c\\d") != 0)
 #else
        if (strcmp (s, "a/b/c/d") != 0)
 #endif
                return FAILED ("1 Got wrong result, got: %s", s);
-       g_free (s);
+       u_free (s);
 
-#ifdef G_OS_WIN32
-       s = g_build_filename ("C:\\", "a", NULL);
+#ifdef U_OS_WIN32
+       s = u_build_filename ("C:\\", "a", NULL);
        if (strcmp (s, "C:\\a") != 0)
 #else
-       s = g_build_filename ("/", "a", NULL);
+       s = u_build_filename ("/", "a", NULL);
        if (strcmp (s, "/a") != 0)
 #endif
                return FAILED ("1 Got wrong result, got: %s", s);
 
-#ifndef G_OS_WIN32
-       s = g_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
+#ifndef U_OS_WIN32
+       s = u_build_filename ("/", "foo", "/bar", "tolo/", "/meo/", NULL);
        if (strcmp (s, "/foo/bar/tolo/meo/") != 0)
                return FAILED ("1 Got wrong result, got: %s", s);
 #endif
@@ -152,47 +152,47 @@ test_dirname ()
 {
        char *s;
 
-#ifdef G_OS_WIN32
-       s = g_path_get_dirname ("c:\\home\\miguel");
+#ifdef U_OS_WIN32
+       s = u_path_get_dirname ("c:\\home\\miguel");
        if (strcmp (s, "c:\\home") != 0)
                return FAILED ("Expected c:\\home, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("c:/home/miguel");
+       s = u_path_get_dirname ("c:/home/miguel");
        if (strcmp (s, "c:/home") != 0)
                return FAILED ("Expected c:/home, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("c:\\home\\dingus\\");
+       s = u_path_get_dirname ("c:\\home\\dingus\\");
        if (strcmp (s, "c:\\home\\dingus") != 0)
                return FAILED ("Expected c:\\home\\dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("dir.c");
+       s = u_path_get_dirname ("dir.c");
        if (strcmp (s, ".") != 0)
                return FAILED ("Expected `.', got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("c:\\index.html");
+       s = u_path_get_dirname ("c:\\index.html");
        if (strcmp (s, "c:") != 0)
                return FAILED ("Expected [c:], got [%s]", s);
 #else
-       s = g_path_get_dirname ("/home/miguel");
+       s = u_path_get_dirname ("/home/miguel");
        if (strcmp (s, "/home") != 0)
                return FAILED ("Expected /home, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("/home/dingus/");
+       s = u_path_get_dirname ("/home/dingus/");
        if (strcmp (s, "/home/dingus") != 0)
                return FAILED ("Expected /home/dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("dir.c");
+       s = u_path_get_dirname ("dir.c");
        if (strcmp (s, ".") != 0)
                return FAILED ("Expected `.', got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_dirname ("/index.html");
+       s = u_path_get_dirname ("/index.html");
        if (strcmp (s, "/") != 0)
                return FAILED ("Expected [/], got [%s]", s);
 #endif 
@@ -204,132 +204,132 @@ test_basename ()
 {
        char *s;
 
-#ifdef G_OS_WIN32
-       s = g_path_get_basename ("");
+#ifdef U_OS_WIN32
+       s = u_path_get_basename ("");
        if (strcmp (s, ".") != 0)
                return FAILED ("Expected `.', got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("c:\\home\\dingus\\");
+       s = u_path_get_basename ("c:\\home\\dingus\\");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("1 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("c:/home/dingus/");
+       s = u_path_get_basename ("c:/home/dingus/");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("1 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("c:\\home\\dingus");
+       s = u_path_get_basename ("c:\\home\\dingus");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("2 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("c:/home/dingus");
+       s = u_path_get_basename ("c:/home/dingus");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("2 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 #else
-       s = g_path_get_basename ("");
+       s = u_path_get_basename ("");
        if (strcmp (s, ".") != 0)
                return FAILED ("Expected `.', got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("/home/dingus/");
+       s = u_path_get_basename ("/home/dingus/");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("1 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 
-       s = g_path_get_basename ("/home/dingus");
+       s = u_path_get_basename ("/home/dingus");
        if (strcmp (s, "dingus") != 0)
                return FAILED ("2 Expected dingus, got %s", s);
-       g_free (s);
+       u_free (s);
 #endif
        return OK;
 }
 
-gchar *
+char *
 test_ppath ()
 {
        char *s;
-#ifdef G_OS_WIN32
-       const gchar *searchfor = "explorer.exe";
+#ifdef U_OS_WIN32
+       const char *searchfor = "explorer.exe";
 #else
-       const gchar *searchfor = "ls";
+       const char *searchfor = "ls";
 #endif
-       s = g_find_program_in_path (searchfor);
+       s = u_find_program_in_path (searchfor);
        if (s == NULL)
                return FAILED ("No %s on this system?", searchfor);
-       g_free (s);
+       u_free (s);
        return OK;
 }
 
-gchar *
+char *
 test_ppath2 ()
 {
        char *s;
-       const char *path = g_getenv ("PATH");
-#ifdef G_OS_WIN32
-       const gchar *searchfor = "test_eglib.exe";
+       const char *path = u_getenv ("PATH");
+#ifdef U_OS_WIN32
+       const char *searchfor = "test_eglib.exe";
 #else
-       const gchar *searchfor = "test-glib";
+       const char *searchfor = "test-glib";
 #endif
        
-       g_setenv ("PATH", "", TRUE);
-       s = g_find_program_in_path ("ls");
+       u_setenv ("PATH", "", TRUE);
+       s = u_find_program_in_path ("ls");
        if (s != NULL) {
-               g_setenv ("PATH", path, TRUE);
+               u_setenv ("PATH", path, TRUE);
                return FAILED ("Found something interesting here: %s", s);
        }
-       g_free (s);
-       s = g_find_program_in_path (searchfor);
+       u_free (s);
+       s = u_find_program_in_path (searchfor);
        if (s == NULL) {
-               g_setenv ("PATH", path, TRUE);
+               u_setenv ("PATH", path, TRUE);
                return FAILED ("It should find '%s' in the current directory.", searchfor);
        }
-       g_free (s);
-       g_setenv ("PATH", path, TRUE);
+       u_free (s);
+       u_setenv ("PATH", path, TRUE);
        return OK;
 }
 
 #ifndef DISABLE_FILESYSTEM_TESTS
-gchar *
+char *
 test_cwd ()
 {
-       char *dir = g_get_current_dir ();
-#ifdef G_OS_WIN32
-       const gchar *newdir = "C:\\Windows";
+       char *dir = u_get_current_dir ();
+#ifdef U_OS_WIN32
+       const char *newdir = "C:\\Windows";
 #else
-       const gchar *newdir = "/bin";
+       const char *newdir = "/bin";
 #endif
 
        if (dir == NULL)
                return FAILED ("No current directory?");
-       g_free (dir);
+       u_free (dir);
        
        if (chdir (newdir) == -1)
                return FAILED ("No %s?", newdir);
        
-       dir = g_get_current_dir ();
+       dir = u_get_current_dir ();
        if (strcmp (dir, newdir) != 0)
                return FAILED("Did not go to %s?", newdir);
-       g_free (dir);
+       u_free (dir);
        
        return OK;
 }
 #else
-gchar *
+char *
 test_cwd ()
 {
        return OK;
 }
 #endif
 
-gchar *
+char *
 test_misc ()
 {
-       const char *home = g_get_home_dir ();
-       const char *tmp = g_get_tmp_dir ();
+       const char *home = u_get_home_dir ();
+       const char *tmp = u_get_tmp_dir ();
        
        if (home == NULL)
                return FAILED ("Where did my home go?");
@@ -341,12 +341,12 @@ test_misc ()
 }
 
 static Test path_tests [] = {
-       {"g_build_filename", test_buildfname},
-       {"g_buildpath", test_buildpath},
-       {"g_path_get_dirname", test_dirname},
-       {"g_path_get_basename", test_basename},
-       {"g_find_program_in_path", test_ppath},
-       {"g_find_program_in_path2", test_ppath2},
+       {"u_build_filename", test_buildfname},
+       {"u_buildpath", test_buildpath},
+       {"u_path_get_dirname", test_dirname},
+       {"u_path_get_basename", test_basename},
+       {"u_find_program_in_path", test_ppath},
+       {"u_find_program_in_path2", test_ppath2},
        {"test_cwd", test_cwd },
        {"test_misc", test_misc },
        {NULL, NULL}
diff --git a/deps/eglib/test/ptrarray.c b/deps/ulib/test/ptrarray.c
similarity index 57%
rename from deps/eglib/test/ptrarray.c
rename to deps/ulib/test/ptrarray.c
index 34d78b0..74720a0 100644
--- a/deps/eglib/test/ptrarray.c
+++ b/deps/ulib/test/ptrarray.c
@@ -1,13 +1,13 @@
 #include <stdio.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 /* Redefine the private structure only to verify proper allocations */
-typedef struct _GPtrArrayPriv {
-       gpointer *pdata;
-       guint len;
-       guint size;
-} GPtrArrayPriv;
+typedef struct _UPtrArrayPriv {
+       void * *pdata;
+       unsigned int len;
+       unsigned int size;
+} UPtrArrayPriv;
 
 /* Don't add more than 32 items to this please */
 static const char *items [] = {
@@ -17,13 +17,13 @@ static const char *items [] = {
        NULL
 };
 
-static GPtrArray *ptrarray_alloc_and_fill(guint *item_count)
+static UPtrArray *ptrarray_alloc_and_fill(unsigned int *item_count)
 {
-       GPtrArray *array = g_ptr_array_new();
-       gint i;
+       UPtrArray *array = u_ptr_array_new();
+       int i;
        
        for(i = 0; items[i] != NULL; i++) {
-               g_ptr_array_add(array, (gpointer)items[i]);
+               u_ptr_array_add(array, (void *)items[i]);
        }
 
        if(item_count != NULL) {
@@ -33,9 +33,9 @@ static GPtrArray *ptrarray_alloc_and_fill(guint *item_count)
        return array;
 }
 
-static guint guess_size(guint length)
+static unsigned int guess_size(unsigned int length)
 {
-       guint size = 1;
+       unsigned int size = 1;
 
        while(size < length) {
                size <<= 1;
@@ -46,10 +46,10 @@ static guint guess_size(guint length)
 
 RESULT ptrarray_alloc()
 {
-       GPtrArrayPriv *array;
-       guint i;
+       UPtrArrayPriv *array;
+       unsigned int i;
        
-       array = (GPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
+       array = (UPtrArrayPriv *)ptrarray_alloc_and_fill(&i);
        
        if(array->size != guess_size(array->len)) {
                return FAILED("Size should be %d, but it is %d", 
@@ -60,18 +60,18 @@ RESULT ptrarray_alloc()
                return FAILED("Expected %d node(s) in the array", i);
        }
        
-       g_ptr_array_free((GPtrArray *)array, TRUE);
+       u_ptr_array_free((UPtrArray *)array, TRUE);
 
        return OK;
 }
 
 RESULT ptrarray_for_iterate()
 {
-       GPtrArray *array = ptrarray_alloc_and_fill(NULL);
-       guint i;
+       UPtrArray *array = ptrarray_alloc_and_fill(NULL);
+       unsigned int i;
 
        for(i = 0; i < array->len; i++) {
-               char *item = (char *)g_ptr_array_index(array, i);
+               char *item = (char *)u_ptr_array_index(array, i);
                if(item != items[i]) {
                        return FAILED(
                                "Expected item at %d to be %s, but it was %s", 
@@ -79,15 +79,15 @@ RESULT ptrarray_for_iterate()
                }
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
-static gint foreach_iterate_index = 0;
+static int foreach_iterate_index = 0;
 static char *foreach_iterate_error = NULL;
 
-void foreach_callback(gpointer data, gpointer user_data)
+void foreach_callback(void * data, void * user_data)
 {
        char *item = (char *)data;
        const char *item_cmp = items[foreach_iterate_index++];
@@ -105,26 +105,26 @@ void foreach_callback(gpointer data, gpointer user_data)
 
 RESULT ptrarray_foreach_iterate()
 {
-       GPtrArray *array = ptrarray_alloc_and_fill(NULL);
+       UPtrArray *array = ptrarray_alloc_and_fill(NULL);
        
        foreach_iterate_index = 0;
        foreach_iterate_error = NULL;
        
-       g_ptr_array_foreach(array, foreach_callback, array);
+       u_ptr_array_foreach(array, foreach_callback, array);
        
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return foreach_iterate_error;
 }
 
 RESULT ptrarray_set_size()
 {
-       GPtrArray *array = g_ptr_array_new();
-       guint i, grow_length = 50;
+       UPtrArray *array = u_ptr_array_new();
+       unsigned int i, grow_length = 50;
        
-       g_ptr_array_add(array, (gpointer)items[0]);
-       g_ptr_array_add(array, (gpointer)items[1]);
-       g_ptr_array_set_size(array, grow_length);
+       u_ptr_array_add(array, (void *)items[0]);
+       u_ptr_array_add(array, (void *)items[1]);
+       u_ptr_array_set_size(array, grow_length);
 
        if(array->len != grow_length) {
                return FAILED("Array length should be 50, it is %d", array->len);
@@ -140,123 +140,123 @@ RESULT ptrarray_set_size()
                }
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
 RESULT ptrarray_remove_index()
 {
-       GPtrArray *array;
-       guint i;
+       UPtrArray *array;
+       unsigned int i;
        
        array = ptrarray_alloc_and_fill(&i);
        
-       g_ptr_array_remove_index(array, 0);
+       u_ptr_array_remove_index(array, 0);
        if(array->pdata[0] != items[1]) {
                return FAILED("First item is not %s, it is %s", items[1],
                        array->pdata[0]);
        }
 
-       g_ptr_array_remove_index(array, array->len - 1);
+       u_ptr_array_remove_index(array, array->len - 1);
        
        if(array->pdata[array->len - 1] != items[array->len]) {
                return FAILED("Last item is not %s, it is %s", 
                        items[array->len - 2], array->pdata[array->len - 1]);
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
 RESULT ptrarray_remove_index_fast()
 {
-       GPtrArray *array;
-       guint i;
+       UPtrArray *array;
+       unsigned int i;
 
        array = ptrarray_alloc_and_fill(&i);
 
-       g_ptr_array_remove_index_fast(array, 0);
+       u_ptr_array_remove_index_fast(array, 0);
        if(array->pdata[0] != items[array->len]) {
                return FAILED("First item is not %s, it is %s", items[array->len],
                        array->pdata[0]);
        }
 
-       g_ptr_array_remove_index_fast(array, array->len - 1);
+       u_ptr_array_remove_index_fast(array, array->len - 1);
        if(array->pdata[array->len - 1] != items[array->len - 1]) {
                return FAILED("Last item is not %s, it is %s",
                        items[array->len - 1], array->pdata[array->len - 1]);
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
 RESULT ptrarray_remove()
 {
-       GPtrArray *array;
-       guint i;
+       UPtrArray *array;
+       unsigned int i;
        
        array = ptrarray_alloc_and_fill(&i);
 
-       g_ptr_array_remove(array, (gpointer)items[7]);
+       u_ptr_array_remove(array, (void *)items[7]);
 
-       if(!g_ptr_array_remove(array, (gpointer)items[4])) {
+       if(!u_ptr_array_remove(array, (void *)items[4])) {
                return FAILED("Item %s not removed", items[4]);
        }
 
-       if(g_ptr_array_remove(array, (gpointer)items[4])) {
+       if(u_ptr_array_remove(array, (void *)items[4])) {
                return FAILED("Item %s still in array after removal", items[4]);
        }
 
        if(array->pdata[array->len - 1] != items[array->len + 1]) {
-               return FAILED("Last item in GPtrArray not correct");
+               return FAILED("Last item in UPtrArray not correct");
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
-static gint ptrarray_sort_compare(gconstpointer a, gconstpointer b)
+static int ptrarray_sort_compare(const void * a, const void * b)
 {
-       gchar *stra = *(gchar **) a;
-       gchar *strb = *(gchar **) b;
+       char *stra = *(char **) a;
+       char *strb = *(char **) b;
        return strcmp(stra, strb);
 }
 
 RESULT ptrarray_sort()
 {
-       GPtrArray *array = g_ptr_array_new();
-       guint i;
-       gchar *letters [] = { "A", "B", "C", "D", "E" };
+       UPtrArray *array = u_ptr_array_new();
+       unsigned int i;
+       char *letters [] = { "A", "B", "C", "D", "E" };
        
-       g_ptr_array_add(array, letters[0]);
-       g_ptr_array_add(array, letters[1]);
-       g_ptr_array_add(array, letters[2]);
-       g_ptr_array_add(array, letters[3]);
-       g_ptr_array_add(array, letters[4]);
+       u_ptr_array_add(array, letters[0]);
+       u_ptr_array_add(array, letters[1]);
+       u_ptr_array_add(array, letters[2]);
+       u_ptr_array_add(array, letters[3]);
+       u_ptr_array_add(array, letters[4]);
        
-       g_ptr_array_sort(array, ptrarray_sort_compare);
+       u_ptr_array_sort(array, ptrarray_sort_compare);
 
        for(i = 0; i < array->len; i++) {
                if(array->pdata[i] != letters[i]) {
                        return FAILED("Array out of order, expected %s got %s at position %d",
-                               letters [i], (gchar *) array->pdata [i], i);
+                               letters [i], (char *) array->pdata [i], i);
                }
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
        
        return OK;
 }
 
-static gint ptrarray_sort_compare_with_data (gconstpointer a, gconstpointer b, gpointer user_data)
+static int ptrarray_sort_compare_with_data (const void * a, const void * b, void * user_data)
 {
-       gchar *stra = *(gchar **) a;
-       gchar *strb = *(gchar **) b;
+       char *stra = *(char **) a;
+       char *strb = *(char **) b;
 
        if (strcmp (user_data, "this is the data for qsort") != 0)
                fprintf (stderr, "oops at compare with_data\n");
@@ -266,66 +266,66 @@ static gint ptrarray_sort_compare_with_data (gconstpointer a, gconstpointer b, g
 
 RESULT ptrarray_sort_with_data ()
 {
-       GPtrArray *array = g_ptr_array_new();
-       guint i;
-       gchar *letters [] = { "A", "B", "C", "D", "E" };
+       UPtrArray *array = u_ptr_array_new();
+       unsigned int i;
+       char *letters [] = { "A", "B", "C", "D", "E" };
 
-       g_ptr_array_add(array, letters[4]);
-       g_ptr_array_add(array, letters[1]);
-       g_ptr_array_add(array, letters[2]);
-       g_ptr_array_add(array, letters[0]);
-       g_ptr_array_add(array, letters[3]);
+       u_ptr_array_add(array, letters[4]);
+       u_ptr_array_add(array, letters[1]);
+       u_ptr_array_add(array, letters[2]);
+       u_ptr_array_add(array, letters[0]);
+       u_ptr_array_add(array, letters[3]);
 
-       g_ptr_array_sort_with_data(array, ptrarray_sort_compare_with_data, "this is the data for qsort");
+       u_ptr_array_sort_with_data(array, ptrarray_sort_compare_with_data, "this is the data for qsort");
 
        for(i = 0; i < array->len; i++) {
                if(array->pdata[i] != letters[i]) {
                        return FAILED("Array out of order, expected %s got %s at position %d",
-                               letters [i], (gchar *) array->pdata [i], i);
+                               letters [i], (char *) array->pdata [i], i);
                }
        }
 
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
 
        return OK;
 }
 
 RESULT ptrarray_remove_fast()
 {
-       GPtrArray *array = g_ptr_array_new();
-       gchar *letters [] = { "A", "B", "C", "D", "E" };
+       UPtrArray *array = u_ptr_array_new();
+       char *letters [] = { "A", "B", "C", "D", "E" };
        
-       if (g_ptr_array_remove_fast (array, NULL))
+       if (u_ptr_array_remove_fast (array, NULL))
                return FAILED ("Removing NULL succeeded");
 
-       g_ptr_array_add(array, letters[0]);
-       if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 0)
+       u_ptr_array_add(array, letters[0]);
+       if (!u_ptr_array_remove_fast (array, letters[0]) || array->len != 0)
                return FAILED ("Removing last element failed");
 
-       g_ptr_array_add(array, letters[0]);
-       g_ptr_array_add(array, letters[1]);
-       g_ptr_array_add(array, letters[2]);
-       g_ptr_array_add(array, letters[3]);
-       g_ptr_array_add(array, letters[4]);
+       u_ptr_array_add(array, letters[0]);
+       u_ptr_array_add(array, letters[1]);
+       u_ptr_array_add(array, letters[2]);
+       u_ptr_array_add(array, letters[3]);
+       u_ptr_array_add(array, letters[4]);
 
-       if (!g_ptr_array_remove_fast (array, letters[0]) || array->len != 4)
+       if (!u_ptr_array_remove_fast (array, letters[0]) || array->len != 4)
                return FAILED ("Removing first element failed");
 
        if (array->pdata [0] != letters [4])
                return FAILED ("First element wasn't replaced with last upon removal");
 
-       if (g_ptr_array_remove_fast (array, letters[0]))
+       if (u_ptr_array_remove_fast (array, letters[0]))
                return FAILED ("Succedeed removing a non-existing element");
 
-       if (!g_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
+       if (!u_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
                return FAILED ("Failed removing \"D\"");
 
-       if (!g_ptr_array_remove_fast (array, letters[1]) || array->len != 2)
+       if (!u_ptr_array_remove_fast (array, letters[1]) || array->len != 2)
                return FAILED ("Failed removing \"B\"");
 
        if (array->pdata [0] != letters [4] || array->pdata [1] != letters [2])
                return FAILED ("Last two elements are wrong");
-       g_ptr_array_free(array, TRUE);
+       u_ptr_array_free(array, TRUE);
        
        return OK;
 }
diff --git a/deps/eglib/test/queue.c b/deps/ulib/test/queue.c
similarity index 78%
rename from deps/eglib/test/queue.c
rename to deps/ulib/test/queue.c
index b12ddec..b1c6922 100644
--- a/deps/eglib/test/queue.c
+++ b/deps/ulib/test/queue.c
@@ -1,16 +1,16 @@
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 RESULT
 test_queue_push ()
 {
-       GQueue *queue = g_queue_new ();
+       UQueue *queue = u_queue_new ();
 
-       g_queue_push_head (queue, "foo");
-       g_queue_push_head (queue, "bar");
-       g_queue_push_head (queue, "baz");
+       u_queue_push_head (queue, "foo");
+       u_queue_push_head (queue, "bar");
+       u_queue_push_head (queue, "baz");
 
        if (queue->length != 3)
                return FAILED ("push failed");
@@ -37,18 +37,18 @@ test_queue_push ()
        if (NULL != queue->tail->prev->prev->prev)
                return FAILED ("TAIL: End is wrong");
 
-       g_queue_free (queue);
+       u_queue_free (queue);
        return OK;
 }
 
 RESULT
 test_queue_push_tail ()
 {
-       GQueue *queue = g_queue_new ();
+       UQueue *queue = u_queue_new ();
 
-       g_queue_push_tail (queue, "baz");
-       g_queue_push_tail (queue, "bar");
-       g_queue_push_tail (queue, "foo");
+       u_queue_push_tail (queue, "baz");
+       u_queue_push_tail (queue, "bar");
+       u_queue_push_tail (queue, "foo");
 
        if (queue->length != 3)
                return FAILED ("push failed");
@@ -75,43 +75,43 @@ test_queue_push_tail ()
        if (NULL != queue->tail->prev->prev->prev)
                return FAILED ("TAIL: End is wrong");
 
-       g_queue_free (queue);
+       u_queue_free (queue);
        return OK;
 }
 
 RESULT
 test_queue_pop ()
 {
-       GQueue *queue = g_queue_new ();
-       gpointer data;
+       UQueue *queue = u_queue_new ();
+       void * data;
 
-       g_queue_push_head (queue, "foo");
-       g_queue_push_head (queue, "bar");
-       g_queue_push_head (queue, "baz");
+       u_queue_push_head (queue, "foo");
+       u_queue_push_head (queue, "bar");
+       u_queue_push_head (queue, "baz");
 
-       data = g_queue_pop_head (queue);
+       data = u_queue_pop_head (queue);
        if (strcmp ("baz", data))
                return FAILED ("expect baz.");
 
-       data = g_queue_pop_head (queue);
+       data = u_queue_pop_head (queue);
        if (strcmp ("bar", data))
                return FAILED ("expect bar.");  
 
-       data = g_queue_pop_head (queue);
+       data = u_queue_pop_head (queue);
        if (strcmp ("foo", data))
                return FAILED ("expect foo.");
        
-       if (g_queue_is_empty (queue) == FALSE)
+       if (u_queue_is_empty (queue) == FALSE)
                return FAILED ("expect is_empty.");
 
        if (queue->length != 0)
                return FAILED ("expect 0 length .");
 
-       g_queue_push_head (queue, "foo");
-       g_queue_push_head (queue, "bar");
-       g_queue_push_head (queue, "baz");
+       u_queue_push_head (queue, "foo");
+       u_queue_push_head (queue, "bar");
+       u_queue_push_head (queue, "baz");
 
-       g_queue_pop_head (queue);
+       u_queue_pop_head (queue);
 
        if (NULL != queue->head->prev)
                return FAILED ("HEAD: prev is wrong");
@@ -131,14 +131,14 @@ test_queue_pop ()
        if (NULL != queue->tail->prev->prev)
                return FAILED ("TAIL: End is wrong");
 
-       g_queue_free (queue);
+       u_queue_free (queue);
        return OK;
 }
 
 RESULT
 test_queue_new ()
 {
-       GQueue *queue = g_queue_new ();
+       UQueue *queue = u_queue_new ();
 
        if (queue->length != 0)
                return FAILED ("expect length == 0");
@@ -149,24 +149,24 @@ test_queue_new ()
        if (queue->tail != NULL)
                return FAILED ("expect tail == NULL");
 
-       g_queue_free (queue);
+       u_queue_free (queue);
        return OK;
 }
 
 RESULT
 test_queue_is_empty ()
 {
-       GQueue *queue = g_queue_new ();
+       UQueue *queue = u_queue_new ();
 
-       if (g_queue_is_empty (queue) == FALSE)
+       if (u_queue_is_empty (queue) == FALSE)
                return FAILED ("new queue should be empty");
 
-       g_queue_push_head (queue, "foo");
+       u_queue_push_head (queue, "foo");
 
-       if (g_queue_is_empty (queue) == TRUE)
+       if (u_queue_is_empty (queue) == TRUE)
                return FAILED ("expected TRUE");
 
-       g_queue_free (queue);
+       u_queue_free (queue);
 
        return OK;
 }
diff --git a/deps/eglib/test/shell.c b/deps/ulib/test/shell.c
similarity index 80%
rename from deps/eglib/test/shell.c
rename to deps/ulib/test/shell.c
index 4715f1c..f00e42e 100644
--- a/deps/eglib/test/shell.c
+++ b/deps/ulib/test/shell.c
@@ -1,4 +1,4 @@
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #include "test.h"
@@ -6,38 +6,38 @@
 RESULT
 test_shell_argv1 ()
 {
-       GError *error;
-       gint argc;
-       gchar **argv;
-       gboolean ret;
+       UError *error;
+       int argc;
+       char **argv;
+       uboolean ret;
 
        /* The next line prints a critical error and returns FALSE 
-       ret = g_shell_parse_argv (NULL, NULL, NULL, NULL);
+       ret = u_shell_parse_argv (NULL, NULL, NULL, NULL);
        */
-       ret = g_shell_parse_argv ("", NULL, NULL, NULL);
+       ret = u_shell_parse_argv ("", NULL, NULL, NULL);
        if (ret)
                return FAILED ("1. It should return FALSE");
 
-       ret = g_shell_parse_argv ("hola", NULL, NULL, NULL);
+       ret = u_shell_parse_argv ("hola", NULL, NULL, NULL);
        if (!ret)
                return FAILED ("2. It should return TRUE");
 
        argc = 0;
-       ret = g_shell_parse_argv ("hola", &argc, NULL, NULL);
+       ret = u_shell_parse_argv ("hola", &argc, NULL, NULL);
        if (!ret)
                return FAILED ("3. It should return TRUE");
        if (argc != 1)
                return FAILED ("4. argc was %d", argc);
 
        argc = 0;
-       ret = g_shell_parse_argv ("hola bola", &argc, NULL, NULL);
+       ret = u_shell_parse_argv ("hola bola", &argc, NULL, NULL);
        if (!ret)
                return FAILED ("5. It should return TRUE");
        if (argc != 2)
                return FAILED ("6. argc was %d", argc);
 
        argc = 0;
-       ret = g_shell_parse_argv ("hola bola", &argc, &argv, NULL);
+       ret = u_shell_parse_argv ("hola bola", &argc, &argv, NULL);
        if (!ret)
                return FAILED ("7. It should return TRUE");
        if (argc != 2)
@@ -47,11 +47,11 @@ test_shell_argv1 ()
        if (strcmp (argv [1], "bola"))
                return FAILED ("10. argv[1] was %s", argv [1]);
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola      'bola'", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola      'bola'", &argc, &argv, &error);
        if (!ret)
                return FAILED ("11. It should return TRUE");
        if (argc != 2)
@@ -64,11 +64,11 @@ test_shell_argv1 ()
                return FAILED ("15. error is not null");
 
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola    ''  'bola'", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola    ''  'bola'", &argc, &argv, &error);
        if (!ret)
                return FAILED ("16. It should return TRUE");
        if (argc != 3)
@@ -82,11 +82,11 @@ test_shell_argv1 ()
        if (error != NULL)
                return FAILED ("20. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
        if (!ret)
                return FAILED ("21. It should return TRUE");
        if (argc != 2)
@@ -104,15 +104,15 @@ test_shell_argv1 ()
 RESULT
 test_shell_argv2 ()
 {
-       GError *error;
-       gint argc;
-       gchar **argv;
-       gboolean ret;
+       UError *error;
+       int argc;
+       char **argv;
+       uboolean ret;
 
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola      \"bola\"", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola      \"bola\"", &argc, &argv, &error);
        if (!ret)
                return FAILED ("1. It should return TRUE");
        if (argc != 2)
@@ -124,11 +124,11 @@ test_shell_argv2 ()
        if (error != NULL)
                return FAILED ("5. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola    \"\"  \"bola \"", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola    \"\"  \"bola \"", &argc, &argv, &error);
        if (!ret)
                return FAILED ("6. It should return TRUE");
        if (argc != 3)
@@ -142,11 +142,11 @@ test_shell_argv2 ()
        if (error != NULL)
                return FAILED ("11. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola\n\t    \"\t\"  \"bola \"", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola\n\t    \"\t\"  \"bola \"", &argc, &argv, &error);
        if (!ret)
                return FAILED ("10. It should return TRUE");
        if (argc != 3)
@@ -160,11 +160,11 @@ test_shell_argv2 ()
        if (error != NULL)
                return FAILED ("15. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola\n\t  \\\n  \"\t\"  \"bola \"", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola\n\t  \\\n  \"\t\"  \"bola \"", &argc, &argv, &error);
        if (!ret)
                return FAILED ("16. It should return TRUE");
        if (argc != 3)
@@ -178,22 +178,22 @@ test_shell_argv2 ()
        if (error != NULL)
                return FAILED ("21. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        return OK;
 }
 
 RESULT
 test_shell_argv3 ()
 {
-       GError *error;
-       gint argc;
-       gchar **argv;
-       gboolean ret;
+       UError *error;
+       int argc;
+       char **argv;
+       uboolean ret;
 
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv ("hola      \"bola", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola      \"bola", &argc, &argv, &error);
        if (ret)
                return FAILED ("1. It should return FALSE");
        if (argc != 0)
@@ -204,9 +204,9 @@ test_shell_argv3 ()
                return FAILED ("4. error is null");
 
        /* Text ended before matching quote was found for ". (The text was 'hola      "bola') */
-       g_error_free (error);
+       u_error_free (error);
        error = NULL;
-       ret = g_shell_parse_argv ("hola      \\\"bola", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola      \\\"bola", &argc, &argv, &error);
        if (!ret)
                return FAILED ("5. It should return TRUE");
        if (argc != 2)
@@ -218,10 +218,10 @@ test_shell_argv3 ()
        if (error != NULL)
                return FAILED ("8. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
-       ret = g_shell_parse_argv ("hola      \"\n\\'bola\"", &argc, &argv, &error);
+       ret = u_shell_parse_argv ("hola      \"\n\\'bola\"", &argc, &argv, &error);
        if (!ret)
                return FAILED ("9. It should return TRUE. %s", error->message);
        if (argc != 2)
@@ -233,7 +233,7 @@ test_shell_argv3 ()
        if (error != NULL)
                return FAILED ("13. error is not null");
 
-       g_strfreev (argv);
+       u_strfreev (argv);
        argv = NULL;
        argc = 0;
        return OK;
@@ -243,16 +243,16 @@ test_shell_argv3 ()
 RESULT
 test_shell_argv4 ()
 {
-       GError *error;
-       gint argc;
-       gchar **argv;
-       gboolean ret;
+       UError *error;
+       int argc;
+       char **argv;
+       uboolean ret;
        char *str = "'/usr/bin/gnome-terminal' -e \"bash -c 'read -p \\\"Press any key to continue...\\\" 
-n1;'\"";
 
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv (str, &argc, &argv, &error);
+       ret = u_shell_parse_argv (str, &argc, &argv, &error);
        if (!ret)
                return FAILED ("1. It should return TRUE");
        if (argc != 3)
@@ -276,16 +276,16 @@ test_shell_argv4 ()
 RESULT
 test_shell_argv5 ()
 {
-       GError *error;
-       gint argc;
-       gchar **argv;
-       gboolean ret;
+       UError *error;
+       int argc;
+       char **argv;
+       uboolean ret;
        char *str = "echo \"foo\",\"bar\"";
 
        argv = NULL;
        argc = 0;
        error = NULL;
-       ret = g_shell_parse_argv (str, &argc, &argv, &error);
+       ret = u_shell_parse_argv (str, &argc, &argv, &error);
        if (!ret)
                return FAILED ("1. It should return TRUE");
        if (argc != 2)
@@ -306,13 +306,13 @@ test_shell_argv5 ()
 RESULT
 test_quote ()
 {
-       if (strcmp (g_shell_quote ("foo"), "'foo'"))
+       if (strcmp (u_shell_quote ("foo"), "'foo'"))
                return FAILED ("Should return 'foo'");
 
-       if (strcmp (g_shell_quote ("foo'bar"), "'foo'\\''bar'"))
+       if (strcmp (u_shell_quote ("foo'bar"), "'foo'\\''bar'"))
                return FAILED ("Should return 'foo'\\''bar'");
 
-       if (strcmp (g_shell_quote ("foo bar"), "'foo bar'"))
+       if (strcmp (u_shell_quote ("foo bar"), "'foo bar'"))
                return FAILED ("Should return 'foo bar'");
        return OK;
 }
@@ -323,7 +323,7 @@ static Test shell_tests [] = {
        {"test_shell_argv3", test_shell_argv3},
        {"test_shell_argv4", test_shell_argv4},
        {"test_shell_argv5", test_shell_argv5},
-       {"g_shell_quote", test_quote},
+       {"u_shell_quote", test_quote},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/sizes.c b/deps/ulib/test/sizes.c
similarity index 68%
rename from deps/eglib/test/sizes.c
rename to deps/ulib/test/sizes.c
index f3657da..595e510 100644
--- a/deps/eglib/test/sizes.c
+++ b/deps/ulib/test/sizes.c
@@ -8,7 +8,7 @@
 #include <stdint.h>
 #endif
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 RESULT
@@ -16,53 +16,53 @@ test_ptrconv ()
 {
        int iv, iv2;
        unsigned int uv, uv2;
-       gpointer ptr;
+       void * ptr;
 
-       iv = G_MAXINT32;
-       ptr = GINT_TO_POINTER (iv);
-       iv2 = GPOINTER_TO_INT (ptr);
+       iv = U_MAXINT32;
+       ptr = U_INT_TO_POINTER (iv);
+       iv2 = U_POINTER_TO_INT (ptr);
        if (iv != iv2)
                return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
 
-       iv = G_MININT32;
-       ptr = GINT_TO_POINTER (iv);
-       iv2 = GPOINTER_TO_INT (ptr);
+       iv = U_MININT32;
+       ptr = U_INT_TO_POINTER (iv);
+       iv2 = U_POINTER_TO_INT (ptr);
        if (iv != iv2)
                return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
 
        iv = 1;
-       ptr = GINT_TO_POINTER (iv);
-       iv2 = GPOINTER_TO_INT (ptr);
+       ptr = U_INT_TO_POINTER (iv);
+       iv2 = U_POINTER_TO_INT (ptr);
        if (iv != iv2)
                return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
 
        iv = -1;
-       ptr = GINT_TO_POINTER (iv);
-       iv2 = GPOINTER_TO_INT (ptr);
+       ptr = U_INT_TO_POINTER (iv);
+       iv2 = U_POINTER_TO_INT (ptr);
        if (iv != iv2)
                return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
 
        iv = 0;
-       ptr = GINT_TO_POINTER (iv);
-       iv2 = GPOINTER_TO_INT (ptr);
+       ptr = U_INT_TO_POINTER (iv);
+       iv2 = U_POINTER_TO_INT (ptr);
        if (iv != iv2)
                return FAILED ("int to pointer and back conversions fail %d != %d", iv, iv2);
 
        uv = 0;
-       ptr = GUINT_TO_POINTER (uv);
-       uv2 = GPOINTER_TO_UINT (ptr);
+       ptr = U_UINT_TO_POINTER (uv);
+       uv2 = U_POINTER_TO_UINT (ptr);
        if (uv != uv2)
                return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
 
        uv = 1;
-       ptr = GUINT_TO_POINTER (uv);
-       uv2 = GPOINTER_TO_UINT (ptr);
+       ptr = U_UINT_TO_POINTER (uv);
+       uv2 = U_POINTER_TO_UINT (ptr);
        if (uv != uv2)
                return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
 
        uv = UINT32_MAX;
-       ptr = GUINT_TO_POINTER (uv);
-       uv2 = GPOINTER_TO_UINT (ptr);
+       ptr = U_UINT_TO_POINTER (uv);
+       uv2 = U_POINTER_TO_UINT (ptr);
        if (uv != uv2)
                return FAILED ("uint to pointer and back conversions fail %u != %d", uv, uv2);
 
@@ -78,10 +78,10 @@ typedef struct {
 RESULT
 test_offset ()
 {
-       if (G_STRUCT_OFFSET (my_struct, a) != 0)
+       if (U_STRUCT_OFFSET (my_struct, a) != 0)
                return FAILED ("offset of a is not zero");
 
-       if (G_STRUCT_OFFSET (my_struct, b) != 4 && G_STRUCT_OFFSET (my_struct, b) != 8)
+       if (U_STRUCT_OFFSET (my_struct, b) != 4 && U_STRUCT_OFFSET (my_struct, b) != 8)
                return FAILED ("offset of b is 4 or 8, macro might be busted");
 
        return OK;
@@ -89,7 +89,7 @@ test_offset ()
 
 static Test size_tests [] = {
        {"ptrconv", test_ptrconv},
-       {"g_struct_offset", test_offset},
+       {"u_struct_offset", test_offset},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/slist.c b/deps/ulib/test/slist.c
similarity index 51%
rename from deps/eglib/test/slist.c
rename to deps/ulib/test/slist.c
index 3f8360e..182d268 100644
--- a/deps/eglib/test/slist.c
+++ b/deps/ulib/test/slist.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 #include "test.h"
 
 
@@ -10,28 +10,28 @@ test_slist_nth ()
        char *foo = "foo";
        char *bar = "bar";
        char *baz = "baz";
-       GSList *nth, *list;
-       list = g_slist_prepend (NULL, baz);
-       list = g_slist_prepend (list, bar);
-       list = g_slist_prepend (list, foo);
+       USList *nth, *list;
+       list = u_slist_prepend (NULL, baz);
+       list = u_slist_prepend (list, bar);
+       list = u_slist_prepend (list, foo);
 
-       nth = g_slist_nth (list, 0);
+       nth = u_slist_nth (list, 0);
        if (nth->data != foo)
                return FAILED ("nth failed. #0");
 
-       nth = g_slist_nth (list, 1);
+       nth = u_slist_nth (list, 1);
        if (nth->data != bar)
                return FAILED ("nth failed. #1");
        
-       nth = g_slist_nth (list, 2);
+       nth = u_slist_nth (list, 2);
        if (nth->data != baz)
                return FAILED ("nth failed. #2");
 
-       nth = g_slist_nth (list, 3);
+       nth = u_slist_nth (list, 3);
        if (nth)
                return FAILED ("nth failed. #3: %s", nth->data);
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
@@ -42,85 +42,85 @@ test_slist_index ()
        char *foo = "foo";
        char *bar = "bar";
        char *baz = "baz";
-       GSList *list;
-       list = g_slist_prepend (NULL, baz);
-       list = g_slist_prepend (list, bar);
-       list = g_slist_prepend (list, foo);
+       USList *list;
+       list = u_slist_prepend (NULL, baz);
+       list = u_slist_prepend (list, bar);
+       list = u_slist_prepend (list, foo);
 
-       i = g_slist_index (list, foo);
+       i = u_slist_index (list, foo);
        if (i != 0)
                return FAILED ("index failed. #0: %d", i);
 
-       i = g_slist_index (list, bar);
+       i = u_slist_index (list, bar);
        if (i != 1)
                return FAILED ("index failed. #1: %d", i);
        
-       i = g_slist_index (list, baz);
+       i = u_slist_index (list, baz);
        if (i != 2)
                return FAILED ("index failed. #2: %d", i);
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
 RESULT
 test_slist_append ()
 {
-       GSList *foo;
-       GSList *list = g_slist_append (NULL, "first");
-       if (g_slist_length (list) != 1)
+       USList *foo;
+       USList *list = u_slist_append (NULL, "first");
+       if (u_slist_length (list) != 1)
                return FAILED ("append(null,...) failed");
 
-       foo = g_slist_append (list, "second");
+       foo = u_slist_append (list, "second");
        if (foo != list)
                return FAILED ("changed list head on non-empty");
 
-       if (g_slist_length (list) != 2)
+       if (u_slist_length (list) != 2)
                return FAILED ("Append failed");
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
 RESULT
 test_slist_concat ()
 {
-       GSList *foo = g_slist_prepend (NULL, "foo");
-       GSList *bar = g_slist_prepend (NULL, "bar");
+       USList *foo = u_slist_prepend (NULL, "foo");
+       USList *bar = u_slist_prepend (NULL, "bar");
 
-       GSList *list = g_slist_concat (foo, bar);
+       USList *list = u_slist_concat (foo, bar);
 
-       if (g_slist_length (list) != 2)
+       if (u_slist_length (list) != 2)
                return FAILED ("Concat failed.");
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
 RESULT
 test_slist_find ()
 {
-       GSList *list = g_slist_prepend (NULL, "three");
-       GSList *found;
+       USList *list = u_slist_prepend (NULL, "three");
+       USList *found;
        char *data;
                
-       list = g_slist_prepend (list, "two");
-       list = g_slist_prepend (list, "one");
+       list = u_slist_prepend (list, "two");
+       list = u_slist_prepend (list, "one");
 
        data = "four";
-       list = g_slist_append (list, data);
+       list = u_slist_append (list, data);
 
-       found = g_slist_find (list, data);
+       found = u_slist_find (list, data);
 
        if (found->data != data)
                return FAILED ("Find failed");
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
-static gint
-find_custom (gconstpointer a, gconstpointer b)
+static int
+find_custom (const void * a, const void * b)
 {
        return(strcmp (a, b));
 }
@@ -128,21 +128,21 @@ find_custom (gconstpointer a, gconstpointer b)
 RESULT
 test_slist_find_custom ()
 {
-       GSList *list = NULL, *found;
+       USList *list = NULL, *found;
        char *foo = "foo";
        char *bar = "bar";
        char *baz = "baz";
        
-       list = g_slist_prepend (list, baz);
-       list = g_slist_prepend (list, bar);
-       list = g_slist_prepend (list, foo);
+       list = u_slist_prepend (list, baz);
+       list = u_slist_prepend (list, bar);
+       list = u_slist_prepend (list, foo);
        
-       found = g_slist_find_custom (list, baz, find_custom);
+       found = u_slist_find_custom (list, baz, find_custom);
        
        if (found == NULL)
                return FAILED ("Find failed");
        
-       g_slist_free (list);
+       u_slist_free (list);
        
        return OK;
 }
@@ -150,50 +150,50 @@ test_slist_find_custom ()
 RESULT
 test_slist_remove ()
 {
-       GSList *list = g_slist_prepend (NULL, "three");
+       USList *list = u_slist_prepend (NULL, "three");
        char *one = "one";
-       list = g_slist_prepend (list, "two");
-       list = g_slist_prepend (list, one);
+       list = u_slist_prepend (list, "two");
+       list = u_slist_prepend (list, one);
 
-       list = g_slist_remove (list, one);
+       list = u_slist_remove (list, one);
 
-       if (g_slist_length (list) != 2)
+       if (u_slist_length (list) != 2)
                return FAILED ("Remove failed");
 
        if (strcmp ("two", list->data) != 0)
                return FAILED ("Remove failed");
 
-       g_slist_free (list);
+       u_slist_free (list);
        return OK;
 }
 
 RESULT
 test_slist_remove_link ()
 {
-       GSList *foo = g_slist_prepend (NULL, "a");
-       GSList *bar = g_slist_prepend (NULL, "b");
-       GSList *baz = g_slist_prepend (NULL, "c");
-       GSList *list = foo;
+       USList *foo = u_slist_prepend (NULL, "a");
+       USList *bar = u_slist_prepend (NULL, "b");
+       USList *baz = u_slist_prepend (NULL, "c");
+       USList *list = foo;
 
-       foo = g_slist_concat (foo, bar);
-       foo = g_slist_concat (foo, baz);        
+       foo = u_slist_concat (foo, bar);
+       foo = u_slist_concat (foo, baz);        
 
-       list = g_slist_remove_link (list, bar);
+       list = u_slist_remove_link (list, bar);
 
-       if (g_slist_length (list) != 2)
+       if (u_slist_length (list) != 2)
                return FAILED ("remove_link failed #1");
 
        if (bar->next != NULL)
                return FAILED ("remove_link failed #2");
 
-       g_slist_free (list);    
-       g_slist_free (bar);
+       u_slist_free (list);    
+       u_slist_free (bar);
 
        return OK;
 }
 
-static gint
-compare (gconstpointer a, gconstpointer b)
+static int
+compare (const void * a, const void * b)
 {
        char *foo = (char *) a;
        char *bar = (char *) b;
@@ -207,64 +207,64 @@ compare (gconstpointer a, gconstpointer b)
 RESULT
 test_slist_insert_sorted ()
 {
-       GSList *list = g_slist_prepend (NULL, "a");
-       list = g_slist_append (list, "aaa");
+       USList *list = u_slist_prepend (NULL, "a");
+       list = u_slist_append (list, "aaa");
 
        /* insert at the middle */
-       list = g_slist_insert_sorted (list, "aa", compare);
+       list = u_slist_insert_sorted (list, "aa", compare);
        if (strcmp ("aa", list->next->data))
                return FAILED("insert_sorted failed #1");
 
        /* insert at the beginning */
-       list = g_slist_insert_sorted (list, "", compare);
+       list = u_slist_insert_sorted (list, "", compare);
        if (strcmp ("", list->data))
                return FAILED ("insert_sorted failed #2");
 
        /* insert at the end */
-       list = g_slist_insert_sorted (list, "aaaa", compare);
-       if (strcmp ("aaaa", g_slist_last (list)->data))
+       list = u_slist_insert_sorted (list, "aaaa", compare);
+       if (strcmp ("aaaa", u_slist_last (list)->data))
                return FAILED ("insert_sorted failed #3");
 
-       g_slist_free (list);    
+       u_slist_free (list);    
        return OK;
 }
 
 RESULT
 test_slist_insert_before ()
 {
-       GSList *foo, *bar, *baz;
+       USList *foo, *bar, *baz;
 
-       foo = g_slist_prepend (NULL, "foo");
-       foo = g_slist_insert_before (foo, NULL, "bar");
-       bar = g_slist_last (foo);
+       foo = u_slist_prepend (NULL, "foo");
+       foo = u_slist_insert_before (foo, NULL, "bar");
+       bar = u_slist_last (foo);
 
        if (strcmp (bar->data, "bar"))
                return FAILED ("1");
 
-       baz = g_slist_insert_before (foo, bar, "baz");
+       baz = u_slist_insert_before (foo, bar, "baz");
        if (foo != baz)
                return FAILED ("2");
 
        if (strcmp (foo->next->data, "baz"))
                return FAILED ("3: %s", foo->next->data);
 
-       g_slist_free (foo);
+       u_slist_free (foo);
        return OK;
 }
 
 #define N_ELEMS 100
 
-static int intcompare (gconstpointer p1, gconstpointer p2)
+static int intcompare (const void * p1, const void * p2)
 {
-       return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
+       return U_POINTER_TO_INT (p1) - U_POINTER_TO_INT (p2);
 }
 
-static gboolean verify_sort (GSList *list, int len)
+static uboolean verify_sort (USList *list, int len)
 {
-       int prev = GPOINTER_TO_INT (list->data);
+       int prev = U_POINTER_TO_INT (list->data);
        len--;
        for (list = list->next; list; list = list->next) {
-               int curr = GPOINTER_TO_INT (list->data);
+               int curr = U_POINTER_TO_INT (list->data);
                if (prev > curr)
                        return FALSE;
                prev = curr;
@@ -280,48 +280,48 @@ RESULT
 test_slist_sort ()
 {
        int i, j, mul;
-       GSList *list = NULL;
+       USList *list = NULL;
 
        for (i = 0; i < N_ELEMS; ++i)
-               list = g_slist_prepend (list, GINT_TO_POINTER (i));
-       list = g_slist_sort (list, intcompare);
+               list = u_slist_prepend (list, U_INT_TO_POINTER (i));
+       list = u_slist_sort (list, intcompare);
        if (!verify_sort (list, N_ELEMS))
                return FAILED ("decreasing list");
 
-       g_slist_free (list);
+       u_slist_free (list);
 
        list = NULL;
        for (i = 0; i < N_ELEMS; ++i)
-               list = g_slist_prepend (list, GINT_TO_POINTER (-i));
-       list = g_slist_sort (list, intcompare);
+               list = u_slist_prepend (list, U_INT_TO_POINTER (-i));
+       list = u_slist_sort (list, intcompare);
        if (!verify_sort (list, N_ELEMS))
                return FAILED ("increasing list");
 
-       g_slist_free (list);
+       u_slist_free (list);
 
-       list = g_slist_prepend (NULL, GINT_TO_POINTER (0));
+       list = u_slist_prepend (NULL, U_INT_TO_POINTER (0));
        for (i = 1; i < N_ELEMS; ++i) {
-               list = g_slist_prepend (list, GINT_TO_POINTER (-i));
-               list = g_slist_prepend (list, GINT_TO_POINTER (i));
+               list = u_slist_prepend (list, U_INT_TO_POINTER (-i));
+               list = u_slist_prepend (list, U_INT_TO_POINTER (i));
        }
-       list = g_slist_sort (list, intcompare);
+       list = u_slist_sort (list, intcompare);
        if (!verify_sort (list, 2*N_ELEMS-1))
                return FAILED ("alternating list");
 
-       g_slist_free (list);
+       u_slist_free (list);
 
        list = NULL;
        mul = 1;
        for (i = 1; i < N_ELEMS; ++i) {
                mul = -mul;
                for (j = 0; j < i; ++j)
-                       list = g_slist_prepend (list, GINT_TO_POINTER (mul * j));
+                       list = u_slist_prepend (list, U_INT_TO_POINTER (mul * j));
        }
-       list = g_slist_sort (list, intcompare);
+       list = u_slist_sort (list, intcompare);
        if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
                return FAILED ("wavering list");
 
-       g_slist_free (list);
+       u_slist_free (list);
 
        return OK;
 }
diff --git a/deps/eglib/test/spawn.c b/deps/ulib/test/spawn.c
similarity index 60%
rename from deps/eglib/test/spawn.c
rename to deps/ulib/test/spawn.c
index ec30fc8..3f80903 100644
--- a/deps/eglib/test/spawn.c
+++ b/deps/ulib/test/spawn.c
@@ -1,5 +1,5 @@
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #ifdef HAVE_UNISTD_H
@@ -7,7 +7,7 @@
 #endif
 #include "test.h"
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <io.h>
 #define read _read
 #define close _close
@@ -16,12 +16,12 @@
 RESULT
 test_spawn_sync ()
 {
-       gchar *out;
-       gchar *err;
-       gint status = -1;
-       GError *error = NULL;
+       char *out;
+       char *err;
+       int status = -1;
+       UError *error = NULL;
 
-       if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
+       if (!u_spawn_command_line_sync ("ls", &out, &err, &status, &error))
                return FAILED ("Error executing 'ls'");
 
        if (status != 0)
@@ -30,8 +30,8 @@ test_spawn_sync ()
        if (out == NULL || strlen (out) == 0)
                return FAILED ("Didn't get any output from ls!?");
 
-       g_free (out);
-       g_free (err);
+       u_free (out);
+       u_free (err);
        return OK;
 }
 
@@ -39,18 +39,18 @@ RESULT
 test_spawn_async ()
 {
        /*
-gboolean
-g_spawn_async_with_pipes (const gchar *working_directory,
-                       gchar **argv,
-                       gchar **envp,
-                       GSpawnFlags flags,
-                       GSpawnChildSetupFunc child_setup,
-                       gpointer user_data,
-                       GPid *child_pid,
-                       gint *standard_input,
-                       gint *standard_output,
-                       gint *standard_error,
-                       GError **error) */
+uboolean
+g_spawn_async_with_pipes (const char *working_directory,
+                       char **argv,
+                       char **envp,
+                       USpawnFlags flags,
+                       USpawnChildSetupFunc child_setup,
+                       void * user_data,
+                       UPid *child_pid,
+                       int *standard_input,
+                       int *standard_output,
+                       int *standard_error,
+                       UError **error) */
        char *argv [15];
        int stdout_fd = -1;
        char buffer [512];
@@ -58,7 +58,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
 
        memset (argv, 0, 15 * sizeof (char *));
        argv [0] = "ls";
-       if (!g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, 
&stdout_fd, NULL, NULL))
+       if (!u_spawn_async_with_pipes (NULL, argv, NULL, U_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, NULL, 
&stdout_fd, NULL, NULL))
                return FAILED ("1 Failed to run ls");
        if (child_pid == 0)
                return FAILED ("2 child pid not returned");
@@ -72,8 +72,8 @@ g_spawn_async_with_pipes (const gchar *working_directory,
 }
 
 static Test spawn_tests [] = {
-       {"g_shell_spawn_sync", test_spawn_sync},
-       {"g_shell_spawn_async_with_pipes", test_spawn_async},
+       {"u_shell_spawn_sync", test_spawn_sync},
+       {"u_shell_spawn_async_with_pipes", test_spawn_async},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/string-util.c b/deps/ulib/test/string-util.c
similarity index 69%
rename from deps/eglib/test/string-util.c
rename to deps/ulib/test/string-util.c
index 73efd13..af895ec 100644
--- a/deps/eglib/test/string-util.c
+++ b/deps/ulib/test/string-util.c
@@ -1,4 +1,4 @@
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #include "test.h"
@@ -7,14 +7,14 @@
 RESULT
 test_strfreev ()
 {
-       gchar **array = g_new (gchar *, 4);
-       array [0] = g_strdup ("one");
-       array [1] = g_strdup ("two");
-       array [2] = g_strdup ("three");
+       char **array = u_new (char *, 4);
+       array [0] = u_strdup ("one");
+       array [1] = u_strdup ("two");
+       array [2] = u_strdup ("three");
        array [3] = NULL;
        
-       g_strfreev (array);
-       g_strfreev (NULL);
+       u_strfreev (array);
+       u_strfreev (NULL);
 
        return OK;
 }
@@ -22,21 +22,21 @@ test_strfreev ()
 RESULT
 test_concat ()
 {
-       gchar *x = g_strconcat ("Hello", ", ", "world", NULL);
+       char *x = u_strconcat ("Hello", ", ", "world", NULL);
        if (strcmp (x, "Hello, world") != 0)
                return FAILED("concat failed, got: %s", x);
-       g_free (x);
+       u_free (x);
        return OK;
 }
 
 RESULT
 test_split ()
 {
-       const gchar *to_split = "Hello world, how are we doing today?";
-       gint i;
-       gchar **v;
+       const char *to_split = "Hello world, how are we doing today?";
+       int i;
+       char **v;
        
-       v= g_strsplit(to_split, " ", 0);
+       v= u_strsplit(to_split, " ", 0);
        
        if(v == NULL) {
                return FAILED("split failed, got NULL vector (1)");
@@ -47,9 +47,9 @@ test_split ()
                return FAILED("split failed, expected 7 tokens, got %d", i);
        }
        
-       g_strfreev(v);
+       u_strfreev(v);
 
-       v = g_strsplit(to_split, ":", -1);
+       v = u_strsplit(to_split, ":", -1);
        if(v == NULL) {
                return FAILED("split failed, got NULL vector (2)");
        }
@@ -63,19 +63,19 @@ test_split ()
                return FAILED("expected vector[0] to be '%s' but it was '%s'",
                        to_split, v[0]);
        }
-       g_strfreev(v);
+       u_strfreev(v);
 
-       v = g_strsplit ("", ":", 0);
+       v = u_strsplit ("", ":", 0);
        if (v == NULL)
-               return FAILED ("g_strsplit returned NULL");
-       g_strfreev (v);
+               return FAILED ("u_strsplit returned NULL");
+       u_strfreev (v);
 
-       v = g_strsplit ("/home/miguel/dingus", "/", 0);
+       v = u_strsplit ("/home/miguel/dingus", "/", 0);
        if (v [0][0] != 0)
                return FAILED ("Got a non-empty first element");
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
+       v = u_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
        if (strcmp (v [0], "appdomain1") != 0)
                return FAILED ("Invalid value");
        
@@ -88,9 +88,9 @@ test_split ()
        if (v [3] != NULL)
                return FAILED ("Expected only 3 elements");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
+       v = u_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 0");
        
@@ -103,9 +103,9 @@ test_split ()
        if (v [3] != NULL)
                return FAILED ("Expected only 3 elements (1)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
+       v = u_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 3");
        
@@ -115,9 +115,9 @@ test_split ()
        if (v [2] != NULL)
                return FAILED ("Expected only 2 elements (2)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
+       v = u_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 5");
        
@@ -130,9 +130,9 @@ test_split ()
        if (v [3] != NULL)
                return FAILED ("Expected only 3 elements (3)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("abcXYXYXYdefXY", "XY", -1);
+       v = u_strsplit ("abcXYXYXYdefXY", "XY", -1);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 8");
 
@@ -151,9 +151,9 @@ test_split ()
        if (v [5] != NULL)
                return FAILED ("Expected only 5 elements (4)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("XYXYXYabcXYdef", "XY", -1);
+       v = u_strsplit ("XYXYXYabcXYdef", "XY", -1);
        if (strcmp (v [0], "") != 0)
                return FAILED ("Invalid value 13");
        
@@ -172,9 +172,9 @@ test_split ()
        if (v [5] != NULL)
                return FAILED ("Expected only 5 elements (5)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit ("value=", "=", 2);
+       v = u_strsplit ("value=", "=", 2);
        if (strcmp (v [0], "value") != 0)
                return FAILED ("Invalid value 18; expected 'value', got '%s'", v [0]);
        if (strcmp (v [1], "") != 0)
@@ -182,7 +182,7 @@ test_split ()
        if (v [2] != NULL)
                return FAILED ("Expected only 2 elements (6)");
 
-       g_strfreev (v);
+       u_strfreev (v);
 
        return OK;
 }
@@ -190,9 +190,9 @@ test_split ()
 RESULT
 test_split_set ()
 {
-       gchar **v;
+       char **v;
        
-       v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
+       v = u_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 0");
 
@@ -214,9 +214,9 @@ test_split_set ()
        if (v [6] != NULL)
                return FAILED ("Expected only 6 elements (1)");
 
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
+       v = u_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 6");
 
@@ -229,9 +229,9 @@ test_split_set ()
        if (v [3] != NULL)
                return FAILED ("Expected only 3 elements (2)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
+       v = u_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 9");
        
@@ -250,9 +250,9 @@ test_split_set ()
        if (v [5] != NULL)
                return FAILED ("Expected only 5 elements (5)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit_set ("abcXYXdefXY", "XY", -1);
+       v = u_strsplit_set ("abcXYXdefXY", "XY", -1);
        if (strcmp (v [0], "abc") != 0)
                return FAILED ("Invalid value 14");
 
@@ -274,9 +274,9 @@ test_split_set ()
        if (v [6] != NULL)
                return FAILED ("Expected only 6 elements (4)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
-       v = g_strsplit_set ("XYXabcXYdef", "XY", -1);
+       v = u_strsplit_set ("XYXabcXYdef", "XY", -1);
        if (strcmp (v [0], "") != 0)
                return FAILED ("Invalid value 20");
        
@@ -298,7 +298,7 @@ test_split_set ()
        if (v [6] != NULL)
                return FAILED ("Expected only 6 elements (5)");
        
-       g_strfreev (v);
+       u_strfreev (v);
 
        return OK;
 }
@@ -307,35 +307,35 @@ RESULT
 test_strreverse ()
 {
        RESULT res = OK;
-       gchar *a = g_strdup ("onetwothree");
-       gchar *a_target = "eerhtowteno";
-       gchar *b = g_strdup ("onetwothre");
-       gchar *b_target = "erhtowteno";
-       gchar *c = g_strdup ("");
-       gchar *c_target = "";
-
-       g_strreverse (a);
+       char *a = u_strdup ("onetwothree");
+       char *a_target = "eerhtowteno";
+       char *b = u_strdup ("onetwothre");
+       char *b_target = "erhtowteno";
+       char *c = u_strdup ("");
+       char *c_target = "";
+
+       u_strreverse (a);
        if (strcmp (a, a_target)) {
                res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", a, a_target);
                goto cleanup;
        }
 
-       g_strreverse (b);
+       u_strreverse (b);
        if (strcmp (b, b_target)) {
                res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
                goto cleanup;
        }
 
-       g_strreverse (c);
+       u_strreverse (c);
        if (strcmp (c, c_target)) {
                res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
                goto cleanup;
        }
 
 cleanup:
-       g_free (c);
-       g_free (b);
-       g_free (a);
+       u_free (c);
+       u_free (b);
+       u_free (a);
        return res;
 }
 
@@ -344,30 +344,30 @@ test_strjoin ()
 {
        char *s;
        
-       s = g_strjoin (NULL, "a", "b", NULL);
+       s = u_strjoin (NULL, "a", "b", NULL);
        if (strcmp (s, "ab") != 0)
                return FAILED ("Join of two strings with no separator fails");
-       g_free (s);
+       u_free (s);
 
-       s = g_strjoin ("", "a", "b", NULL);
+       s = u_strjoin ("", "a", "b", NULL);
        if (strcmp (s, "ab") != 0)
                return FAILED ("Join of two strings with empty separator fails");
-       g_free (s);
+       u_free (s);
 
-       s = g_strjoin ("-", "a", "b", NULL);
+       s = u_strjoin ("-", "a", "b", NULL);
        if (strcmp (s, "a-b") != 0)
                return FAILED ("Join of two strings with separator fails");
-       g_free (s);
+       u_free (s);
 
-       s = g_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
+       s = u_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
        if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
                return FAILED ("Join of multiple strings fails");
-       g_free (s);
+       u_free (s);
 
-       s = g_strjoin ("-", NULL);
+       s = u_strjoin ("-", NULL);
        if (s == NULL || (strcmp (s, "") != 0))
                return FAILED ("Failed to join empty arguments");
-       g_free (s);
+       u_free (s);
 
        return OK;
 }
@@ -375,56 +375,56 @@ test_strjoin ()
 RESULT
 test_strchug ()
 {
-       char *str = g_strdup (" \t\n hola");
+       char *str = u_strdup (" \t\n hola");
 
-       g_strchug (str);
+       u_strchug (str);
        if (strcmp ("hola", str)) {
                fprintf (stderr, "%s\n", str);
-               g_free (str);
+               u_free (str);
                return FAILED ("Failed.");
        }
-       g_free (str);
+       u_free (str);
        return OK;
 }
 
 RESULT
 test_strchomp ()
 {
-       char *str = g_strdup ("hola  \t");
+       char *str = u_strdup ("hola  \t");
 
-       g_strchomp (str);
+       u_strchomp (str);
        if (strcmp ("hola", str)) {
                fprintf (stderr, "%s\n", str);
-               g_free (str);
+               u_free (str);
                return FAILED ("Failed.");
        }
-       g_free (str);
+       u_free (str);
        return OK;
 }
 
 RESULT
 test_strstrip ()
 {
-       char *str = g_strdup (" \t hola   ");
+       char *str = u_strdup (" \t hola   ");
 
-       g_strstrip (str);
+       u_strstrip (str);
        if (strcmp ("hola", str)) {
                fprintf (stderr, "%s\n", str);
-               g_free (str);
+               u_free (str);
                return FAILED ("Failed.");
        }
-       g_free (str);
+       u_free (str);
        return OK;
 }
 
-#define urit(so,j) do { s = g_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got 
%s expected %s", s, j); g_free (s); } while (0);
+#define urit(so,j) do { s = u_filename_to_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return FAILED("Got 
%s expected %s", s, j); u_free (s); } while (0);
 
-#define errit(so) do { s = g_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, 
expected NULL", s); } while (0);
+#define errit(so) do { s = u_filename_to_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, 
expected NULL", s); } while (0);
 
 RESULT
 test_filename_to_uri ()
 {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #else
        char *s;
 
@@ -449,14 +449,14 @@ test_filename_to_uri ()
        return OK;
 }
 
-#define fileit(so,j) do { s = g_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return 
FAILED("Got %s expected %s", s, j); g_free (s); } while (0);
+#define fileit(so,j) do { s = u_filename_from_uri (so, NULL, NULL); if (strcmp (s, j) != 0) return 
FAILED("Got %s expected %s", s, j); u_free (s); } while (0);
 
-#define ferrit(so) do { s = g_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, 
expected NULL", s); } while (0);
+#define ferrit(so) do { s = u_filename_from_uri (so, NULL, NULL); if (s != NULL) return FAILED ("got %s, 
expected NULL", s); } while (0);
 
 RESULT
 test_filename_from_uri ()
 {
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #else
        char *s;
 
@@ -480,39 +480,39 @@ RESULT
 test_ascii_xdigit_value ()
 {
        int i;
-       gchar j;
+       char j;
 
-       i = g_ascii_xdigit_value ('9' + 1);
+       i = u_ascii_xdigit_value ('9' + 1);
        if (i != -1)
                return FAILED ("'9' + 1");
-       i = g_ascii_xdigit_value ('0' - 1);
+       i = u_ascii_xdigit_value ('0' - 1);
        if (i != -1)
                return FAILED ("'0' - 1");
-       i = g_ascii_xdigit_value ('a' - 1);
+       i = u_ascii_xdigit_value ('a' - 1);
        if (i != -1)
                return FAILED ("'a' - 1");
-       i = g_ascii_xdigit_value ('f' + 1);
+       i = u_ascii_xdigit_value ('f' + 1);
        if (i != -1)
                return FAILED ("'f' + 1");
-       i = g_ascii_xdigit_value ('A' - 1);
+       i = u_ascii_xdigit_value ('A' - 1);
        if (i != -1)
                return FAILED ("'A' - 1");
-       i = g_ascii_xdigit_value ('F' + 1);
+       i = u_ascii_xdigit_value ('F' + 1);
        if (i != -1)
                return FAILED ("'F' + 1");
 
        for (j = '0'; j < '9'; j++) {
-               int c = g_ascii_xdigit_value (j);
+               int c = u_ascii_xdigit_value (j);
                if (c  != (j - '0'))
                        return FAILED ("Digits %c -> %d", j, c);
        }
        for (j = 'a'; j < 'f'; j++) {
-               int c = g_ascii_xdigit_value (j);
+               int c = u_ascii_xdigit_value (j);
                if (c  != (j - 'a' + 10))
                        return FAILED ("Lower %c -> %d", j, c);
        }
        for (j = 'A'; j < 'F'; j++) {
-               int c = g_ascii_xdigit_value (j);
+               int c = u_ascii_xdigit_value (j);
                if (c  != (j - 'A' + 10))
                        return FAILED ("Upper %c -> %d", j, c);
        }
@@ -522,18 +522,18 @@ test_ascii_xdigit_value ()
 RESULT
 test_strdelimit ()
 {
-       gchar *str;
+       char *str;
 
-       str = g_strdup (G_STR_DELIMITERS);
-       str = g_strdelimit (str, NULL, 'a');
+       str = u_strdup (U_STR_DELIMITERS);
+       str = u_strdelimit (str, NULL, 'a');
        if (0 != strcmp ("aaaaaaa", str))
                return FAILED ("All delimiters: '%s'", str);
-       g_free (str);
-       str = g_strdup ("hola");
-       str = g_strdelimit (str, "ha", '+');
+       u_free (str);
+       str = u_strdup ("hola");
+       str = u_strdelimit (str, "ha", '+');
        if (0 != strcmp ("+ol+", str))
                return FAILED ("2 delimiters: '%s'", str);
-       g_free (str);
+       u_free (str);
        return OK;
 }
 
@@ -542,43 +542,43 @@ test_strdelimit ()
 RESULT
 test_strlcpy ()
 {
-       const gchar *src = "onetwothree";
-       gchar *dest;
-       gsize i;
+       const char *src = "onetwothree";
+       char *dest;
+       size_t i;
 
-       dest = g_malloc (strlen (src) + 1);
+       dest = u_malloc (strlen (src) + 1);
        memset (dest, 0, strlen (src) + 1);
-       i = g_strlcpy (dest, src, (gsize)-1);
+       i = u_strlcpy (dest, src, (size_t)-1);
        if (i != strlen (src))
                return FAILED ("Test1 got %d", i);
 
        if (0 != strcmp (dest, src))
                return FAILED ("Src and dest not equal");
 
-       i = g_strlcpy (dest, src, 3);
+       i = u_strlcpy (dest, src, 3);
        if (i != strlen (src))
                return FAILED ("Test1 got %d", i);
        if (0 != strcmp (dest, "on"))
                return FAILED ("Test2");
 
-       i = g_strlcpy (dest, src, 1);
+       i = u_strlcpy (dest, src, 1);
        if (i != strlen (src))
                return FAILED ("Test3 got %d", i);
        if (*dest != '\0')
                return FAILED ("Test4");
 
-       i = g_strlcpy (dest, src, 12345);
+       i = u_strlcpy (dest, src, 12345);
        if (i != strlen (src))
                return FAILED ("Test4 got %d", i);
        if (0 != strcmp (dest, src))
                return FAILED ("Src and dest not equal 2");
-       g_free (dest);
+       u_free (dest);
 
-       /* This is a test for g_filename_from_utf8, even if it does not look like it */
-       dest = g_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
+       /* This is a test for u_filename_from_utf8, even if it does not look like it */
+       dest = u_filename_from_utf8 (NUMBERS, strlen (NUMBERS), NULL, NULL, NULL);
        if (0 != strcmp (dest, NUMBERS))
                return FAILED ("problem [%s] and [%s]", dest, NUMBERS);
-       g_free (dest);
+       u_free (dest);
        
        return OK;
 }
@@ -586,18 +586,18 @@ test_strlcpy ()
 RESULT
 test_strescape ()
 {
-       gchar *str;
+       char *str;
 
-       str = g_strescape ("abc", NULL);
+       str = u_strescape ("abc", NULL);
        if (strcmp ("abc", str))
                return FAILED ("#1");
-       str = g_strescape ("\t\b\f\n\r\\\"abc", NULL);
+       str = u_strescape ("\t\b\f\n\r\\\"abc", NULL);
        if (strcmp ("\\t\\b\\f\\n\\r\\\\\\\"abc", str))
                return FAILED ("#2 %s", str);
-       str = g_strescape ("\001abc", NULL);
+       str = u_strescape ("\001abc", NULL);
        if (strcmp ("\\001abc", str))
                return FAILED ("#3 %s", str);
-       str = g_strescape ("\001abc", "\001");
+       str = u_strescape ("\001abc", "\001");
        if (strcmp ("\001abc", str))
                return FAILED ("#3 %s", str);
        return OK;
@@ -608,19 +608,19 @@ test_ascii_strncasecmp ()
 {
        int n;
 
-       n = g_ascii_strncasecmp ("123", "123", 1);
+       n = u_ascii_strncasecmp ("123", "123", 1);
        if (n != 0)
                return FAILED ("Should have been 0");
        
-       n = g_ascii_strncasecmp ("423", "123", 1);
+       n = u_ascii_strncasecmp ("423", "123", 1);
        if (n != 3)
                return FAILED ("Should have been 3, got %d", n);
 
-       n = g_ascii_strncasecmp ("123", "423", 1);
+       n = u_ascii_strncasecmp ("123", "423", 1);
        if (n != -3)
                return FAILED ("Should have been -3, got %d", n);
 
-       n = g_ascii_strncasecmp ("1", "1", 10);
+       n = u_ascii_strncasecmp ("1", "1", 10);
        if (n != 0)
                return FAILED ("Should have been 0, got %d", n);
        return OK;
@@ -629,67 +629,67 @@ test_ascii_strncasecmp ()
 RESULT
 test_ascii_strdown ()
 {
-       const gchar *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
-       const gchar *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
-       gchar *c;
-       gint n, l;
+       const char *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
+       const char *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
+       char *c;
+       int n, l;
 
-       l = (gint)strlen (b);
-       c = g_ascii_strdown (a, l);
-       n = g_ascii_strncasecmp (b, c, l);
+       l = (int)strlen (b);
+       c = u_ascii_strdown (a, l);
+       n = u_ascii_strncasecmp (b, c, l);
 
        if (n != 0) {
-               g_free (c);
+               u_free (c);
                return FAILED ("Should have been 0, got %d", n);
        }
 
-       g_free (c);
+       u_free (c);
        return OK;
 }
 
 RESULT
 test_strdupv ()
 {
-       gchar **one;
-       gchar **two;
-       gint len;
+       char **one;
+       char **two;
+       int len;
 
-       one = g_strdupv (NULL);
+       one = u_strdupv (NULL);
        if (one)
                return FAILED ("Should have been NULL");
 
-       one = g_malloc (sizeof (gchar *));
+       one = u_malloc (sizeof (char *));
        *one = NULL;
-       two = g_strdupv (one);
+       two = u_strdupv (one);
        if (!two)
                FAILED ("Should have been not NULL");
-       len = g_strv_length (two);
+       len = u_strv_length (two);
        if (len)
                FAILED ("Should have been 0");
-       g_strfreev (two);
-       g_strfreev (one);
+       u_strfreev (two);
+       u_strfreev (one);
        return NULL;
 }
 
 static Test strutil_tests [] = {
-       {"g_strfreev", test_strfreev},
-       {"g_strconcat", test_concat},
-       {"g_strsplit", test_split},
-       {"g_strsplit_set", test_split_set},
-       {"g_strreverse", test_strreverse},
-       {"g_strjoin", test_strjoin},
-       {"g_strchug", test_strchug},
-       {"g_strchomp", test_strchomp},
-       {"g_strstrip", test_strstrip},
-       {"g_filename_to_uri", test_filename_to_uri},
-       {"g_filename_from_uri", test_filename_from_uri},
-       {"g_ascii_xdigit_value", test_ascii_xdigit_value},
-       {"g_strdelimit", test_strdelimit},
-       {"g_strlcpy", test_strlcpy},
-       {"g_strescape", test_strescape},
-       {"g_ascii_strncasecmp", test_ascii_strncasecmp },
-       {"g_ascii_strdown", test_ascii_strdown },
-       {"g_strdupv", test_strdupv },
+       {"u_strfreev", test_strfreev},
+       {"u_strconcat", test_concat},
+       {"u_strsplit", test_split},
+       {"u_strsplit_set", test_split_set},
+       {"u_strreverse", test_strreverse},
+       {"u_strjoin", test_strjoin},
+       {"u_strchug", test_strchug},
+       {"u_strchomp", test_strchomp},
+       {"u_strstrip", test_strstrip},
+       {"u_filename_to_uri", test_filename_to_uri},
+       {"u_filename_from_uri", test_filename_from_uri},
+       {"u_ascii_xdigit_value", test_ascii_xdigit_value},
+       {"u_strdelimit", test_strdelimit},
+       {"u_strlcpy", test_strlcpy},
+       {"u_strescape", test_strescape},
+       {"u_ascii_strncasecmp", test_ascii_strncasecmp },
+       {"u_ascii_strdown", test_ascii_strdown },
+       {"u_strdupv", test_strdupv },
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/string.c b/deps/ulib/test/string.c
similarity index 65%
rename from deps/eglib/test/string.c
rename to deps/ulib/test/string.c
index 02ad0ad..19af6f1 100644
--- a/deps/eglib/test/string.c
+++ b/deps/ulib/test/string.c
@@ -1,18 +1,18 @@
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <stdio.h>
 #include "test.h"
 
-#define sfail(k,p) if (s->str [p] != k) { g_string_free (s,TRUE); return FAILED("Got %s, Failed at %d, 
expected '%c'", s->str, p, k);}
+#define sfail(k,p) if (s->str [p] != k) { u_string_free (s,TRUE); return FAILED("Got %s, Failed at %d, 
expected '%c'", s->str, p, k);}
 
 RESULT
 test_append_speed()
 {
-       GString *s = g_string_new("");
-       gint i;
+       UString *s = u_string_new("");
+       int i;
        
        for(i = 0; i < 1024; i++) {
-               g_string_append(s, "x");
+               u_string_append(s, "x");
        }
        
        if(strlen (s->str) != 1024) {
@@ -20,7 +20,7 @@ test_append_speed()
                        s->str, strlen(s->str));
        }
        
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
        return OK;
 }
@@ -28,11 +28,11 @@ test_append_speed()
 RESULT
 test_append_c_speed()
 {
-       GString *s = g_string_new("");
-       gint i;
+       UString *s = u_string_new("");
+       int i;
        
        for(i = 0; i < 1024; i++) {
-               g_string_append_c(s, 'x');
+               u_string_append_c(s, 'x');
        }
        
        if(strlen(s->str) != 1024) {
@@ -40,7 +40,7 @@ test_append_c_speed()
                        strlen(s->str));
        }
        
-       g_string_free(s, TRUE);
+       u_string_free(s, TRUE);
 
        return OK;
 }
@@ -48,62 +48,62 @@ test_append_c_speed()
 RESULT
 test_gstring ()
 {
-       GString *s = g_string_new_len ("My stuff", 2);
+       UString *s = u_string_new_len ("My stuff", 2);
        char *ret;
        int i;
 
        if (strcmp (s->str, "My") != 0)
                return "Expected only 'My' on the string";
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
-       s = g_string_new_len ("My\0\0Rest", 6);
+       s = u_string_new_len ("My\0\0Rest", 6);
        if (s->str [2] != 0)
                return "Null was not copied";
        if (strcmp (s->str+4, "Re") != 0){
                return "Did not find the 'Re' part";
        }
 
-       g_string_append (s, "lalalalalalalalalalalalalalalalalalalalalalal");
+       u_string_append (s, "lalalalalalalalalalalalalalalalalalalalalalal");
        if (s->str [2] != 0)
                return "Null as not copied";
        if (strncmp (s->str+4, "Relala", 6) != 0){
                return FAILED("Did not copy correctly, got: %s", s->str+4);
        }
 
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
-       s = g_string_new ("");
+       s = u_string_new ("");
        for (i = 0; i < 1024; i++){
-               g_string_append_c (s, 'x');
+               u_string_append_c (s, 'x');
        }
        if (strlen (s->str) != 1024){
                return FAILED("Incorrect string size, got: %s %d\n", s->str, strlen (s->str));
        }
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
-       s = g_string_new ("hola");
-       g_string_sprintfa (s, "%s%d", ", bola", 5);
+       s = u_string_new ("hola");
+       u_string_sprintfa (s, "%s%d", ", bola", 5);
        if (strcmp (s->str, "hola, bola5") != 0){
                return FAILED("Incorrect data, got: %s\n", s->str);
        }
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
-       s = g_string_new ("Hola");
-       g_string_printf (s, "Dingus");
+       s = u_string_new ("Hola");
+       u_string_printf (s, "Dingus");
        
        /* Test that it does not release it */
-       ret = g_string_free (s, FALSE);
-       g_free (ret);
+       ret = u_string_free (s, FALSE);
+       u_free (ret);
 
-       s = g_string_new_len ("H" "\000" "H", 3);
-       g_string_append_len (s, "1" "\000" "2", 3);
+       s = u_string_new_len ("H" "\000" "H", 3);
+       u_string_append_len (s, "1" "\000" "2", 3);
        sfail ('H', 0);
        sfail ( 0, 1);
        sfail ('H', 2);
        sfail ('1', 3);
        sfail ( 0, 4);
        sfail ('2', 5);
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
        
        return OK;
 }
@@ -111,14 +111,14 @@ test_gstring ()
 RESULT
 test_sized ()
 {
-       GString *s = g_string_sized_new (20);
+       UString *s = u_string_sized_new (20);
 
        if (s->str [0] != 0)
                return FAILED ("Expected an empty string");
        if (s->len != 0)
                return FAILED ("Expected an empty len");
 
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
        
        return NULL;
 }
@@ -126,25 +126,25 @@ test_sized ()
 RESULT
 test_truncate ()
 {
-       GString *s = g_string_new ("0123456789");
-       g_string_truncate (s, 3);
+       UString *s = u_string_new ("0123456789");
+       u_string_truncate (s, 3);
 
        if (strlen (s->str) != 3)
                return FAILED ("size of string should have been 3, instead it is [%s]\n", s->str);
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
        
-       s = g_string_new ("a");
-       s = g_string_truncate (s, 10);
+       s = u_string_new ("a");
+       s = u_string_truncate (s, 10);
        if (strlen (s->str) != 1)
                return FAILED ("The size is not 1");
-       g_string_truncate (s, (gsize)-1);
+       u_string_truncate (s, (size_t)-1);
        if (strlen (s->str) != 1)
                return FAILED ("The size is not 1");
-       g_string_truncate (s, 0);
+       u_string_truncate (s, 0);
        if (strlen (s->str) != 0)
                return FAILED ("The size is not 0");
        
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
        return NULL;
 }
@@ -152,31 +152,31 @@ test_truncate ()
 RESULT
 test_prepend ()
 {
-       GString *s = g_string_new ("dingus");
-       g_string_prepend (s, "one");
+       UString *s = u_string_new ("dingus");
+       u_string_prepend (s, "one");
 
        if (strcmp (s->str, "onedingus") != 0)
                return FAILED ("Failed, expected onedingus, got [%s]", s->str);
 
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
        /* This is to force the code that where stuff does not fit in the allocated block */
-       s = g_string_sized_new (1);
-       g_string_prepend (s, "one");
+       s = u_string_sized_new (1);
+       u_string_prepend (s, "one");
        if (strcmp (s->str, "one") != 0)
                return FAILED ("Got erroneous result, expected [one] got [%s]", s->str);
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
        /* This is to force the path where things fit */
-       s = g_string_new ("123123123123123123123123");
-       g_string_truncate (s, 1);
+       s = u_string_new ("123123123123123123123123");
+       u_string_truncate (s, 1);
        if (strcmp (s->str, "1") != 0)
                return FAILED ("Expected [1] string, got [%s]", s->str);
 
-       g_string_prepend (s, "pre");
+       u_string_prepend (s, "pre");
        if (strcmp (s->str, "pre1") != 0)
                return FAILED ("Expected [pre1], got [%s]", s->str);
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
        
        return NULL;
 }
@@ -184,19 +184,19 @@ test_prepend ()
 RESULT
 test_appendlen ()
 {
-       GString *s = g_string_new ("");
+       UString *s = u_string_new ("");
 
-       g_string_append_len (s, "boo\000x", 0);
+       u_string_append_len (s, "boo\000x", 0);
        if (s->len != 0)
                return FAILED ("The length is not zero %d", s->len);
-       g_string_append_len (s, "boo\000x", 5);
+       u_string_append_len (s, "boo\000x", 5);
        if (s->len != 5)
                return FAILED ("The length is not five %d", s->len);
-       g_string_append_len (s, "ha", -1);
+       u_string_append_len (s, "ha", -1);
        if (s->len != 7)
                return FAILED ("The length is not seven %d", s->len);
                
-       g_string_free (s, TRUE);
+       u_string_free (s, TRUE);
 
        return NULL;
 }
@@ -204,7 +204,7 @@ test_appendlen ()
 RESULT
 test_macros ()
 {
-       char *s = g_strdup (G_STRLOC);
+       char *s = u_strdup (U_STRLOC);
        char *p = strchr (s + 2, ':');
        int n;
        
@@ -216,9 +216,9 @@ test_macros ()
 
        *p = 0;
        if (strcmp (s + strlen(s) - 8 , "string.c") != 0)
-               return FAILED ("This did not store the filename on G_STRLOC");
+               return FAILED ("This did not store the filename on U_STRLOC");
        
-       g_free (s);
+       u_free (s);
        return NULL;
 }
 
diff --git a/deps/eglib/test/test-both b/deps/ulib/test/test-both
similarity index 81%
rename from deps/eglib/test/test-both
rename to deps/ulib/test/test-both
index 038c927..ff41e2a 100755
--- a/deps/eglib/test/test-both
+++ b/deps/ulib/test/test-both
@@ -51,13 +51,13 @@ if [ "x$1" = "x--speed-compare" ]; then
        echo "Running tests with $OPTIONS..."
        
        GLIB=`./test-glib $OPTIONS`
-       EGLIB=`./test-eglib $OPTIONS`
+       ULIB=`./test-eglib $OPTIONS`
 
        # this blows
-       FASTER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
-       FASTER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
-       SLOWER_NAME=`echo "$GLIB GLib $EGLIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
-       SLOWER_SPEED=`echo "$GLIB $EGLIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
+       FASTER_NAME=`echo "$GLIB GLib $ULIB EGlib" | awk '{ if($1 < $3) print $2; else print $4 }'`
+       FASTER_SPEED=`echo "$GLIB $ULIB" | awk '{ if($1 < $2) print $1; else print $2 }'`
+       SLOWER_NAME=`echo "$GLIB GLib $ULIB EGlib" | awk '{ if($1 > $3) print $2; else print $4 }'`
+       SLOWER_SPEED=`echo "$GLIB $ULIB" | awk '{ if($1 > $2) print $1; else print $2 }'`
 
        FASTER_PERCENTAGE=`echo "$SLOWER_SPEED $FASTER_SPEED" | awk '{ print ($1 / $2) * 100 }'`
 
diff --git a/deps/eglib/test/test.c b/deps/ulib/test/test.c
similarity index 72%
rename from deps/eglib/test/test.c
rename to deps/ulib/test/test.c
index 6dd7bf4..8f051a4 100644
--- a/deps/eglib/test/test.c
+++ b/deps/ulib/test/test.c
@@ -1,5 +1,5 @@
 /*
- * EGLib Unit Group/Test Runners
+ * ULib Unit Group/Test Runners
  *
  * Author:
  *   Aaron Bockover (abockover novell com)
@@ -35,17 +35,17 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
-#include <glib.h>
+#include <ulib.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <winsock2.h>
 #endif
 
 #include "test.h"
 
-extern gint global_passed, global_tests;
+extern int global_passed, global_tests;
 
 #ifndef HAVE_VASPRINTF
   /* systen does not provide a vasprintf function, use the one
@@ -53,12 +53,12 @@ extern gint global_passed, global_tests;
 extern int vasprintf(char **ret, const char *format, va_list ap);
 #endif
 
-static gchar *last_result = NULL;
+static char *last_result = NULL;
 
-gboolean 
-run_test(Test *test, gchar **result_out)
+uboolean 
+run_test(Test *test, char **result_out)
 {
-       gchar *result; 
+       char *result; 
 
        if((result = test->handler()) == NULL) {
                *result_out = NULL;
@@ -69,14 +69,14 @@ run_test(Test *test, gchar **result_out)
        }
 }
 
-gboolean
-run_group(Group *group, gint iterations, gboolean quiet, 
-       gboolean time, gchar *tests_to_run_s)
+uboolean
+run_group(Group *group, int iterations, uboolean quiet, 
+       uboolean time, char *tests_to_run_s)
 {
        Test *tests = group->handler();
-       gint i, j, passed = 0, total = 0;
-       gdouble start_time_group, start_time_test;
-       gchar **tests_to_run = NULL;
+       int i, j, passed = 0, total = 0;
+       double start_time_group, start_time_test;
+       char **tests_to_run = NULL;
 
        if(!quiet) {
                if(iterations > 1) {
@@ -93,12 +93,12 @@ run_group(Group *group, gint iterations, gboolean quiet,
        start_time_group = get_timestamp();
 
        for(i = 0; tests[i].name != NULL; i++) {
-               gchar *result = "";
-               gboolean iter_pass, run;
+               char *result = "";
+               uboolean iter_pass, run;
        
                iter_pass = FALSE;
                if(tests_to_run != NULL) {
-                       gint j;
+                       int j;
                        run = FALSE;
                        for(j = 0; tests_to_run[j] != NULL; j++) {
                                if(strcmp(tests_to_run[j], tests[i].name) == 0) {
@@ -145,7 +145,7 @@ run_group(Group *group, gint iterations, gboolean quiet,
                        
                        if(last_result == result) {
                                last_result = NULL;
-                               g_free(result);
+                               u_free(result);
                        }
                }
        }
@@ -154,7 +154,7 @@ run_group(Group *group, gint iterations, gboolean quiet,
        global_tests += total;
 
        if(!quiet) {
-               gdouble pass_percentage = ((gdouble)passed / (gdouble)total) * 100.0;
+               double pass_percentage = ((double)passed / (double)total) * 100.0;
                if(time) {
                        printf("  %d / %d (%g%%, %g)\n", passed, total,
                                pass_percentage, get_timestamp() - start_time_group);
@@ -171,15 +171,15 @@ run_group(Group *group, gint iterations, gboolean quiet,
 }
 
 RESULT
-FAILED(const gchar *format, ...)
+FAILED(const char *format, ...)
 {
-       gchar *ret;
+       char *ret;
        va_list args;
-       gint n;
+       int n;
 
-#if !defined(HAVE_VASPRINTF) && !defined(_EGLIB_MAJOR)
+#if !defined(HAVE_VASPRINTF) && !defined(_ULIB_MAJOR)
        /* We are linked against the real glib, no vasprintf */
-       g_assert_not_reached ();
+       u_assert_not_reached ();
        return NULL;
 #else
        va_start(args, format);
@@ -196,50 +196,50 @@ FAILED(const gchar *format, ...)
 #endif
 }
 
-gdouble
+double
 get_timestamp()
 {
-       /* FIXME: We should use g_get_current_time here */
-       GTimeVal res;
-       g_get_current_time (&res);
+       /* FIXME: We should use u_get_current_time here */
+       UTimeVal res;
+       u_get_current_time (&res);
        return res.tv_sec + (1.e-6) * res.tv_usec;
 }
 
 /* 
- * Duplicating code here from EGlib to avoid g_strsplit skew between
- * EGLib and GLib
+ * Duplicating code here from EGlib to avoid u_strsplit skew between
+ * ULib and ULib
  */
  
-gchar ** 
-eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
+char ** 
+eg_strsplit (const char *string, const char *delimiter, int max_tokens)
 {
-       gchar *string_c;
-       gchar *strtok_save, **vector;
-       gchar *token, *token_c;
-       gint size = 1;
+       char *string_c;
+       char *strtok_save, **vector;
+       char *token, *token_c;
+       int size = 1;
        size_t token_length;
 
-       g_return_val_if_fail(string != NULL, NULL);
-       g_return_val_if_fail(delimiter != NULL, NULL);
-       g_return_val_if_fail(delimiter[0] != 0, NULL);
+       u_return_val_if_fail(string != NULL, NULL);
+       u_return_val_if_fail(delimiter != NULL, NULL);
+       u_return_val_if_fail(delimiter[0] != 0, NULL);
        
        token_length = strlen(string);
-       string_c = (gchar *)g_malloc(token_length + 1);
+       string_c = (char *)u_malloc(token_length + 1);
        memcpy(string_c, string, token_length);
        string_c[token_length] = 0;
        
        vector = NULL;
-       token = (gchar *)strtok_r(string_c, delimiter, &strtok_save);
+       token = (char *)strtok_r(string_c, delimiter, &strtok_save);
 
        while(token != NULL) {
                token_length = strlen(token);
-               token_c = (gchar *)g_malloc(token_length + 1);
+               token_c = (char *)u_malloc(token_length + 1);
                memcpy(token_c, token, token_length);
                token_c[token_length] = 0;
 
                vector = vector == NULL ? 
-                       (gchar **)g_malloc(2 * sizeof(vector)) :
-                       (gchar **)g_realloc(vector, (size + 1) * sizeof(vector));
+                       (char **)u_malloc(2 * sizeof(vector)) :
+                       (char **)u_realloc(vector, (size + 1) * sizeof(vector));
        
                vector[size - 1] = token_c;     
                size++;
@@ -251,7 +251,7 @@ eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
 
                        token = strtok_save;
                } else {
-                       token = (gchar *)strtok_r(NULL, delimiter, &strtok_save);
+                       token = (char *)strtok_r(NULL, delimiter, &strtok_save);
                }
        }
 
@@ -259,23 +259,23 @@ eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens)
                vector[size - 1] = NULL;
        }
        
-       g_free(string_c);
+       u_free(string_c);
        string_c = NULL;
 
        return vector;
 }
 
 void
-eg_strfreev (gchar **str_array)
+eg_strfreev (char **str_array)
 {
-       gchar **orig = str_array;
+       char **orig = str_array;
        if (str_array == NULL)
                return;
        while (*str_array != NULL){
-               g_free (*str_array);
+               u_free (*str_array);
                str_array++;
        }
-       g_free (orig);
+       u_free (orig);
 }
 
 
diff --git a/deps/eglib/test/test.h b/deps/ulib/test/test.h
similarity index 81%
rename from deps/eglib/test/test.h
rename to deps/ulib/test/test.h
index 5c7275e..97ae8c0 100644
--- a/deps/eglib/test/test.h
+++ b/deps/ulib/test/test.h
@@ -1,5 +1,5 @@
 /*
- * EGLib Unit Group/Test Runners
+ * ULib Unit Group/Test Runners
  *
  * Author:
  *   Aaron Bockover (abockover novell com)
@@ -33,7 +33,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
-#include <glib.h>
+#include <ulib.h>
 
 #ifdef _MSC_VER
 /* disable the following warnings 
@@ -43,31 +43,31 @@
 #pragma warning(disable:4100 4127)
 #endif
 
-typedef gchar * RESULT;
+typedef char * RESULT;
 
 typedef struct _Test Test;
 typedef struct _Group Group;
 
-typedef gchar * (* RunTestHandler)();
+typedef char * (* RunTestHandler)();
 typedef Test * (* LoadGroupHandler)();
 
 struct _Test {
-       const gchar *name;
+       const char *name;
        RunTestHandler handler;
 };
 
 struct _Group {
-       const gchar *name;
+       const char *name;
        LoadGroupHandler handler;
 };
 
-gboolean run_group(Group *group, gint iterations, gboolean quiet, 
-       gboolean time, gchar *tests);
+uboolean run_group(Group *group, int iterations, uboolean quiet, 
+       uboolean time, char *tests);
 #undef FAILED
-RESULT FAILED(const gchar *format, ...);
-gdouble get_timestamp();
-gchar ** eg_strsplit (const gchar *string, const gchar *delimiter, gint max_tokens);
-void eg_strfreev (gchar **str_array);
+RESULT FAILED(const char *format, ...);
+double get_timestamp();
+char ** eg_strsplit (const char *string, const char *delimiter, int max_tokens);
+void eg_strfreev (char **str_array);
 
 #define OK NULL
 
diff --git a/deps/eglib/test/tests.h b/deps/ulib/test/tests.h
similarity index 100%
rename from deps/eglib/test/tests.h
rename to deps/ulib/test/tests.h
diff --git a/deps/eglib/test/timer.c b/deps/ulib/test/timer.c
similarity index 70%
rename from deps/eglib/test/timer.c
rename to deps/ulib/test/timer.c
index 7b41f80..206a6fc 100644
--- a/deps/eglib/test/timer.c
+++ b/deps/ulib/test/timer.c
@@ -1,5 +1,5 @@
 #include <config.h>
-#include <glib.h>
+#include <ulib.h>
 #include <string.h>
 #include <math.h>
 #ifdef HAVE_UNISTD_H
@@ -8,7 +8,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#ifdef G_OS_WIN32
+#ifdef U_OS_WIN32
 #include <windows.h>
 #define sleep(t)                 Sleep((t) * 1000)
 #endif
@@ -18,19 +18,19 @@
 RESULT
 test_timer ()
 {
-       GTimer *timer;
-       gdouble elapsed1, elapsed2;
-       gulong usec = 0;
+       UTimer *timer;
+       double elapsed1, elapsed2;
+       unsigned long usec = 0;
 
-       timer = g_timer_new ();
+       timer = u_timer_new ();
        sleep (1);
-       elapsed1 = g_timer_elapsed (timer, NULL);
+       elapsed1 = u_timer_elapsed (timer, NULL);
        if ((elapsed1 + 0.1) < 1.0)
                return FAILED ("Elapsed time should be around 1s and was %f", elapsed1);
 
-       g_timer_stop (timer);
-       elapsed1 = g_timer_elapsed (timer, NULL);
-       elapsed2 = g_timer_elapsed (timer, &usec);
+       u_timer_stop (timer);
+       elapsed1 = u_timer_elapsed (timer, NULL);
+       elapsed2 = u_timer_elapsed (timer, &usec);
        if (fabs (elapsed1 - elapsed2) > 0.000001)
                return FAILED ("The elapsed times are not equal %f - %f.", elapsed1, elapsed2);
 
@@ -41,12 +41,12 @@ test_timer ()
        if (fabs (usec - elapsed2) > 100.0)
                return FAILED ("usecs are wrong.");
 
-       g_timer_destroy (timer);
+       u_timer_destroy (timer);
        return OK;
 }
 
 static Test timer_tests [] = {
-       {"g_timer", test_timer},
+       {"u_timer", test_timer},
        {NULL, NULL}
 };
 
diff --git a/deps/ulib/test/unicode.c b/deps/ulib/test/unicode.c
new file mode 100644
index 0000000..eaac5d9
--- /dev/null
+++ b/deps/ulib/test/unicode.c
@@ -0,0 +1,99 @@
+#include "test.h"
+
+/*
+ * u_unichar_type
+ */
+RESULT
+test_g_unichar_type ()
+{
+       if (u_unichar_type ('A') != U_UNICODE_UPPERCASE_LETTER)
+               return FAILED ("#1");
+       if (u_unichar_type ('a') != U_UNICODE_LOWERCASE_LETTER)
+               return FAILED ("#2");
+       if (u_unichar_type ('1') != U_UNICODE_DECIMAL_NUMBER)
+               return FAILED ("#3");
+       if (u_unichar_type (0xA3) != U_UNICODE_CURRENCY_SYMBOL)
+               return FAILED ("#4");
+       return NULL;
+}
+
+/*
+ * u_unichar_toupper
+ */
+RESULT
+test_g_unichar_toupper ()
+{
+       if (u_unichar_toupper (0) != 0)
+               return FAILED ("#0");
+       if (u_unichar_toupper ('a') != 'A')
+               return FAILED ("#1");
+       if (u_unichar_toupper ('1') != '1')
+               return FAILED ("#2");
+       if (u_unichar_toupper (0x1C4) != 0x1C4)
+               return FAILED ("#3");
+       if (u_unichar_toupper (0x1F2) != 0x1F1)
+               return FAILED ("#4");
+       if (u_unichar_toupper (0x1F3) != 0x1F1)
+               return FAILED ("#5");
+       if (u_unichar_toupper (0xFFFF) != 0xFFFF)
+               return FAILED ("#6");
+       if (u_unichar_toupper (0x10428) != 0x10400)
+               return FAILED ("#7");
+       return NULL;
+}
+
+/*
+ * u_unichar_tolower
+ */
+RESULT
+test_g_unichar_tolower ()
+{
+       if (u_unichar_tolower (0) != 0)
+               return FAILED ("#0");
+       if (u_unichar_tolower ('A') != 'a')
+               return FAILED ("#1");
+       if (u_unichar_tolower ('1') != '1')
+               return FAILED ("#2");
+       if (u_unichar_tolower (0x1C5) != 0x1C6)
+               return FAILED ("#3");
+       if (u_unichar_tolower (0x1F1) != 0x1F3)
+               return FAILED ("#4");
+       if (u_unichar_tolower (0x1F2) != 0x1F3)
+               return FAILED ("#5");
+       if (u_unichar_tolower (0xFFFF) != 0xFFFF)
+               return FAILED ("#6");
+       return NULL;
+}
+
+/*
+ * u_unichar_totitle
+ */
+RESULT
+test_g_unichar_totitle ()
+{
+       if (u_unichar_toupper (0) != 0)
+               return FAILED ("#0");
+       if (u_unichar_totitle ('a') != 'A')
+               return FAILED ("#1");
+       if (u_unichar_totitle ('1') != '1')
+               return FAILED ("#2");
+       if (u_unichar_totitle (0x1C4) != 0x1C5)
+               return FAILED ("#3");
+       if (u_unichar_totitle (0x1F2) != 0x1F2)
+               return FAILED ("#4");
+       if (u_unichar_totitle (0x1F3) != 0x1F2)
+               return FAILED ("#5");
+       if (u_unichar_toupper (0xFFFF) != 0xFFFF)
+               return FAILED ("#6");
+       return NULL;
+}
+
+static Test unicode_tests [] = {
+       {"u_unichar_type", test_g_unichar_type},
+       {"u_unichar_toupper", test_g_unichar_toupper},
+       {"u_unichar_tolower", test_g_unichar_tolower},
+       {"u_unichar_totitle", test_g_unichar_totitle},
+       {NULL, NULL}
+};
+
+DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests)
diff --git a/deps/eglib/test/utf8.c b/deps/ulib/test/utf8.c
similarity index 62%
rename from deps/eglib/test/utf8.c
rename to deps/ulib/test/utf8.c
index a924902..89e879e 100644
--- a/deps/eglib/test/utf8.c
+++ b/deps/ulib/test/utf8.c
@@ -3,11 +3,11 @@
 #include "test.h"
 
 /*
- * g_utf16_to_utf8
+ * u_utf16_to_utf8
  */
 
-glong
-compare_strings_utf8_pos (const gchar *expected, const gchar *actual, glong size)
+long
+compare_strings_utf8_pos (const char *expected, const char *actual, long size)
 {
        int i;
        for (i = 0; i < size; i++)
@@ -17,9 +17,9 @@ compare_strings_utf8_pos (const gchar *expected, const gchar *actual, glong size
 }
 
 RESULT
-compare_strings_utf8_RESULT (const gchar *expected, const gchar *actual, glong size)
+compare_strings_utf8_RESULT (const char *expected, const char *actual, long size)
 {
-       glong ret;
+       long ret;
 
        ret = compare_strings_utf8_pos (expected, actual, size);
        if (ret < 0)
@@ -28,7 +28,7 @@ compare_strings_utf8_RESULT (const gchar *expected, const gchar *actual, glong s
 }
 
 void
-gchar_to_gunichar2 (gunichar2 ret[], const gchar *src)
+char_to_uunichar2 (uunichar2 ret[], const char *src)
 {
        int i;
 
@@ -38,22 +38,22 @@ gchar_to_gunichar2 (gunichar2 ret[], const gchar *src)
 }
 
 RESULT
-compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out, 
glong size_spec)
+compare_utf16_to_utf8_explicit (const char *expected, const uunichar2 *utf16, long len_in, long len_out, 
long size_spec)
 {
-       GError *error;
-       gchar* ret;
+       UError *error;
+       char* ret;
        RESULT result;
-       glong in_read, out_read;
+       long in_read, out_read;
 
        result = NULL;
 
        error = NULL;
-       ret = g_utf16_to_utf8 (utf16, size_spec, &in_read, &out_read, &error);
+       ret = u_utf16_to_utf8 (utf16, size_spec, &in_read, &out_read, &error);
        if (error) {
                result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
-               g_error_free (error);
+               u_error_free (error);
                if (ret)
-                       g_free (ret);
+                       u_free (ret);
                return result;
        }
        if (in_read != len_in)
@@ -63,7 +63,7 @@ compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, g
        else
                result = compare_strings_utf8_RESULT (expected, ret, len_out);
 
-       g_free (ret);
+       u_free (ret);
        if (result)
                return result;
 
@@ -71,7 +71,7 @@ compare_utf16_to_utf8_explicit (const gchar *expected, const gunichar2 *utf16, g
 }
 
 RESULT
-compare_utf16_to_utf8 (const gchar *expected, const gunichar2 *utf16, glong len_in, glong len_out)
+compare_utf16_to_utf8 (const char *expected, const uunichar2 *utf16, long len_in, long len_out)
 {
        RESULT result;
 
@@ -84,11 +84,11 @@ compare_utf16_to_utf8 (const gchar *expected, const gunichar2 *utf16, glong len_
 RESULT
 test_utf16_to_utf8 ()
 {
-       const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81", *src5 = "\xF0\x90\x90\x80";
-       gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = 
{0xFF41, 0}, str5 [] = {0xD801, 0xDC00, 0};
+       const char *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81", *src5 = "\xF0\x90\x90\x80";
+       uunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = 
{0xFF41, 0}, str5 [] = {0xD801, 0xDC00, 0};
        RESULT result;
 
-       gchar_to_gunichar2 (str1, src1);
+       char_to_uunichar2 (str1, src1);
 
        /* empty string */
        result = compare_utf16_to_utf8 (src0, str0, 0, 0);
@@ -115,11 +115,11 @@ test_utf16_to_utf8 ()
 }
 
 /*
- * g_utf8_to_utf16 
+ * u_utf8_to_utf16
  */
 
-glong
-compare_strings_utf16_pos (const gunichar2 *expected, const gunichar2 *actual, glong size)
+long
+compare_strings_utf16_pos (const uunichar2 *expected, const uunichar2 *actual, long size)
 {
        int i;
        for (i = 0; i < size; i++)
@@ -129,9 +129,9 @@ compare_strings_utf16_pos (const gunichar2 *expected, const gunichar2 *actual, g
 }
 
 RESULT
-compare_strings_utf16_RESULT (const gunichar2 *expected, const gunichar2 *actual, glong size)
+compare_strings_utf16_RESULT (const uunichar2 *expected, const uunichar2 *actual, long size)
 {
-       glong ret;
+       long ret;
 
        ret = compare_strings_utf16_pos (expected, actual, size);
        if (ret < 0)
@@ -139,17 +139,17 @@ compare_strings_utf16_RESULT (const gunichar2 *expected, const gunichar2 *actual
        return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d ('%c' x '%c')\n", 
expected, actual, ret, expected [ret], actual [ret]);
 }
 
-#if !defined(EGLIB_TESTS)
-#define eg_utf8_to_utf16_with_nuls g_utf8_to_utf16
+#if !defined(ULIB_TESTS)
+#define eg_utf8_to_utf16_with_nuls u_utf8_to_utf16
 #endif
 
 RESULT
-compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, 
glong size_spec, gboolean include_nuls)
+compare_utf8_to_utf16_explicit (const uunichar2 *expected, const char *utf8, long len_in, long len_out, long 
size_spec, uboolean include_nuls)
 {
-       GError *error;
-       gunichar2* ret;
+       UError *error;
+       uunichar2* ret;
        RESULT result;
-       glong in_read, out_read;
+       long in_read, out_read;
 
        result = NULL;
 
@@ -157,13 +157,13 @@ compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, gl
        if (include_nuls)
                ret = eg_utf8_to_utf16_with_nuls (utf8, size_spec, &in_read, &out_read, &error);
        else
-               ret = g_utf8_to_utf16 (utf8, size_spec, &in_read, &out_read, &error);
+               ret = u_utf8_to_utf16 (utf8, size_spec, &in_read, &out_read, &error);
 
        if (error) {
                result = FAILED ("The error is %d %s\n", (error)->code, (error)->message);
-               g_error_free (error);
+               u_error_free (error);
                if (ret)
-                       g_free (ret);
+                       u_free (ret);
                return result;
        }
        if (in_read != len_in)
@@ -173,7 +173,7 @@ compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, gl
        else
                result = compare_strings_utf16_RESULT (expected, ret, len_out);
 
-       g_free (ret);
+       u_free (ret);
        if (result)
                return result;
 
@@ -181,7 +181,7 @@ compare_utf8_to_utf16_explicit (const gunichar2 *expected, const gchar *utf8, gl
 }
 
 RESULT
-compare_utf8_to_utf16_general (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out, 
gboolean include_nuls)
+compare_utf8_to_utf16_general (const uunichar2 *expected, const char *utf8, long len_in, long len_out, 
uboolean include_nuls)
 {
        RESULT result;
 
@@ -192,13 +192,13 @@ compare_utf8_to_utf16_general (const gunichar2 *expected, const gchar *utf8, glo
 }
 
 RESULT
-compare_utf8_to_utf16 (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+compare_utf8_to_utf16 (const uunichar2 *expected, const char *utf8, long len_in, long len_out)
 {
        return compare_utf8_to_utf16_general (expected, utf8, len_in, len_out, FALSE);
 }
 
 RESULT
-compare_utf8_to_utf16_with_nuls (const gunichar2 *expected, const gchar *utf8, glong len_in, glong len_out)
+compare_utf8_to_utf16_with_nuls (const uunichar2 *expected, const char *utf8, long len_in, long len_out)
 {
        return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, TRUE);
 }
@@ -207,14 +207,14 @@ compare_utf8_to_utf16_with_nuls (const gunichar2 *expected, const gchar *utf8, g
 RESULT
 test_utf8_seq ()
 {
-       const gchar *src = "\xE5\xB9\xB4\x27";
-       glong in_read, out_read;
-       //gunichar2 expected [6];
-       GError *error = NULL;
-       gunichar2 *dst;
+       const char *src = "\xE5\xB9\xB4\x27";
+       long in_read, out_read;
+       //uunichar2 expected [6];
+       UError *error = NULL;
+       uunichar2 *dst;
 
        //printf ("got: %s\n", src);
-       dst = g_utf8_to_utf16 (src, (glong)strlen (src), &in_read, &out_read, &error);
+       dst = u_utf8_to_utf16 (src, (long)strlen (src), &in_read, &out_read, &error);
        if (error != NULL){
                return error->message;
        }
@@ -225,7 +225,7 @@ test_utf8_seq ()
        if (out_read != 2) {
                return FAILED ("out_read is expected to be 2 but was %d\n", out_read);
        }
-       g_free (dst);
+       u_free (dst);
 
        return OK;
 }
@@ -233,11 +233,11 @@ test_utf8_seq ()
 RESULT
 test_utf8_to_utf16 ()
 {
-       const gchar *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81";
-       gunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = 
{0xFF41, 0};
+       const char *src0 = "", *src1 = "ABCDE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81";
+       uunichar2 str0 [] = {0}, str1 [6], str2 [] = {0x5E74, 39, 0}, str3 [] = {0xFF21, 0}, str4 [] = 
{0xFF41, 0};
        RESULT result;
 
-       gchar_to_gunichar2 (str1, src1);
+       char_to_uunichar2 (str1, src1);
 
        /* empty string */
        result = compare_utf8_to_utf16 (str0, src0, 0, 0);
@@ -263,11 +263,11 @@ test_utf8_to_utf16 ()
 RESULT
 test_utf8_to_utf16_with_nuls ()
 {
-       const gchar *src0 = "", *src1 = "AB\0DE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81";
-       gunichar2 str0 [] = {0}, str1 [] = {'A', 'B', 0, 'D', 'E', 0}, str2 [] = {0x5E74, 39, 0}, str3 [] = 
{0xFF21, 0}, str4 [] = {0xFF41, 0};
+       const char *src0 = "", *src1 = "AB\0DE", *src2 = "\xE5\xB9\xB4\x27", *src3 = "\xEF\xBC\xA1", *src4 = 
"\xEF\xBD\x81";
+       uunichar2 str0 [] = {0}, str1 [] = {'A', 'B', 0, 'D', 'E', 0}, str2 [] = {0x5E74, 39, 0}, str3 [] = 
{0xFF21, 0}, str4 [] = {0xFF41, 0};
        RESULT result;
 
-#if !defined(EGLIB_TESTS)
+#if !defined(ULIB_TESTS)
        return OK;
 #endif
 
@@ -305,102 +305,102 @@ RESULT
 test_convert ()
 {
        static const char *charsets[] = { "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE" };
-       gsize length, converted_length, n;
+       size_t length, converted_length, n;
        char *content, *converted, *path;
        convert_result_t **expected;
-       GError *err = NULL;
+       UError *err = NULL;
        const char *srcdir;
-       gboolean loaded;
-       guint i, j, k;
+       uboolean loaded;
+       unsigned int i, j, k;
        char c;
-       
+
        if (!(srcdir = getenv ("srcdir")) && !(srcdir = getenv ("PWD")))
                return FAILED ("srcdir not defined!");
-       
-       expected = g_malloc (sizeof (convert_result_t *) * G_N_ELEMENTS (charsets));
-       
+
+       expected = u_malloc (sizeof (convert_result_t *) * U_N_ELEMENTS (charsets));
+
        /* first load all our test samples... */
-       for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
-               path = g_strdup_printf ("%s%c%s.txt", srcdir, G_DIR_SEPARATOR, charsets[i]);
-               loaded = g_file_get_contents (path, &content, &length, &err);
-               g_free (path);
-               
+       for (i = 0; i < U_N_ELEMENTS (charsets); i++) {
+               path = u_strdup_printf ("%s%c%s.txt", srcdir, U_DIR_SEPARATOR, charsets[i]);
+               loaded = u_file_get_contents (path, &content, &length, &err);
+               u_free (path);
+
                if (!loaded) {
                        for (j = 0; j < i; j++) {
-                               g_free (expected[j]->content);
-                               g_free (expected[j]);
+                               u_free (expected[j]->content);
+                               u_free (expected[j]);
                        }
-                       
-                       g_free (expected);
-                       
+
+                       u_free (expected);
+
                        return FAILED ("Failed to load content for %s: %s", charsets[i], err->message);
                }
-               
-               expected[i] = g_malloc (sizeof (convert_result_t));
+
+               expected[i] = u_malloc (sizeof (convert_result_t));
                expected[i]->content = content;
                expected[i]->length = length;
        }
-       
+
        /* test conversion from every charset to every other charset */
-       for (i = 0; i < G_N_ELEMENTS (charsets); i++) {
-               for (j = 0; j < G_N_ELEMENTS (charsets); j++) {
-                       converted = g_convert (expected[i]->content, expected[i]->length, charsets[j],
+       for (i = 0; i < U_N_ELEMENTS (charsets); i++) {
+               for (j = 0; j < U_N_ELEMENTS (charsets); j++) {
+                       converted = u_convert (expected[i]->content, expected[i]->length, charsets[j],
                                               charsets[i], NULL, &converted_length, NULL);
-                       
+
                        if (converted == NULL) {
-                               for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
-                                       g_free (expected[k]->content);
-                                       g_free (expected[k]);
+                               for (k = 0; k < U_N_ELEMENTS (charsets); k++) {
+                                       u_free (expected[k]->content);
+                                       u_free (expected[k]);
                                }
-                               
-                               g_free (expected);
-                               
+
+                               u_free (expected);
+
                                return FAILED ("Failed to convert from %s to %s: NULL", charsets[i], 
charsets[j]);
                        }
-                       
+
                        if (converted_length != expected[j]->length) {
                                length = expected[j]->length;
-                               
-                               for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
-                                       g_free (expected[k]->content);
-                                       g_free (expected[k]);
+
+                               for (k = 0; k < U_N_ELEMENTS (charsets); k++) {
+                                       u_free (expected[k]->content);
+                                       u_free (expected[k]);
                                }
-                               
-                               g_free (converted);
-                               g_free (expected);
-                               
+
+                               u_free (converted);
+                               u_free (expected);
+
                                return FAILED ("Failed to convert from %s to %s: expected %u bytes, got %u",
                                               charsets[i], charsets[j], length, converted_length);
                        }
-                       
+
                        for (n = 0; n < converted_length; n++) {
                                if (converted[n] != expected[j]->content[n]) {
                                        c = expected[j]->content[n];
-                                       
-                                       for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
-                                               g_free (expected[k]->content);
-                                               g_free (expected[k]);
+
+                                       for (k = 0; k < U_N_ELEMENTS (charsets); k++) {
+                                               u_free (expected[k]->content);
+                                               u_free (expected[k]);
                                        }
-                                       
-                                       g_free (converted);
-                                       g_free (expected);
-                                       
+
+                                       u_free (converted);
+                                       u_free (expected);
+
                                        return FAILED ("Failed to convert from %s to %s: expected 0x%x at 
offset %u, got 0x%x",
                                                       charsets[i], charsets[j], c, n, converted[n]);
                                }
                        }
-                       
-                       g_free (converted);
+
+                       u_free (converted);
                }
        }
-       
-       for (k = 0; k < G_N_ELEMENTS (charsets); k++) {
-               g_free (expected[k]->content);
-               g_free (expected[k]);
+
+       for (k = 0; k < U_N_ELEMENTS (charsets); k++) {
+               u_free (expected[k]->content);
+               u_free (expected[k]);
        }
-       
-       g_free (expected);
-       
+
+       u_free (expected);
+
        return OK;
 }
 
@@ -409,32 +409,32 @@ RESULT
 test_xdigit ()
 {
        static char test_chars[] = {
-               '0', '1', '2', '3', '4', 
-               '5', '6', '7', '8', '9', 
+               '0', '1', '2', '3', '4',
+               '5', '6', '7', '8', '9',
                'a', 'b', 'c', 'd', 'e', 'f', 'g',
-               'A', 'B', 'C', 'D', 'E', 'F', 'G'};
-       static gint32 test_values[] = {
-               0, 1, 2, 3, 4, 
-               5, 6, 7, 8, 9, 
+               'A', 'B', 'C', 'D', 'E', 'F', 'U'};
+       static int32_t test_values[] = {
+               0, 1, 2, 3, 4,
+               5, 6, 7, 8, 9,
                10, 11, 12, 13, 14, 15, -1,
                10, 11, 12, 13, 14, 15, -1};
 
                int i =0;
 
                for (i = 0; i < sizeof(test_chars); i++)
-                       if (g_unichar_xdigit_value ((gunichar)test_chars[i]) != test_values[i])
+                       if (u_unichar_xdigit_value ((uunichar)test_chars[i]) != test_values[i])
                                return FAILED("Incorrect value %d at index %d", test_values[i], i);
 
                return OK;
 }
 
 static RESULT
-ucs4_to_utf16_check_result (const gunichar2 *result_str, const gunichar2 *expected_str,
-                           glong result_items_read, glong expected_items_read,
-                           glong result_items_written, glong expected_items_written,
-                           GError* result_error, gboolean expect_error)
+ucs4_to_utf16_check_result (const uunichar2 *result_str, const uunichar2 *expected_str,
+                           long result_items_read, long expected_items_read,
+                           long result_items_written, long expected_items_written,
+                           UError* result_error, uboolean expect_error)
 {
-       glong i;
+       long i;
        if (result_items_read != expected_items_read)
                return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, 
result_items_read);
        if (result_items_written != expected_items_written)
@@ -451,100 +451,100 @@ ucs4_to_utf16_check_result (const gunichar2 *result_str, const gunichar2 *expect
                if (result_str [i] != expected_str [i])
                        return FAILED("Incorrect value %d at index %d", result_str [i], i);
        }
-       if (result_str && result_str[expected_items_written] != '\0') 
+       if (result_str && result_str[expected_items_written] != '\0')
                return FAILED("Null termination not found at the end of the string.");
-       
+
        return OK;
 }
 
 RESULT
 test_ucs4_to_utf16 ()
 {
-       static gunichar str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
-       static gunichar2 exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
-       static gunichar str2[3] = {'h',0x80000000,'\0'};
-       static gunichar2 exp2[2] = {'h','\0'};
-       static gunichar str3[3] = {'h',0xDA00,'\0'};
-       static gunichar str4[3] = {'h',0x10FFFF,'\0'};
-       static gunichar2 exp4[4] = {'h',0xdbff,0xdfff,'\0'};
-       static gunichar str5[7] = {0xD7FF,0xD800,0xDFFF,0xE000,0x110000,0x10FFFF,'\0'};
-       static gunichar2 exp5[5] = {0xD7FF,0xE000,0xdbff,0xdfff,'\0'};
-       static gunichar str6[2] = {0x10400, '\0'};
-       static gunichar2 exp6[3] = {0xD801, 0xDC00, '\0'};
-       static glong read_write[12] = {1,1,0,0,0,0,1,1,0,0,1,2};
-       gunichar2* res;
-       glong items_read, items_written, current_write_index;
-       GError* err=0;
+       static uunichar str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+       static uunichar2 exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+       static uunichar str2[3] = {'h',0x80000000,'\0'};
+       static uunichar2 exp2[2] = {'h','\0'};
+       static uunichar str3[3] = {'h',0xDA00,'\0'};
+       static uunichar str4[3] = {'h',0x10FFFF,'\0'};
+       static uunichar2 exp4[4] = {'h',0xdbff,0xdfff,'\0'};
+       static uunichar str5[7] = {0xD7FF,0xD800,0xDFFF,0xE000,0x110000,0x10FFFF,'\0'};
+       static uunichar2 exp5[5] = {0xD7FF,0xE000,0xdbff,0xdfff,'\0'};
+       static uunichar str6[2] = {0x10400, '\0'};
+       static uunichar2 exp6[3] = {0xD801, 0xDC00, '\0'};
+       static long read_write[12] = {1,1,0,0,0,0,1,1,0,0,1,2};
+       uunichar2* res;
+       long items_read, items_written, current_write_index;
+       UError* err=0;
        RESULT check_result;
-       glong i;
-       
-       res = g_ucs4_to_utf16 (str1, 12, &items_read, &items_written, &err);
+       long i;
+
+       res = u_ucs4_to_utf16 (str1, 12, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        items_read = items_written = 0;
-       res = g_ucs4_to_utf16 (str2, 0, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str2, 0, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        items_read = items_written = 0;
-       res = g_ucs4_to_utf16 (str2, 1, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str2, 1, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        items_read = items_written = 0;
-       res = g_ucs4_to_utf16 (str2, 2, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str2, 2, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
-       g_free (res);
+       u_free (res);
        if (check_result) return check_result;
 
        items_read = items_written = 0;
        err = 0;
-       res = g_ucs4_to_utf16 (str3, 2, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str3, 2, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, 0, items_read, 1, items_written, 0, err, TRUE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        items_read = items_written = 0;
        err = 0;
-       res = g_ucs4_to_utf16 (str4, 5, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str4, 5, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, exp4, items_read, 2, items_written, 3, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        // This loop tests the bounds of the conversion algorithm
        current_write_index = 0;
        for (i=0;i<6;i++) {
                items_read = items_written = 0;
                err = 0;
-               res = g_ucs4_to_utf16 (&str5[i], 1, &items_read, &items_written, &err);
-               check_result = ucs4_to_utf16_check_result (res, &exp5[current_write_index], 
+               res = u_ucs4_to_utf16 (&str5[i], 1, &items_read, &items_written, &err);
+               check_result = ucs4_to_utf16_check_result (res, &exp5[current_write_index],
                                        items_read, read_write[i*2], items_written, read_write[(i*2)+1], err, 
!read_write[(i*2)+1]);
                if (check_result) return check_result;
-               g_free (res);
+               u_free (res);
                current_write_index += items_written;
        }
 
        items_read = items_written = 0;
        err = 0;
-       res = g_ucs4_to_utf16 (str6, 1, &items_read, &items_written, &err);
+       res = u_ucs4_to_utf16 (str6, 1, &items_read, &items_written, &err);
        check_result = ucs4_to_utf16_check_result (res, exp6, items_read, 1, items_written, 2, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        return OK;
 }
 
 static RESULT
-utf16_to_ucs4_check_result (const gunichar *result_str, const gunichar *expected_str,
-                           glong result_items_read, glong expected_items_read,
-                           glong result_items_written, glong expected_items_written,
-                           GError* result_error, gboolean expect_error)
+utf16_to_ucs4_check_result (const uunichar *result_str, const uunichar *expected_str,
+                           long result_items_read, long expected_items_read,
+                           long result_items_written, long expected_items_written,
+                           UError* result_error, uboolean expect_error)
 {
-       glong i;
+       long i;
        if (result_items_read != expected_items_read)
                return FAILED("Incorrect number of items read; expected %d, got %d", expected_items_read, 
result_items_read);
        if (result_items_written != expected_items_written)
@@ -561,147 +561,147 @@ utf16_to_ucs4_check_result (const gunichar *result_str, const gunichar *expected
                if (result_str [i] != expected_str [i])
                        return FAILED("Incorrect value %d at index %d", result_str [i], i);
        }
-       if (result_str && result_str[expected_items_written] != '\0') 
+       if (result_str && result_str[expected_items_written] != '\0')
                return FAILED("Null termination not found at the end of the string.");
-       
+
        return OK;
 }
 
 RESULT
 test_utf16_to_ucs4 ()
 {
-       static gunichar2 str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
-       static gunichar exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
-       static gunichar2 str2[7] = {'H', 0xD800, 0xDC01,0xD800,0xDBFF,'l','\0'};
-       static gunichar exp2[3] = {'H',0x00010001,'\0'};
-       static gunichar2 str3[4] = {'H', 0xDC00 ,'l','\0'};
-       static gunichar exp3[2] = {'H','\0'};
-       static gunichar2 str4[20] = {0xDC00,0xDFFF,0xDFF,0xD800,0xDBFF,0xD800,0xDC00,0xD800,0xDFFF,
+       static uunichar2 str1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+       static uunichar exp1[12] = {'H','e','l','l','o',' ','W','o','r','l','d','\0'};
+       static uunichar2 str2[7] = {'H', 0xD800, 0xDC01,0xD800,0xDBFF,'l','\0'};
+       static uunichar exp2[3] = {'H',0x00010001,'\0'};
+       static uunichar2 str3[4] = {'H', 0xDC00 ,'l','\0'};
+       static uunichar exp3[2] = {'H','\0'};
+       static uunichar2 str4[20] = {0xDC00,0xDFFF,0xDFF,0xD800,0xDBFF,0xD800,0xDC00,0xD800,0xDFFF,
                                     
0xD800,0xE000,0xDBFF,0xDBFF,0xDBFF,0xDC00,0xDBFF,0xDFFF,0xDBFF,0xE000,'\0'};
-       static gunichar exp4[6] = {0xDFF,0x10000,0x103ff,0x10fc00,0x10FFFF,'\0'};
-       static gunichar2 str5[3] = {0xD801, 0xDC00, 0};
-       static gunichar exp5[2] = {0x10400, 0};
-       static glong read_write[33] = {1,0,0,1,0,0,1,1,1,2,1,0,2,2,1,2,2,1,2,1,0,2,1,0,2,2,1,2,2,1,2,1,0};
-       gunichar* res;
-       glong items_read, items_written, current_read_index,current_write_index;
-       GError* err=0;
+       static uunichar exp4[6] = {0xDFF,0x10000,0x103ff,0x10fc00,0x10FFFF,'\0'};
+       static uunichar2 str5[3] = {0xD801, 0xDC00, 0};
+       static uunichar exp5[2] = {0x10400, 0};
+       static long read_write[33] = {1,0,0,1,0,0,1,1,1,2,1,0,2,2,1,2,2,1,2,1,0,2,1,0,2,2,1,2,2,1,2,1,0};
+       uunichar* res;
+       long items_read, items_written, current_read_index,current_write_index;
+       UError* err=0;
        RESULT check_result;
-       glong i;
-       
-       res = g_utf16_to_ucs4 (str1, 12, &items_read, &items_written, &err);
+       long i;
+
+       res = u_utf16_to_ucs4 (str1, 12, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp1, items_read, 11, items_written, 11, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 0, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 0, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 0, items_written, 0, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 1, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 1, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 2, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 2, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 1, items_written, 1, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 3, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 3, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 4, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 4, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 3, items_written, 2, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
-       res = g_utf16_to_ucs4 (str2, 5, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str2, 5, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp2, items_read, 4, items_written, 0, err, TRUE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        items_read = items_written = 0;
        err = 0;
-       res = g_utf16_to_ucs4 (str3, 5, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str3, 5, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp3, items_read, 1, items_written, 0, err, TRUE);
        if (check_result) return check_result;
-       g_free (res);
-       
+       u_free (res);
+
        // This loop tests the bounds of the conversion algorithm
        current_read_index = current_write_index = 0;
        for (i=0;i<11;i++) {
                items_read = items_written = 0;
                err = 0;
-               res = g_utf16_to_ucs4 (&str4[current_read_index], read_write[i*3], &items_read, 
&items_written, &err);
-               check_result = utf16_to_ucs4_check_result (res, &exp4[current_write_index], items_read, 
-                                            read_write[(i*3)+1], items_written, read_write[(i*3)+2], err, 
+               res = u_utf16_to_ucs4 (&str4[current_read_index], read_write[i*3], &items_read, 
&items_written, &err);
+               check_result = utf16_to_ucs4_check_result (res, &exp4[current_write_index], items_read,
+                                            read_write[(i*3)+1], items_written, read_write[(i*3)+2], err,
                                             !read_write[(i*3)+2]);
                if (check_result) return check_result;
-               g_free (res);
+               u_free (res);
                current_read_index += read_write[i*3];
                current_write_index += items_written;
        }
 
        items_read = items_written = 0;
        err = 0;
-       res = g_utf16_to_ucs4 (str5, 2, &items_read, &items_written, &err);
+       res = u_utf16_to_ucs4 (str5, 2, &items_read, &items_written, &err);
        check_result = utf16_to_ucs4_check_result (res, exp5, items_read, 2, items_written, 1, err, FALSE);
        if (check_result) return check_result;
-       g_free (res);
+       u_free (res);
 
        return OK;
 }
 RESULT
 test_utf8_strlen ()
 {
-       gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'};//Valid, len = 5
-       gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};//Valid, len = 5
-       gchar word3 [] = {'h','e',0xC2, 0x82,0x45,'\0'};                                                      
                          //Valid, len = 4
-       gchar word4 [] = {0x62,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};                                   
  //Valid, len = 5
-       
-       glong len = 0;
-       
+       char word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'};//Valid, len = 5
+       char word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};//Valid, len = 5
+       char word3 [] = {'h','e',0xC2, 0x82,0x45,'\0'};                                                       
                  //Valid, len = 4
+       char word4 [] = {0x62,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'};                                    
  //Valid, len = 5
+
+       long len = 0;
+
        //Test word1
-       len = g_utf8_strlen (word1,-1);
+       len = u_utf8_strlen (word1,-1);
        if (len != 5)
                return FAILED ("Word1 expected length of 5, but was %i", len);
        //Do tests with different values for max parameter.
-       len = g_utf8_strlen (word1,1);
+       len = u_utf8_strlen (word1,1);
        if (len != 0)
                return FAILED ("Word1, max = 1, expected length of 0, but was %i", len);
-       len = g_utf8_strlen (word1,2);
+       len = u_utf8_strlen (word1,2);
        if (len != 1)
                return FAILED ("Word1, max = 1, expected length of 1, but was %i", len);
-       len = g_utf8_strlen (word1,3);
+       len = u_utf8_strlen (word1,3);
        if (len != 2)
                return FAILED ("Word1, max = 2, expected length of 2, but was %i", len);
-               
+
        //Test word2
-       len = g_utf8_strlen (word2,-1);
+       len = u_utf8_strlen (word2,-1);
        if (len != 5)
                return FAILED ("Word2 expected length of 5, but was %i", len);
-               
+
        //Test word3
-       len = g_utf8_strlen (word3,-1);
+       len = u_utf8_strlen (word3,-1);
        if (len != 4)
                return FAILED ("Word3 expected length of 4, but was %i", len);
-               
+
        //Test word4
-       len = g_utf8_strlen (word4,-1);
+       len = u_utf8_strlen (word4,-1);
        if (len != 5)
                return FAILED ("Word4 expected length of 5, but was %i", len);
-               
+
        //Test null case
-       len = g_utf8_strlen(NULL,0);
+       len = u_utf8_strlen(NULL,0);
        if (len != 0)
                return FAILED ("Expected passing null to result in a length of 0");
        return OK;
@@ -710,21 +710,21 @@ test_utf8_strlen ()
 RESULT
 test_utf8_get_char()
 {
-       gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+       char word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
 
-       gunichar value = g_utf8_get_char (&word1 [0]);
+       uunichar value = u_utf8_get_char (&word1 [0]);
        if (value != 0x82UL)
                return FAILED ("Expected value of 0x82, but was %x", value);
-       value = g_utf8_get_char (&word1 [2]);
+       value = u_utf8_get_char (&word1 [2]);
        if (value != 0x45UL)
                return FAILED ("Expected value of 0x45, but was %x", value);
-       value = g_utf8_get_char (&word1 [3]);
+       value = u_utf8_get_char (&word1 [3]);
        if (value != 0x1043UL)
                return FAILED ("Expected value of 0x1043, but was %x", value);
-       value = g_utf8_get_char (&word1 [6]);
+       value = u_utf8_get_char (&word1 [6]);
        if (value != 0x58UL)
                return FAILED ("Expected value of 0x58, but was %x", value);
-       value = g_utf8_get_char (&word1 [7]);
+       value = u_utf8_get_char (&word1 [7]);
        if (value != 0x42082UL)
                return FAILED ("Expected value of 0x42082, but was %x", value);
 
@@ -734,23 +734,23 @@ test_utf8_get_char()
 RESULT
 test_utf8_next_char()
 {
-       gchar word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
-       gchar word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
-       gchar word1ExpectedValues [] = {0xC2, 0x45,0xE1, 0x58, 0xF1};
-       gchar word2ExpectedValues [] = {0xF1, 0xC2, 0x45, 0xE1, 0x58};
-       
-       gchar* ptr = word1;
-       gint count = 0;
+       char word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
+       char word2 [] = {0xF1, 0x82, 0x82, 0x82,0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Valid, len = 5
+       char word1ExpectedValues [] = {0xC2, 0x45,0xE1, 0x58, 0xF1};
+       char word2ExpectedValues [] = {0xF1, 0xC2, 0x45, 0xE1, 0x58};
+
+       char* ptr = word1;
+       int count = 0;
        //Test word1
        while (*ptr != 0) {
                if (count > 4)
                        return FAILED ("Word1 has gone past its expected length");
                if (*ptr != word1ExpectedValues[count])
                        return FAILED ("Word1 has an incorrect next_char at index %i", count);
-               ptr = g_utf8_next_char (ptr);
+               ptr = u_utf8_next_char (ptr);
                count++;
        }
-       
+
        //Test word2
        count = 0;
        ptr = word2;
@@ -759,53 +759,53 @@ test_utf8_next_char()
                        return FAILED ("Word2 has gone past its expected length");
                if (*ptr != word2ExpectedValues[count])
                        return FAILED ("Word2 has an incorrect next_char at index %i", count);
-               ptr = g_utf8_next_char (ptr);
+               ptr = u_utf8_next_char (ptr);
                count++;
        }
-       
+
        return OK;
 }
 
 RESULT
 test_utf8_validate()
 {
-       gchar invalidWord1 [] = {0xC3, 0x82, 0xC1,0x90,'\0'}; //Invalid, 1nd oct Can't be 0xC0 or 0xC1
-       gchar invalidWord2 [] = {0xC1, 0x89, 0x60, '\0'}; //Invalid, 1st oct can not be 0xC1
-       gchar invalidWord3 [] = {0xC2, 0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Invalid, oct after 0xC2 must be > 
0x80
-
-       gchar validWord1 [] = {0xC2, 0x82, 0xC3,0xA0,'\0'}; //Valid
-       gchar validWord2 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid
-       
-       const gchar* end;
-       gboolean retVal = g_utf8_validate (invalidWord1, -1, &end);
+       char invalidWord1 [] = {0xC3, 0x82, 0xC1,0x90,'\0'}; //Invalid, 1nd oct Can't be 0xC0 or 0xC1
+       char invalidWord2 [] = {0xC1, 0x89, 0x60, '\0'}; //Invalid, 1st oct can not be 0xC1
+       char invalidWord3 [] = {0xC2, 0x45,0xE1, 0x81, 0x83,0x58,'\0'}; //Invalid, oct after 0xC2 must be > 
0x80
+
+       char validWord1 [] = {0xC2, 0x82, 0xC3,0xA0,'\0'}; //Valid
+       char validWord2 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid
+
+       const char* end;
+       uboolean retVal = u_utf8_validate (invalidWord1, -1, &end);
        if (retVal != FALSE)
                return FAILED ("Expected invalidWord1 to be invalid");
        if (end != &invalidWord1 [2])
                return FAILED ("Expected end parameter to be pointing to invalidWord1[2]");
 
        end = NULL;
-       retVal = g_utf8_validate (invalidWord2, -1, &end);
+       retVal = u_utf8_validate (invalidWord2, -1, &end);
        if (retVal != FALSE)
                return FAILED ("Expected invalidWord2 to be invalid");
        if (end != &invalidWord2 [0])
                return FAILED ("Expected end parameter to be pointing to invalidWord2[0]");
 
        end = NULL;
-       retVal = g_utf8_validate (invalidWord3, -1, &end);
+       retVal = u_utf8_validate (invalidWord3, -1, &end);
        if (retVal != FALSE)
                return FAILED ("Expected invalidWord3 to be invalid");
        if (end != &invalidWord3 [0])
                return FAILED ("Expected end parameter to be pointing to invalidWord3[1]");
 
        end = NULL;
-       retVal = g_utf8_validate (validWord1, -1, &end);
+       retVal = u_utf8_validate (validWord1, -1, &end);
        if (retVal != TRUE)
                return FAILED ("Expected validWord1 to be valid");
        if (end != &validWord1 [4])
                return FAILED ("Expected end parameter to be pointing to validWord1[4]");
 
        end = NULL;
-       retVal = g_utf8_validate (validWord2, -1, &end);
+       retVal = u_utf8_validate (validWord2, -1, &end);
        if (retVal != TRUE)
                return FAILED ("Expected validWord2 to be valid");
        if (end != &validWord2 [11])
@@ -813,8 +813,8 @@ test_utf8_validate()
        return OK;
 }
 
-glong
-utf8_byteslen (const gchar *src)
+long
+utf8_byteslen (const char *src)
 {
        int i = 0;
        do {
@@ -825,34 +825,34 @@ utf8_byteslen (const gchar *src)
 }
 
 RESULT
-test_utf8_strcase_each (const gchar *src, const gchar *expected, gboolean strup)
+test_utf8_strcase_each (const char *src, const char *expected, uboolean strup)
 {
-       gchar *tmp;
-       glong len, len2;
+       char *tmp;
+       long len, len2;
        RESULT r;
 
        len = utf8_byteslen (src);
-       tmp = strup ? g_utf8_strup (src, len) : g_utf8_strdown (src, len);
+       tmp = strup ? u_utf8_strup (src, len) : u_utf8_strdown (src, len);
        len2 = utf8_byteslen (tmp);
        r = compare_strings_utf8_RESULT (expected, tmp, len < len2 ? len2 : len);
-       g_free (tmp);
+       u_free (tmp);
        return r;
 }
 
 RESULT
-test_utf8_strup_each (const gchar *src, const gchar *expected)
+test_utf8_strup_each (const char *src, const char *expected)
 {
        return test_utf8_strcase_each (src, expected, TRUE);
 }
 
 RESULT
-test_utf8_strdown_each (const gchar *src, const gchar *expected)
+test_utf8_strdown_each (const char *src, const char *expected)
 {
        return test_utf8_strcase_each (src, expected, FALSE);
 }
 
 /*
- * g_utf8_strup
+ * u_utf8_strup
  */
 RESULT
 test_utf8_strup ()
@@ -880,7 +880,7 @@ test_utf8_strup ()
 }
 
 /*
- * g_utf8_strdown
+ * u_utf8_strdown
  */
 RESULT
 test_utf8_strdown ()
@@ -913,20 +913,20 @@ test_utf8_strdown ()
  */
 
 static Test utf8_tests [] = {
-       {"g_utf16_to_utf8", test_utf16_to_utf8},
-       {"g_utf8_to_utf16", test_utf8_to_utf16},
-       {"g_utf8_to_utf16_with_nuls", test_utf8_to_utf16_with_nuls},
-       {"g_utf8_seq", test_utf8_seq},
-       {"g_convert", test_convert },
-       {"g_unichar_xdigit_value", test_xdigit },
-       {"g_ucs4_to_utf16", test_ucs4_to_utf16 },
-       {"g_utf16_to_ucs4", test_utf16_to_ucs4 },
-       {"g_utf8_strlen", test_utf8_strlen },
-       {"g_utf8_get_char", test_utf8_get_char },
-       {"g_utf8_next_char", test_utf8_next_char },
-       {"g_utf8_validate", test_utf8_validate },
-       {"g_utf8_strup", test_utf8_strup},
-       {"g_utf8_strdown", test_utf8_strdown},
+       {"u_utf16_to_utf8", test_utf16_to_utf8},
+       {"u_utf8_to_utf16", test_utf8_to_utf16},
+       {"u_utf8_to_utf16_with_nuls", test_utf8_to_utf16_with_nuls},
+       {"u_utf8_seq", test_utf8_seq},
+       {"u_convert", test_convert },
+       {"u_unichar_xdigit_value", test_xdigit },
+       {"u_ucs4_to_utf16", test_ucs4_to_utf16 },
+       {"u_utf16_to_ucs4", test_utf16_to_ucs4 },
+       {"u_utf8_strlen", test_utf8_strlen },
+       {"u_utf8_get_char", test_utf8_get_char },
+       {"u_utf8_next_char", test_utf8_next_char },
+       {"u_utf8_validate", test_utf8_validate },
+       {"u_utf8_strup", test_utf8_strup},
+       {"u_utf8_strdown", test_utf8_strdown},
        {NULL, NULL}
 };
 
diff --git a/deps/eglib/test/whats-implemented b/deps/ulib/test/whats-implemented
similarity index 100%
rename from deps/eglib/test/whats-implemented
rename to deps/ulib/test/whats-implemented
diff --git a/deps/eglib/winconfig.h b/deps/ulib/winconfig.h
similarity index 100%
rename from deps/eglib/winconfig.h
rename to deps/ulib/winconfig.h
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 47a2157..ae4dd78 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,7 +1,9 @@
 include $(top_srcdir)/build/autotools/Makefile.am.silent
 
 AM_CPPFLAGS = \
-       -I$(top_srcdir)
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/deps/ulib/src \
+       -I$(top_builddir)/deps/ulib/src
 
 AM_CFLAGS = \
        $(COGL_DEP_CFLAGS) \
@@ -16,12 +18,9 @@ endif
 common_ldadd = \
        $(COGL_DEP_LIBS) \
        $(top_builddir)/cogl/libcogl2.la \
+       $(top_builddir)/deps/ulib/src/libulib.la \
        $(LIBM)
 
-if !USE_GLIB
-common_ldadd += $(top_builddir)/deps/eglib/src/libeglib.la
-endif
-
 programs = cogl-info
 
 cogl_info_SOURCES = cogl-info.c
@@ -107,7 +106,7 @@ cogl_sdl2_hello_LDADD = $(common_ldadd)
 endif
 
 if USING_EMSCRIPTEN
-%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/glib/.libs/libglib.a
+%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/ulib/src/.libs/libulib.a
        $(CC) $(AM_CFLAGS) $(CFLAGS) --js-library $(top_srcdir)/examples/emscripten-example-js-library.js -o 
$@ $^
 
 all-local: $(addsuffix .html, $(programs))
diff --git a/examples/cogl-crate.c b/examples/cogl-crate.c
index 570c196..4eeab9d 100644
--- a/examples/cogl-crate.c
+++ b/examples/cogl-crate.c
@@ -213,7 +213,7 @@ main (int argc, char **argv)
    */
   data.indices = cogl_get_rectangle_indices (ctx, 6 /* n_rectangles */);
   data.prim = cogl_primitive_new_p3t2 (ctx, COGL_VERTICES_MODE_TRIANGLES,
-                                       G_N_ELEMENTS (vertices),
+                                       U_N_ELEMENTS (vertices),
                                        vertices);
   /* Each face will have 6 indices so we have 6 * 6 indices in total... */
   cogl_primitive_set_indices (data.prim,
diff --git a/examples/cogl-point-sprites.c b/examples/cogl-point-sprites.c
index da13138..fde687e 100644
--- a/examples/cogl-point-sprites.c
+++ b/examples/cogl-point-sprites.c
@@ -226,9 +226,9 @@ create_primitive (Data *data)
     cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_POINTS,
                                         N_SPARKS,
                                         attributes,
-                                        G_N_ELEMENTS (attributes));
+                                        U_N_ELEMENTS (attributes));
 
-  for (i = 0; i < G_N_ELEMENTS (attributes); i++)
+  for (i = 0; i < U_N_ELEMENTS (attributes); i++)
     cogl_object_unref (attributes[i]);
 }
 
diff --git a/test-fixtures/Makefile.am b/test-fixtures/Makefile.am
index 332c5ee..87c1065 100644
--- a/test-fixtures/Makefile.am
+++ b/test-fixtures/Makefile.am
@@ -4,13 +4,11 @@ noinst_LTLIBRARIES = libtest-fixtures.la
 libtest_fixtures_la_CPPFLAGS = \
        -I$(top_srcdir) \
        -I$(top_builddir)/cogl \
+       -I$(top_srcdir)/deps/ulib/src \
+       -I$(top_builddir)/deps/ulib/src \
        -Wall \
        $(NULL)
 
-if !USE_GLIB
-libtest_fixtures_la_CPPFLAGS += -I$(top_builddir)/deps/glib
-endif
-
 libtest_fixtures_la_CPPFLAGS += \
        -DCOGL_DISABLE_DEPRECATED \
        -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index 9c3ced9..bc106c2 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -20,7 +20,7 @@
 #include <cogl/cogl.h>
 #endif
 
-#include <glib.h>
+#include <ulib.h>
 
 /* We don't really care about functions that are defined without a
    header for the unit tests so we can just disable it here */
diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am
index 083d734..d198ba3 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -129,6 +129,8 @@ BUILT_SOURCES = wrappers
 
 AM_CPPFLAGS = \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/deps/ulib/src \
+       -I$(top_builddir)/deps/ulib/src \
        -I$(top_builddir)/cogl \
        -I$(top_srcdir)/test-fixtures
 
@@ -144,9 +146,7 @@ test_conformance_LDADD = \
 if BUILD_COGL_PATH
 test_conformance_LDADD += $(top_builddir)/cogl-path/libcogl-path.la
 endif
-if !USE_GLIB
-test_conformance_LDADD += $(top_builddir)/deps/eglib/src/libeglib.la
-endif
+test_conformance_LDADD += $(top_builddir)/deps/ulib/src/libulib.la
 test_conformance_LDFLAGS = -export-dynamic
 
 test: wrappers
diff --git a/tests/conform/test-alpha-test.c b/tests/conform/test-alpha-test.c
index e74f6d8..cf9b7b0 100644
--- a/tests/conform/test-alpha-test.c
+++ b/tests/conform/test-alpha-test.c
@@ -68,6 +68,6 @@ test_alpha_test (void)
                            0x0000ffff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-alpha-textures.c b/tests/conform/test-alpha-textures.c
index f4ad49b..c4053a7 100644
--- a/tests/conform/test-alpha-textures.c
+++ b/tests/conform/test-alpha-textures.c
@@ -118,6 +118,6 @@ test_alpha_textures (void)
                           0xffffffff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-atlas-migration.c b/tests/conform/test-atlas-migration.c
index 39e8a3c..d5fa47b 100644
--- a/tests/conform/test-atlas-migration.c
+++ b/tests/conform/test-atlas-migration.c
@@ -31,7 +31,7 @@ create_texture (int size)
   /* Create a red, green or blue texture depending on the size */
   color = COLOR_FOR_SIZE (size);
 
-  p = data = g_malloc (size * size * 4);
+  p = data = u_malloc (size * size * 4);
 
   /* Fill the data with the color but fade the opacity out with
      increasing y coordinates so that we can see the blending it the
@@ -77,7 +77,7 @@ verify_texture (CoglTexture *texture, int size)
 
   color = COLOR_FOR_SIZE (size);
 
-  p = data = g_malloc (size * size * 4);
+  p = data = u_malloc (size * size * 4);
 
   cogl_texture_get_data (texture,
                          COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -141,5 +141,5 @@ test_atlas_migration (void)
     cogl_object_unref (textures[tex_num]);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
index 02836d8..7573bcf 100644
--- a/tests/conform/test-backface-culling.c
+++ b/tests/conform/test-backface-culling.c
@@ -200,7 +200,7 @@ make_texture (void)
   guchar *tex_data, *p;
   CoglTexture *tex;
 
-  tex_data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+  tex_data = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
 
   for (p = tex_data + TEXTURE_SIZE * TEXTURE_SIZE * 4; p > tex_data;)
     {
@@ -250,6 +250,6 @@ test_backface_culling (void)
   cogl_object_unref (state.texture);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-blend-strings.c b/tests/conform/test-blend-strings.c
index 4c1a09b..cfb3bb0 100644
--- a/tests/conform/test-blend-strings.c
+++ b/tests/conform/test-blend-strings.c
@@ -86,7 +86,7 @@ test_blend (TestState *state,
        {
          g_debug ("Failed to test blend string %s: %s",
                   blend_string, error->message);
-         g_print ("Skipping\n");
+         u_print ("Skipping\n");
        }
       return;
     }
@@ -109,14 +109,14 @@ test_blend (TestState *state,
 
   if (cogl_test_verbose ())
     {
-      g_print ("test_blend (%d, %d):\n%s\n", x, y, blend_string);
-      g_print ("  src color = %02x, %02x, %02x, %02x\n", Sr, Sg, Sb, Sa);
-      g_print ("  dst color = %02x, %02x, %02x, %02x\n", Dr, Dg, Db, Da);
+      u_print ("test_blend (%d, %d):\n%s\n", x, y, blend_string);
+      u_print ("  src color = %02x, %02x, %02x, %02x\n", Sr, Sg, Sb, Sa);
+      u_print ("  dst color = %02x, %02x, %02x, %02x\n", Dr, Dg, Db, Da);
       if (blend_constant != BLEND_CONSTANT_UNUSED)
-        g_print ("  blend constant = %02x, %02x, %02x, %02x\n",
+        u_print ("  blend constant = %02x, %02x, %02x, %02x\n",
                  Br, Bg, Bb, Ba);
       else
-        g_print ("  blend constant = UNUSED\n");
+        u_print ("  blend constant = UNUSED\n");
     }
 
   test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
@@ -132,7 +132,7 @@ make_texture (uint32_t color)
   uint8_t a = MASK_ALPHA (color);
   CoglTexture *tex;
 
-  tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
+  tex_data = u_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
 
   for (p = tex_data + QUAD_WIDTH * QUAD_WIDTH * 4; p > tex_data;)
     {
@@ -226,14 +226,14 @@ test_tex_combine (TestState *state,
 
   if (cogl_test_verbose ())
     {
-      g_print ("test_tex_combine (%d, %d):\n%s\n", x, y, combine_string);
-      g_print ("  texture 0 color = 0x%08lX\n", (unsigned long)tex0_color);
-      g_print ("  texture 1 color = 0x%08lX\n", (unsigned long)tex1_color);
+      u_print ("test_tex_combine (%d, %d):\n%s\n", x, y, combine_string);
+      u_print ("  texture 0 color = 0x%08lX\n", (unsigned long)tex0_color);
+      u_print ("  texture 1 color = 0x%08lX\n", (unsigned long)tex1_color);
       if (combine_constant != TEX_CONSTANT_UNUSED)
-        g_print ("  combine constant = %02x, %02x, %02x, %02x\n",
+        u_print ("  combine constant = %02x, %02x, %02x, %02x\n",
                  Cr, Cg, Cb, Ca);
       else
-        g_print ("  combine constant = UNUSED\n");
+        u_print ("  combine constant = UNUSED\n");
     }
 
   test_utils_check_pixel (test_fb, x_off, y_off, expected_result);
@@ -369,6 +369,6 @@ test_blend_strings (void)
   paint (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-color-hsl.c b/tests/conform/test-color-hsl.c
index 8c51cd9..2c03c7a 100644
--- a/tests/conform/test-color-hsl.c
+++ b/tests/conform/test-color-hsl.c
@@ -41,5 +41,5 @@ test_color_hsl (void)
   cogl_assert_float(color.alpha, 1.0f);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-color-mask.c b/tests/conform/test-color-mask.c
index 4cbfb98..a56ddf9 100644
--- a/tests/conform/test-color-mask.c
+++ b/tests/conform/test-color-mask.c
@@ -101,6 +101,6 @@ test_color_mask (void)
   paint (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 0cbaf09..56d651e 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -2,7 +2,7 @@
 
 #include <cogl/cogl.h>
 
-#include <glib.h>
+#include <ulib.h>
 #include <locale.h>
 #include <stdlib.h>
 #include <string.h>
@@ -11,7 +11,7 @@
 
 /* A bit of sugar for adding new conformance tests */
 #define ADD_TEST(FUNC, REQUIREMENTS, KNOWN_FAIL_REQUIREMENTS)           \
-  G_STMT_START {                                                        \
+  U_STMT_START {                                                        \
     extern void FUNC (void);                                            \
     if (strcmp (#FUNC, argv[1]) == 0)                                   \
       {                                                                 \
@@ -20,7 +20,7 @@
         test_utils_fini ();                                             \
         exit (0);                                                       \
       }                                                                 \
-  } G_STMT_END
+  } U_STMT_END
 
 #define UNPORTED_TEST(FUNC)
 
@@ -31,7 +31,7 @@ main (int argc, char **argv)
 
   if (argc != 2)
     {
-      g_printerr ("usage %s UNIT_TEST\n", argv[0]);
+      u_printerr ("usage %s UNIT_TEST\n", argv[0]);
       exit (1);
     }
 
@@ -155,7 +155,7 @@ main (int argc, char **argv)
 
   ADD_TEST (test_texture_rg, TEST_REQUIREMENT_TEXTURE_RG, 0);
 
-  g_printerr ("Unknown test name \"%s\"\n", argv[1]);
+  u_printerr ("Unknown test name \"%s\"\n", argv[1]);
 
   return 1;
 }
diff --git a/tests/conform/test-copy-replace-texture.c b/tests/conform/test-copy-replace-texture.c
index f11070e..0ed07d6 100644
--- a/tests/conform/test-copy-replace-texture.c
+++ b/tests/conform/test-copy-replace-texture.c
@@ -89,13 +89,13 @@ test_copy_replace_texture (void)
     {
       int i;
 
-      g_print ("Alive textures:");
+      u_print ("Alive textures:");
 
       for (i = 0; i < N_PIPELINES * N_LAYERS; i++)
         if ((alive_texture_mask & (1 << (i + 1))))
-          g_print (" %i", i);
+          u_print (" %i", i);
 
-      g_print ("\n");
+      u_print ("\n");
     }
 
   /* Ideally there should only be the textures from the last pipeline
@@ -116,5 +116,5 @@ test_copy_replace_texture (void)
   g_assert_cmpint (alive_texture_mask, ==, 0);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c
index 633dc2a..0c65c50 100644
--- a/tests/conform/test-custom-attributes.c
+++ b/tests/conform/test-custom-attributes.c
@@ -50,13 +50,13 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
   attributes[0] = cogl_attribute_new (buffer,
                                       "cogl_position_in",
                                       sizeof (FloatVert),
-                                      G_STRUCT_OFFSET (FloatVert, x),
+                                      U_STRUCT_OFFSET (FloatVert, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_SHORT);
   attributes[1] = cogl_attribute_new (buffer,
                                       "color",
                                       sizeof (FloatVert),
-                                      G_STRUCT_OFFSET (FloatVert, r),
+                                      U_STRUCT_OFFSET (FloatVert, r),
                                       4, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_FLOAT);
 
@@ -110,13 +110,13 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
   attributes[0] = cogl_attribute_new (buffer,
                                       "cogl_position_in",
                                       sizeof (ByteVert),
-                                      G_STRUCT_OFFSET (ByteVert, x),
+                                      U_STRUCT_OFFSET (ByteVert, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_SHORT);
   attributes[1] = cogl_attribute_new (buffer,
                                       "color",
                                       sizeof (ByteVert),
-                                      G_STRUCT_OFFSET (ByteVert, r),
+                                      U_STRUCT_OFFSET (ByteVert, r),
                                       4, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE);
   cogl_attribute_set_normalized (attributes[1], TRUE);
@@ -140,7 +140,7 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
   attributes[1] = cogl_attribute_new (unnorm_buffer,
                                       "color",
                                       sizeof (ByteVert),
-                                      G_STRUCT_OFFSET (ByteVert, r),
+                                      U_STRUCT_OFFSET (ByteVert, r),
                                       4, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_BYTE);
 
@@ -191,13 +191,13 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
   attributes[0] = cogl_attribute_new (buffer,
                                       "cogl_position_in",
                                       sizeof (ShortVert),
-                                      G_STRUCT_OFFSET (ShortVert, x),
+                                      U_STRUCT_OFFSET (ShortVert, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_SHORT);
   attributes[1] = cogl_attribute_new (buffer,
                                       "color",
                                       sizeof (ShortVert),
-                                      G_STRUCT_OFFSET (ShortVert, r),
+                                      U_STRUCT_OFFSET (ShortVert, r),
                                       4, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT);
   cogl_attribute_set_normalized (attributes[1], TRUE);
@@ -223,7 +223,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
   attributes[0] = cogl_attribute_new (buffer,
                                       "cogl_position_in",
                                       sizeof (ShortVert),
-                                      G_STRUCT_OFFSET (ShortVert, x),
+                                      U_STRUCT_OFFSET (ShortVert, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_UNSIGNED_SHORT);
 
@@ -297,5 +297,5 @@ test_custom_attributes (void)
   cogl_object_unref (snippet);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-depth-test.c b/tests/conform/test-depth-test.c
index 7b9cdf7..b354876 100644
--- a/tests/conform/test-depth-test.c
+++ b/tests/conform/test-depth-test.c
@@ -230,6 +230,6 @@ test_depth_test (void)
   paint (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-euler-quaternion.c b/tests/conform/test-euler-quaternion.c
index c250bec..920e588 100644
--- a/tests/conform/test-euler-quaternion.c
+++ b/tests/conform/test-euler-quaternion.c
@@ -77,5 +77,5 @@ test_euler_quaternion (void)
   /* FIXME: This needs a lot more tests! */
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-fence.c b/tests/conform/test-fence.c
index d5e3586..87beb46 100644
--- a/tests/conform/test-fence.c
+++ b/tests/conform/test-fence.c
@@ -59,5 +59,5 @@ test_fence (void)
   g_main_loop_run (loop);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-gles2-context.c b/tests/conform/test-gles2-context.c
index 5e1d278..8494e60 100644
--- a/tests/conform/test-gles2-context.c
+++ b/tests/conform/test-gles2-context.c
@@ -258,7 +258,7 @@ create_gles2_framebuffer (const CoglGLES2Vtable *gles2,
 
   status = gles2->glCheckFramebufferStatus (GL_FRAMEBUFFER);
   if (cogl_test_verbose ())
-    g_print ("status for gles2 framebuffer = 0x%x %s\n",
+    u_print ("status for gles2 framebuffer = 0x%x %s\n",
              status, status == GL_FRAMEBUFFER_COMPLETE ? "(complete)" : "(?)");
 
   gles2->glBindFramebuffer (GL_FRAMEBUFFER, 0);
@@ -368,7 +368,7 @@ test_gles2_context (void)
   test_gles2_read_pixels ();
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
 static GLuint
@@ -609,7 +609,7 @@ static void
 verify_read_pixels (const PaintData *data)
 {
   int stride = data->fb_width * 4;
-  uint8_t *buf = g_malloc (data->fb_height * stride);
+  uint8_t *buf = u_malloc (data->fb_height * stride);
 
   data->gles2->glReadPixels (0, 0, /* x/y */
                              data->fb_width, data->fb_height,
@@ -663,7 +663,7 @@ test_gles2_context_fbo (void)
   data.fb_width = cogl_framebuffer_get_width (test_fb);
   data.fb_height = cogl_framebuffer_get_height (test_fb);
 
-  for (i = 0; i < G_N_ELEMENTS (paint_methods); i++)
+  for (i = 0; i < U_N_ELEMENTS (paint_methods); i++)
     {
       CoglTexture *offscreen_texture;
       CoglOffscreen *offscreen;
@@ -752,7 +752,7 @@ verify_region (const CoglGLES2Vtable *gles2,
 {
   uint8_t *buf, *p;
 
-  buf = g_malloc (width * height * 4);
+  buf = u_malloc (width * height * 4);
 
   gles2->glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
 
diff --git a/tests/conform/test-just-vertex-shader.c b/tests/conform/test-just-vertex-shader.c
index 1ed951c..9e5138b 100644
--- a/tests/conform/test-just-vertex-shader.c
+++ b/tests/conform/test-just-vertex-shader.c
@@ -99,5 +99,5 @@ test_just_vertex_shader (void)
   validate_result (test_fb);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-layer-remove.c b/tests/conform/test-layer-remove.c
index de1efec..4476491 100644
--- a/tests/conform/test-layer-remove.c
+++ b/tests/conform/test-layer-remove.c
@@ -141,5 +141,5 @@ test_layer_remove (void)
   cogl_object_unref (pipeline1);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-map-buffer-range.c b/tests/conform/test-map-buffer-range.c
index e979240..7a0598e 100644
--- a/tests/conform/test-map-buffer-range.c
+++ b/tests/conform/test-map-buffer-range.c
@@ -119,5 +119,5 @@ test_map_buffer_range (void)
   cogl_object_unref (tex);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-materials.c b/tests/conform/test-materials.c
index 69c9c74..5185ab3 100644
--- a/tests/conform/test-materials.c
+++ b/tests/conform/test-materials.c
@@ -248,6 +248,6 @@ test_materials (TestUtilsGTestFixture *fixture,
   g_source_remove (idle_source);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-multitexture.c b/tests/conform/test-multitexture.c
index da38766..18b40f0 100644
--- a/tests/conform/test-multitexture.c
+++ b/tests/conform/test-multitexture.c
@@ -28,7 +28,7 @@ assert_region_color (int x,
                      uint8_t blue,
                      uint8_t alpha)
 {
-  uint8_t *data = g_malloc0 (width * height * 4);
+  uint8_t *data = u_malloc0 (width * height * 4);
   cogl_read_pixels (x, y, width, height,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -68,7 +68,7 @@ make_texture (guchar ref)
   CoglHandle tex;
   guchar val;
 
-  tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 16);
+  tex_data = u_malloc (QUAD_WIDTH * QUAD_WIDTH * 16);
 
   for (y = 0; y < QUAD_WIDTH * 2; y++)
     for (x = 0; x < QUAD_WIDTH * 2; x++)
@@ -202,5 +202,5 @@ test_multitexture (TestUtilsGTestFixture *fixture,
   g_source_remove (idle_source);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-npot-texture.c b/tests/conform/test-npot-texture.c
index 85c16c9..d375787 100644
--- a/tests/conform/test-npot-texture.c
+++ b/tests/conform/test-npot-texture.c
@@ -60,7 +60,7 @@ make_texture (void)
   CoglTexture *tex;
   int partx, party, width, height;
 
-  p = tex_data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+  p = tex_data = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
 
   /* Make a texture with a different color for each part */
   for (party = 0; party < PARTS; party++)
@@ -100,9 +100,9 @@ make_texture (void)
   if (cogl_test_verbose ())
     {
       if (cogl_texture_is_sliced (tex))
-        g_print ("Texture is sliced\n");
+        u_print ("Texture is sliced\n");
       else
-        g_print ("Texture is not sliced\n");
+        u_print ("Texture is not sliced\n");
     }
 
   /* The texture should be sliced unless NPOTs are supported */
@@ -149,9 +149,9 @@ test_npot_texture (void)
   if (cogl_test_verbose ())
     {
       if (cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT))
-        g_print ("NPOT textures are supported\n");
+        u_print ("NPOT textures are supported\n");
       else
-        g_print ("NPOT textures are not supported\n");
+        u_print ("NPOT textures are not supported\n");
     }
 
   cogl_framebuffer_orthographic (test_fb,
@@ -165,6 +165,6 @@ test_npot_texture (void)
   validate_result ();
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-object.c b/tests/conform/test-object.c
index 0a6dcab..4d22561 100644
--- a/tests/conform/test-object.c
+++ b/tests/conform/test-object.c
@@ -81,6 +81,6 @@ test_object (TestUtilsGTestFixture *fixture,
   g_assert_cmpint (destroy2_count, ==, 1);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-offscreen.c b/tests/conform/test-offscreen.c
index dc32968..0797495 100644
--- a/tests/conform/test-offscreen.c
+++ b/tests/conform/test-offscreen.c
@@ -194,5 +194,5 @@ test_offscreen (void)
   test_flush (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-path-clip.c b/tests/conform/test-path-clip.c
index 18f4339..efdf706 100644
--- a/tests/conform/test-path-clip.c
+++ b/tests/conform/test-path-clip.c
@@ -63,5 +63,5 @@ test_path_clip (void)
                           0x0000ffff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-path.c b/tests/conform/test-path.c
index 01cee55..7b4b633 100644
--- a/tests/conform/test-path.c
+++ b/tests/conform/test-path.c
@@ -207,6 +207,6 @@ test_path (void)
   validate_result ();
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-pipeline-cache-unrefs-texture.c 
b/tests/conform/test-pipeline-cache-unrefs-texture.c
index 5d278dc..5cd243e 100644
--- a/tests/conform/test-pipeline-cache-unrefs-texture.c
+++ b/tests/conform/test-pipeline-cache-unrefs-texture.c
@@ -87,5 +87,5 @@ test_pipeline_cache_unrefs_texture (void)
   g_assert_cmpint (destroyed_texture_count, ==, N_TEXTURES);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-pipeline-uniforms.c b/tests/conform/test-pipeline-uniforms.c
index 3b41af0..436528d 100644
--- a/tests/conform/test-pipeline-uniforms.c
+++ b/tests/conform/test-pipeline-uniforms.c
@@ -402,5 +402,5 @@ test_pipeline_uniforms (void)
   destroy_state (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-pixel-buffer.c b/tests/conform/test-pixel-buffer.c
index d3102f2..ef62cfa 100644
--- a/tests/conform/test-pixel-buffer.c
+++ b/tests/conform/test-pixel-buffer.c
@@ -160,7 +160,7 @@ test_pixel_buffer_map (void)
                  0xff0000ff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
 void
@@ -175,7 +175,7 @@ test_pixel_buffer_set_data (void)
 
   stride = cogl_bitmap_get_rowstride (bitmap);
 
-  data = g_malloc (stride * BITMAP_SIZE);
+  data = u_malloc (stride * BITMAP_SIZE);
 
   generate_bitmap_data (data, stride);
 
@@ -206,14 +206,14 @@ test_pixel_buffer_set_data (void)
                  0xff0000ff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
 static CoglTexture *
 create_white_texture (void)
 {
   CoglTexture2D *texture;
-  uint8_t *data = g_malloc (BITMAP_SIZE * BITMAP_SIZE * 4);
+  uint8_t *data = u_malloc (BITMAP_SIZE * BITMAP_SIZE * 4);
 
   memset (data, 255, BITMAP_SIZE * BITMAP_SIZE * 4);
 
@@ -269,5 +269,5 @@ test_pixel_buffer_sub_region (void)
                  0xffffffff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-point-size-attribute.c b/tests/conform/test-point-size-attribute.c
index a08d1da..76e7333 100644
--- a/tests/conform/test-point-size-attribute.c
+++ b/tests/conform/test-point-size-attribute.c
@@ -75,13 +75,13 @@ create_primitive (const char *attribute_name)
   attributes[0] = cogl_attribute_new (buffer,
                                       "cogl_position_in",
                                       sizeof (PointVertex),
-                                      G_STRUCT_OFFSET (PointVertex, x),
+                                      U_STRUCT_OFFSET (PointVertex, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_FLOAT);
   attributes[1] = cogl_attribute_new (buffer,
                                       attribute_name,
                                       sizeof (PointVertex),
-                                      G_STRUCT_OFFSET (PointVertex, point_size),
+                                      U_STRUCT_OFFSET (PointVertex, point_size),
                                       1, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_FLOAT);
 
@@ -134,7 +134,7 @@ do_test (const char *attribute_name,
                        MAX_POINT_SIZE - i /* point size */);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
 void
diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c
index 49d0833..27e15c3 100644
--- a/tests/conform/test-point-size.c
+++ b/tests/conform/test-point-size.c
@@ -95,5 +95,5 @@ test_point_size (void)
                        point_size);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index 65ce9a8..b0dcf21 100644
--- a/tests/conform/test-point-sprite.c
+++ b/tests/conform/test-point-sprite.c
@@ -169,7 +169,7 @@ do_test (CoglBool check_orientation,
                            0x0000ffff);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
 void
diff --git a/tests/conform/test-premult.c b/tests/conform/test-premult.c
index 816c487..fd8953f 100644
--- a/tests/conform/test-premult.c
+++ b/tests/conform/test-premult.c
@@ -31,7 +31,7 @@ gen_tex_data (uint32_t color)
   uint8_t b = MASK_BLUE (color);
   uint8_t a = MASK_ALPHA (color);
 
-  tex_data = g_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
+  tex_data = u_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
 
   for (p = tex_data + QUAD_WIDTH * QUAD_WIDTH * 4; p > tex_data;)
     {
@@ -132,7 +132,7 @@ test_premult (void)
   /* If the user explicitly specifies an unmultiplied internal format then
    * Cogl shouldn't automatically premultiply the given texture data... */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xff00ff80, "
+    u_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xff00ff80,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
@@ -145,7 +145,7 @@ test_premult (void)
    * gives unmultiplied src data then Cogl should always premultiply that
    * for us */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xff00ff80, "
+    u_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xff00ff80,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
@@ -159,7 +159,7 @@ test_premult (void)
    * unpremultiplied texture data...
    */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xff00ff80, "
+    u_print ("make_texture (0xff00ff80, "
                             "src = RGBA_8888, internal = ANY)\n");
   tex = make_texture (0xff00ff80,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
@@ -172,7 +172,7 @@ test_premult (void)
    * premultiplied source data, Cogl should never modify that source data...
    */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0x80008080, "
+    u_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
   tex = make_texture (0x80008080,
@@ -186,7 +186,7 @@ test_premult (void)
    * supplies premultiplied source data, then Cogl should always
    * un-premultiply the source data... */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0x80008080, "
+    u_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, internal = RGBA_8888)\n");
   tex = make_texture (0x80008080,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
@@ -200,7 +200,7 @@ test_premult (void)
    * (In the future there will be additional Cogl API to control this
    *  behaviour) */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0x80008080, "
+    u_print ("make_texture (0x80008080, "
                             "src = RGBA_8888_PRE, internal = ANY)\n");
   tex = make_texture (0x80008080,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
@@ -214,13 +214,13 @@ test_premult (void)
    */
 
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xDEADBEEF, "
+    u_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
                       TEXTURE_FLAG_SET_UNPREMULTIPLIED);
   if (cogl_test_verbose ())
-    g_print ("set_region (0xff00ff80, RGBA_8888)\n");
+    u_print ("set_region (0xff00ff80, RGBA_8888)\n");
   set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
   check_texture (pipeline, 6, 0, /* position */
                 tex,
@@ -230,13 +230,13 @@ test_premult (void)
    * region data should result in Cogl unmultiplying the given region data...
    */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xDEADBEEF, "
+    u_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888, internal = RGBA_8888)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888, /* src format */
                       TEXTURE_FLAG_SET_UNPREMULTIPLIED);
   if (cogl_test_verbose ())
-    g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
+    u_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
   set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
   check_texture (pipeline, 7, 0, /* position */
                 tex,
@@ -244,14 +244,14 @@ test_premult (void)
 
 
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xDEADBEEF, "
+    u_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
                       TEXTURE_FLAG_SET_PREMULTIPLIED);
   if (cogl_test_verbose ())
-    g_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
+    u_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
   set_region (tex, 0x80008080, COGL_PIXEL_FORMAT_RGBA_8888_PRE);
   check_texture (pipeline, 8, 0, /* position */
                 tex,
@@ -262,14 +262,14 @@ test_premult (void)
    * region data should result in Cogl premultiplying the given region data...
    */
   if (cogl_test_verbose ())
-    g_print ("make_texture (0xDEADBEEF, "
+    u_print ("make_texture (0xDEADBEEF, "
                             "src = RGBA_8888_PRE, "
                             "internal = RGBA_8888_PRE)\n");
   tex = make_texture (0xDEADBEEF,
                       COGL_PIXEL_FORMAT_RGBA_8888_PRE, /* src format */
                       TEXTURE_FLAG_SET_PREMULTIPLIED);
   if (cogl_test_verbose ())
-    g_print ("set_region (0xff00ff80, RGBA_8888)\n");
+    u_print ("set_region (0xff00ff80, RGBA_8888)\n");
   set_region (tex, 0xff00ff80, COGL_PIXEL_FORMAT_RGBA_8888);
   check_texture (pipeline, 9, 0, /* position */
                 tex,
@@ -277,6 +277,6 @@ test_premult (void)
 
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-primitive-and-journal.c b/tests/conform/test-primitive-and-journal.c
index f978cd5..c728b15 100644
--- a/tests/conform/test-primitive-and-journal.c
+++ b/tests/conform/test-primitive-and-journal.c
@@ -46,7 +46,7 @@ create_primitives (CoglPrimitive *primitives[2])
 
   primitives[0] = cogl_primitive_new_p2c4 (test_ctx,
                                            COGL_VERTICES_MODE_TRIANGLE_STRIP,
-                                           G_N_ELEMENTS (vertex_data),
+                                           U_N_ELEMENTS (vertex_data),
                                            vertex_data);
   cogl_primitive_set_n_vertices (primitives[0], 4);
 
@@ -117,6 +117,6 @@ test_primitive_and_journal (void)
   cogl_framebuffer_pop_clip (test_fb);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c
index 1cd2ffc..738d659 100644
--- a/tests/conform/test-primitive.c
+++ b/tests/conform/test-primitive.c
@@ -185,7 +185,7 @@ test_paint (TestState *state)
   cogl_pipeline_set_layer_texture (pipeline, 0, tex);
   cogl_object_unref (tex);
 
-  for (i = 0; i < G_N_ELEMENTS (test_prim_funcs); i++)
+  for (i = 0; i < U_N_ELEMENTS (test_prim_funcs); i++)
     {
       CoglPrimitive *prim;
       uint32_t expected_color = PRIM_COLOR;
@@ -330,5 +330,5 @@ test_primitive (void)
   test_copy (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-read-texture-formats.c b/tests/conform/test-read-texture-formats.c
index 4fa9ecc..2653136 100644
--- a/tests/conform/test-read-texture-formats.c
+++ b/tests/conform/test-read-texture-formats.c
@@ -211,5 +211,5 @@ test_read_texture_formats (void)
   cogl_object_unref (tex_2d);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-readpixels.c b/tests/conform/test-readpixels.c
index 131b08b..e2f30bf 100644
--- a/tests/conform/test-readpixels.c
+++ b/tests/conform/test-readpixels.c
@@ -43,7 +43,7 @@ on_paint (ClutterActor *actor, void *state)
    * verify is reading back grid of colors from a CoglOffscreen framebuffer
    */
 
-  data = g_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
+  data = u_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
   tex = test_utils_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
                                     TEST_UTILS_TEXTURE_NO_SLICING,
                                     COGL_PIXEL_FORMAT_RGBA_8888, /* data fmt */
@@ -68,7 +68,7 @@ on_paint (ClutterActor *actor, void *state)
   cogl_set_source_color4ub (0xff, 0xff, 0xff, 0xff);
   cogl_rectangle (0, 0, 1, -1);
 
-  pixels = g_malloc0 (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
+  pixels = u_malloc0 (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
   cogl_read_pixels (0, 0, FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -89,7 +89,7 @@ on_paint (ClutterActor *actor, void *state)
   cogl_set_source_texture (tex);
   cogl_rectangle (-1, 1, 1, -1);
 
-  pixels = g_malloc0 (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
+  pixels = u_malloc0 (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
   cogl_read_pixels (0, 0, FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -106,7 +106,7 @@ on_paint (ClutterActor *actor, void *state)
   cogl_set_source_texture (tex);
   cogl_rectangle (-1, 1, 1, -1);
 
-  pixelsc = g_malloc0 (FRAMEBUFFER_WIDTH * 3 * FRAMEBUFFER_HEIGHT);
+  pixelsc = u_malloc0 (FRAMEBUFFER_WIDTH * 3 * FRAMEBUFFER_HEIGHT);
   cogl_read_pixels (0, 0, FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_BGR_888,
@@ -173,6 +173,6 @@ test_readpixels (TestUtilsGTestFixture *fixture,
                              NULL);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-snippets.c b/tests/conform/test-snippets.c
index 96f32a0..d894c1a 100644
--- a/tests/conform/test-snippets.c
+++ b/tests/conform/test-snippets.c
@@ -773,7 +773,7 @@ run_tests (TestState *state)
 {
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (tests); i++)
+  for (i = 0; i < U_N_ELEMENTS (tests); i++)
     {
       cogl_framebuffer_clear4f (test_fb,
                                 COGL_BUFFER_BIT_COLOR,
@@ -801,5 +801,5 @@ test_snippets (void)
   run_tests (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-sparse-pipeline.c b/tests/conform/test-sparse-pipeline.c
index 2b618dc..ef0fda2 100644
--- a/tests/conform/test-sparse-pipeline.c
+++ b/tests/conform/test-sparse-pipeline.c
@@ -57,6 +57,6 @@ test_sparse_pipeline (void)
      work */
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-sub-texture.c b/tests/conform/test-sub-texture.c
index cec5b67..812f950 100644
--- a/tests/conform/test-sub-texture.c
+++ b/tests/conform/test-sub-texture.c
@@ -29,7 +29,7 @@ static CoglTexture2D *
 create_source (TestState *state)
 {
   int dx, dy;
-  uint8_t *data = g_malloc (SOURCE_SIZE * SOURCE_SIZE * 4);
+  uint8_t *data = u_malloc (SOURCE_SIZE * SOURCE_SIZE * 4);
   CoglTexture2D *tex;
 
   /* Create a texture with a different coloured rectangle at each
@@ -67,7 +67,7 @@ static CoglTexture2D *
 create_test_texture (TestState *state)
 {
   CoglTexture2D *tex;
-  uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
+  uint8_t *data = u_malloc (256 * 256 * 4), *p = data;
   int x, y;
 
   /* Create a texture that is 256x256 where the red component ranges
@@ -169,7 +169,7 @@ validate_part (int xpos, int ypos,
 static uint8_t *
 create_update_data (void)
 {
-  uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
+  uint8_t *data = u_malloc (256 * 256 * 4), *p = data;
   int x, y;
 
   /* Create some image data that is 256x256 where the blue component
@@ -212,7 +212,7 @@ validate_result (TestState *state)
                      corner_colors[division_num]);
 
   /* Sub sub texture */
-  p = texture_data = g_malloc (10 * 10 * 4);
+  p = texture_data = u_malloc (10 * 10 * 4);
   cogl_framebuffer_read_pixels (test_fb,
                                 0, SOURCE_SIZE * 2, 10, 10,
                                 COGL_PIXEL_FORMAT_RGBA_8888,
@@ -235,7 +235,7 @@ validate_result (TestState *state)
                                       SOURCE_SIZE / 2);
   tex_width = cogl_texture_get_width (sub_texture);
   tex_height = cogl_texture_get_height (sub_texture);
-  p = texture_data = g_malloc (tex_width * tex_height * 4);
+  p = texture_data = u_malloc (tex_width * tex_height * 4);
   cogl_texture_get_data (sub_texture,
                          COGL_PIXEL_FORMAT_RGBA_8888,
                          tex_width * 4,
@@ -275,7 +275,7 @@ validate_result (TestState *state)
   g_free (texture_data);
   cogl_object_unref (sub_texture);
   /* Get the texture data */
-  p = texture_data = g_malloc (256 * 256 * 4);
+  p = texture_data = u_malloc (256 * 256 * 4);
   cogl_texture_get_data (test_tex,
                          COGL_PIXEL_FORMAT_RGBA_8888_PRE,
                          256 * 4, texture_data);
@@ -324,6 +324,6 @@ test_sub_texture (void)
   cogl_object_unref (state.tex);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c
index 80d077a..311f857 100644
--- a/tests/conform/test-texture-3d.c
+++ b/tests/conform/test-texture-3d.c
@@ -21,7 +21,7 @@ static CoglTexture3D *
 create_texture_3d (CoglContext *context)
 {
   int x, y, z;
-  uint8_t *data = g_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH);
+  uint8_t *data = u_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH);
   uint8_t *p = data;
   CoglTexture3D *tex;
   CoglError *error = NULL;
@@ -136,13 +136,13 @@ draw_frame (TestState *state)
   attributes[0] = cogl_attribute_new (attribute_buffer,
                                       "cogl_position_in",
                                       sizeof (Vert),
-                                      G_STRUCT_OFFSET (Vert, x),
+                                      U_STRUCT_OFFSET (Vert, x),
                                       2, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_FLOAT);
   attributes[1] = cogl_attribute_new (attribute_buffer,
                                       "cogl_tex_coord_in",
                                       sizeof (Vert),
-                                      G_STRUCT_OFFSET (Vert, s),
+                                      U_STRUCT_OFFSET (Vert, s),
                                       3, /* n_components */
                                       COGL_ATTRIBUTE_TYPE_FLOAT);
   primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
@@ -270,5 +270,5 @@ test_texture_3d (void)
   test_multi_texture (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-texture-get-set-data.c b/tests/conform/test-texture-get-set-data.c
index 626823d..858b6d7 100644
--- a/tests/conform/test-texture-get-set-data.c
+++ b/tests/conform/test-texture-get-set-data.c
@@ -13,7 +13,7 @@ check_texture (int width, int height, TestUtilsTextureFlags flags)
   int rowstride;
   CoglBitmap *bmp;
 
-  p = data = g_malloc (width * height * 4);
+  p = data = u_malloc (width * height * 4);
   for (y = 0; y < height; y++)
     for (x = 0; x < width; x++)
       {
diff --git a/tests/conform/test-texture-mipmap-get-set.c b/tests/conform/test-texture-mipmap-get-set.c
index c4cd0be..674f1ec 100644
--- a/tests/conform/test-texture-mipmap-get-set.c
+++ b/tests/conform/test-texture-mipmap-get-set.c
@@ -13,7 +13,7 @@ make_texture (void)
   CoglTexture *tex;
   int x, y;
 
-  p = tex_data = g_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+  p = tex_data = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
   for (y = 0; y < TEXTURE_SIZE; y++)
     {
       for (x = 0; x < TEXTURE_SIZE; x++)
@@ -47,7 +47,7 @@ update_mipmap_levels (CoglTexture *tex)
   uint8_t *p, *tex_data;
   int x, y;
 
-  p = tex_data = g_malloc ((TEXTURE_SIZE / 2) * (TEXTURE_SIZE / 2) * 4);
+  p = tex_data = u_malloc ((TEXTURE_SIZE / 2) * (TEXTURE_SIZE / 2) * 4);
 
   for (y = 0; y < TEXTURE_SIZE / 2; y++)
     {
@@ -169,6 +169,6 @@ test_texture_mipmap_get_set (void)
   validate_results ();
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-texture-mipmaps.c b/tests/conform/test-texture-mipmaps.c
index 3118ba8..6a1781e 100644
--- a/tests/conform/test-texture-mipmaps.c
+++ b/tests/conform/test-texture-mipmaps.c
@@ -18,7 +18,7 @@ typedef struct _TestState
 static CoglHandle
 make_texture (void)
 {
-  guchar *tex_data = g_malloc (TEX_SIZE * TEX_SIZE * 3), *p = tex_data;
+  guchar *tex_data = u_malloc (TEX_SIZE * TEX_SIZE * 3), *p = tex_data;
   CoglHandle tex;
   int x, y;
 
@@ -132,5 +132,5 @@ test_texture_mipmaps (TestUtilsGTestFixture *fixture,
   g_source_remove (idle_source);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-texture-no-allocate.c b/tests/conform/test-texture-no-allocate.c
index 5bce8f6..ef61a3b 100644
--- a/tests/conform/test-texture-no-allocate.c
+++ b/tests/conform/test-texture-no-allocate.c
@@ -18,7 +18,7 @@ test_texture_no_allocate (void)
   CoglTexture2D *texture_2d;
   CoglError *error = NULL;
 
-  tex_data = g_malloc (BIG_TEX_WIDTH * BIG_TEX_HEIGHT * 4);
+  tex_data = u_malloc (BIG_TEX_WIDTH * BIG_TEX_HEIGHT * 4);
 
   /* NB: if we make the atlas and sliced texture APIs public then this
    * could changed to explicitly use that instead of the magic texture
diff --git a/tests/conform/test-texture-pixmap-x11.c b/tests/conform/test-texture-pixmap-x11.c
index 4e8d550..6db6b8b 100644
--- a/tests/conform/test-texture-pixmap-x11.c
+++ b/tests/conform/test-texture-pixmap-x11.c
@@ -88,7 +88,7 @@ check_paint (TestState *state, int x, int y, int scale)
 {
   uint8_t *data, *p, update_value = 0;
 
-  p = data = g_malloc (PIXMAP_WIDTH * PIXMAP_HEIGHT * 4);
+  p = data = u_malloc (PIXMAP_WIDTH * PIXMAP_HEIGHT * 4);
 
   cogl_read_pixels (x, y, PIXMAP_WIDTH / scale, PIXMAP_HEIGHT / scale,
                     COGL_READ_PIXELS_COLOR_BUFFER,
@@ -233,12 +233,12 @@ test_texture_pixmap_x11 (TestUtilsGTestFixture *fixture,
   XFreePixmap (state.display, state.pixmap);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 
 #else /* COGL_HAS_XLIB */
 
   if (cogl_test_verbose ())
-   g_print ("Skipping\n");
+   u_print ("Skipping\n");
 
 #endif /* COGL_HAS_XLIB */
 }
diff --git a/tests/conform/test-texture-rectangle.c b/tests/conform/test-texture-rectangle.c
index 3784cdc..6a49380 100644
--- a/tests/conform/test-texture-rectangle.c
+++ b/tests/conform/test-texture-rectangle.c
@@ -21,7 +21,7 @@ create_source_rect (void)
   GLint prev_unpack_skip_rows;
   GLint prev_unpack_skip_pixles;
   GLint prev_rectangle_binding;
-  uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
+  uint8_t *data = u_malloc (256 * 256 * 4), *p = data;
   CoglHandle tex;
   GLuint gl_tex;
 
@@ -87,7 +87,7 @@ static CoglHandle
 create_source_2d (void)
 {
   int x, y;
-  uint8_t *data = g_malloc (256 * 256 * 4), *p = data;
+  uint8_t *data = u_malloc (256 * 256 * 4), *p = data;
   CoglHandle tex;
 
   for (y = 0; y < 256; y++)
@@ -163,7 +163,7 @@ validate_result (TestState *state)
   uint8_t *data, *p;
   int x, y;
 
-  p = data = g_malloc (512 * 384 * 4);
+  p = data = u_malloc (512 * 384 * 4);
 
   cogl_read_pixels (0, 0, 512, 384,
                     COGL_READ_PIXELS_COLOR_BUFFER,
@@ -268,9 +268,9 @@ test_texture_rectangle (TestUtilsGTestFixture *fixture,
       g_signal_handler_disconnect (state.stage, paint_handler);
 
       if (cogl_test_verbose ())
-        g_print ("OK\n");
+        u_print ("OK\n");
     }
   else if (cogl_test_verbose ())
-    g_print ("Skipping\n");
+    u_print ("Skipping\n");
 }
 
diff --git a/tests/conform/test-version.c b/tests/conform/test-version.c
index b651165..0e484d7 100644
--- a/tests/conform/test-version.c
+++ b/tests/conform/test-version.c
@@ -80,6 +80,6 @@ test_version (void)
   g_assert_cmpstr (version, ==, "version = " COGL_VERSION_STRING);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-viewport.c b/tests/conform/test-viewport.c
index a1937c4..494fa27 100644
--- a/tests/conform/test-viewport.c
+++ b/tests/conform/test-viewport.c
@@ -24,7 +24,7 @@ assert_region_color (int x,
                      uint8_t blue,
                      uint8_t alpha)
 {
-  uint8_t *data = g_malloc0 (width * height * 4);
+  uint8_t *data = u_malloc0 (width * height * 4);
   cogl_read_pixels (x, y, width, height,
                     COGL_READ_PIXELS_COLOR_BUFFER,
                     COGL_PIXEL_FORMAT_RGBA_8888_PRE,
@@ -209,7 +209,7 @@ on_paint (ClutterActor *actor, void *state)
   /*
    * Next test offscreen drawing...
    */
-  data = g_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
+  data = u_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
   tex = test_utils_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
                                     TEST_UTILS_TEXTURE_NO_SLICING,
                                     COGL_PIXEL_FORMAT_RGBA_8888, /* data fmt */
@@ -411,6 +411,6 @@ test_viewport (TestUtilsGTestFixture *fixture,
                              NULL);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
 
diff --git a/tests/conform/test-wrap-modes.c b/tests/conform/test-wrap-modes.c
index 5aea0eb..cd99dcb 100644
--- a/tests/conform/test-wrap-modes.c
+++ b/tests/conform/test-wrap-modes.c
@@ -15,7 +15,7 @@ typedef struct _TestState
 static CoglTexture *
 create_texture (TestUtilsTextureFlags flags)
 {
-  uint8_t *data = g_malloc (TEX_SIZE * TEX_SIZE * 4), *p = data;
+  uint8_t *data = u_malloc (TEX_SIZE * TEX_SIZE * 4), *p = data;
   CoglTexture *tex;
   int x, y;
 
@@ -83,7 +83,7 @@ draw_tests (TestState *state)
 {
   int i;
 
-  for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2)
+  for (i = 0; i < U_N_ELEMENTS (wrap_modes); i += 2)
     {
       CoglPipelineWrapMode wrap_mode_s, wrap_mode_t;
       CoglPipeline *pipeline;
@@ -111,7 +111,7 @@ validate_set (TestState *state, int offset)
   uint8_t data[TEX_SIZE * 2 * TEX_SIZE * 2 * 4], *p;
   int x, y, i;
 
-  for (i = 0; i < G_N_ELEMENTS (wrap_modes); i += 2)
+  for (i = 0; i < U_N_ELEMENTS (wrap_modes); i += 2)
     {
       CoglPipelineWrapMode wrap_mode_s, wrap_mode_t;
 
@@ -200,5 +200,5 @@ test_wrap_modes (void)
   paint (&state);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/conform/test-write-texture-formats.c b/tests/conform/test-write-texture-formats.c
index 4e6c02a..d7e6d56 100644
--- a/tests/conform/test-write-texture-formats.c
+++ b/tests/conform/test-write-texture-formats.c
@@ -166,5 +166,5 @@ test_write_texture_formats (void)
                   -1);
 
   if (cogl_test_verbose ())
-    g_print ("OK\n");
+    u_print ("OK\n");
 }
diff --git a/tests/micro-perf/Makefile.am b/tests/micro-perf/Makefile.am
index 3a21ee9..3812b7c 100644
--- a/tests/micro-perf/Makefile.am
+++ b/tests/micro-perf/Makefile.am
@@ -3,7 +3,9 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
 NULL =
 
 AM_CPPFLAGS = \
-       -I$(top_srcdir)
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/deps/ulib/src \
+       -I$(top_builddir)/deps/ulib/src
 
 test_conformance_CPPFLAGS = \
        -DCOGL_ENABLE_EXPERIMENTAL_API \
@@ -21,6 +23,7 @@ AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS)
 
 common_ldadd = \
        $(COGL_DEP_LIBS) \
+       $(top_builddir)/deps/ulib/src/libulib.la \
        $(top_builddir)/cogl/libcogl2.la \
        $(LIBM)
 
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index 7bfdcf7..c8b1040 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -115,7 +115,7 @@ paint_cb (void *user_data)
   elapsed = g_timer_elapsed (data->timer, NULL);
   if (elapsed > 1.0)
     {
-      g_print ("fps = %f\n", data->frame / elapsed);
+      u_print ("fps = %f\n", data->frame / elapsed);
       g_timer_start (data->timer);
       data->frame = 0;
     }
diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
index 4e0c1f5..53c03d0 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -58,6 +58,8 @@ BUILT_SOURCES = wrappers
 AM_CPPFLAGS = \
        -I$(top_srcdir) \
        -I$(top_srcdir)/test-fixtures \
+       -I$(top_srcdir)/deps/ulib/src \
+       -I$(top_builddir)/deps/ulib/src \
        -I$(top_builddir)/cogl
 
 AM_CPPFLAGS += \
@@ -70,9 +72,7 @@ test_unit_LDADD = \
        $(COGL_DEP_LIBS) \
        $(top_builddir)/cogl/libcogl2.la \
        $(LIBM)
-if !USE_GLIB
-test_unit_LDADD += $(top_builddir)/deps/eglib/src/libeglib.la
-endif
+test_unit_LDADD += $(top_builddir)/deps/ulib/src/libulib.la
 test_unit_LDFLAGS = -export-dynamic
 
 test: wrappers
diff --git a/tests/unit/test-unit-main.c b/tests/unit/test-unit-main.c
index b1f7864..88ecc71 100644
--- a/tests/unit/test-unit-main.c
+++ b/tests/unit/test-unit-main.c
@@ -14,7 +14,7 @@ main (int argc, char **argv)
 
   if (argc != 2)
     {
-      g_printerr ("usage %s UNIT_TEST\n", argv[0]);
+      u_printerr ("usage %s UNIT_TEST\n", argv[0]);
       exit (1);
     }
 
@@ -32,7 +32,7 @@ main (int argc, char **argv)
 
   if (!g_module_symbol (main_module, argv[1], (void **) &unit_test))
     {
-      g_printerr ("Unknown test name \"%s\"\n", argv[1]);
+      u_printerr ("Unknown test name \"%s\"\n", argv[1]);
       return 1;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]