summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert.bragg@intel.com>2014-05-18 10:35:47 +0100
committerRobert Bragg <robert.bragg@intel.com>2014-06-11 22:50:11 +0100
commit49b241a9ba0a63de0a1010273d9109b2f155879b (patch)
treed4010ddea058108b0dd2e1f098e46db3940a462f
parent8c64ed3ee48148e7d09ef99e8f489a26e37eaf10 (diff)
downloadcogl-49b241a9ba0a63de0a1010273d9109b2f155879b.tar.gz
Rename ulib to clib ready for merging into rig
The 'u' prefix has turned out to be problematic since it clashes with the lib ICU namespace and can also be confused with meaning 'unsigned'.
-rw-r--r--cogl-gst/cogl-gst-video-sink.c6
-rw-r--r--cogl-pango/Makefile.am6
-rw-r--r--cogl-pango/cogl-pango-glyph-cache.c4
-rw-r--r--cogl-pango/cogl-pango-render.c2
-rw-r--r--cogl-path/Makefile.am6
-rw-r--r--cogl-path/cogl-path-private.h2
-rw-r--r--cogl-path/cogl-path.c118
-rw-r--r--cogl-path/tesselator/memalloc.h8
-rw-r--r--cogl/Makefile.am6
-rw-r--r--cogl/cogl-atlas-set-private.h2
-rw-r--r--cogl/cogl-atlas-set.c22
-rw-r--r--cogl/cogl-atlas-texture.c6
-rw-r--r--cogl/cogl-atlas.c14
-rw-r--r--cogl/cogl-attribute-buffer.c4
-rw-r--r--cogl/cogl-attribute.c54
-rw-r--r--cogl/cogl-bitmap-conversion.c20
-rw-r--r--cogl/cogl-bitmap-packing.h4
-rw-r--r--cogl/cogl-bitmap-pixbuf.c10
-rw-r--r--cogl/cogl-bitmap-private.h4
-rw-r--r--cogl/cogl-bitmap.c26
-rw-r--r--cogl/cogl-bitmask.c102
-rw-r--r--cogl/cogl-bitmask.h12
-rw-r--r--cogl/cogl-blend-string.c72
-rw-r--r--cogl/cogl-blend-string.h2
-rw-r--r--cogl/cogl-blit.c16
-rw-r--r--cogl/cogl-blit.h4
-rw-r--r--cogl/cogl-boxed-value.c18
-rw-r--r--cogl/cogl-boxed-value.h6
-rw-r--r--cogl/cogl-buffer-private.h2
-rw-r--r--cogl/cogl-buffer.c22
-rw-r--r--cogl/cogl-clip-stack.c12
-rw-r--r--cogl/cogl-clip-stack.h2
-rw-r--r--cogl/cogl-closure-list-private.h8
-rw-r--r--cogl/cogl-closure-list.c6
-rw-r--r--cogl/cogl-color-private.h2
-rw-r--r--cogl/cogl-color.c8
-rw-r--r--cogl/cogl-color.h4
-rw-r--r--cogl/cogl-config.c2
-rw-r--r--cogl/cogl-context-private.h26
-rw-r--r--cogl/cogl-context.c74
-rw-r--r--cogl/cogl-debug.c34
-rw-r--r--cogl/cogl-debug.h20
-rw-r--r--cogl/cogl-display.c6
-rw-r--r--cogl/cogl-error-private.h4
-rw-r--r--cogl/cogl-error.c18
-rw-r--r--cogl/cogl-euler.c6
-rw-r--r--cogl/cogl-feature-private.c22
-rw-r--r--cogl/cogl-feature-private.h2
-rw-r--r--cogl/cogl-fence.c6
-rw-r--r--cogl/cogl-flags.h10
-rw-r--r--cogl/cogl-frame-info.c4
-rw-r--r--cogl/cogl-framebuffer-private.h4
-rw-r--r--cogl/cogl-framebuffer.c48
-rw-r--r--cogl/cogl-gles2-context-private.h12
-rw-r--r--cogl/cogl-gles2-context.c156
-rw-r--r--cogl/cogl-glib-source.c20
-rw-r--r--cogl/cogl-glib-source.h4
-rw-r--r--cogl/cogl-glsl-shader.c24
-rw-r--r--cogl/cogl-glx-renderer-private.h2
-rw-r--r--cogl/cogl-gpu-info-private.h4
-rw-r--r--cogl/cogl-gpu-info.c28
-rw-r--r--cogl/cogl-index-buffer.c6
-rw-r--r--cogl/cogl-indices.c18
-rw-r--r--cogl/cogl-journal-private.h4
-rw-r--r--cogl/cogl-journal.c154
-rw-r--r--cogl/cogl-magazine-private.h4
-rw-r--r--cogl/cogl-magazine.c6
-rw-r--r--cogl/cogl-matrix-private.h6
-rw-r--r--cogl/cogl-matrix-stack.c54
-rw-r--r--cogl/cogl-matrix.c16
-rw-r--r--cogl/cogl-memory-stack-private.h2
-rw-r--r--cogl/cogl-memory-stack.c16
-rw-r--r--cogl/cogl-object-private.h16
-rw-r--r--cogl/cogl-object.c34
-rw-r--r--cogl/cogl-object.h2
-rw-r--r--cogl/cogl-onscreen-private.h4
-rw-r--r--cogl/cogl-onscreen-template.c4
-rw-r--r--cogl/cogl-onscreen.c28
-rw-r--r--cogl/cogl-output.c14
-rw-r--r--cogl/cogl-pipeline-cache.c24
-rw-r--r--cogl/cogl-pipeline-debug.c64
-rw-r--r--cogl/cogl-pipeline-hash-table.c42
-rw-r--r--cogl/cogl-pipeline-hash-table.h2
-rw-r--r--cogl/cogl-pipeline-layer-private.h2
-rw-r--r--cogl/cogl-pipeline-layer-state.c20
-rw-r--r--cogl/cogl-pipeline-layer.c34
-rw-r--r--cogl/cogl-pipeline-private.h12
-rw-r--r--cogl/cogl-pipeline-snippet-private.h8
-rw-r--r--cogl/cogl-pipeline-snippet.c68
-rw-r--r--cogl/cogl-pipeline-state.c48
-rw-r--r--cogl/cogl-pipeline.c106
-rw-r--r--cogl/cogl-pixel-buffer-private.h2
-rw-r--r--cogl/cogl-pixel-buffer.c6
-rw-r--r--cogl/cogl-point-in-poly-private.h2
-rw-r--r--cogl/cogl-point-in-poly.c2
-rw-r--r--cogl/cogl-poll.c34
-rw-r--r--cogl/cogl-primitive-texture.c2
-rw-r--r--cogl/cogl-primitive.c24
-rw-r--r--cogl/cogl-primitives-private.h2
-rw-r--r--cogl/cogl-primitives.c8
-rw-r--r--cogl/cogl-profile.c10
-rw-r--r--cogl/cogl-profile.h10
-rw-r--r--cogl/cogl-quaternion-private.h2
-rw-r--r--cogl/cogl-quaternion.c12
-rw-r--r--cogl/cogl-rectangle-map.c66
-rw-r--r--cogl/cogl-rectangle-map.h4
-rw-r--r--cogl/cogl-renderer-private.h12
-rw-r--r--cogl/cogl-renderer.c88
-rw-r--r--cogl/cogl-sampler-cache.c36
-rw-r--r--cogl/cogl-snippet-private.h2
-rw-r--r--cogl/cogl-snippet.c30
-rw-r--r--cogl/cogl-spans.c4
-rw-r--r--cogl/cogl-sub-texture-private.h2
-rw-r--r--cogl/cogl-sub-texture.c2
-rw-r--r--cogl/cogl-texture-2d-sliced-private.h8
-rw-r--r--cogl/cogl-texture-2d-sliced.c112
-rw-r--r--cogl/cogl-texture-2d.c4
-rw-r--r--cogl/cogl-texture-3d.c6
-rw-r--r--cogl/cogl-texture-private.h4
-rw-r--r--cogl/cogl-texture-rectangle.c12
-rw-r--r--cogl/cogl-texture.c28
-rw-r--r--cogl/cogl-util.c22
-rw-r--r--cogl/cogl-util.h8
-rw-r--r--cogl/cogl-vector.c10
-rw-r--r--cogl/cogl-xlib-renderer.c44
-rw-r--r--cogl/cogl.c6
-rw-r--r--cogl/driver/gl/cogl-attribute-gl.c8
-rw-r--r--cogl/driver/gl/cogl-buffer-gl.c4
-rw-r--r--cogl/driver/gl/cogl-framebuffer-gl.c38
-rw-r--r--cogl/driver/gl/cogl-pipeline-fragend-glsl.c184
-rw-r--r--cogl/driver/gl/cogl-pipeline-opengl.c54
-rw-r--r--cogl/driver/gl/cogl-pipeline-progend-glsl.c72
-rw-r--r--cogl/driver/gl/cogl-pipeline-vertend-glsl.c76
-rw-r--r--cogl/driver/gl/cogl-texture-2d-gl.c8
-rw-r--r--cogl/driver/gl/cogl-util-gl-private.h12
-rw-r--r--cogl/driver/gl/cogl-util-gl.c4
-rw-r--r--cogl/driver/gl/gl/cogl-driver-gl.c16
-rw-r--r--cogl/driver/gl/gl/cogl-texture-driver-gl.c2
-rw-r--r--cogl/driver/gl/gles/cogl-driver-gles.c16
-rw-r--r--cogl/driver/gl/gles/cogl-texture-driver-gles.c6
-rw-r--r--cogl/driver/nop/cogl-driver-nop.c2
-rw-r--r--cogl/driver/nop/cogl-framebuffer-nop.c2
-rw-r--r--cogl/driver/nop/cogl-pipeline-fragend-nop.c2
-rw-r--r--cogl/stb_image.c20
-rw-r--r--cogl/winsys/cogl-texture-pixmap-x11.c18
-rw-r--r--cogl/winsys/cogl-winsys-egl-android.c8
-rw-r--r--cogl/winsys/cogl-winsys-egl-gdl.c10
-rw-r--r--cogl/winsys/cogl-winsys-egl-kms.c112
-rw-r--r--cogl/winsys/cogl-winsys-egl-null.c8
-rw-r--r--cogl/winsys/cogl-winsys-egl-wayland.c26
-rw-r--r--cogl/winsys/cogl-winsys-egl-x11.c24
-rw-r--r--cogl/winsys/cogl-winsys-egl.c42
-rw-r--r--cogl/winsys/cogl-winsys-glx.c88
-rw-r--r--cogl/winsys/cogl-winsys-sdl.c14
-rw-r--r--cogl/winsys/cogl-winsys-sdl2.c30
-rw-r--r--cogl/winsys/cogl-winsys-stub.c6
-rw-r--r--cogl/winsys/cogl-winsys-wgl.c44
-rw-r--r--cogl/winsys/cogl-winsys.c4
-rw-r--r--configure.ac13
-rw-r--r--deps/Makefile.am2
-rw-r--r--deps/clib/.gitignore (renamed from deps/ulib/.gitignore)0
-rw-r--r--deps/clib/Makefile.am3
-rw-r--r--deps/clib/src/.gitignore (renamed from deps/ulib/src/.gitignore)0
-rw-r--r--deps/clib/src/Makefile.am81
-rw-r--r--deps/clib/src/carray.c (renamed from deps/ulib/src/uarray.c)102
-rw-r--r--deps/clib/src/cbytearray.c (renamed from deps/ulib/src/ubytearray.c)26
-rw-r--r--deps/clib/src/cdate-unix.c (renamed from deps/ulib/src/udate-unix.c)8
-rw-r--r--deps/clib/src/cdate-win32.c (renamed from deps/ulib/src/udate-win32.c)8
-rw-r--r--deps/clib/src/cdebugkey.c (renamed from deps/ulib/src/udebugkey.c)20
-rw-r--r--deps/clib/src/cdir-unix.c (renamed from deps/ulib/src/udir-unix.c)44
-rw-r--r--deps/clib/src/cdir-win32.c (renamed from deps/ulib/src/udir-win32.c)58
-rw-r--r--deps/clib/src/cerror.c (renamed from deps/ulib/src/uerror.c)44
-rw-r--r--deps/clib/src/cfile-posix.c (renamed from deps/ulib/src/ufile-posix.c)68
-rw-r--r--deps/clib/src/cfile-unix.c (renamed from deps/ulib/src/ufile-unix.c)18
-rw-r--r--deps/clib/src/cfile-win32.c (renamed from deps/ulib/src/ufile-win32.c)26
-rw-r--r--deps/clib/src/cfile.c (renamed from deps/ulib/src/ufile.c)88
-rw-r--r--deps/clib/src/chashtable.c (renamed from deps/ulib/src/uhashtable.c)212
-rw-r--r--deps/clib/src/chooklist.c (renamed from deps/ulib/src/uhooklist.c)46
-rw-r--r--deps/clib/src/ciconv.c (renamed from deps/ulib/src/uiconv.c)294
-rw-r--r--deps/clib/src/clib-config.h19
-rw-r--r--deps/clib/src/clib-config.h.in19
-rw-r--r--deps/clib/src/clib.h1232
-rw-r--r--deps/clib/src/clist.c (renamed from deps/ulib/src/ulist.c)150
-rw-r--r--deps/clib/src/cmem.c (renamed from deps/ulib/src/umem.c)28
-rw-r--r--deps/clib/src/cmisc-unix.c (renamed from deps/ulib/src/umisc-unix.c)38
-rw-r--r--deps/clib/src/cmisc-win32.c (renamed from deps/ulib/src/umisc-win32.c)66
-rw-r--r--deps/clib/src/cmodule-unix.c (renamed from deps/ulib/src/umodule-unix.c)94
-rw-r--r--deps/clib/src/cmodule-win32.c (renamed from deps/ulib/src/umodule-win32.c)46
-rw-r--r--deps/clib/src/cmodule.h37
-rw-r--r--deps/clib/src/coutput.c (renamed from deps/ulib/src/uoutput.c)66
-rw-r--r--deps/clib/src/cpath.c (renamed from deps/ulib/src/upath.c)108
-rw-r--r--deps/clib/src/cptrarray.c (renamed from deps/ulib/src/uptrarray.c)90
-rw-r--r--deps/clib/src/cqsort.c (renamed from deps/ulib/src/uqsort.c)4
-rw-r--r--deps/clib/src/cquark.c (renamed from deps/ulib/src/uquark.c)18
-rw-r--r--deps/clib/src/cqueue.c (renamed from deps/ulib/src/uqueue.c)80
-rw-r--r--deps/clib/src/cshell.c (renamed from deps/ulib/src/ushell.c)122
-rw-r--r--deps/clib/src/cslist.c (renamed from deps/ulib/src/uslist.c)158
-rw-r--r--deps/clib/src/cspawn.c (renamed from deps/ulib/src/uspawn.c)94
-rw-r--r--deps/clib/src/cstr.c (renamed from deps/ulib/src/ustr.c)280
-rw-r--r--deps/clib/src/cstring.c (renamed from deps/ulib/src/ustring.c)150
-rw-r--r--deps/clib/src/ctimer-unix.c (renamed from deps/ulib/src/utimer-unix.c)26
-rw-r--r--deps/clib/src/ctimer-win32.c (renamed from deps/ulib/src/utimer-win32.c)24
-rw-r--r--deps/clib/src/cunicode.c (renamed from deps/ulib/src/uunicode.c)90
-rw-r--r--deps/clib/src/cutf8.c (renamed from deps/ulib/src/uutf8.c)66
-rw-r--r--deps/clib/src/sort.frag.h (renamed from deps/ulib/src/sort.frag.h)10
-rw-r--r--deps/clib/src/ulib-config.hw (renamed from deps/ulib/src/ulib-config.hw)0
-rw-r--r--deps/clib/src/unicode-data.h (renamed from deps/ulib/src/unicode-data.h)2
-rw-r--r--deps/clib/src/vasprintf.c (renamed from deps/ulib/src/vasprintf.c)0
-rw-r--r--deps/clib/test/.gitignore (renamed from deps/ulib/test/.gitignore)0
-rwxr-xr-xdeps/clib/winconfig.h (renamed from deps/ulib/winconfig.h)0
-rw-r--r--deps/ulib/Makefile.am15
-rw-r--r--deps/ulib/src/Makefile.am83
-rw-r--r--deps/ulib/src/ulib-config.h.in19
-rw-r--r--deps/ulib/src/ulib.h1285
-rw-r--r--deps/ulib/src/umodule.h37
-rw-r--r--deps/ulib/test/Makefile.am49
-rw-r--r--deps/ulib/test/README113
-rw-r--r--deps/ulib/test/UTF-16BE.txtbin15242 -> 0 bytes
-rw-r--r--deps/ulib/test/UTF-16LE.txtbin15242 -> 0 bytes
-rw-r--r--deps/ulib/test/UTF-32BE.txtbin30484 -> 0 bytes
-rw-r--r--deps/ulib/test/UTF-32LE.txtbin30484 -> 0 bytes
-rw-r--r--deps/ulib/test/UTF-8.txt212
-rw-r--r--deps/ulib/test/array.c163
-rw-r--r--deps/ulib/test/dir.c66
-rw-r--r--deps/ulib/test/driver.c248
-rw-r--r--deps/ulib/test/endian.c38
-rw-r--r--deps/ulib/test/fake.c19
-rw-r--r--deps/ulib/test/file.c228
-rw-r--r--deps/ulib/test/hashtable.c177
-rw-r--r--deps/ulib/test/list.c438
-rw-r--r--deps/ulib/test/memory.c40
-rw-r--r--deps/ulib/test/module.c64
-rw-r--r--deps/ulib/test/path.c357
-rw-r--r--deps/ulib/test/ptrarray.c349
-rw-r--r--deps/ulib/test/queue.c184
-rw-r--r--deps/ulib/test/shell.c331
-rw-r--r--deps/ulib/test/sizes.c96
-rw-r--r--deps/ulib/test/slist.c345
-rw-r--r--deps/ulib/test/spawn.c82
-rw-r--r--deps/ulib/test/string-util.c698
-rw-r--r--deps/ulib/test/string.c237
-rwxr-xr-xdeps/ulib/test/test-both74
-rw-r--r--deps/ulib/test/test.c282
-rw-r--r--deps/ulib/test/test.h82
-rw-r--r--deps/ulib/test/tests.h53
-rw-r--r--deps/ulib/test/timer.c55
-rw-r--r--deps/ulib/test/unicode.c99
-rw-r--r--deps/ulib/test/utf8.c935
-rwxr-xr-xdeps/ulib/test/whats-implemented83
-rw-r--r--examples/Makefile.am8
-rw-r--r--test-fixtures/Makefile.am4
-rw-r--r--test-fixtures/test-utils.h2
-rw-r--r--tests/conform/Makefile.am6
-rw-r--r--tests/conform/test-alpha-test.c2
-rw-r--r--tests/conform/test-alpha-textures.c2
-rw-r--r--tests/conform/test-atlas-migration.c6
-rw-r--r--tests/conform/test-backface-culling.c4
-rw-r--r--tests/conform/test-blend-strings.c26
-rw-r--r--tests/conform/test-color-hsl.c2
-rw-r--r--tests/conform/test-color-mask.c2
-rw-r--r--tests/conform/test-conform-main.c10
-rw-r--r--tests/conform/test-copy-replace-texture.c8
-rw-r--r--tests/conform/test-custom-attributes.c18
-rw-r--r--tests/conform/test-depth-test.c2
-rw-r--r--tests/conform/test-euler-quaternion.c2
-rw-r--r--tests/conform/test-fence.c2
-rw-r--r--tests/conform/test-gles2-context.c10
-rw-r--r--tests/conform/test-just-vertex-shader.c2
-rw-r--r--tests/conform/test-layer-remove.c2
-rw-r--r--tests/conform/test-map-buffer-range.c2
-rw-r--r--tests/conform/test-npot-texture.c12
-rw-r--r--tests/conform/test-offscreen.c2
-rw-r--r--tests/conform/test-path-clip.c2
-rw-r--r--tests/conform/test-path.c2
-rw-r--r--tests/conform/test-pipeline-cache-unrefs-texture.c2
-rw-r--r--tests/conform/test-pipeline-uniforms.c2
-rw-r--r--tests/conform/test-pixel-buffer.c10
-rw-r--r--tests/conform/test-point-size-attribute.c6
-rw-r--r--tests/conform/test-point-size.c2
-rw-r--r--tests/conform/test-point-sprite.c2
-rw-r--r--tests/conform/test-premult.c32
-rw-r--r--tests/conform/test-primitive-and-journal.c4
-rw-r--r--tests/conform/test-primitive.c4
-rw-r--r--tests/conform/test-read-texture-formats.c2
-rw-r--r--tests/conform/test-snippets.c4
-rw-r--r--tests/conform/test-sparse-pipeline.c2
-rw-r--r--tests/conform/test-sub-texture.c14
-rw-r--r--tests/conform/test-texture-3d.c8
-rw-r--r--tests/conform/test-texture-get-set-data.c2
-rw-r--r--tests/conform/test-texture-mipmap-get-set.c6
-rw-r--r--tests/conform/test-texture-no-allocate.c2
-rw-r--r--tests/conform/test-version.c2
-rw-r--r--tests/conform/test-wrap-modes.c8
-rw-r--r--tests/conform/test-write-texture-formats.c2
-rw-r--r--tests/micro-perf/Makefile.am6
-rw-r--r--tests/micro-perf/test-journal.c4
-rw-r--r--tests/unit/Makefile.am6
-rw-r--r--tests/unit/test-unit-main.c4
298 files changed, 4769 insertions, 10983 deletions
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 84f03c83..d8e1fde1 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -35,7 +35,7 @@
#include <gst/riff/riff-ids.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.h>
/* We just need the public Cogl api for cogl-gst but we first need to
* undef COGL_COMPILATION to avoid getting an error that normally
@@ -199,7 +199,7 @@ cogl_gst_video_sink_attach_frame (CoglGstVideoSink *sink,
CoglGstVideoSinkPrivate *priv = sink->priv;
int i;
- for (i = 0; i < U_N_ELEMENTS (priv->frame); i++)
+ for (i = 0; i < C_N_ELEMENTS (priv->frame); i++)
if (priv->frame[i] != NULL)
cogl_pipeline_set_layer_texture (pln, i + priv->custom_start,
priv->frame[i]);
@@ -409,7 +409,7 @@ clear_frame_textures (CoglGstVideoSink *sink)
CoglGstVideoSinkPrivate *priv = sink->priv;
int i;
- for (i = 0; i < U_N_ELEMENTS (priv->frame); i++)
+ for (i = 0; i < C_N_ELEMENTS (priv->frame); i++)
{
if (priv->frame[i] == NULL)
break;
diff --git a/cogl-pango/Makefile.am b/cogl-pango/Makefile.am
index 70bf362b..bedb49cd 100644
--- a/cogl-pango/Makefile.am
+++ b/cogl-pango/Makefile.am
@@ -28,7 +28,7 @@ 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)/deps/ulib/src/libulib.la
+libcogl_pango2_la_LIBADD = $(top_builddir)/deps/clib/src/libclib.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 = \
@@ -40,8 +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)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/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 39a3f077..187308d4 100644
--- a/cogl-pango/cogl-pango-glyph-cache.c
+++ b/cogl-pango/cogl-pango-glyph-cache.c
@@ -224,8 +224,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,
- (UDestroyNotify) cogl_pango_glyph_cache_key_free,
- (UDestroyNotify) cogl_pango_glyph_cache_value_free);
+ (CDestroyNotify) cogl_pango_glyph_cache_key_free,
+ (CDestroyNotify) cogl_pango_glyph_cache_value_free);
_cogl_list_init (&cache->atlas_closures);
diff --git a/cogl-pango/cogl-pango-render.c b/cogl-pango/cogl-pango-render.c
index 4cb9e41d..0805b05c 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,
- (UDestroyNotify)
+ (CDestroyNotify)
cogl_pango_render_qdata_destroy);
}
diff --git a/cogl-path/Makefile.am b/cogl-path/Makefile.am
index b4d4f536..ba1bad74 100644
--- a/cogl-path/Makefile.am
+++ b/cogl-path/Makefile.am
@@ -57,7 +57,7 @@ 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)/deps/ulib/src/libulib.la
+libcogl_path_la_LIBADD = $(top_builddir)/deps/clib/src/libclib.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 = \
@@ -70,8 +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$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/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 c682869d..f41f2eaa 100644
--- a/cogl-path/cogl-path-private.h
+++ b/cogl-path/cogl-path-private.h
@@ -81,7 +81,7 @@ struct _CoglPathData
CoglPathFillRule fill_rule;
- UArray *path_nodes;
+ CArray *path_nodes;
floatVec2 path_start;
floatVec2 path_pen;
diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index 2555b420..9d25f5ee 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -34,7 +34,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.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]);
- u_free (data->stroke_attributes);
+ c_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);
- u_array_free (data->path_nodes, TRUE);
+ c_array_free (data->path_nodes, TRUE);
- u_slice_free (CoglPathData, data);
+ c_slice_free (CoglPathData, data);
}
}
@@ -125,10 +125,10 @@ _cogl_path_modify (CoglPath *path)
{
CoglPathData *old_data = path->data;
- path->data = u_slice_dup (CoglPathData, old_data);
- path->data->path_nodes = u_array_new (FALSE, FALSE,
+ path->data = c_slice_dup (CoglPathData, old_data);
+ path->data->path_nodes = c_array_new (FALSE, FALSE,
sizeof (CoglPathNode));
- u_array_append_vals (path->data->path_nodes,
+ c_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;
- u_array_append_val (data->path_nodes, new_node);
+ c_array_append_val (data->path_nodes, new_node);
- u_array_index (data->path_nodes, CoglPathNode, data->last_path).path_size++;
+ c_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 = &u_array_index (data->path_nodes, CoglPathNode, path_start);
+ node = &c_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)
{
- u_warning ("Paths can not be filled using materials with "
+ c_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 = u_slice_new (CoglPath);
- data = path->data = u_slice_new (CoglPathData);
+ path = c_slice_new (CoglPath);
+ data = path->data = c_slice_new (CoglPathData);
data->ref_count = 1;
data->context = context;
data->fill_rule = COGL_PATH_FILL_RULE_EVEN_ODD;
- data->path_nodes = u_array_new (FALSE, FALSE, sizeof (CoglPathNode));
+ data->path_nodes = c_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 = u_slice_new (CoglPath);
+ new_path = c_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);
- u_slice_free (CoglPath, path);
+ c_slice_free (CoglPath, path);
}
/* If second order beziers were needed the following code could
@@ -1050,16 +1050,16 @@ typedef struct _CoglPathTesselatorVertex CoglPathTesselatorVertex;
struct _CoglPathTesselator
{
- GLUtesselator *glu_tess;
+ GLUtesselator *glc_tess;
GLenum primitive_type;
int vertex_number;
/* Array of CoglPathTesselatorVertex. This needs to grow when the
combine callback is called */
- UArray *vertices;
+ CArray *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 */
- UArray *indices;
+ CArray *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)
{
- u_assert (type == GL_TRIANGLES ||
+ c_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 = u_array_new (FALSE, FALSE, sizeof (uint8_t));
+ tess->indices = c_array_new (FALSE, FALSE, sizeof (uint8_t));
break;
case COGL_INDICES_TYPE_UNSIGNED_SHORT:
- tess->indices = u_array_new (FALSE, FALSE, sizeof (uint16_t));
+ tess->indices = c_array_new (FALSE, FALSE, sizeof (uint16_t));
break;
case COGL_INDICES_TYPE_UNSIGNED_INT:
- tess->indices = u_array_new (FALSE, FALSE, sizeof (uint32_t));
+ tess->indices = c_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;
- u_array_append_val (tess->indices, val);
+ c_array_append_val (tess->indices, val);
}
break;
case COGL_INDICES_TYPE_UNSIGNED_SHORT:
{
uint16_t val = vertex_index;
- u_array_append_val (tess->indices, val);
+ c_array_append_val (tess->indices, val);
}
break;
case COGL_INDICES_TYPE_UNSIGNED_INT:
{
uint32_t val = vertex_index;
- u_array_append_val (tess->indices, val);
+ c_array_append_val (tess->indices, val);
}
break;
}
@@ -1193,7 +1193,7 @@ _cogl_path_tesselator_vertex (void *vertex_data,
break;
default:
- u_assert_not_reached ();
+ c_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 */
- u_array_set_size (tess->vertices, tess->vertices->len + 1);
- vertex = &u_array_index (tess->vertices,
+ c_array_set_size (tess->vertices, tess->vertices->len + 1);
+ vertex = &c_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 =
- &u_array_index (tess->vertices, CoglPathTesselatorVertex,
+ &c_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;
- UArray *old_vertices = tess->indices;
+ CArray *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,
- u_array_index (old_vertices,
+ c_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,
- u_array_index (old_vertices,
+ c_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,
- u_array_index (old_vertices,
+ c_array_index (old_vertices,
uint32_t, i));
break;
}
- u_array_free (old_vertices, TRUE);
+ c_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 = u_array_new (FALSE, FALSE, sizeof (CoglPathTesselatorVertex));
- u_array_set_size (tess.vertices, data->path_nodes->len);
+ tess.vertices = c_array_new (FALSE, FALSE, sizeof (CoglPathTesselatorVertex));
+ c_array_set_size (tess.vertices, data->path_nodes->len);
for (i = 0; i < data->path_nodes->len; i++)
{
CoglPathNode *node =
- &u_array_index (data->path_nodes, CoglPathNode, i);
+ &c_array_index (data->path_nodes, CoglPathNode, i);
CoglPathTesselatorVertex *vertex =
- &u_array_index (tess.vertices, CoglPathTesselatorVertex, i);
+ &c_array_index (tess.vertices, CoglPathTesselatorVertex, i);
vertex->x = node->x;
vertex->y = node->y;
@@ -1325,58 +1325,58 @@ _cogl_path_build_fill_attribute_buffer (CoglPath *path)
_cogl_path_tesselator_get_indices_type_for_size (data->path_nodes->len);
_cogl_path_tesselator_allocate_indices_array (&tess);
- tess.glu_tess = gluNewTess ();
+ tess.glc_tess = gluNewTess ();
if (data->fill_rule == COGL_PATH_FILL_RULE_EVEN_ODD)
- gluTessProperty (tess.glu_tess, GLU_TESS_WINDING_RULE,
+ gluTessProperty (tess.glc_tess, GLU_TESS_WINDING_RULE,
GLU_TESS_WINDING_ODD);
else
- gluTessProperty (tess.glu_tess, GLU_TESS_WINDING_RULE,
+ gluTessProperty (tess.glc_tess, GLU_TESS_WINDING_RULE,
GLU_TESS_WINDING_NONZERO);
/* All vertices are on the xy-plane */
- gluTessNormal (tess.glu_tess, 0.0, 0.0, 1.0);
+ gluTessNormal (tess.glc_tess, 0.0, 0.0, 1.0);
- gluTessCallback (tess.glu_tess, GLU_TESS_BEGIN_DATA,
+ gluTessCallback (tess.glc_tess, GLU_TESS_BEGIN_DATA,
_cogl_path_tesselator_begin);
- gluTessCallback (tess.glu_tess, GLU_TESS_VERTEX_DATA,
+ gluTessCallback (tess.glc_tess, GLU_TESS_VERTEX_DATA,
_cogl_path_tesselator_vertex);
- gluTessCallback (tess.glu_tess, GLU_TESS_END_DATA,
+ gluTessCallback (tess.glc_tess, GLU_TESS_END_DATA,
_cogl_path_tesselator_end);
- gluTessCallback (tess.glu_tess, GLU_TESS_COMBINE_DATA,
+ gluTessCallback (tess.glc_tess, GLU_TESS_COMBINE_DATA,
_cogl_path_tesselator_combine);
- gluTessBeginPolygon (tess.glu_tess, &tess);
+ gluTessBeginPolygon (tess.glc_tess, &tess);
while (path_start < data->path_nodes->len)
{
CoglPathNode *node =
- &u_array_index (data->path_nodes, CoglPathNode, path_start);
+ &c_array_index (data->path_nodes, CoglPathNode, path_start);
- gluTessBeginContour (tess.glu_tess);
+ gluTessBeginContour (tess.glc_tess);
for (i = 0; i < node->path_size; i++)
{
double vertex[3] = { node[i].x, node[i].y, 0.0 };
- gluTessVertex (tess.glu_tess, vertex,
+ gluTessVertex (tess.glc_tess, vertex,
GINT_TO_POINTER (i + path_start));
}
- gluTessEndContour (tess.glu_tess);
+ gluTessEndContour (tess.glc_tess);
path_start += node->path_size;
}
- gluTessEndPolygon (tess.glu_tess);
+ gluTessEndPolygon (tess.glc_tess);
- gluDeleteTess (tess.glu_tess);
+ gluDeleteTess (tess.glc_tess);
data->fill_attribute_buffer =
cogl_attribute_buffer_new (data->context,
sizeof (CoglPathTesselatorVertex) *
tess.vertices->len,
tess.vertices->data);
- u_array_free (tess.vertices, TRUE);
+ c_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;
- u_array_free (tess.indices, TRUE);
+ c_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 = &u_array_index (data->path_nodes, CoglPathNode, path_start);
+ node = &c_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 = u_new (CoglAttribute *, n_attributes);
+ data->stroke_attributes = c_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 = &u_array_index (data->path_nodes, CoglPathNode, path_start);
+ node = &c_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 82a954bc..5c78fa17 100644
--- a/cogl-path/tesselator/memalloc.h
+++ b/cogl-path/tesselator/memalloc.h
@@ -34,11 +34,11 @@
#ifndef __MEMALLOC_H__
#define __MEMALLOC_H__
-#include <ulib.h>
+#include <clib.h>
-#define memRealloc u_realloc
-#define memAlloc u_malloc
-#define memFree u_free
+#define memRealloc c_realloc
+#define memAlloc c_malloc
+#define memFree c_free
#define memInit(x) 1
/* tess.c defines TRUE and FALSE itself unconditionally so we need to
diff --git a/cogl/Makefile.am b/cogl/Makefile.am
index dd8f78e2..2829b883 100644
--- a/cogl/Makefile.am
+++ b/cogl/Makefile.am
@@ -23,8 +23,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 \
+ -I$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src \
$(NULL)
AM_CPPFLAGS += \
@@ -147,7 +147,7 @@ endif
lib_LTLIBRARIES += libcogl2.la
libcogl2_la_LIBADD = $(LIBM) $(COGL_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
-libcogl2_la_LIBADD += $(top_builddir)/deps/ulib/src/libulib.la
+libcogl2_la_LIBADD += $(top_builddir)/deps/clib/src/libclib.la
if UNIT_TESTS
libcogl2_la_LIBADD += $(top_builddir)/test-fixtures/libtest-fixtures.la
endif
diff --git a/cogl/cogl-atlas-set-private.h b/cogl/cogl-atlas-set-private.h
index 5e3833f7..77094bfd 100644
--- a/cogl/cogl-atlas-set-private.h
+++ b/cogl/cogl-atlas-set-private.h
@@ -43,7 +43,7 @@ struct _CoglAtlasSet
CoglObject _parent;
CoglContext *context;
- USList *atlases;
+ CSList *atlases;
CoglTextureComponents components;
CoglPixelFormat internal_format;
diff --git a/cogl/cogl-atlas-set.c b/cogl/cogl-atlas-set.c
index b600100d..fcc274d9 100644
--- a/cogl/cogl-atlas-set.c
+++ b/cogl/cogl-atlas-set.c
@@ -41,14 +41,14 @@ static CoglUserDataKey atlas_private_key;
static void
dissociate_atlases (CoglAtlasSet *set)
{
- USList *l;
+ CSList *l;
/* NB: The set doesn't maintain a reference on the atlases since we don't
* want to keep them alive if they become empty. */
for (l = set->atlases; l; l = l->next)
cogl_object_set_user_data (l->data, &atlas_private_key, NULL, NULL);
- u_slist_free (set->atlases);
+ c_slist_free (set->atlases);
set->atlases = NULL;
}
@@ -59,7 +59,7 @@ _cogl_atlas_set_free (CoglAtlasSet *set)
_cogl_closure_list_disconnect_all (&set->atlas_closures);
- u_slice_free (CoglAtlasSet, set);
+ c_slice_free (CoglAtlasSet, set);
}
static void
@@ -74,7 +74,7 @@ _update_internal_format (CoglAtlasSet *set)
CoglAtlasSet *
cogl_atlas_set_new (CoglContext *context)
{
- CoglAtlasSet *set = u_slice_new0 (CoglAtlasSet);
+ CoglAtlasSet *set = c_slice_new0 (CoglAtlasSet);
set->context = context;
set->atlases = NULL;
@@ -95,7 +95,7 @@ void
cogl_atlas_set_set_components (CoglAtlasSet *set,
CoglTextureComponents components)
{
- u_return_if_fail (set->atlases == NULL);
+ c_return_if_fail (set->atlases == NULL);
set->components = components;
_update_internal_format (set);
@@ -111,7 +111,7 @@ void
cogl_atlas_set_set_premultiplied (CoglAtlasSet *set,
CoglBool premultiplied)
{
- u_return_if_fail (set->atlases == NULL);
+ c_return_if_fail (set->atlases == NULL);
set->premultiplied = premultiplied;
_update_internal_format (set);
@@ -179,7 +179,7 @@ atlas_destroyed_cb (void *user_data, void *instance)
CoglAtlasSet *set = user_data;
CoglAtlas *atlas = instance;
- set->atlases = u_slist_remove (set->atlases, atlas);
+ set->atlases = c_slist_remove (set->atlases, atlas);
}
CoglAtlas *
@@ -188,7 +188,7 @@ cogl_atlas_set_allocate_space (CoglAtlasSet *set,
int height,
void *allocation_data)
{
- USList *l;
+ CSList *l;
CoglAtlasFlags flags = 0;
CoglAtlas *atlas;
@@ -230,7 +230,7 @@ cogl_atlas_set_allocate_space (CoglAtlasSet *set,
return NULL;
}
- set->atlases = u_slist_prepend (set->atlases, atlas);
+ set->atlases = c_slist_prepend (set->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. set->atlases
@@ -250,7 +250,7 @@ cogl_atlas_set_allocate_space (CoglAtlasSet *set,
* the allocations within the atlas so we don't keep a reference
* ourselves.
*/
- u_warn_if_fail (atlas->_parent.ref_count != 1);
+ c_warn_if_fail (atlas->_parent.ref_count != 1);
cogl_object_unref (atlas);
@@ -262,7 +262,7 @@ cogl_atlas_set_foreach (CoglAtlasSet *atlas_set,
CoglAtlasSetForeachCallback callback,
void *user_data)
{
- USList *l;
+ CSList *l;
for (l = atlas_set->atlases; l; l = l->next)
callback (l->data, user_data);
diff --git a/cogl/cogl-atlas-texture.c b/cogl/cogl-atlas-texture.c
index 401801fa..17aa66b1 100644
--- a/cogl/cogl-atlas-texture.c
+++ b/cogl/cogl-atlas-texture.c
@@ -158,7 +158,7 @@ _cogl_atlas_texture_post_reorganize_cb (CoglAtlas *atlas,
CoglAtlasTextureGetAllocationsData data;
int i;
- data.textures = u_alloca (sizeof (CoglAtlasTexture *) * n_allocations);
+ data.textures = c_alloca (sizeof (CoglAtlasTexture *) * n_allocations);
data.n_textures = 0;
/* We need to remove all of the references that we took during
@@ -651,7 +651,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 = u_new0 (CoglAtlasTexture, 1);
+ atlas_tex = c_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;
@@ -852,7 +852,7 @@ _cogl_atlas_texture_allocate (CoglTexture *tex,
break;
}
- u_return_val_if_reached (FALSE);
+ c_return_val_if_reached (FALSE);
}
static CoglAtlasTexture *
diff --git a/cogl/cogl-atlas.c b/cogl/cogl-atlas.c
index 94ae7929..96cfca4e 100644
--- a/cogl/cogl-atlas.c
+++ b/cogl/cogl-atlas.c
@@ -55,7 +55,7 @@ _cogl_atlas_new (CoglContext *context,
CoglPixelFormat internal_format,
CoglAtlasFlags flags)
{
- CoglAtlas *atlas = u_new (CoglAtlas, 1);
+ CoglAtlas *atlas = c_new (CoglAtlas, 1);
atlas->context = context;
atlas->map = NULL;
@@ -105,7 +105,7 @@ _cogl_atlas_free (CoglAtlas *atlas)
_cogl_closure_list_disconnect_all (&atlas->pre_reorganize_closures);
_cogl_closure_list_disconnect_all (&atlas->post_reorganize_closures);
- u_free (atlas);
+ c_free (atlas);
}
typedef struct _CoglAtlasRepositionData
@@ -330,7 +330,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
int bpp = _cogl_pixel_format_get_bytes_per_pixel (atlas->internal_format);
/* Create a buffer of zeroes to initially clear the texture */
- clear_data = u_malloc0 (width * height * bpp);
+ clear_data = c_malloc0 (width * height * bpp);
clear_bmp = cogl_bitmap_new_for_data (ctx,
width,
height,
@@ -352,7 +352,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
cogl_object_unref (clear_bmp);
- u_free (clear_data);
+ c_free (clear_data);
}
else
{
@@ -436,12 +436,12 @@ _cogl_atlas_allocate_space (CoglAtlas *atlas,
/* Get an array of all the textures currently in the atlas. */
data.n_textures = 0;
if (atlas->map == NULL)
- data.textures = u_malloc (sizeof (CoglAtlasRepositionData));
+ data.textures = c_malloc (sizeof (CoglAtlasRepositionData));
else
{
int n_rectangles =
_cogl_rectangle_map_get_n_rectangles (atlas->map);
- data.textures = u_malloc (sizeof (CoglAtlasRepositionData) *
+ data.textures = c_malloc (sizeof (CoglAtlasRepositionData) *
(n_rectangles + 1));
_cogl_rectangle_map_foreach (atlas->map,
_cogl_atlas_get_rectangles_cb,
@@ -562,7 +562,7 @@ _cogl_atlas_allocate_space (CoglAtlas *atlas,
ret = TRUE;
}
- u_free (data.textures);
+ c_free (data.textures);
_cogl_closure_list_invoke (&atlas->pre_reorganize_closures,
CoglAtlasReorganizeCallback,
diff --git a/cogl/cogl-attribute-buffer.c b/cogl/cogl-attribute-buffer.c
index c0aaa42f..e42b59ac 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 = u_slice_new (CoglAttributeBuffer);
+ CoglAttributeBuffer *buffer = c_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));
- u_slice_free (CoglAttributeBuffer, array);
+ c_slice_free (CoglAttributeBuffer, array);
}
diff --git a/cogl/cogl-attribute.c b/cogl/cogl-attribute.c
index e172fbc6..13c259ae 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)
{
- u_warning ("Texture coordinate attributes should either be named "
+ c_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
{
- u_warning ("Unknown cogl_* attribute name cogl_%s\n", name);
+ c_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 = u_new (CoglAttributeNameState, 1);
+ CoglAttributeNameState *name_state = c_new (CoglAttributeNameState, 1);
int name_index = context->n_attribute_names++;
- char *name_copy = u_strdup (name);
+ char *name_copy = c_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;
- u_hash_table_insert (context->attribute_name_states_hash,
+ c_hash_table_insert (context->attribute_name_states_hash,
name_copy, name_state);
- if (U_UNLIKELY (context->attribute_name_index_map == NULL))
+ if (C_UNLIKELY (context->attribute_name_index_map == NULL))
context->attribute_name_index_map =
- u_array_new (FALSE, FALSE, sizeof (void *));
+ c_array_new (FALSE, FALSE, sizeof (void *));
- u_array_set_size (context->attribute_name_index_map, name_index + 1);
+ c_array_set_size (context->attribute_name_index_map, name_index + 1);
- u_array_index (context->attribute_name_index_map,
+ c_array_index (context->attribute_name_index_map,
CoglAttributeNameState *, name_index) = name_state;
return name_state;
error:
- u_free (name_state);
+ c_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 (U_UNLIKELY (n_components == 1))
+ if (C_UNLIKELY (n_components == 1))
{
- u_critical ("glVertexPointer doesn't allow 1 component vertex "
+ c_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 (U_UNLIKELY (n_components != 3 && n_components != 4))
+ if (C_UNLIKELY (n_components != 3 && n_components != 4))
{
- u_critical ("glColorPointer expects 3 or 4 component colors so we "
+ c_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 (U_UNLIKELY (n_components != 3))
+ if (C_UNLIKELY (n_components != 3))
{
- u_critical ("glNormalPointer expects 3 component normals so we "
+ c_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 (U_UNLIKELY (n_components != 1))
+ if (C_UNLIKELY (n_components != 1))
{
- u_critical ("The point size attribute can only have one "
+ c_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 = u_slice_new (CoglAttribute);
+ CoglAttribute *attribute = c_slice_new (CoglAttribute);
CoglBuffer *buffer = COGL_BUFFER (attribute_buffer);
CoglContext *ctx = buffer->context;
attribute->is_buffered = TRUE;
attribute->name_state =
- u_hash_table_lookup (ctx->attribute_name_states_hash, name);
+ c_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 = u_slice_new (CoglAttribute);
+ CoglAttribute *attribute = c_slice_new (CoglAttribute);
attribute->name_state =
- u_hash_table_lookup (context->attribute_name_states_hash, name);
+ c_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)
{
- u_warning ("Mid-scene modification of attributes has "
+ c_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 (U_UNLIKELY (attribute->immutable_ref))
+ if (C_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 (U_UNLIKELY (attribute->immutable_ref))
+ if (C_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);
- u_slice_free (CoglAttribute, attribute);
+ c_slice_free (CoglAttribute, attribute);
}
static CoglBool
@@ -589,7 +589,7 @@ validate_layer_cb (CoglPipeline *pipeline,
if (!_cogl_texture_can_hardware_repeat (texture))
{
- u_warning ("Disabling layer %d of the current source material, "
+ c_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 5512ad2b..9f94c816 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) \
- U_STMT_START { \
+ C_STMT_START { \
t = d * a + 128; \
d = ((t >> 8) + t) >> 8; \
- } U_STMT_END
+ } C_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:
- u_assert_not_reached ();
+ c_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;
}
- u_assert_not_reached ();
+ c_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 = u_malloc (width *
+ tmp_row = c_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);
- u_free (tmp_row);
+ c_free (tmp_row);
return TRUE;
}
@@ -641,7 +641,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
if (_cogl_bitmap_can_fast_premult (format))
tmp_row = NULL;
else
- tmp_row = u_malloc (sizeof (uint16_t) * 4 * width);
+ tmp_row = c_malloc (sizeof (uint16_t) * 4 * width);
for (y = 0; y < height; y++)
{
@@ -671,7 +671,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
}
}
- u_free (tmp_row);
+ c_free (tmp_row);
_cogl_bitmap_unmap (bmp);
@@ -708,7 +708,7 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
if (_cogl_bitmap_can_fast_premult (format))
tmp_row = NULL;
else
- tmp_row = u_malloc (sizeof (uint16_t) * 4 * width);
+ tmp_row = c_malloc (sizeof (uint16_t) * 4 * width);
for (y = 0; y < height; y++)
{
@@ -735,7 +735,7 @@ _cogl_bitmap_premult (CoglBitmap *bmp,
}
}
- u_free (tmp_row);
+ c_free (tmp_row);
_cogl_bitmap_unmap (bmp);
diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h
index 14e0734b..1cf78ea7 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:
- u_assert_not_reached ();
+ c_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:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
}
diff --git a/cogl/cogl-bitmap-pixbuf.c b/cogl/cogl-bitmap-pixbuf.c
index ab3a8594..39ca2a35 100644
--- a/cogl/cogl-bitmap-pixbuf.c
+++ b/cogl/cogl-bitmap-pixbuf.c
@@ -91,7 +91,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
_cogl_set_error_literal (error,
COGL_BITMAP_ERROR,
COGL_BITMAP_ERROR_FAILED,
- u_strerror (save_errno));
+ c_strerror (save_errno));
return NULL;
}
@@ -226,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 */
- u_assert (bits_per_sample == 8);
+ c_assert (bits_per_sample == 8);
if (has_alpha)
- u_assert (n_channels == 4);
+ c_assert (n_channels == 4);
else
- u_assert (n_channels == 3);
+ c_assert (n_channels == 3);
/* Translate to cogl pixel format */
switch (color_space)
@@ -379,7 +379,7 @@ _cogl_bitmap_new_from_stb_pixels (CoglContext *ctx,
break;
default:
- u_warn_if_reached ();
+ c_warn_if_reached ();
return NULL;
}
diff --git a/cogl/cogl-bitmap-private.h b/cogl/cogl-bitmap-private.h
index 65b806ed..eb3ee2d7 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 <ulib.h>
+#include <clib.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 u_malloc() instead of creating a
+ * allocated the buffer using c_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 a4b2b50c..13b2e892 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)
{
- u_assert (!bmp->mapped);
- u_assert (!bmp->bound);
+ c_assert (!bmp->mapped);
+ c_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);
- u_slice_free (CoglBitmap, bmp);
+ c_slice_free (CoglBitmap, bmp);
}
CoglBool
@@ -183,13 +183,13 @@ cogl_bitmap_new_for_data (CoglContext *context,
{
CoglBitmap *bmp;
- u_return_val_if_fail (cogl_is_context (context), NULL);
+ c_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 = u_slice_new (CoglBitmap);
+ bmp = c_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 = u_try_malloc (rowstride * height);
+ uint8_t *data = c_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,
- u_free);
+ c_free);
return bitmap;
}
@@ -389,7 +389,7 @@ cogl_bitmap_get_buffer (CoglBitmap *bitmap)
uint32_t
cogl_bitmap_error_domain (void)
{
- return u_quark_from_static_string ("cogl-bitmap-error-quark");
+ return c_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);
- u_assert (!bitmap->mapped);
+ c_assert (!bitmap->mapped);
if (bitmap->buffer)
{
@@ -442,7 +442,7 @@ _cogl_bitmap_unmap (CoglBitmap *bitmap)
return;
}
- u_assert (bitmap->mapped);
+ c_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;
- u_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
+ c_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;
- u_assert_not_reached ();
+ c_assert_not_reached ();
return NULL;
}
@@ -518,7 +518,7 @@ _cogl_bitmap_gl_unbind (CoglBitmap *bitmap)
return;
}
- u_assert (bitmap->bound);
+ c_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 a398490b..dcc5de23 100644
--- a/cogl/cogl-bitmask.c
+++ b/cogl/cogl-bitmask.c
@@ -33,7 +33,7 @@
#include "config.h"
-#include <ulib.h>
+#include <clib.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)
{
- UArray *array = (UArray *) *bitmask;
+ CArray *array = (CArray *) *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 !!(u_array_index (array, unsigned long, ARRAY_INDEX (bit_num)) &
+ return !!(c_array_index (array, unsigned long, ARRAY_INDEX (bit_num)) &
BIT_MASK (bit_num));
}
static void
_cogl_bitmask_convert_to_array (CoglBitmask *bitmask)
{
- UArray *array;
+ CArray *array;
/* Fetch the old values */
unsigned long old_values = _cogl_bitmask_to_bits (bitmask);
- array = u_array_new (FALSE, /* not zero-terminated */
+ array = c_array_new (FALSE, /* not zero-terminated */
TRUE, /* do clear new entries */
sizeof (unsigned long));
/* Copy the old values back in */
- u_array_append_val (array, old_values);
+ c_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)
{
- UArray *array;
+ CArray *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 = (UArray *) *bitmask;
+ array = (CArray *) *bitmask;
array_index = ARRAY_INDEX (bit_num);
/* Grow the array if necessary. This will clear the new data */
if (array_index >= array->len)
- u_array_set_size (array, array_index + 1);
+ c_array_set_size (array, array_index + 1);
new_value_mask = BIT_MASK (bit_num);
if (value)
- u_array_index (array, unsigned long, array_index) |= new_value_mask;
+ c_array_index (array, unsigned long, array_index) |= new_value_mask;
else
- u_array_index (array, unsigned long, array_index) &= ~new_value_mask;
+ c_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))
{
- UArray *src_array, *dst_array;
+ CArray *src_array, *dst_array;
int i;
if (!_cogl_bitmask_has_array (dst))
_cogl_bitmask_convert_to_array (dst);
- dst_array = (UArray *) *dst;
- src_array = (UArray *) *src;
+ dst_array = (CArray *) *dst;
+ src_array = (CArray *) *src;
if (dst_array->len < src_array->len)
- u_array_set_size (dst_array, src_array->len);
+ c_array_set_size (dst_array, src_array->len);
for (i = 0; i < src_array->len; i++)
- u_array_index (dst_array, unsigned long, i) |=
- u_array_index (src_array, unsigned long, i);
+ c_array_index (dst_array, unsigned long, i) |=
+ c_array_index (src_array, unsigned long, i);
}
else if (_cogl_bitmask_has_array (dst))
{
- UArray *dst_array;
+ CArray *dst_array;
- dst_array = (UArray *) *dst;
+ dst_array = (CArray *) *dst;
- u_array_index (dst_array, unsigned long, 0) |=
+ c_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)
{
- UArray *array;
+ CArray *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 = (UArray *) *bitmask;
+ array = (CArray *) *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)
- u_array_set_size (array, array_index + 1);
+ c_array_set_size (array, array_index + 1);
if (value)
{
/* Set the bits that are touching this index */
- u_array_index (array, unsigned long, array_index) |=
+ c_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 */
- u_array_index (array, unsigned long, array_index) &= ~1UL << bit_index;
+ c_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))
{
- UArray *src_array, *dst_array;
+ CArray *src_array, *dst_array;
int i;
if (!_cogl_bitmask_has_array (dst))
_cogl_bitmask_convert_to_array (dst);
- dst_array = (UArray *) *dst;
- src_array = (UArray *) *src;
+ dst_array = (CArray *) *dst;
+ src_array = (CArray *) *src;
if (dst_array->len < src_array->len)
- u_array_set_size (dst_array, src_array->len);
+ c_array_set_size (dst_array, src_array->len);
for (i = 0; i < src_array->len; i++)
- u_array_index (dst_array, unsigned long, i) ^=
- u_array_index (src_array, unsigned long, i);
+ c_array_index (dst_array, unsigned long, i) ^=
+ c_array_index (src_array, unsigned long, i);
}
else if (_cogl_bitmask_has_array (dst))
{
- UArray *dst_array;
+ CArray *dst_array;
- dst_array = (UArray *) *dst;
+ dst_array = (CArray *) *dst;
- u_array_index (dst_array, unsigned long, 0) ^=
+ c_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)
{
- UArray *array = (UArray *) *bitmask;
+ CArray *array = (CArray *) *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))
{
- UArray *array = (UArray *) *bitmask;
- const unsigned long *values = &u_array_index (array, unsigned long, 0);
+ CArray *array = (CArray *) *bitmask;
+ const unsigned long *values = &c_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 UArray *array = (const UArray *) *bitmask;
+ const CArray *array = (const CArray *) *bitmask;
int i;
for (i = 0; i < array->len; i++)
- flags[i] |= u_array_index (array, unsigned long, i);
+ flags[i] |= c_array_index (array, unsigned long, i);
}
int
_cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask)
{
- const UArray *array = (const UArray *) *bitmask;
+ const CArray *array = (const CArray *) *bitmask;
int pop = 0;
int i;
for (i = 0; i < array->len; i++)
- pop += _cogl_util_popcountl (u_array_index (array, unsigned long, i));
+ pop += _cogl_util_popcountl (c_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 UArray *array = (const UArray *) *bitmask;
+ const CArray *array = (const CArray *) *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 (u_array_index (array, unsigned long, i));
+ pop += _cogl_util_popcountl (c_array_index (array, unsigned long, i));
- top_mask = u_array_index (array, unsigned long, array_index);
+ top_mask = c_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;
}
- u_assert_not_reached ();
+ c_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++)
- u_assert_cmpint (data.bits[i], ==, -1);
+ c_assert_cmpint (data.bits[i], ==, -1);
- u_assert_cmpint (_cogl_bitmask_popcount (bitmask), ==, data.n_bits);
+ c_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++;
- u_assert_cmpint (_cogl_bitmask_popcount_upto (bitmask, i),
+ c_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;
- u_assert_cmpint (_cogl_bitmask_get (bitmask, i), ==, (j < data.n_bits));
+ c_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++)
- u_assert_cmpint (_cogl_bitmask_get (&bitmask, i),
+ c_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++)
- u_assert_cmpint (_cogl_bitmask_get (&bitmask, i), ==, (i < 500));
+ c_assert_cmpint (_cogl_bitmask_get (&bitmask, i), ==, (i < 500));
}
diff --git a/cogl/cogl-bitmask.h b/cogl/cogl-bitmask.h
index 550b3dd6..09520104 100644
--- a/cogl/cogl-bitmask.h
+++ b/cogl/cogl-bitmask.h
@@ -32,7 +32,7 @@
#ifndef __COGL_BITMASK_H
#define __COGL_BITMASK_H
-#include <ulib.h>
+#include <clib.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 UArray of
- * unsigned ints. This relies on the fact the u_malloc will return a
+ * part of the bitmask, otherwise it is a pointer to a CArray of
+ * unsigned ints. This relies on the fact the c_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
- UArray allocated or whether the pointer is just used directly */
+ CArray 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) \
- U_STMT_START { *(bitmask) = _cogl_bitmask_from_bits (0); } U_STMT_END
+ C_STMT_START { *(bitmask) = _cogl_bitmask_from_bits (0); } C_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))
- u_array_free ((UArray *) *bitmask, TRUE);
+ c_array_free ((CArray *) *bitmask, TRUE);
}
/*
diff --git a/cogl/cogl-blend-string.c b/cogl/cogl-blend-string.c
index 884ab77d..4ac2d1ae 100644
--- a/cogl/cogl-blend-string.c
+++ b/cogl/cogl-blend-string.c
@@ -36,7 +36,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.h>
#include <test-fixtures/test-unit.h>
@@ -128,7 +128,7 @@ static CoglBlendStringFunctionInfo blend_functions[] = {
uint32_t
cogl_blend_string_error_domain (void)
{
- return u_quark_from_static_string ("cogl-blend-string-error-quark");
+ return c_quark_from_static_string ("cogl-blend-string-error-quark");
}
void
@@ -205,7 +205,7 @@ error:
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
- u_debug ("Invalid texture combine string: %s",
+ c_debug ("Invalid texture combine string: %s",
error_string);
}
return FALSE;
@@ -315,7 +315,7 @@ error:
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
- u_debug ("Invalid %s string: %s",
+ c_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"
};
- u_print (" Arg:\n");
- u_print (" is zero = %s\n", arg->source.is_zero ? "yes" : "no");
+ c_print (" Arg:\n");
+ c_print (" is zero = %s\n", arg->source.is_zero ? "yes" : "no");
if (!arg->source.is_zero)
{
- 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",
+ c_print (" color source = %s\n", arg->source.info->name);
+ c_print (" one minus = %s\n", arg->source.one_minus ? "yes" : "no");
+ c_print (" mask = %s\n", mask_names[arg->source.mask]);
+ c_print (" texture = %d\n", arg->source.texture);
+ c_print ("\n");
+ c_print (" factor is_one = %s\n", arg->factor.is_one ? "yes" : "no");
+ c_print (" factor is_src_alpha_saturate = %s\n",
arg->factor.is_src_alpha_saturate ? "yes" : "no");
- u_print (" factor is_color = %s\n", arg->factor.is_color ? "yes" : "no");
+ c_print (" factor is_color = %s\n", arg->factor.is_color ? "yes" : "no");
if (arg->factor.is_color)
{
- u_print (" factor color:is zero = %s\n",
+ c_print (" factor color:is zero = %s\n",
arg->factor.source.is_zero ? "yes" : "no");
- u_print (" factor color:color source = %s\n",
+ c_print (" factor color:color source = %s\n",
arg->factor.source.info->name);
- u_print (" factor color:one minus = %s\n",
+ c_print (" factor color:one minus = %s\n",
arg->factor.source.one_minus ? "yes" : "no");
- u_print (" factor color:mask = %s\n",
+ c_print (" factor color:mask = %s\n",
mask_names[arg->factor.source.mask]);
- u_print (" factor color:texture = %d\n",
+ c_print (" factor color:texture = %d\n",
arg->factor.source.texture);
}
}
@@ -371,10 +371,10 @@ print_statement (int num, CoglBlendStringStatement *statement)
"RGBA"
};
int i;
- u_print ("Statement %d:\n", num);
- u_print (" Destination channel mask = %s\n",
+ c_print ("Statement %d:\n", num);
+ c_print (" Destination channel mask = %s\n",
mask_names[statement->mask]);
- u_print (" Function = %s\n", statement->function->name);
+ c_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 = U_N_ELEMENTS (blend_functions);
+ array_len = C_N_ELEMENTS (blend_functions);
}
else
{
functions = tex_combine_functions;
- array_len = U_N_ELEMENTS (tex_combine_functions);
+ array_len = C_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 = U_N_ELEMENTS (blending_color_sources);
+ array_len = C_N_ELEMENTS (blending_color_sources);
}
else
{
sources = tex_combine_color_sources;
- array_len = U_N_ELEMENTS (tex_combine_color_sources);
+ array_len = C_N_ELEMENTS (tex_combine_color_sources);
}
if (len >= 8 &&
strncmp (mark, "TEXTURE_", 8) == 0 &&
- u_ascii_isdigit (mark[8]))
+ c_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 (u_ascii_isalpha (c) || c == '_') ? TRUE : FALSE;
+ return (c_ascii_isalpha (c) || c == '_') ? TRUE : FALSE;
}
static CoglBool
is_alphanum_char (const char c)
{
- return (u_ascii_isalnum (c) || c == '_') ? TRUE : FALSE;
+ return (c_ascii_isalnum (c) || c == '_') ? TRUE : FALSE;
}
static CoglBool
@@ -493,7 +493,7 @@ parse_argument (const char *string, /* original user string */
do
{
- if (u_ascii_isspace (*p))
+ if (c_ascii_isspace (*p))
continue;
if (*p == '\0')
@@ -745,7 +745,7 @@ error:
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
- u_debug ("Syntax error for argument %d at offset %d: %s",
+ c_debug ("Syntax error for argument %d at offset %d: %s",
current_arg, offset, error_string);
}
return FALSE;
@@ -782,7 +782,7 @@ _cogl_blend_string_compile (CoglContext *ctx,
do
{
- if (u_ascii_isspace (*p))
+ if (c_ascii_isspace (*p))
continue;
if (*p == '\0')
@@ -928,7 +928,7 @@ error:
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
- u_debug ("Syntax error at offset %d: %s",
+ c_debug ("Syntax error at offset %d: %s",
offset, error_string);
}
return 0;
@@ -1014,14 +1014,14 @@ UNIT_TEST (blend_string_parsing,
{
if (error)
{
- u_debug ("Unexpected parse error for string \"%s\"",
+ c_debug ("Unexpected parse error for string \"%s\"",
tests[i].string);
- u_assert_cmpstr ("", ==, error->message);
+ c_assert_cmpstr ("", ==, error->message);
}
}
else
{
- u_assert (error);
+ c_assert (error);
cogl_error_free (error);
error = NULL;
}
diff --git a/cogl/cogl-blend-string.h b/cogl/cogl-blend-string.h
index 8561c25f..22ef6acf 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 <ulib.h>
+#include <clib.h>
typedef enum _CoglBlendStringContext
{
diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
index 580fc912..ee008f0d 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 = u_malloc (data->bpp * data->src_width *
+ data->image_data = c_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)
{
- u_free (data->image_data);
+ c_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 = u_getenv ("COGL_ATLAS_DEFAULT_BLIT_MODE")))
+ if ((default_mode_string = c_getenv ("COGL_ATLAS_DEFAULT_BLIT_MODE")))
{
- for (i = 0; i < U_N_ELEMENTS (_cogl_blit_modes); i++)
+ for (i = 0; i < C_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 >= U_N_ELEMENTS (_cogl_blit_modes))
+ if (i >= C_N_ELEMENTS (_cogl_blit_modes))
{
- u_warning ("Unknown blit mode %s", default_mode_string);
+ c_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 < U_N_ELEMENTS (_cogl_blit_modes); i++)
+ for (i = 0; i < C_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 < U_N_ELEMENTS (_cogl_blit_modes));
+ _COGL_RETURN_IF_FAIL (i < C_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 16cfe083..599042d5 100644
--- a/cogl/cogl-blit.h
+++ b/cogl/cogl-blit.h
@@ -29,7 +29,7 @@
#ifndef __COGL_BLIT_H
#define __COGL_BLIT_H
-#include <ulib.h>
+#include <clib.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 u_malloc a buffer and copy the
+ /* If we're not using an FBO then we c_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 ef3dae9d..f60427f5 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);
}
- u_warn_if_reached ();
+ c_warn_if_reached ();
return FALSE;
}
@@ -141,7 +141,7 @@ _cogl_boxed_value_set_x (CoglBoxedValue *bv,
if (count == 1)
{
if (bv->count > 1)
- u_free (bv->v.array);
+ c_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)
{
- u_free (bv->v.array);
- bv->v.array = u_malloc (count * value_size);
+ c_free (bv->v.array);
+ bv->v.array = c_malloc (count * value_size);
}
}
else
- bv->v.array = u_malloc (count * value_size);
+ bv->v.array = c_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 = u_memdup (src->v.int_array,
+ dst->v.int_array = c_memdup (src->v.int_array,
src->size * src->count * sizeof (int));
break;
case COGL_BOXED_FLOAT:
- dst->v.float_array = u_memdup (src->v.float_array,
+ dst->v.float_array = c_memdup (src->v.float_array,
src->size *
src->count *
sizeof (float));
break;
case COGL_BOXED_MATRIX:
- dst->v.float_array = u_memdup (src->v.float_array,
+ dst->v.float_array = c_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)
- u_free (bv->v.array);
+ c_free (bv->v.array);
}
void
diff --git a/cogl/cogl-boxed-value.h b/cogl/cogl-boxed-value.h
index f214b0dd..98166325 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 <ulib.h>
+#include <clib.h>
#include "cogl-context.h"
@@ -58,11 +58,11 @@ typedef struct _CoglBoxedValue
} CoglBoxedValue;
#define _cogl_boxed_value_init(bv) \
- U_STMT_START { \
+ C_STMT_START { \
CoglBoxedValue *_bv = (bv); \
_bv->type = COGL_BOXED_NONE; \
_bv->count = 1; \
- } U_STMT_END
+ } C_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 c48b757a..0fc10e9a 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 <ulib.h>
+#include <clib.h>
#include "cogl-object-private.h"
#include "cogl-buffer.h"
diff --git a/cogl/cogl-buffer.c b/cogl/cogl-buffer.c
index 9d7b2645..361ea950 100644
--- a/cogl/cogl-buffer.c
+++ b/cogl/cogl-buffer.c
@@ -43,7 +43,7 @@
#include <stdio.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.h>
#include "cogl-util.h"
#include "cogl-context-private.h"
@@ -56,19 +56,19 @@
* abstract class manually.
*/
-static USList *_cogl_buffer_types;
+static CSList *_cogl_buffer_types;
void
_cogl_buffer_register_buffer_type (const CoglObjectClass *klass)
{
- _cogl_buffer_types = u_slist_prepend (_cogl_buffer_types, (void *) klass);
+ _cogl_buffer_types = c_slist_prepend (_cogl_buffer_types, (void *) klass);
}
CoglBool
cogl_is_buffer (void *object)
{
const CoglObject *obj = object;
- USList *l;
+ CSList *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 = u_malloc (size);
+ buffer->data = c_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
- u_free (buffer->data);
+ c_free (buffer->data);
}
unsigned int
@@ -194,7 +194,7 @@ cogl_buffer_set_update_hint (CoglBuffer *buffer,
if (!cogl_is_buffer (buffer))
return;
- if (U_UNLIKELY (hint > COGL_BUFFER_UPDATE_HINT_STREAM))
+ if (C_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)
{
- u_warning ("Mid-scene modification of buffers has "
+ c_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 (U_UNLIKELY (buffer->immutable_ref))
+ if (C_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 */
- u_byte_array_set_size (ctx->buffer_map_fallback_array, size);
+ c_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 (U_UNLIKELY (buffer->immutable_ref))
+ if (C_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 0920cb84..8c426d3e 100644
--- a/cogl/cogl-clip-stack.c
+++ b/cogl/cogl-clip-stack.c
@@ -35,7 +35,7 @@
#include <string.h>
#include <math.h>
-#include <ulib.h>
+#include <clib.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 = u_slice_alloc (size);
+ CoglClipStack *entry = c_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);
- u_slice_free1 (sizeof (CoglClipStackRect), entry);
+ c_slice_free1 (sizeof (CoglClipStackRect), entry);
break;
}
case COGL_CLIP_STACK_WINDOW_RECT:
- u_slice_free1 (sizeof (CoglClipStackWindowRect), entry);
+ c_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);
- u_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
+ c_slice_free1 (sizeof (CoglClipStackPrimitive), entry);
break;
}
default:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
entry = parent;
diff --git a/cogl/cogl-clip-stack.h b/cogl/cogl-clip-stack.h
index f233da3a..5480038a 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 USList where only a pointer to the top
+/* The clip stack works like a CSList 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 2e69191a..86ab000b 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, ...) \
- U_STMT_START { \
+ C_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); \
} \
- } U_STMT_END
+ } C_STMT_END
#define _cogl_closure_list_invoke_no_args(list) \
- U_STMT_START { \
+ C_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); \
} \
- } U_STMT_END
+ } C_STMT_END
#endif /* _COGL_CLOSURE_LIST_PRIVATE_H_ */
diff --git a/cogl/cogl-closure-list.c b/cogl/cogl-closure-list.c
index dd6aafe4..666f657a 100644
--- a/cogl/cogl-closure-list.c
+++ b/cogl/cogl-closure-list.c
@@ -29,7 +29,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.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);
- u_slice_free (CoglClosure, closure);
+ c_slice_free (CoglClosure, closure);
}
void
@@ -59,7 +59,7 @@ _cogl_closure_list_add (CoglList *list,
void *user_data,
CoglUserDataDestroyCallback destroy_cb)
{
- CoglClosure *closure = u_slice_new (CoglClosure);
+ CoglClosure *closure = c_slice_new (CoglClosure);
closure->function = function;
closure->user_data = user_data;
diff --git a/cogl/cogl-color-private.h b/cogl/cogl-color-private.h
index 38b71cf2..cef10319 100644
--- a/cogl/cogl-color-private.h
+++ b/cogl/cogl-color-private.h
@@ -36,7 +36,7 @@
#include "cogl-color.h"
-#include <ulib.h>
+#include <clib.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 5205554f..25bbe3ec 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 (U_LIKELY (color))
- return u_slice_dup (CoglColor, color);
+ if (C_LIKELY (color))
+ return c_slice_dup (CoglColor, color);
return NULL;
}
@@ -267,8 +267,8 @@ cogl_color_copy (const CoglColor *color)
void
cogl_color_free (CoglColor *color)
{
- if (U_LIKELY (color))
- u_slice_free (CoglColor, color);
+ if (C_LIKELY (color))
+ c_slice_free (CoglColor, color);
}
void
diff --git a/cogl/cogl-color.h b/cogl/cogl-color.h
index 3e892a22..53780aa6 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 u_hash_table_new() as the @key_equal_func
- * parameter, when using #CoglColor<!-- -->s as keys in a #UHashTable.
+ * This function can be passed to c_hash_table_new() as the @key_equal_func
+ * parameter, when using #CoglColor<!-- -->s as keys in a #CHashTable.
*
* Return value: %TRUE if the two colors are the same.
*
diff --git a/cogl/cogl-config.c b/cogl/cogl-config.c
index e76dc8fd..675f8008 100644
--- a/cogl/cogl-config.c
+++ b/cogl/cogl-config.c
@@ -91,7 +91,7 @@ _cogl_config_process (GKeyFile *key_file)
g_free (value);
}
- for (i = 0; i < U_N_ELEMENTS (cogl_config_string_options); i++)
+ for (i = 0; i < C_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 f65c197e..0a35f740 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;
- UHashTable *attribute_name_states_hash;
- UArray *attribute_name_index_map;
+ CHashTable *attribute_name_states_hash;
+ CArray *attribute_name_index_map;
int n_attribute_names;
CoglBitmask enabled_custom_attributes;
@@ -135,13 +135,13 @@ struct _CoglContext
CoglMatrixEntryCache builtin_flushed_projection;
CoglMatrixEntryCache builtin_flushed_modelview;
- UArray *texture_units;
+ CArray *texture_units;
int active_texture_unit;
/* Pipelines */
CoglPipeline *opaque_color_pipeline; /* to check for simple pipelines */
- UString *codegen_header_buffer;
- UString *codegen_source_buffer;
+ CString *codegen_header_buffer;
+ CString *codegen_source_buffer;
CoglPipelineCache *pipeline_cache;
@@ -152,11 +152,11 @@ struct _CoglContext
/* Central list of all framebuffers so all journals can be flushed
* at any time. */
- UList *framebuffers;
+ CList *framebuffers;
/* Global journal buffers */
- UArray *journal_flush_attributes_array;
- UArray *journal_clip_bounds;
+ CArray *journal_flush_attributes_array;
+ CArray *journal_clip_bounds;
/* Some simple caching, to minimize state changes... */
CoglPipeline *current_pipeline;
@@ -189,7 +189,7 @@ struct _CoglContext
CoglClosure *onscreen_dispatch_idle;
CoglGLES2Context *current_gles2_context;
- UQueue gles2_context_stack;
+ CQueue gles2_context_stack;
/* Primitives */
CoglPipeline *stencil_pipeline;
@@ -241,7 +241,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 */
- UByteArray *buffer_map_fallback_array;
+ CByteArray *buffer_map_fallback_array;
CoglBool buffer_map_fallback_in_use;
size_t buffer_map_fallback_offset;
@@ -256,7 +256,7 @@ struct _CoglContext
#ifdef COGL_HAS_XLIB_SUPPORT
int damage_base;
/* List of callback functions that will be given every Xlib event */
- USList *event_filters;
+ CSList *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;
@@ -275,7 +275,7 @@ struct _CoglContext
/* 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. */
- UHashTable *uniform_name_hash;
+ CHashTable *uniform_name_hash;
int n_uniform_names;
CoglPollSource *fences_poll_source;
@@ -340,7 +340,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 u_strfreev().
+ * by the caller and should be freed with c_strfreev().
*/
char **
_cogl_context_get_gl_extensions (CoglContext *context);
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index bf436f5a..9b5c52fd 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -80,13 +80,13 @@ static CoglContext *_cogl_context = NULL;
static void
_cogl_init_feature_overrides (CoglContext *ctx)
{
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_VBOS, FALSE);
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE);
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
{
COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, FALSE);
COGL_FLAGS_SET (ctx->features,
@@ -94,7 +94,7 @@ _cogl_init_feature_overrides (CoglContext *ctx)
FALSE);
}
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_NPOT_TEXTURES)))
+ if (C_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,
@@ -151,7 +151,7 @@ cogl_context_new (CoglDisplay *display,
#endif
/* Allocate context memory */
- context = u_malloc0 (sizeof (CoglContext));
+ context = c_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
@@ -180,7 +180,7 @@ cogl_context_new (CoglDisplay *display,
CoglRenderer *renderer = cogl_renderer_new ();
if (!cogl_renderer_connect (renderer, error))
{
- u_free (context);
+ c_free (context);
return NULL;
}
@@ -193,7 +193,7 @@ cogl_context_new (CoglDisplay *display,
if (!cogl_display_setup (display, error))
{
cogl_object_unref (display);
- u_free (context);
+ c_free (context);
return NULL;
}
@@ -209,19 +209,19 @@ cogl_context_new (CoglDisplay *display,
context->driver_vtable = display->renderer->driver_vtable;
context->texture_driver = display->renderer->texture_driver;
- for (i = 0; i < U_N_ELEMENTS (context->private_features); i++)
+ for (i = 0; i < C_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);
- u_free (context);
+ c_free (context);
return NULL;
}
context->attribute_name_states_hash =
- u_hash_table_new_full (u_str_hash, u_str_equal, u_free, u_free);
+ c_hash_table_new_full (c_str_hash, c_str_equal, c_free, c_free);
context->attribute_name_index_map = NULL;
context->n_attribute_names = 0;
@@ -231,8 +231,8 @@ cogl_context_new (CoglDisplay *display,
context->uniform_names =
- u_ptr_array_new_with_free_func ((UDestroyNotify) u_free);
- context->uniform_name_hash = u_hash_table_new (u_str_hash, u_str_equal);
+ c_ptr_array_new_with_free_func ((CDestroyNotify) c_free);
+ context->uniform_name_hash = c_hash_table_new (c_str_hash, c_str_equal);
context->n_uniform_names = 0;
/* Initialise the driver specific state */
@@ -269,7 +269,7 @@ cogl_context_new (CoglDisplay *display,
cogl_matrix_scale (&context->y_flip_matrix, 1, -1, 1);
context->texture_units =
- u_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
+ c_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
if (_cogl_has_private_feature (context, COGL_PRIVATE_FEATURE_ANY_GL))
{
@@ -280,8 +280,8 @@ cogl_context_new (CoglDisplay *display,
}
context->opaque_color_pipeline = cogl_pipeline_new (context);
- context->codegen_header_buffer = u_string_new ("");
- context->codegen_source_buffer = u_string_new ("");
+ context->codegen_header_buffer = c_string_new ("");
+ context->codegen_source_buffer = c_string_new ("");
context->default_gl_texture_2d_tex = NULL;
context->default_gl_texture_3d_tex = NULL;
@@ -296,10 +296,10 @@ cogl_context_new (CoglDisplay *display,
_cogl_list_init (&context->onscreen_events_queue);
_cogl_list_init (&context->onscreen_dirty_queue);
- u_queue_init (&context->gles2_context_stack);
+ c_queue_init (&context->gles2_context_stack);
context->journal_flush_attributes_array =
- u_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
+ c_array_new (TRUE, FALSE, sizeof (CoglAttribute *));
context->journal_clip_bounds = NULL;
context->current_pipeline = NULL;
@@ -406,7 +406,7 @@ cogl_context_new (CoglDisplay *display,
cogl_object_unref (white_pixel_bitmap);
- context->buffer_map_fallback_array = u_byte_array_new ();
+ context->buffer_map_fallback_array = c_byte_array_new ();
context->buffer_map_fallback_in_use = FALSE;
_cogl_list_init (&context->fences);
@@ -445,12 +445,12 @@ _cogl_context_free (CoglContext *context)
if (context->blit_texture_pipeline)
cogl_object_unref (context->blit_texture_pipeline);
- u_warn_if_fail (context->gles2_context_stack.length == 0);
+ c_warn_if_fail (context->gles2_context_stack.length == 0);
if (context->journal_flush_attributes_array)
- u_array_free (context->journal_flush_attributes_array, TRUE);
+ c_array_free (context->journal_flush_attributes_array, TRUE);
if (context->journal_clip_bounds)
- u_array_free (context->journal_clip_bounds, TRUE);
+ c_array_free (context->journal_clip_bounds, TRUE);
if (context->rectangle_byte_indices)
cogl_object_unref (context->rectangle_byte_indices);
@@ -487,17 +487,17 @@ _cogl_context_free (CoglContext *context)
_cogl_destroy_texture_units ();
- u_ptr_array_free (context->uniform_names, TRUE);
- u_hash_table_destroy (context->uniform_name_hash);
+ c_ptr_array_free (context->uniform_names, TRUE);
+ c_hash_table_destroy (context->uniform_name_hash);
- u_hash_table_destroy (context->attribute_name_states_hash);
- u_array_free (context->attribute_name_index_map, TRUE);
+ c_hash_table_destroy (context->attribute_name_states_hash);
+ c_array_free (context->attribute_name_index_map, TRUE);
- u_byte_array_free (context->buffer_map_fallback_array, TRUE);
+ c_byte_array_free (context->buffer_map_fallback_array, TRUE);
cogl_object_unref (context->display);
- u_free (context);
+ c_free (context);
}
CoglContext *
@@ -574,13 +574,13 @@ _cogl_context_get_gl_extensions (CoglContext *context)
context->glGetIntegerv (GL_NUM_EXTENSIONS, &num_extensions);
- ret = u_malloc (sizeof (char *) * (num_extensions + 1));
+ ret = c_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] = u_strdup (ext);
+ ret[i] = c_strdup (ext);
}
ret[num_extensions] = NULL;
@@ -591,10 +591,10 @@ _cogl_context_get_gl_extensions (CoglContext *context)
const char *all_extensions =
(const char *) context->glGetString (GL_EXTENSIONS);
- ret = u_strsplit (all_extensions, " ", 0 /* max tokens */);
+ ret = c_strsplit (all_extensions, " ", 0 /* max tokens */);
}
- if ((env_disabled_extensions = u_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
+ if ((env_disabled_extensions = c_getenv ("COGL_DISABLE_GL_EXTENSIONS"))
|| _cogl_config_disable_gl_extensions)
{
char **split_env_disabled_extensions;
@@ -603,7 +603,7 @@ _cogl_context_get_gl_extensions (CoglContext *context)
if (env_disabled_extensions)
split_env_disabled_extensions =
- u_strsplit (env_disabled_extensions,
+ c_strsplit (env_disabled_extensions,
",",
0 /* no max tokens */);
else
@@ -611,7 +611,7 @@ _cogl_context_get_gl_extensions (CoglContext *context)
if (_cogl_config_disable_gl_extensions)
split_conf_disabled_extensions =
- u_strsplit (_cogl_config_disable_gl_extensions,
+ c_strsplit (_cogl_config_disable_gl_extensions,
",",
0 /* no max tokens */);
else
@@ -636,16 +636,16 @@ _cogl_context_get_gl_extensions (CoglContext *context)
continue;
disabled:
- u_free (*src);
+ c_free (*src);
continue;
}
*dst = NULL;
if (split_env_disabled_extensions)
- u_strfreev (split_env_disabled_extensions);
+ c_strfreev (split_env_disabled_extensions);
if (split_conf_disabled_extensions)
- u_strfreev (split_conf_disabled_extensions);
+ c_strfreev (split_conf_disabled_extensions);
}
return ret;
@@ -656,7 +656,7 @@ _cogl_context_get_gl_version (CoglContext *context)
{
const char *version_override;
- if ((version_override = u_getenv ("COGL_OVERRIDE_GL_VERSION")))
+ if ((version_override = c_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 fe705ee3..26b9f915 100644
--- a/cogl/cogl-debug.c
+++ b/cogl/cogl-debug.c
@@ -44,7 +44,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 UDebugKey cogl_log_debug_keys[] = {
+static const CDebugKey cogl_log_debug_keys[] = {
{ "object", COGL_DEBUG_OBJECT },
{ "slicing", COGL_DEBUG_SLICING },
{ "atlas", COGL_DEBUG_ATLAS },
@@ -64,9 +64,9 @@ static const UDebugKey cogl_log_debug_keys[] = {
{ "performance", COGL_DEBUG_PERFORMANCE }
};
static const int n_cogl_log_debug_keys =
- U_N_ELEMENTS (cogl_log_debug_keys);
+ C_N_ELEMENTS (cogl_log_debug_keys);
-static const UDebugKey cogl_behavioural_debug_keys[] = {
+static const CDebugKey cogl_behavioural_debug_keys[] = {
{ "rectangles", COGL_DEBUG_RECTANGLES },
{ "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
{ "disable-vbos", COGL_DEBUG_DISABLE_VBOS },
@@ -85,20 +85,20 @@ static const UDebugKey cogl_behavioural_debug_keys[] = {
{ "disable-fast-read-pixel", COGL_DEBUG_DISABLE_FAST_READ_PIXEL}
};
static const int n_cogl_behavioural_debug_keys =
- U_N_ELEMENTS (cogl_behavioural_debug_keys);
+ C_N_ELEMENTS (cogl_behavioural_debug_keys);
unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
-UHashTable *_cogl_debug_instances;
+CHashTable *_cogl_debug_instances;
static void
_cogl_parse_debug_string_for_keys (const char *value,
CoglBool enable,
- const UDebugKey *keys,
+ const CDebugKey *keys,
unsigned int nkeys)
{
int long_num, key_num;
- /* u_parse_debug_string expects the value field in UDebugKey to be a
+ /* c_parse_debug_string expects the value field in CDebugKey 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 */
@@ -111,7 +111,7 @@ _cogl_parse_debug_string_for_keys (const char *value,
int_num < sizeof (unsigned long) / sizeof (unsigned int);
int_num++)
{
- UDebugKey keys_for_int[sizeof (unsigned int) * 8];
+ CDebugKey keys_for_int[sizeof (unsigned int) * 8];
int nkeys_for_int = 0;
for (key_num = 0; key_num < nkeys; key_num++)
@@ -134,7 +134,7 @@ _cogl_parse_debug_string_for_keys (const char *value,
if (nkeys_for_int > 0)
{
unsigned long mask =
- ((unsigned long) u_parse_debug_string (value,
+ ((unsigned long) c_parse_debug_string (value,
keys_for_int,
nkeys_for_int)) <<
(int_num * sizeof (unsigned int) * 8);
@@ -156,7 +156,7 @@ _cogl_parse_debug_string (const char *value,
if (ignore_help && strcmp (value, "help") == 0)
return;
- /* We don't want to let u_parse_debug_string handle "all" because
+ /* We don't want to let c_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.
@@ -171,20 +171,20 @@ _cogl_parse_debug_string (const char *value,
else
COGL_DEBUG_CLEAR_FLAG (cogl_log_debug_keys[i].value);
}
- else if (u_ascii_strcasecmp (value, "help") == 0)
+ else if (c_ascii_strcasecmp (value, "help") == 0)
{
- u_printerr ("\n\n%28s\n", _("Supported debug values:"));
+ c_printerr ("\n\n%28s\n", _("Supported debug values:"));
#define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \
- u_printerr ("%28s %s\n", NAME ":", _(DESCRIPTION));
+ c_printerr ("%28s %s\n", NAME ":", _(DESCRIPTION));
#include "cogl-debug-options.h"
- u_printerr ("\n%28s\n", _("Special debug values:"));
+ c_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
- u_printerr ("\n"
+ c_printerr ("\n"
"%28s\n"
" COGL_DISABLE_GL_EXTENSIONS: %s\n"
" COGL_OVERRIDE_GL_VERSION: %s\n",
@@ -213,7 +213,7 @@ _cogl_debug_check_environment (void)
{
const char *env_string;
- env_string = u_getenv ("COGL_DEBUG");
+ env_string = c_getenv ("COGL_DEBUG");
if (env_string != NULL)
{
_cogl_parse_debug_string (env_string,
@@ -222,7 +222,7 @@ _cogl_debug_check_environment (void)
env_string = NULL;
}
- env_string = u_getenv ("COGL_NO_DEBUG");
+ env_string = c_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 e94d2f16..010fedf4 100644
--- a/cogl/cogl-debug.h
+++ b/cogl/cogl-debug.h
@@ -35,7 +35,7 @@
#include "cogl-flags.h"
#include "cogl-util.h"
-#include <ulib.h>
+#include <clib.h>
COGL_BEGIN_DECLS
@@ -77,7 +77,7 @@ typedef enum {
COGL_DEBUG_N_FLAGS
} CoglDebugFlags;
-extern UHashTable *_cogl_debug_instances;
+extern CHashTable *_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
@@ -95,18 +95,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...) U_STMT_START { \
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
+#define COGL_NOTE(type,x,a...) C_STMT_START { \
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
_cogl_profile_trace_message ("[" #type "] " G_STRLOC " & " x, ##a); \
- } } U_STMT_END
+ } } C_STMT_END
#else
-#define COGL_NOTE(type,...) U_STMT_START { \
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
- char *_fmt = u_strdup_printf (__VA_ARGS__); \
+#define COGL_NOTE(type,...) C_STMT_START { \
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
+ char *_fmt = c_strdup_printf (__VA_ARGS__); \
_cogl_profile_trace_message ("[" #type "] " G_STRLOC " & %s", _fmt);\
- u_free (_fmt); \
- } } U_STMT_END
+ c_free (_fmt); \
+ } } C_STMT_END
#endif /* __GNUC__ */
diff --git a/cogl/cogl-display.c b/cogl/cogl-display.c
index cccbbfce..29753f14 100644
--- a/cogl/cogl-display.c
+++ b/cogl/cogl-display.c
@@ -79,14 +79,14 @@ _cogl_display_free (CoglDisplay *display)
display->onscreen_template = NULL;
}
- u_slice_free (CoglDisplay, display);
+ c_slice_free (CoglDisplay, display);
}
CoglDisplay *
cogl_display_new (CoglRenderer *renderer,
CoglOnscreenTemplate *onscreen_template)
{
- CoglDisplay *display = u_slice_new0 (CoglDisplay);
+ CoglDisplay *display = c_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))
- u_error ("Failed to connect to renderer: %s\n", error->message);
+ c_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 81e1fdae..4822d09a 100644
--- a/cogl/cogl-error-private.h
+++ b/cogl/cogl-error-private.h
@@ -40,7 +40,7 @@ _cogl_set_error (CoglError **error,
uint32_t domain,
int code,
const char *format,
- ...) U_GNUC_PRINTF (4, 5);
+ ...) C_GNUC_PRINTF (4, 5);
void
_cogl_set_error_literal (CoglError **error,
@@ -58,6 +58,6 @@ _cogl_propagate_gerror (CoglError **dest,
GError *src);
#endif /* COGL_HAS_GLIB_SUPPORT */
-#define _cogl_clear_error(X) u_clear_error ((GError **)X)
+#define _cogl_clear_error(X) c_clear_error ((GError **)X)
#endif /* __COGL_ERROR_PRIVATE_H__ */
diff --git a/cogl/cogl-error.c b/cogl/cogl-error.c
index 8a22e618..d49ab7be 100644
--- a/cogl/cogl-error.c
+++ b/cogl/cogl-error.c
@@ -35,7 +35,7 @@
#include "cogl-util.h"
#include "cogl-error-private.h"
-#include <ulib.h>
+#include <clib.h>
#ifdef COGL_HAS_GLIB_SUPPORT
#include <glib.h>
@@ -49,10 +49,10 @@
#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
+#define _real_error_free c_error_free
+#define _real_error_copy c_error_copy
+#define _real_error_matches c_error_matches
+#define _real_error_new_valist c_error_new_valist
#endif
@@ -97,7 +97,7 @@ _cogl_set_error (CoglError **error,
if (error == NULL)
{
- u_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
+ c_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
va_end (args);
return;
}
@@ -108,7 +108,7 @@ _cogl_set_error (CoglError **error,
if (*error == NULL)
*error = (CoglError *)new;
else
- u_warning (ERROR_OVERWRITTEN_WARNING, new->message);
+ c_warning (ERROR_OVERWRITTEN_WARNING, new->message);
}
void
@@ -128,11 +128,11 @@ _cogl_propagate_error (CoglError **dest,
if (dest == NULL)
{
- u_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message);
+ c_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message);
cogl_error_free (src);
}
else if (*dest)
- u_warning (ERROR_OVERWRITTEN_WARNING, src->message);
+ c_warning (ERROR_OVERWRITTEN_WARNING, src->message);
else
*dest = src;
}
diff --git a/cogl/cogl-euler.c b/cogl/cogl-euler.c
index a43672b9..f7cf7fd5 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 (U_LIKELY (src))
+ if (C_LIKELY (src))
{
- CoglEuler *new = u_slice_new (CoglEuler);
+ CoglEuler *new = c_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)
{
- u_slice_free (CoglEuler, euler);
+ c_slice_free (CoglEuler, euler);
}
diff --git a/cogl/cogl-feature-private.c b/cogl/cogl-feature-private.c
index a3a0e7ef..7f75a0c5 100644
--- a/cogl/cogl-feature-private.c
+++ b/cogl/cogl-feature-private.c
@@ -78,7 +78,7 @@ _cogl_feature_check (CoglRenderer *renderer,
namespace += strlen (namespace) + 1)
{
const char *extension;
- UString *full_extension_name = u_string_new ("");
+ CString *full_extension_name = c_string_new ("");
/* If the namespace part contains a ':' then the suffix for
the function names is different from the name space */
@@ -97,18 +97,18 @@ _cogl_feature_check (CoglRenderer *renderer,
*extension;
extension += strlen (extension) + 1)
{
- u_string_assign (full_extension_name, driver_prefix);
- u_string_append_c (full_extension_name, '_');
- u_string_append_len (full_extension_name,
+ c_string_assign (full_extension_name, driver_prefix);
+ c_string_append_c (full_extension_name, '_');
+ c_string_append_len (full_extension_name,
namespace, namespace_len);
- u_string_append_c (full_extension_name, '_');
- u_string_append (full_extension_name, extension);
+ c_string_append_c (full_extension_name, '_');
+ c_string_append (full_extension_name, extension);
if (_cogl_check_extension (full_extension_name->str,
extensions))
break;
}
- u_string_free (full_extension_name, TRUE);
+ c_string_free (full_extension_name, TRUE);
/* If we found an extension with this namespace then use it
as the suffix */
@@ -133,12 +133,12 @@ _cogl_feature_check (CoglRenderer *renderer,
void *func;
char *full_function_name;
- full_function_name = u_strconcat (data->functions[func_num].name,
+ full_function_name = c_strconcat (data->functions[func_num].name,
suffix, NULL);
func = _cogl_renderer_get_proc_address (renderer,
full_function_name,
in_core);
- u_free (full_function_name);
+ c_free (full_function_name);
if (func == NULL)
goto error;
@@ -169,7 +169,7 @@ error:
namespaces, extension_names) \
static const CoglFeatureFunction cogl_ext_ ## name ## _funcs[] = {
#define COGL_EXT_FUNCTION(ret, name, args) \
- { G_STRINGIFY (name), U_STRUCT_OFFSET (CoglContext, name) },
+ { G_STRINGIFY (name), C_STRUCT_OFFSET (CoglContext, name) },
#define COGL_EXT_END() \
{ NULL, 0 }, \
};
@@ -203,7 +203,7 @@ _cogl_feature_check_ext_functions (CoglContext *context,
{
int i;
- for (i = 0; i < U_N_ELEMENTS (cogl_feature_ext_functions_data); i++)
+ for (i = 0; i < C_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 2286ce29..33491135 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 <ulib.h>
+#include <clib.h>
#define COGL_CHECK_GL_VERSION(driver_major, driver_minor, \
diff --git a/cogl/cogl-fence.c b/cogl/cogl-fence.c
index 2eabc651..8baf6a3d 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;
- UList *l;
+ CList *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 = u_slice_new (CoglFenceClosure);
+ fence = c_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
}
- u_slice_free (CoglFenceClosure, fence);
+ c_slice_free (CoglFenceClosure, fence);
}
void
diff --git a/cogl/cogl-flags.h b/cogl/cogl-flags.h
index 847b8930..e0519a71 100644
--- a/cogl/cogl-flags.h
+++ b/cogl/cogl-flags.h
@@ -32,7 +32,7 @@
#ifndef __COGL_FLAGS_H
#define __COGL_FLAGS_H
-#include <ulib.h>
+#include <clib.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) \
- U_STMT_START { \
+ C_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)); \
- } U_STMT_END
+ } C_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) \
- U_STMT_START { \
+ C_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 \
- } } } U_STMT_END
+ } } } C_STMT_END
COGL_END_DECLS
diff --git a/cogl/cogl-frame-info.c b/cogl/cogl-frame-info.c
index c574458d..58be0558 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 = u_slice_new0 (CoglFrameInfo);
+ info = c_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)
{
- u_slice_free (CoglFrameInfo, info);
+ c_slice_free (CoglFrameInfo, info);
}
int64_t
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index 7f6a2460..da2d5e98 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... */
- UList *deps;
+ CList *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;
- UList *renderbuffers;
+ CList *renderbuffers;
int samples_per_pixel;
} CoglGLFramebuffer;
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index daaa252b..081af755 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 u_quark_from_static_string ("cogl-framebuffer-error-quark");
+ return c_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 = u_list_prepend (ctx->framebuffers, framebuffer);
+ ctx->framebuffers = c_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 = u_list_remove (ctx->framebuffers, framebuffer);
+ ctx->framebuffers = c_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)
{
- u_warning ("You should specify at least one auxiliary buffer "
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)) &&
+ if (C_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)
{
- UList *l;
+ CList *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 =
- u_list_prepend (framebuffer->deps, cogl_object_ref (dependency));
+ c_list_prepend (framebuffer->deps, cogl_object_ref (dependency));
}
void
_cogl_framebuffer_remove_all_dependencies (CoglFramebuffer *framebuffer)
{
- UList *l;
+ CList *l;
for (l = framebuffer->deps; l; l = l->next)
cogl_object_unref (l->data);
- u_list_free (framebuffer->deps);
+ c_list_free (framebuffer->deps);
framebuffer->deps = NULL;
}
@@ -603,7 +603,7 @@ _cogl_framebuffer_flush (CoglFramebuffer *framebuffer)
void
_cogl_framebuffer_flush_dependency_journals (CoglFramebuffer *framebuffer)
{
- UList *l;
+ CList *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 = u_new0 (CoglOffscreen, 1);
+ offscreen = c_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);
- u_free (offscreen);
+ c_free (offscreen);
}
CoglBool
@@ -778,7 +778,7 @@ _cogl_framebuffer_compare_viewport_state (CoglFramebuffer *a,
*
* TODO: file a bug upstream!
*/
- if (U_UNLIKELY (context->needs_viewport_scissor_workaround))
+ if (C_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:
- u_warn_if_reached ();
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FAST_READ_PIXEL)))
+ if (C_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)
- u_warning ("Inconsistent ref count on a framebuffer with journal "
+ c_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];
}
- u_return_val_if_reached (0);
+ c_return_val_if_reached (0);
}
static void
@@ -1858,7 +1858,7 @@ get_line_count (CoglVerticesMode mode, int n_vertices)
}
#endif
- u_return_val_if_reached (0);
+ c_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 = u_malloc (4 * n_lines * 2);
+ line_indices = c_malloc (4 * n_lines * 2);
pos = 0;
@@ -1966,7 +1966,7 @@ get_wire_line_indices (CoglContext *ctx,
line_indices,
*n_indices);
- u_free (line_indices);
+ c_free (line_indices);
return ret;
}
@@ -2098,7 +2098,7 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
CoglDrawFlags flags)
{
#ifdef COGL_ENABLE_DEBUG
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
+ if (C_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME) &&
+ if (C_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 = u_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
+ rects = c_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 = u_alloca (n_rectangles * sizeof (CoglMultiTexturedRect));
+ rects = c_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 52e42156..e1a0d305 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 <ulib.h>
+#include <clib.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 */
- UList *attached_shaders;
+ CList *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. */
- UHashTable *shader_map;
- UHashTable *program_map;
+ CHashTable *shader_map;
+ CHashTable *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 */
- UHashTable *texture_object_map;
+ CHashTable *texture_object_map;
/* Array of CoglGLES2TextureUnits to keep track of state for each
* texture unit */
- UArray *texture_units;
+ CArray *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 c8faf74f..0cd0a928 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 u_quark_from_static_string ("cogl-gles2-context-error-quark");
+ return c_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 */
- u_hash_table_remove (context->shader_map,
+ c_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 */
- u_hash_table_remove (program_data->context->program_map,
+ c_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)
{
- UList *l;
+ CList *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 =
- u_list_delete_link (program_data->attached_shaders, l);
+ c_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 u_ascii_isalnum (ch) || ch == '_';
+ return c_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 u_array_index (gles2_ctx->texture_units,
+ return c_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 = u_hash_table_lookup (gles2_ctx->texture_object_map,
+ texture_object = c_hash_table_lookup (gles2_ctx->texture_object_map,
GUINT_TO_POINTER (texture_id));
if (texture_object == NULL)
{
- texture_object = u_slice_new0 (CoglGLES2TextureObjectData);
+ texture_object = c_slice_new0 (CoglGLES2TextureObjectData);
texture_object->object_id = texture_id;
- u_hash_table_insert (gles2_ctx->texture_object_map,
+ c_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 = u_hash_table_lookup (gles2_ctx->texture_object_map,
+ tex_object_data = c_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 = u_alloca (bytes_per_row);
+ temprow = c_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 = u_slice_new (CoglGLES2ShaderData);
+ CoglGLES2ShaderData *data = c_slice_new (CoglGLES2ShaderData);
data->object_id = id;
data->type = type;
data->ref_count = 1;
data->deleted = FALSE;
- u_hash_table_insert (gles2_ctx->shader_map,
+ c_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 = u_hash_table_lookup (gles2_ctx->shader_map,
+ if ((shader_data = c_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 = u_slice_new (CoglGLES2ProgramData);
+ CoglGLES2ProgramData *data = c_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;
- u_hash_table_insert (gles2_ctx->program_map,
+ c_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 = u_hash_table_lookup (gles2_ctx->program_map,
+ if ((program_data = c_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 = u_hash_table_lookup (gles2_ctx->program_map,
+ program_data = c_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 = u_hash_table_lookup (gles2_ctx->program_map,
+ if ((program_data = c_hash_table_lookup (gles2_ctx->program_map,
GINT_TO_POINTER (program))) &&
- (shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
+ (shader_data = c_hash_table_lookup (gles2_ctx->shader_map,
GINT_TO_POINTER (shader))) &&
/* Ignore attempts to attach a shader that is already attached */
- u_list_find (program_data->attached_shaders, shader_data) == NULL)
+ c_list_find (program_data->attached_shaders, shader_data) == NULL)
{
shader_data->ref_count++;
program_data->attached_shaders =
- u_list_prepend (program_data->attached_shaders, shader_data);
+ c_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 = u_hash_table_lookup (gles2_ctx->program_map,
+ if ((program_data = c_hash_table_lookup (gles2_ctx->program_map,
GINT_TO_POINTER (program))) &&
- (shader_data = u_hash_table_lookup (gles2_ctx->shader_map,
+ (shader_data = c_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 = u_hash_table_lookup (gles2_ctx->shader_map,
+ if ((shader_data = c_hash_table_lookup (gles2_ctx->shader_map,
GINT_TO_POINTER (shader))) &&
shader_data->type == GL_VERTEX_SHADER)
{
- char **string_copy = u_alloca ((count + 1) * sizeof (char *));
- int *length_copy = u_alloca ((count + 1) * sizeof (int));
+ char **string_copy = c_alloca ((count + 1) * sizeof (char *));
+ int *length_copy = c_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] = u_memdup (string[i], string_length);
+ string_copy[i] = c_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++)
- u_free (string_copy[i]);
+ c_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 = u_hash_table_lookup (gles2_ctx->shader_map,
+ if ((shader_data = c_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 = u_hash_table_lookup (gles2_ctx->program_map,
+ program_data = c_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;
- u_array_set_size (gles2_ctx->texture_units,
+ c_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 =
- &u_array_index (gles2_ctx->texture_units,
+ &c_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 */
- u_hash_table_remove (gles2_ctx->texture_object_map,
+ c_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 =
- &u_array_index (gles2_ctx->texture_units,
+ &c_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);
- u_slice_free (CoglGLES2Offscreen, gles2_offscreen);
+ c_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;
- UList *objects, *l;
+ CList *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 = u_hash_table_get_values (gles2_context->program_map);
+ objects = c_hash_table_get_values (gles2_context->program_map);
for (l = objects; l; l = l->next)
force_delete_program_object (gles2_context, l->data);
- u_list_free (objects);
- objects = u_hash_table_get_values (gles2_context->shader_map);
+ c_list_free (objects);
+ objects = c_hash_table_get_values (gles2_context->shader_map);
for (l = objects; l; l = l->next)
force_delete_shader_object (gles2_context, l->data);
- u_list_free (objects);
- objects = u_hash_table_get_values (gles2_context->texture_object_map);
+ c_list_free (objects);
+ objects = c_hash_table_get_values (gles2_context->texture_object_map);
for (l = objects; l; l = l->next)
force_delete_texture_object (gles2_context, l->data);
- u_list_free (objects);
+ c_list_free (objects);
/* All of the program and shader objects should now be destroyed */
- 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");
+ if (c_hash_table_size (gles2_context->program_map) > 0)
+ c_warning ("Program objects have been leaked from a CoglGLES2Context");
+ if (c_hash_table_size (gles2_context->shader_map) > 0)
+ c_warning ("Shader objects have been leaked from a CoglGLES2Context");
- u_hash_table_destroy (gles2_context->program_map);
- u_hash_table_destroy (gles2_context->shader_map);
+ c_hash_table_destroy (gles2_context->program_map);
+ c_hash_table_destroy (gles2_context->shader_map);
- u_hash_table_destroy (gles2_context->texture_object_map);
- u_array_free (gles2_context->texture_units, TRUE);
+ c_hash_table_destroy (gles2_context->texture_object_map);
+ c_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);
}
- u_free (gles2_context->vtable);
+ c_free (gles2_context->vtable);
- u_free (gles2_context);
+ c_free (gles2_context);
}
static void
free_shader_data (CoglGLES2ShaderData *data)
{
- u_slice_free (CoglGLES2ShaderData, data);
+ c_slice_free (CoglGLES2ShaderData, data);
}
static void
@@ -1550,13 +1550,13 @@ free_program_data (CoglGLES2ProgramData *data)
detach_shader (data,
data->attached_shaders->data);
- u_slice_free (CoglGLES2ProgramData, data);
+ c_slice_free (CoglGLES2ProgramData, data);
}
static void
free_texture_object_data (CoglGLES2TextureObjectData *data)
{
- u_slice_free (CoglGLES2TextureObjectData, data);
+ c_slice_free (CoglGLES2TextureObjectData, data);
}
CoglGLES2Context *
@@ -1574,7 +1574,7 @@ cogl_gles2_context_new (CoglContext *ctx, CoglError **error)
return NULL;
}
- gles2_ctx = u_malloc0 (sizeof (CoglGLES2Context));
+ gles2_ctx = c_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)
{
- u_free (gles2_ctx);
+ c_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 = u_malloc0 (sizeof (CoglGLES2Vtable));
+ gles2_ctx->vtable = c_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 =
- u_hash_table_new_full (u_direct_hash,
- u_direct_equal,
+ c_hash_table_new_full (c_direct_hash,
+ c_direct_equal,
NULL, /* key_destroy */
- (UDestroyNotify) free_shader_data);
+ (CDestroyNotify) free_shader_data);
gles2_ctx->program_map =
- u_hash_table_new_full (u_direct_hash,
- u_direct_equal,
+ c_hash_table_new_full (c_direct_hash,
+ c_direct_equal,
NULL, /* key_destroy */
- (UDestroyNotify) free_program_data);
+ (CDestroyNotify) free_program_data);
gles2_ctx->texture_object_map =
- u_hash_table_new_full (u_direct_hash,
- u_direct_equal,
+ c_hash_table_new_full (c_direct_hash,
+ c_direct_equal,
NULL, /* key_destroy */
- (UDestroyNotify) free_texture_object_data);
+ (CDestroyNotify) free_texture_object_data);
- gles2_ctx->texture_units = u_array_new (FALSE, /* not zero terminated */
+ gles2_ctx->texture_units = c_array_new (FALSE, /* not zero terminated */
TRUE, /* clear */
sizeof (CoglGLES2TextureUnitData));
gles2_ctx->current_texture_unit = 0;
- u_array_set_size (gles2_ctx->texture_units, 1);
+ c_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 = u_slice_new0 (CoglGLES2Offscreen);
+ gles2_offscreen = c_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);
- u_slice_free (CoglGLES2Offscreen, gles2_offscreen);
+ c_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 (u_queue_find (&ctx->gles2_context_stack, gles2_ctx))
+ if (c_queue_find (&ctx->gles2_context_stack, gles2_ctx))
{
- u_critical ("Pushing the same GLES2 context multiple times isn't "
+ c_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;
}
- u_queue_push_tail (&ctx->gles2_context_stack, gles2_ctx);
+ c_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);
- u_queue_pop_tail (&ctx->gles2_context_stack);
+ c_queue_pop_tail (&ctx->gles2_context_stack);
- gles2_ctx = u_queue_peek_tail (&ctx->gles2_context_stack);
+ gles2_ctx = c_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 2140409c..a4574aa0 100644
--- a/cogl/cogl-glib-source.c
+++ b/cogl/cogl-glib-source.c
@@ -31,7 +31,7 @@
#include <config.h>
#include <glib.h>
-#include <ulib.h>
+#include <clib.h>
#include "cogl-glib-source.h"
#include "cogl-poll.h"
@@ -42,7 +42,7 @@ typedef struct _CoglGLibSource
CoglRenderer *renderer;
- UArray *poll_fds;
+ CArray *poll_fds;
int poll_fds_age;
int64_t expiration_time;
@@ -72,15 +72,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 = &u_array_index (cogl_source->poll_fds, GPollFD, i);
+ GPollFD *poll_fd = &c_array_index (cogl_source->poll_fds, GPollFD, i);
g_source_remove_poll (source, poll_fd);
}
- u_array_set_size (cogl_source->poll_fds, n_poll_fds);
+ c_array_set_size (cogl_source->poll_fds, n_poll_fds);
for (i = 0; i < n_poll_fds; i++)
{
- GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
+ GPollFD *poll_fd = &c_array_index (cogl_source->poll_fds, GPollFD, i);
poll_fd->fd = poll_fds[i].fd;
g_source_add_poll (source, poll_fd);
}
@@ -91,7 +91,7 @@ cogl_glib_source_prepare (GSource *source, int *timeout)
/* Update the events */
for (i = 0; i < n_poll_fds; i++)
{
- GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
+ GPollFD *poll_fd = &c_array_index (cogl_source->poll_fds, GPollFD, i);
poll_fd->events = poll_fds[i].events;
poll_fd->revents = 0;
}
@@ -124,7 +124,7 @@ cogl_glib_source_check (GSource *source)
for (i = 0; i < cogl_source->poll_fds->len; i++)
{
- GPollFD *poll_fd = &u_array_index (cogl_source->poll_fds, GPollFD, i);
+ GPollFD *poll_fd = &c_array_index (cogl_source->poll_fds, GPollFD, i);
if (poll_fd->revents != 0)
return TRUE;
}
@@ -139,7 +139,7 @@ cogl_glib_source_dispatch (GSource *source,
{
CoglGLibSource *cogl_source = (CoglGLibSource *) source;
CoglPollFD *poll_fds =
- (CoglPollFD *) &u_array_index (cogl_source->poll_fds, GPollFD, 0);
+ (CoglPollFD *) &c_array_index (cogl_source->poll_fds, GPollFD, 0);
cogl_poll_renderer_dispatch (cogl_source->renderer,
poll_fds,
@@ -153,7 +153,7 @@ cogl_glib_source_finalize (GSource *source)
{
CoglGLibSource *cogl_source = (CoglGLibSource *) source;
- u_array_free (cogl_source->poll_fds, TRUE);
+ c_array_free (cogl_source->poll_fds, TRUE);
}
static GSourceFuncs
@@ -177,7 +177,7 @@ cogl_glib_renderer_source_new (CoglRenderer *renderer,
cogl_source = (CoglGLibSource *) source;
cogl_source->renderer = renderer;
- cogl_source->poll_fds = u_array_new (FALSE, FALSE, sizeof (GPollFD));
+ cogl_source->poll_fds = c_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 f1e5bd8c..020c2008 100644
--- a/cogl/cogl-glib-source.h
+++ b/cogl/cogl-glib-source.h
@@ -50,7 +50,7 @@ COGL_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
- * u_source_attach().
+ * c_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
- * u_source_attach().
+ * c_source_attach().
*
* Return value: a new #GSource
*
diff --git a/cogl/cogl-glsl-shader.c b/cogl/cogl-glsl-shader.c
index ada309e4..73f7e806 100644
--- a/cogl/cogl-glsl-shader.c
+++ b/cogl/cogl-glsl-shader.c
@@ -43,7 +43,7 @@
#include <string.h>
-#include <ulib.h>
+#include <clib.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 = u_alloca (sizeof (char *) * (count_in + 6));
- GLint *lengths = u_alloca (sizeof (GLint) * (count_in + 6));
+ const char **strings = c_alloca (sizeof (char *) * (count_in + 6));
+ GLint *lengths = c_alloca (sizeof (GLint) * (count_in + 6));
char *version_string;
int count = 0;
vertex_boilerplate = _COGL_VERTEX_SHADER_BOILERPLATE;
fragment_boilerplate = _COGL_FRAGMENT_SHADER_BOILERPLATE;
- version_string = u_strdup_printf ("#version %i\n\n",
+ version_string = c_strdup_printf ("#version %i\n\n",
ctx->glsl_version_to_use);
strings[count] = version_string;
@@ -150,28 +150,28 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
}
count += count_in;
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
{
- UString *buf = u_string_new (NULL);
+ CString *buf = c_string_new (NULL);
int i;
- u_string_append_printf (buf,
+ c_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)
- u_string_append_len (buf, strings[i], lengths[i]);
+ c_string_append_len (buf, strings[i], lengths[i]);
else
- u_string_append (buf, strings[i]);
+ c_string_append (buf, strings[i]);
- u_message ("%s", buf->str);
+ c_message ("%s", buf->str);
- u_string_free (buf, TRUE);
+ c_string_free (buf, TRUE);
}
GE( ctx, glShaderSource (shader_gl_handle, count,
(const char **) strings, lengths) );
- u_free (version_string);
+ c_free (version_string);
}
diff --git a/cogl/cogl-glx-renderer-private.h b/cogl/cogl-glx-renderer-private.h
index 4804a0fc..f0702268 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 <umodule.h>
+#include <cmodule.h>
#include "cogl-object-private.h"
#include "cogl-xlib-renderer-private.h"
diff --git a/cogl/cogl-gpu-info-private.h b/cogl/cogl-gpu-info-private.h
index 90dceccb..1879a805 100644
--- a/cogl/cogl-gpu-info-private.h
+++ b/cogl/cogl-gpu-info-private.h
@@ -103,7 +103,7 @@ struct _CoglGpuInfo
};
/*
- * _cogl_gpu_info_init:
+ * _cogl_gpc_info_init:
* @ctx: A #CoglContext
* @gpu: A return location for the GPU information
*
@@ -111,7 +111,7 @@ struct _CoglGpuInfo
* context.
*/
void
-_cogl_gpu_info_init (CoglContext *ctx,
+_cogl_gpc_info_init (CoglContext *ctx,
CoglGpuInfo *gpu);
#endif /* __COGL_GPU_INFO_PRIVATE_H */
diff --git a/cogl/cogl-gpu-info.c b/cogl/cogl-gpu-info.c
index f8f83c9b..da26a2ab 100644
--- a/cogl/cogl-gpu-info.c
+++ b/cogl/cogl-gpu-info.c
@@ -75,7 +75,7 @@ typedef struct
} CoglGpuInfoDriverPackageDescription;
static CoglBool
-_cogl_gpu_info_parse_version_string (const char *version_string,
+_cogl_gpc_info_parse_version_string (const char *version_string,
int n_components,
const char **tail,
int *version_ret)
@@ -87,7 +87,7 @@ _cogl_gpu_info_parse_version_string (const char *version_string,
for (i = 0; ; i++)
{
errno = 0;
- part = u_ascii_strtoull (version_string,
+ part = c_ascii_strtoull (version_string,
(char **) &version_string,
10);
@@ -356,7 +356,7 @@ unknown_architectures[] =
};
static const CoglGpuInfoVendorDescription
-_cogl_gpu_info_vendors[] =
+_cogl_gpc_info_vendors[] =
{
{
COGL_GPU_INFO_VENDOR_INTEL,
@@ -418,7 +418,7 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
/* The version string should always begin a two-part GL version
number */
- if (!_cogl_gpu_info_parse_version_string (strings->version_string,
+ if (!_cogl_gpc_info_parse_version_string (strings->version_string,
2, /* n_components */
&v, /* tail */
NULL /* version_ret */))
@@ -435,7 +435,7 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
/* Next there will be a version string that is at least two
components. On a git devel build the version will be something
like "-devel<git hash>" instead */
- if (!_cogl_gpu_info_parse_version_string (v,
+ if (!_cogl_gpc_info_parse_version_string (v,
2, /* n_components */
&v, /* tail */
version_ret))
@@ -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 (u_str_has_prefix (v, "-devel"))
+ if (c_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 = u_ascii_strtoull (v + 1, NULL /* endptr */, 10 /* base */);
+ micro_part = c_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 < U_N_ELEMENTS (test_strings); i++)
+ for (i = 0; i < C_N_ELEMENTS (test_strings); i++)
{
- u_assert (check_mesa_driver_package (&test_strings[i], &version));
- u_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0));
+ c_assert (check_mesa_driver_package (&test_strings[i], &version));
+ c_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0));
}
}
@@ -492,7 +492,7 @@ check_unknown_driver_package (const CoglGpuInfoStrings *strings,
}
static const CoglGpuInfoDriverPackageDescription
-_cogl_gpu_info_driver_packages[] =
+_cogl_gpc_info_driver_packages[] =
{
{
COGL_GPU_INFO_DRIVER_PACKAGE_MESA,
@@ -508,7 +508,7 @@ _cogl_gpu_info_driver_packages[] =
};
void
-_cogl_gpu_info_init (CoglContext *ctx,
+_cogl_gpc_info_init (CoglContext *ctx,
CoglGpuInfo *gpu)
{
CoglGpuInfoStrings strings;
@@ -522,7 +522,7 @@ _cogl_gpu_info_init (CoglContext *ctx,
for (i = 0; ; i++)
{
const CoglGpuInfoDriverPackageDescription *description =
- _cogl_gpu_info_driver_packages + i;
+ _cogl_gpc_info_driver_packages + i;
if (description->check_function (&strings, &gpu->driver_package_version))
{
@@ -536,7 +536,7 @@ _cogl_gpu_info_init (CoglContext *ctx,
for (i = 0; ; i++)
{
const CoglGpuInfoVendorDescription *description =
- _cogl_gpu_info_vendors + i;
+ _cogl_gpc_info_vendors + i;
if (description->check_function (&strings))
{
diff --git a/cogl/cogl-index-buffer.c b/cogl/cogl-index-buffer.c
index 7f0d1d6b..2629f5dd 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 = u_slice_new (CoglIndexBuffer);
+ CoglIndexBuffer *indices = c_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));
- u_slice_free (CoglIndexBuffer, indices);
+ c_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)
{
- UList *l;
+ CList *l;
for (l = indices->ranges; l; l = l->next)
{
diff --git a/cogl/cogl-indices.c b/cogl/cogl-indices.c
index 5cebe058..3578067e 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;
}
- u_return_val_if_reached (0);
+ c_return_val_if_reached (0);
}
CoglIndices *
@@ -69,7 +69,7 @@ cogl_indices_new_for_buffer (CoglIndicesType type,
CoglIndexBuffer *buffer,
size_t offset)
{
- CoglIndices *indices = u_slice_new (CoglIndices);
+ CoglIndices *indices = c_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)
{
- u_warning ("Mid-scene modification of indices has "
+ c_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 (U_UNLIKELY (indices->immutable_ref))
+ if (C_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);
- u_slice_free (CoglIndices, indices);
+ c_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 = u_malloc (256 / 4 * 6 * sizeof (uint8_t));
+ uint8_t *byte_array = c_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);
- u_free (byte_array);
+ c_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 = u_malloc ((ctx->rectangle_short_indices_len
+ p = short_array = c_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);
- u_free (short_array);
+ c_free (short_array);
}
return ctx->rectangle_short_indices;
diff --git a/cogl/cogl-journal-private.h b/cogl/cogl-journal-private.h
index ffdc7aeb..de13ed07 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;
- UArray *entries;
- UArray *vertices;
+ CArray *entries;
+ CArray *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 cb2b9bc3..a1d63ad9 100644
--- a/cogl/cogl-journal.c
+++ b/cogl/cogl-journal.c
@@ -46,7 +46,7 @@
#include "cogl-private.h"
#include <string.h>
-#include <umodule.h>
+#include <cmodule.h>
#include <math.h>
/* XXX NB:
@@ -104,7 +104,7 @@ typedef struct _CoglJournalFlushState
CoglJournal *journal;
CoglAttributeBuffer *attribute_buffer;
- UArray *attributes;
+ CArray *attributes;
int current_attribute;
size_t stride;
@@ -133,21 +133,21 @@ _cogl_journal_free (CoglJournal *journal)
int i;
if (journal->entries)
- u_array_free (journal->entries, TRUE);
+ c_array_free (journal->entries, TRUE);
if (journal->vertices)
- u_array_free (journal->vertices, TRUE);
+ c_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]);
- u_slice_free (CoglJournal, journal);
+ c_slice_free (CoglJournal, journal);
}
CoglJournal *
_cogl_journal_new (CoglFramebuffer *framebuffer)
{
- CoglJournal *journal = u_slice_new0 (CoglJournal);
+ CoglJournal *journal = c_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 = u_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
- journal->vertices = u_array_new (FALSE, FALSE, sizeof (float));
+ journal->entries = c_array_new (FALSE, FALSE, sizeof (CoglJournalEntry));
+ journal->vertices = c_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;
- u_print ("n_layers = %d; rgba=0x%02X%02X%02X%02X\n",
+ c_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;
- u_print ("v%d: x = %f, y = %f", i, v[0], v[1]);
+ c_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;
- u_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
+ c_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
}
- u_print ("\n");
+ c_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;
- u_print ("n_layers = %d; stride = %d; pos stride = %d; color stride = %d; "
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED
(COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
- u_print ("v%d: x = %f, y = %f, rgba=0x%02X%02X%02X%02X",
+ c_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
- u_print ("v%d: x = %f, y = %f, z = %f, rgba=0x%02X%02X%02X%02X",
+ c_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;
- u_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
+ c_print (", tx%d = %f, ty%d = %f", j, t[0], j, t[1]);
}
- u_print ("\n");
+ c_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;
- u_print ("_cogl_journal_dump_quad_batch: n_layers = %d, n_quads = %d\n",
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
- u_print ("BATCHING: modelview batch len = %d\n", batch_len);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+ c_print ("BATCHING: modelview batch len = %d\n", batch_len);
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+ if (C_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)))
+ if (C_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
- u_print ("BATCHING: pipeline batch len = %d\n", batch_len);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+ if (C_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 =
- &u_array_index (flush_state->attributes,
+ &c_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] :
- u_strdup_printf ("cogl_tex_coord%d_in", layer_number);
+ c_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)
- u_free (name);
+ c_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 (u_array_index (state->attributes, CoglAttribute *, i));
+ cogl_object_unref (c_array_index (state->attributes, CoglAttribute *, i));
- u_array_set_size (state->attributes, batch_start->n_layers + 2);
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
- u_print ("BATCHING: vbo offset batch len = %d\n", batch_len);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+ c_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 (u_array_index (state->attributes, CoglAttribute *, i));
+ cogl_object_unref (c_array_index (state->attributes, CoglAttribute *, i));
- u_array_set_size (state->attributes, 2);
+ c_array_set_size (state->attributes, 2);
- attribute_entry = &u_array_index (state->attributes, CoglAttribute *, 0);
+ attribute_entry = &c_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 = &u_array_index (state->attributes, CoglAttribute *, 1);
+ attribute_entry = &c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+ if (C_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
- u_print ("new vbo offset = %lu\n", (unsigned long)state->array_offset);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
- u_print ("BATCHING: clip stack batch len = %d\n", batch_len);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+ c_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 (U_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))))
+ if (C_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 = u_array_new (FALSE, FALSE, sizeof (ClipBounds));
- u_array_set_size (ctx->journal_clip_bounds, batch_len);
+ ctx->journal_clip_bounds = c_array_new (FALSE, FALSE, sizeof (ClipBounds));
+ c_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 = &u_array_index (ctx->journal_clip_bounds,
+ ClipBounds *clip_bounds = &c_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 = &u_array_index (journal->vertices, float,
+ float *verts = &c_array_index (journal->vertices, float,
journal_entry->array_offset + 1);
- ClipBounds *clip_bounds = &u_array_index (ctx->journal_clip_bounds,
+ ClipBounds *clip_bounds = &c_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,
- UArray *vertices)
+ CArray *vertices)
{
CoglAttributeBuffer *attribute_buffer;
CoglBuffer *buffer;
@@ -1087,7 +1087,7 @@ upload_vertices (CoglJournal *journal,
CoglMatrixEntry *last_modelview_entry = NULL;
CoglMatrix modelview;
- u_assert (needed_vbo_len);
+ c_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 = &u_array_index (vertices, float, 0);
+ vin = &c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+ if (C_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 =
- &u_array_index (journal->entries, CoglJournalEntry, i);
+ &c_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);
}
- u_array_set_size (journal->entries, 0);
- u_array_set_size (journal->vertices, 0);
+ c_array_set_size (journal->entries, 0);
+ c_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 = &u_array_index (journal->entries, CoglJournalEntry, i);
+ entry = &c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
- u_print ("BATCHING: journal len = %d\n", journal->entries->len);
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
+ c_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 (U_UNLIKELY ((COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_CLIP)) == 0))
+ if (C_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,
- &u_array_index (journal->entries, CoglJournalEntry, 0),
+ &c_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 (u_array_index (state.attributes, CoglAttribute *, i));
- u_array_set_size (state.attributes, 0);
+ cogl_object_unref (c_array_index (state.attributes, CoglAttribute *, i));
+ c_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 UList *l;
+ const CList *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;
- u_array_set_size (journal->vertices, next_vert + 2 * stride + 1);
- v = &u_array_index (journal->vertices, float, next_vert);
+ c_array_set_size (journal->vertices, next_vert + 2 * stride + 1);
+ v = &c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
{
- u_print ("Logged new quad:\n");
- v = &u_array_index (journal->vertices, float, next_vert);
+ c_print ("Logged new quad:\n");
+ v = &c_array_index (journal->vertices, float, next_vert);
_cogl_journal_dump_logged_quad ((uint8_t *)v, n_layers);
}
next_entry = journal->entries->len;
- u_array_set_size (journal->entries, next_entry + 1);
- entry = &u_array_index (journal->entries, CoglJournalEntry, next_entry);
+ c_array_set_size (journal->entries, next_entry + 1);
+ entry = &c_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 (U_UNLIKELY (cogl_pipeline_get_n_layers (pipeline) != n_layers))
+ if (C_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 (U_UNLIKELY (layer0_override_texture))
+ if (C_UNLIKELY (layer0_override_texture))
{
flush_options.flags |= COGL_PIPELINE_FLUSH_LAYER0_OVERRIDE;
flush_options.layer0_override_texture = layer0_override_texture;
}
- if (U_UNLIKELY (flush_options.flags))
+ if (C_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 (U_UNLIKELY (final_pipeline != pipeline))
+ if (C_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BATCHING)))
+ if (C_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 =
- &u_array_index (journal->entries, CoglJournalEntry, i);
- uint8_t *color = (uint8_t *)&u_array_index (journal->vertices, float,
+ &c_array_index (journal->entries, CoglJournalEntry, i);
+ uint8_t *color = (uint8_t *)&c_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 9177c036..aeab46a3 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 <ulib.h>
+#include <clib.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 (U_LIKELY (magazine->head))
+ if (C_LIKELY (magazine->head))
{
CoglMagazineChunk *chunk = magazine->head;
magazine->head = chunk->next;
diff --git a/cogl/cogl-magazine.c b/cogl/cogl-magazine.c
index a8963ffc..60484ade 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 <ulib.h>
+#include <clib.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 = u_new0 (CoglMagazine, 1);
+ CoglMagazine *magazine = c_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);
- u_free (magazine);
+ c_free (magazine);
}
diff --git a/cogl/cogl-matrix-private.h b/cogl/cogl-matrix-private.h
index f6671b6a..fb5558a7 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 <ulib.h>
+#include <clib.h>
COGL_BEGIN_DECLS
#define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \
{ \
- u_print ("%s:\n", G_STRFUNC); \
+ c_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 2cd131c2..548a6f88 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -511,21 +511,21 @@ initialized:
return save->cache;
}
}
- u_warn_if_reached ();
+ c_warn_if_reached ();
return NULL;
}
#ifdef COGL_ENABLE_DEBUG
if (!current)
{
- u_warning ("Inconsistent matrix stack");
+ c_warning ("Inconsistent matrix stack");
return NULL;
}
entry->composite_gets++;
#endif
- children = u_alloca (sizeof (CoglMatrixEntry) * depth);
+ children = c_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:
- u_warn_if_reached ();
+ c_warn_if_reached ();
continue;
}
}
@@ -645,15 +645,15 @@ static void
_cogl_matrix_stack_free (CoglMatrixStack *stack)
{
cogl_matrix_entry_unref (stack->last_entry);
- u_slice_free (CoglMatrixStack, stack);
+ c_slice_free (CoglMatrixStack, stack);
}
CoglMatrixStack *
cogl_matrix_stack_new (CoglContext *ctx)
{
- CoglMatrixStack *stack = u_slice_new (CoglMatrixStack);
+ CoglMatrixStack *stack = c_slice_new (CoglMatrixStack);
- if (U_UNLIKELY (cogl_matrix_stack_magazine == NULL))
+ if (C_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)
{
- USList *head0 = NULL;
- USList *head1 = NULL;
+ CSList *head0 = NULL;
+ CSList *head1 = NULL;
CoglMatrixEntry *node0;
CoglMatrixEntry *node1;
int len0 = 0;
int len1 = 0;
int count;
- USList *common_ancestor0;
- USList *common_ancestor1;
+ CSList *common_ancestor0;
+ CSList *common_ancestor1;
/* Algorithm:
*
@@ -722,12 +722,12 @@ cogl_matrix_entry_calculate_translation (CoglMatrixEntry *entry0,
for (node0 = entry0; node0; node0 = node0->parent)
{
- USList *link;
+ CSList *link;
if (node0->op == COGL_MATRIX_OP_SAVE)
continue;
- link = alloca (sizeof (USList));
+ link = alloca (sizeof (CSList));
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)
{
- USList *link;
+ CSList *link;
if (node1->op == COGL_MATRIX_OP_SAVE)
continue;
- link = alloca (sizeof (USList));
+ link = alloca (sizeof (CSList));
link->next = head1;
link->data = node1;
head1 = link;
@@ -918,7 +918,7 @@ cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
}
case COGL_MATRIX_OP_SAVE:
/* We skip over saves above so we shouldn't see save entries */
- u_warn_if_reached ();
+ c_warn_if_reached ();
}
}
@@ -936,7 +936,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
for (depth = 0, e = entry; e; e = e->parent)
depth++;
- children = u_alloca (sizeof (CoglMatrixEntry) * depth);
+ children = c_alloca (sizeof (CoglMatrixEntry) * depth);
for (i = depth - 1, e = entry;
i >= 0 && e;
@@ -945,7 +945,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
children[i] = e;
}
- u_print ("MatrixEntry %p =\n", entry);
+ c_print ("MatrixEntry %p =\n", entry);
for (i = 0; i < depth; i++)
{
@@ -954,13 +954,13 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
switch (entry->op)
{
case COGL_MATRIX_OP_LOAD_IDENTITY:
- u_print (" LOAD IDENTITY\n");
+ c_print (" LOAD IDENTITY\n");
continue;
case COGL_MATRIX_OP_TRANSLATE:
{
CoglMatrixEntryTranslate *translate =
(CoglMatrixEntryTranslate *)entry;
- u_print (" TRANSLATE X=%f Y=%f Z=%f\n",
+ c_print (" TRANSLATE X=%f Y=%f Z=%f\n",
translate->x,
translate->y,
translate->z);
@@ -970,7 +970,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
{
CoglMatrixEntryRotate *rotate =
(CoglMatrixEntryRotate *)entry;
- u_print (" ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
+ c_print (" ROTATE ANGLE=%f X=%f Y=%f Z=%f\n",
rotate->angle,
rotate->x,
rotate->y,
@@ -981,7 +981,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
{
CoglMatrixEntryRotateQuaternion *rotate =
(CoglMatrixEntryRotateQuaternion *)entry;
- u_print (" ROTATE QUATERNION w=%f x=%f y=%f z=%f\n",
+ c_print (" ROTATE QUATERNION w=%f x=%f y=%f z=%f\n",
rotate->values[0],
rotate->values[1],
rotate->values[2],
@@ -992,7 +992,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
{
CoglMatrixEntryRotateEuler *rotate =
(CoglMatrixEntryRotateEuler *)entry;
- u_print (" ROTATE EULER heading=%f pitch=%f roll=%f\n",
+ c_print (" ROTATE EULER heading=%f pitch=%f roll=%f\n",
rotate->heading,
rotate->pitch,
rotate->roll);
@@ -1001,7 +1001,7 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
case COGL_MATRIX_OP_SCALE:
{
CoglMatrixEntryScale *scale = (CoglMatrixEntryScale *)entry;
- u_print (" SCALE X=%f Y=%f Z=%f\n",
+ c_print (" SCALE X=%f Y=%f Z=%f\n",
scale->x,
scale->y,
scale->z);
@@ -1010,19 +1010,19 @@ cogl_debug_matrix_entry_print (CoglMatrixEntry *entry)
case COGL_MATRIX_OP_MULTIPLY:
{
CoglMatrixEntryMultiply *mult = (CoglMatrixEntryMultiply *)entry;
- u_print (" MULT:\n");
+ c_print (" MULT:\n");
_cogl_matrix_prefix_print (" ", mult->matrix);
continue;
}
case COGL_MATRIX_OP_LOAD:
{
CoglMatrixEntryLoad *load = (CoglMatrixEntryLoad *)entry;
- u_print (" LOAD:\n");
+ c_print (" LOAD:\n");
_cogl_matrix_prefix_print (" ", load->matrix);
continue;
}
case COGL_MATRIX_OP_SAVE:
- u_print (" SAVE\n");
+ c_print (" SAVE\n");
}
}
}
diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c
index cc0a4482..03968392 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 <ulib.h>
+#include <clib.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++)
- u_print ("%s\t%f %f %f %f\n", prefix, m[i], m[4+i], m[8+i], m[12+i] );
+ c_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);
- u_print ("%sMatrix type: %s, flags: %x\n",
+ c_print ("%sMatrix type: %s, flags: %x\n",
prefix, types[matrix->type], (int)matrix->flags);
}
else
- u_print ("%sMatrix type: DIRTY, flags: %x\n",
+ c_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 u_hash_table_new() and a
+ * to the prototype suitable for use with c_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 (U_LIKELY (matrix))
- return u_slice_dup (CoglMatrix, matrix);
+ if (C_LIKELY (matrix))
+ return c_slice_dup (CoglMatrix, matrix);
return NULL;
}
@@ -1957,7 +1957,7 @@ cogl_matrix_copy (const CoglMatrix *matrix)
void
cogl_matrix_free (CoglMatrix *matrix)
{
- u_slice_free (CoglMatrix, matrix);
+ c_slice_free (CoglMatrix, matrix);
}
const float *
diff --git a/cogl/cogl-memory-stack-private.h b/cogl/cogl-memory-stack-private.h
index 218b3c33..7a21cd43 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 <ulib.h>
+#include <clib.h>
typedef struct _CoglMemoryStack CoglMemoryStack;
diff --git a/cogl/cogl-memory-stack.c b/cogl/cogl-memory-stack.c
index eabda3f0..39247236 100644
--- a/cogl/cogl-memory-stack.c
+++ b/cogl/cogl-memory-stack.c
@@ -63,7 +63,7 @@
#include <stdint.h>
-#include <ulib.h>
+#include <clib.h>
typedef struct _CoglMemorySubStack
{
@@ -83,9 +83,9 @@ struct _CoglMemoryStack
static CoglMemorySubStack *
_cogl_memory_sub_stack_alloc (size_t bytes)
{
- CoglMemorySubStack *sub_stack = u_slice_new (CoglMemorySubStack);
+ CoglMemorySubStack *sub_stack = c_slice_new (CoglMemorySubStack);
sub_stack->bytes = bytes;
- sub_stack->data = u_malloc (bytes);
+ sub_stack->data = c_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 = u_slice_new0 (CoglMemoryStack);
+ CoglMemoryStack *stack = c_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 (U_LIKELY (sub_stack->bytes - stack->sub_stack_offset >= bytes))
+ if (C_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)
{
- u_free (sub_stack->data);
- u_slice_free (CoglMemorySubStack, sub_stack);
+ c_free (sub_stack->data);
+ c_slice_free (CoglMemorySubStack, sub_stack);
}
void
@@ -192,5 +192,5 @@ _cogl_memory_stack_free (CoglMemoryStack *stack)
_cogl_memory_sub_stack_free (sub_stack);
}
- u_slice_free (CoglMemoryStack, stack);
+ c_slice_free (CoglMemoryStack, stack);
}
diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h
index 7ddef4cf..e5f37069 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 <ulib.h>
+#include <clib.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];
- UArray *user_data_array;
+ CArray *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) U_STMT_START { \
+#define _COGL_OBJECT_DEBUG_REF(type_name, object) C_STMT_START { \
CoglObject *__obj = (CoglObject *)object; \
COGL_NOTE (OBJECT, "COGL %s REF %p %i", \
(__obj)->klass->name, \
- (__obj), (__obj)->ref_count); } U_STMT_END
+ (__obj), (__obj)->ref_count); } C_STMT_END
-#define _COGL_OBJECT_DEBUG_UNREF(type_name, object) U_STMT_START { \
+#define _COGL_OBJECT_DEBUG_UNREF(type_name, object) C_STMT_START { \
CoglObject *__obj = (CoglObject *)object; \
COGL_NOTE (OBJECT, "COGL %s UNREF %p %i", \
(__obj)->klass->name, \
- (__obj), (__obj)->ref_count - 1); } U_STMT_END
+ (__obj), (__obj)->ref_count - 1); } C_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 = \
- u_hash_table_new (u_str_hash, u_str_equal); \
+ c_hash_table_new (c_str_hash, c_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, \
\
- u_hash_table_insert (_cogl_debug_instances, \
+ c_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 ae639d56..6b71a14b 100644
--- a/cogl/cogl-object.c
+++ b/cogl/cogl-object.c
@@ -33,7 +33,7 @@
#include "config.h"
#endif
-#include <ulib.h>
+#include <clib.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 =
- &u_array_index (obj->user_data_array,
+ &c_array_index (obj->user_data_array,
CoglUserDataEntry, i);
if (entry->destroy)
entry->destroy (entry->user_data, obj);
}
- u_array_free (obj->user_data_array, TRUE);
+ c_array_free (obj->user_data_array, TRUE);
}
}
@@ -126,12 +126,12 @@ _cogl_object_find_entry (CoglObject *object, CoglUserDataKey *key)
entry = current;
}
- if (U_UNLIKELY (object->user_data_array != NULL))
+ if (C_UNLIKELY (object->user_data_array != NULL))
{
for (i = 0; i < object->user_data_array->len; i++)
{
CoglUserDataEntry *current =
- &u_array_index (object->user_data_array, CoglUserDataEntry, i);
+ &c_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 (U_LIKELY (entry->destroy))
+ if (C_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 (U_LIKELY (object->n_user_data_entries <
+ if (C_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 (U_UNLIKELY (object->user_data_array == NULL))
+ if (C_UNLIKELY (object->user_data_array == NULL))
{
object->user_data_array =
- u_array_new (FALSE, FALSE, sizeof (CoglUserDataEntry));
+ c_array_new (FALSE, FALSE, sizeof (CoglUserDataEntry));
}
- u_array_set_size (object->user_data_array,
+ c_array_set_size (object->user_data_array,
object->user_data_array->len + 1);
entry =
- &u_array_index (object->user_data_array, CoglUserDataEntry,
+ &c_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 =
- &u_array_index (object->user_data_array, CoglUserDataEntry, i);
+ &c_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)
{
- UHashTableIter iter;
+ CHashTableIter iter;
unsigned int *instance_count;
CoglDebugObjectTypeInfo info;
- u_hash_table_iter_init (&iter, _cogl_debug_instances);
- while (u_hash_table_iter_next (&iter,
+ c_hash_table_iter_init (&iter, _cogl_debug_instances);
+ while (c_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)
{
- u_print ("\t%s: %u\n", info->name, info->instance_count);
+ c_print ("\t%s: %u\n", info->name, info->instance_count);
}
void
cogl_debug_object_print_instances (void)
{
- u_print ("Cogl instances:\n");
+ c_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 df1ab932..16a57fee 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)
* {
- * u_free (data);
+ * c_free (data);
* }
*
* static void
diff --git a/cogl/cogl-onscreen-private.h b/cogl/cogl-onscreen-private.h
index eb4fd4bc..09421623 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 <ulib.h>
+#include <clib.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() */
- UQueue pending_frame_infos;
+ CQueue pending_frame_infos;
void *winsys;
};
diff --git a/cogl/cogl-onscreen-template.c b/cogl/cogl-onscreen-template.c
index 6ad624a9..92799ac4 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)
{
- u_slice_free (CoglOnscreenTemplate, onscreen_template);
+ c_slice_free (CoglOnscreenTemplate, onscreen_template);
}
CoglOnscreenTemplate *
cogl_onscreen_template_new (void)
{
- CoglOnscreenTemplate *onscreen_template = u_slice_new0 (CoglOnscreenTemplate);
+ CoglOnscreenTemplate *onscreen_template = c_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 7d5f288a..13c544df 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 = u_new0 (CoglOnscreen, 1);
+ onscreen = c_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 = u_queue_pop_tail (&onscreen->pending_frame_infos)))
+ while ((frame_info = c_queue_pop_tail (&onscreen->pending_frame_infos)))
cogl_object_unref (frame_info);
- u_queue_clear (&onscreen->pending_frame_infos);
+ c_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);
- u_free (onscreen);
+ c_free (onscreen);
}
static void
@@ -150,7 +150,7 @@ _cogl_dispatch_onscreen_cb (CoglContext *context)
cogl_object_unref (onscreen);
cogl_object_unref (info);
- u_slice_free (CoglOnscreenEvent, event);
+ c_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);
- u_slice_free (CoglOnscreenQueuedDirty, qe);
+ c_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 = u_slice_new (CoglOnscreenQueuedDirty);
+ CoglOnscreenQueuedDirty *qe = c_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 = u_slice_new (CoglOnscreenEvent);
+ CoglOnscreenEvent *event = c_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;
- u_queue_push_tail (&onscreen->pending_frame_infos, info);
+ c_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;
- u_warn_if_fail (onscreen->pending_frame_infos.length == 1);
+ c_warn_if_fail (onscreen->pending_frame_infos.length == 1);
- info = u_queue_pop_tail (&onscreen->pending_frame_infos);
+ info = c_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;
- u_queue_push_tail (&onscreen->pending_frame_infos, info);
+ c_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;
- u_warn_if_fail (onscreen->pending_frame_infos.length == 1);
+ c_warn_if_fail (onscreen->pending_frame_infos.length == 1);
- info = u_queue_pop_tail (&onscreen->pending_frame_infos);
+ info = c_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 d49bb572..de9361ea 100644
--- a/cogl/cogl-output.c
+++ b/cogl/cogl-output.c
@@ -45,8 +45,8 @@ _cogl_output_new (const char *name)
{
CoglOutput *output;
- output = u_slice_new0 (CoglOutput);
- output->name = u_strdup (name);
+ output = c_slice_new0 (CoglOutput);
+ output->name = c_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)
{
- u_free (output->name);
+ c_free (output->name);
- u_slice_free (CoglOutput, output);
+ c_slice_free (CoglOutput, output);
}
CoglBool
_cogl_output_values_equal (CoglOutput *output,
CoglOutput *other)
{
- 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;
+ return memcmp ((const char *)output + C_STRUCT_OFFSET (CoglOutput, x),
+ (const char *)other + C_STRUCT_OFFSET (CoglOutput, x),
+ sizeof (CoglOutput) - C_STRUCT_OFFSET (CoglOutput, x)) == 0;
}
int
diff --git a/cogl/cogl-pipeline-cache.c b/cogl/cogl-pipeline-cache.c
index 04fcff3d..4e004bfc 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 = u_new (CoglPipelineCache, 1);
+ CoglPipelineCache *cache = c_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);
- u_free (cache);
+ c_free (cache);
}
CoglPipelineCacheEntry *
@@ -128,7 +128,7 @@ create_pipelines (CoglPipeline **pipelines,
for (i = 0; i < n_pipelines; i++)
{
- char *source = u_strdup_printf (" cogl_color_out = "
+ char *source = c_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);
- u_free (source);
+ c_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 */
- 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);
+ c_assert_cmpint (c_hash_table_size (fragment_hash->table), ==, 18);
+ c_assert_cmpint (c_hash_table_size (combined_hash->table), ==, 18);
+ c_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
+ c_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 */
- u_assert_cmpint (u_hash_table_size (fragment_hash->table), ==, 27);
- u_assert_cmpint (u_hash_table_size (combined_hash->table), ==, 27);
+ c_assert_cmpint (c_hash_table_size (fragment_hash->table), ==, 27);
+ c_assert_cmpint (c_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. */
- u_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
- u_assert_cmpint (combined_hash->expected_min_size, ==, 17);
+ c_assert_cmpint (fragment_hash->expected_min_size, ==, 17);
+ c_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 24adc259..31de8676 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 <ulib.h>
+#include <clib.h>
typedef struct
{
int parent_id;
int *node_id_ptr;
- UString *graph;
+ CString *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;
- UString *changes_label;
+ CString *changes_label;
CoglBool changes = FALSE;
if (state->parent_id >= 0)
- u_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n",
+ c_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n",
state->indent, "",
layer->_parent.parent,
layer);
- u_string_append_printf (state->graph,
+ c_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 = u_string_new ("");
- u_string_append_printf (changes_label,
+ changes_label = c_string_new ("");
+ c_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;
- u_string_append_printf (changes_label,
+ c_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;
- u_string_append_printf (changes_label,
+ c_string_append_printf (changes_label,
"\\ltexture=%p\\n",
layer->texture);
}
if (changes)
{
- u_string_append_printf (changes_label, "\"];\n");
- u_string_append (state->graph, changes_label->str);
- u_string_free (changes_label, TRUE);
+ c_string_append_printf (changes_label, "\"];\n");
+ c_string_append (state->graph, changes_label->str);
+ c_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;
- u_string_append_printf (state->graph,
+ c_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;
- UString *changes_label;
+ CString *changes_label;
CoglBool changes = FALSE;
CoglBool layers = FALSE;
if (state->parent_id >= 0)
- u_string_append_printf (state->graph, "%*spipeline%d -> pipeline%d;\n",
+ c_string_append_printf (state->graph, "%*spipeline%d -> pipeline%d;\n",
state->indent, "",
state->parent_id,
pipeline_id);
- u_string_append_printf (state->graph,
+ c_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 = u_string_new ("");
- u_string_append_printf (changes_label,
+ changes_label = c_string_new ("");
+ c_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;
- u_string_append_printf (changes_label,
+ c_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";
}
- u_string_append_printf (changes_label,
+ c_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;
- u_string_append_printf (changes_label, "\\ln_layers=%d\\n",
+ c_string_append_printf (changes_label, "\\ln_layers=%d\\n",
pipeline->n_layers);
}
if (changes)
{
- u_string_append_printf (changes_label, "\"];\n");
- u_string_append (state->graph, changes_label->str);
- u_string_free (changes_label, TRUE);
+ c_string_append_printf (changes_label, "\"];\n");
+ c_string_append (state->graph, changes_label->str);
+ c_string_free (changes_label, TRUE);
}
if (layers)
{
- u_list_foreach (pipeline->layer_differences,
+ c_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)
{
- UString *graph;
+ CString *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 = u_string_new ("");
- u_string_append_printf (graph, "digraph {\n");
+ graph = c_string_new ("");
+ c_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);
- u_string_append_printf (graph, "}\n");
+ c_string_append_printf (graph, "}\n");
if (filename)
- u_file_set_contents (filename, graph->str, -1, NULL);
+ c_file_set_contents (filename, graph->str, -1, NULL);
else
- u_print ("%s", graph->str);
+ c_print ("%s", graph->str);
- u_string_free (graph, TRUE);
+ c_string_free (graph, TRUE);
}
diff --git a/cogl/cogl-pipeline-hash-table.c b/cogl/cogl-pipeline-hash-table.c
index 84435b12..3ce50b55 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 UHashTable. */
+ * outside of the CHashTable. */
unsigned int hash_value;
- /* UHashTable annoyingly doesn't let us pass a user data pointer to
+ /* CHashTable 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);
- u_slice_free (CoglPipelineHashTableEntry, entry);
+ c_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 = u_hash_table_new_full (entry_hash,
+ hash->table = c_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)
{
- u_hash_table_destroy (hash->table);
+ c_hash_table_destroy (hash->table);
}
static void
@@ -123,11 +123,11 @@ collect_prunable_entries_cb (void *key,
void *value,
void *user_data)
{
- UQueue *entries = user_data;
+ CQueue *entries = user_data;
CoglPipelineCacheEntry *entry = value;
if (entry->usage_count == 0)
- u_queue_push_tail (entries, entry);
+ c_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)
{
- UQueue entries;
- UList *l;
+ CQueue entries;
+ CList *l;
int i;
- /* Collect all of the prunable entries into a UQueue */
- u_queue_init (&entries);
- u_hash_table_foreach (hash->table,
+ /* Collect all of the prunable entries into a CQueue */
+ c_queue_init (&entries);
+ c_hash_table_foreach (hash->table,
collect_prunable_entries_cb,
&entries);
/* Sort the entries by increasing order of age */
- entries.head = u_list_sort (entries.head, compare_pipeline_age_cb);
+ entries.head = c_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 = (u_hash_table_size (hash->table) -
+ hash->expected_min_size = (c_hash_table_size (hash->table) -
entries.length +
1);
@@ -169,10 +169,10 @@ prune_old_pipelines (CoglPipelineHashTable *hash)
{
CoglPipelineCacheEntry *entry = l->data;
- u_hash_table_remove (hash->table, entry);
+ c_hash_table_remove (hash->table, entry);
}
- u_list_free (entries.head);
+ c_list_free (entries.head);
}
CoglPipelineCacheEntry *
@@ -189,7 +189,7 @@ _cogl_pipeline_hash_table_get (CoglPipelineHashTable *hash,
hash->main_state,
hash->layer_state,
0);
- entry = u_hash_table_lookup (hash->table, &dummy_entry);
+ entry = c_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)
- u_warning ("Over 50 separate %s have been generated which is very "
+ c_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 (u_hash_table_size (hash->table) >= hash->expected_min_size * 2)
+ if (c_hash_table_size (hash->table) >= hash->expected_min_size * 2)
prune_old_pipelines (hash);
- entry = u_slice_new (CoglPipelineHashTableEntry);
+ entry = c_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);
- u_hash_table_insert (hash->table, entry, entry);
+ c_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 40ed8110..50668423 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;
- UHashTable *table;
+ CHashTable *table;
} CoglPipelineHashTable;
void
diff --git a/cogl/cogl-pipeline-layer-private.h b/cogl/cogl-pipeline-layer-private.h
index 5e6bd413..45aa47df 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 <ulib.h>
+#include <clib.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 d9cf0827..bed8313d 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;
- u_assert (layer->owner == pipeline);
+ c_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);
- u_assert (layer->owner == pipeline);
+ c_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)
{
- u_warning ("The default 3D texture was set on a pipeline but "
+ c_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)
{
- u_warning ("The default rectangle texture was set on a pipeline but "
+ c_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;
- u_assert (layer->owner == pipeline);
+ c_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)
- u_warning ("Point sprite texture coordinates are enabled "
+ c_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;
- u_assert (layer->owner == pipeline);
+ c_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:
- u_warning ("Unexpected texture combine source");
+ c_warning ("Unexpected texture combine source");
texture_combine_src[i] = COGL_PIPELINE_COMBINE_SOURCE_TEXTURE;
}
@@ -1243,7 +1243,7 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
{
layer->differences &= ~state;
- u_assert (layer->owner == pipeline);
+ c_assert (layer->owner == pipeline);
if (layer->differences == 0)
_cogl_pipeline_prune_empty_layer_difference (pipeline,
layer);
@@ -1323,7 +1323,7 @@ cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline,
{
layer->differences &= ~state;
- u_assert (layer->owner == pipeline);
+ c_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 b4484230..77574773 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 = u_slice_new (CoglPipelineLayerBigState);
+ dest->big_state = c_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:
- u_warn_if_reached ();
+ c_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:
- u_return_if_reached ();
+ c_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 = u_slice_new (CoglPipelineLayerBigState);
+ layer->big_state = c_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 = u_slice_new (CoglPipelineLayer);
+ CoglPipelineLayer *layer = c_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)
{
- USList *head0 = NULL;
- USList *head1 = NULL;
+ CSList *head0 = NULL;
+ CSList *head1 = NULL;
CoglPipelineLayer *node0;
CoglPipelineLayer *node1;
int len0 = 0;
int len1 = 0;
int count;
- USList *common_ancestor0;
- USList *common_ancestor1;
+ CSList *common_ancestor0;
+ CSList *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))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
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))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
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)));
- u_assert (remaining == 0);
+ c_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)
- u_slice_free (CoglPipelineLayerBigState, layer->big_state);
+ c_slice_free (CoglPipelineLayerBigState, layer->big_state);
- u_slice_free (CoglPipelineLayer, layer);
+ c_slice_free (CoglPipelineLayer, layer);
}
void
_cogl_pipeline_init_default_layers (void)
{
- CoglPipelineLayer *layer = u_slice_new0 (CoglPipelineLayer);
+ CoglPipelineLayer *layer = c_slice_new0 (CoglPipelineLayer);
CoglPipelineLayerBigState *big_state =
- u_slice_new0 (CoglPipelineLayerBigState);
+ c_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);
- u_assert (new == ctx->default_layer_n);
+ c_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 0a4b7e19..cfbd0bc6 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 <ulib.h>
+#include <clib.h>
#define COGL_PIPELINE_PROGEND_GLSL 0
#define COGL_PIPELINE_PROGEND_NOP 1
@@ -336,7 +336,7 @@ struct _CoglPipeline
*
* This is sparse state, ref COGL_PIPELINE_STATE_LAYERS */
unsigned int n_layers;
- UList *layer_differences;
+ CList *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
@@ -688,7 +688,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func);
* static void
* destroy_cache_cb (CoglObject *object, void *user_data)
* {
- * u_slice_free (MyValidatedMaterialCache, user_data);
+ * c_slice_free (MyValidatedMaterialCache, user_data);
* }
*
* static void
@@ -705,16 +705,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 (U_UNLIKELY (cache == NULL))
+ * if (C_UNLIKELY (cache == NULL))
* {
- * cache = u_slice_new (MyValidatedMaterialCache);
+ * cache = c_slice_new (MyValidatedMaterialCache);
* cogl_object_set_user_data (COGL_OBJECT (source),
* &_cogl_my_cache_key,
* cache, destroy_cache_cb);
* cache->validated_source = source;
* }
*
- * if (U_UNLIKELY (cache->validated_source == NULL))
+ * if (C_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 5e19f73c..77390510 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 <ulib.h>
+#include <clib.h>
#include "cogl-snippet.h"
typedef struct
{
- UList *entries;
+ CList *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 */
- UString *source_buf;
+ CString *source_buf;
} CoglPipelineSnippetData;
void
_cogl_pipeline_snippet_generate_code (const CoglPipelineSnippetData *data);
void
-_cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
+_cogl_pipeline_snippet_generate_declarations (CString *declarations_buf,
CoglSnippetHook hook,
CoglPipelineSnippetList *list);
diff --git a/cogl/cogl-pipeline-snippet.c b/cogl/cogl-pipeline-snippet.c
index f09aa055..da5c04b5 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)
{
- UList *first_snippet, *l;
+ CList *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)
- u_string_append_printf (data->source_buf,
+ c_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
- u_string_append_printf (data->source_buf,
+ c_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)))
- u_string_append (data->source_buf, source);
+ c_string_append (data->source_buf, source);
- u_string_append_printf (data->source_buf,
+ c_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)
- u_string_append_printf (data->source_buf,
+ c_string_append_printf (data->source_buf,
"%s_%i",
data->function_prefix,
snippet_num);
else
- u_string_append (data->source_buf, data->final_name);
+ c_string_append (data->source_buf, data->final_name);
- u_string_append (data->source_buf, " (");
+ c_string_append (data->source_buf, " (");
if (data->argument_declarations)
- u_string_append (data->source_buf, data->argument_declarations);
+ c_string_append (data->source_buf, data->argument_declarations);
- u_string_append (data->source_buf,
+ c_string_append (data->source_buf,
")\n"
"{\n");
if (data->return_type && !data->return_variable_is_argument)
- u_string_append_printf (data->source_buf,
+ c_string_append_printf (data->source_buf,
" %s %s;\n"
"\n",
data->return_type,
data->return_variable);
if ((source = cogl_snippet_get_pre (snippet)))
- u_string_append (data->source_buf, source);
+ c_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)))
- u_string_append (data->source_buf, source);
+ c_string_append (data->source_buf, source);
else
{
- u_string_append (data->source_buf, " ");
+ c_string_append (data->source_buf, " ");
if (data->return_type)
- u_string_append_printf (data->source_buf,
+ c_string_append_printf (data->source_buf,
"%s = ",
data->return_variable);
if (snippet_num > 0)
- u_string_append_printf (data->source_buf,
+ c_string_append_printf (data->source_buf,
"%s_%i",
data->function_prefix,
snippet_num - 1);
else
- u_string_append (data->source_buf, data->chain_function);
+ c_string_append (data->source_buf, data->chain_function);
- u_string_append (data->source_buf, " (");
+ c_string_append (data->source_buf, " (");
if (data->arguments)
- u_string_append (data->source_buf, data->arguments);
+ c_string_append (data->source_buf, data->arguments);
- u_string_append (data->source_buf, ");\n");
+ c_string_append (data->source_buf, ");\n");
}
if ((source = cogl_snippet_get_post (snippet)))
- u_string_append (data->source_buf, source);
+ c_string_append (data->source_buf, source);
if (data->return_type)
- u_string_append_printf (data->source_buf,
+ c_string_append_printf (data->source_buf,
" return %s;\n",
data->return_variable);
- u_string_append (data->source_buf, "}\n");
+ c_string_append (data->source_buf, "}\n");
snippet_num++;
}
}
}
void
-_cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
+_cogl_pipeline_snippet_generate_declarations (CString *declarations_buf,
CoglSnippetHook hook,
CoglPipelineSnippetList *snippets)
{
- UList *l;
+ CList *l;
for (l = snippets->entries; l; l = l->next)
{
@@ -213,7 +213,7 @@ _cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
const char *source;
if ((source = cogl_snippet_get_declarations (snippet)))
- u_string_append (declarations_buf, source);
+ c_string_append (declarations_buf, source);
}
}
}
@@ -221,14 +221,14 @@ _cogl_pipeline_snippet_generate_declarations (UString *declarations_buf,
void
_cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list)
{
- UList *l, *tmp;
+ CList *l, *tmp;
for (l = list->entries; l; l = tmp)
{
tmp = l->next;
cogl_object_unref (l->data);
- u_list_free_1 (l);
+ c_list_free_1 (l);
}
}
@@ -236,7 +236,7 @@ void
_cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list,
CoglSnippet *snippet)
{
- list->entries = u_list_append (list->entries, cogl_object_ref (snippet));
+ list->entries = c_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)
{
- UQueue queue = U_QUEUE_INIT;
- const UList *l;
+ CQueue queue = C_QUEUE_INIT;
+ const CList *l;
for (l = src->entries; l; l = l->next)
- u_queue_push_tail (&queue, cogl_object_ref (l->data));
+ c_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)
{
- UList *l;
+ CList *l;
for (l = list->entries; l; l = l->next)
{
@@ -274,7 +274,7 @@ CoglBool
_cogl_pipeline_snippet_list_equal (CoglPipelineSnippetList *list0,
CoglPipelineSnippetList *list1)
{
- UList *l0, *l1;
+ CList *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 bf44d71a..9c506379 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 = u_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
- values1 = u_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
+ values0 = c_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
+ values1 = c_alloca (sizeof (const CoglBoxedValue *) * ctx->n_uniform_names);
n_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names);
- differences = u_alloca (n_longs * sizeof (unsigned long));
+ differences = c_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
- u_warning ("Unable to determine valid blend factor from blend string\n");
+ c_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:
- u_warning ("Unsupported blend function given");
+ c_warning ("Unsupported blend function given");
*blend_equation = GL_FUNC_ADD;
}
@@ -1069,9 +1069,9 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, 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);
+ c_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
+ c_return_val_if_fail (location >= 0, NULL);
+ c_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.
@@ -1102,8 +1102,8 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
if (uniforms_state->override_values == NULL)
{
- u_assert (override_index == 0);
- uniforms_state->override_values = u_new (CoglBoxedValue, 1);
+ c_assert (override_index == 0);
+ uniforms_state->override_values = c_new (CoglBoxedValue, 1);
}
else
{
@@ -1111,7 +1111,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 = u_new (CoglBoxedValue, old_size + 1);
+ uniforms_state->override_values = c_new (CoglBoxedValue, old_size + 1);
/* Copy in the old values leaving a gap for the new value */
memcpy (uniforms_state->override_values,
@@ -1121,7 +1121,7 @@ _cogl_pipeline_override_uniform (CoglPipeline *pipeline,
old_values + override_index,
sizeof (CoglBoxedValue) * (old_size - override_index));
- u_free (old_values);
+ c_free (old_values);
}
_cogl_boxed_value_init (uniforms_state->override_values + override_index);
@@ -1240,9 +1240,9 @@ void
cogl_pipeline_add_snippet (CoglPipeline *pipeline,
CoglSnippet *snippet)
{
- 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);
+ c_return_if_fail (cogl_is_pipeline (pipeline));
+ c_return_if_fail (cogl_is_snippet (snippet));
+ c_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);
@@ -1516,7 +1516,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 */
- u_warn_if_reached ();
+ c_warn_if_reached ();
}
void
@@ -1524,15 +1524,15 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
CoglPipeline *pipeline0,
CoglPipeline *pipeline1)
{
- USList *head0 = NULL;
- USList *head1 = NULL;
+ CSList *head0 = NULL;
+ CSList *head1 = NULL;
CoglPipeline *node0;
CoglPipeline *node1;
int len0 = 0;
int len1 = 0;
int count;
- USList *common_ancestor0;
- USList *common_ancestor1;
+ CSList *common_ancestor0;
+ CSList *common_ancestor1;
/* This algorithm is copied from
_cogl_pipeline_compare_differences(). It might be nice to share
@@ -1540,7 +1540,7 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
link->next = head0;
link->data = node0;
head0 = link;
@@ -1548,7 +1548,7 @@ _cogl_pipeline_compare_uniform_differences (unsigned long *differences,
}
for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
link->next = head1;
link->data = node1;
head1 = link;
@@ -1641,7 +1641,7 @@ UNIT_TEST (check_blend_constant_ancestry,
for (node = (CoglNode *) pipeline; node; node = node->parent)
pipeline_length++;
- u_assert_cmpint (pipeline_length, <=, 2);
+ c_assert_cmpint (pipeline_length, <=, 2);
cogl_object_unref (pipeline);
}
@@ -1676,7 +1676,7 @@ UNIT_TEST (check_uniform_ancestry,
for (node = (CoglNode *) pipeline; node; node = node->parent)
pipeline_length++;
- u_assert_cmpint (pipeline_length, <=, 2);
+ c_assert_cmpint (pipeline_length, <=, 2);
cogl_object_unref (pipeline);
}
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index a6af7615..112709d0 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -50,7 +50,7 @@
#include "cogl-depth-state-private.h"
#include "cogl-private.h"
-#include <ulib.h>
+#include <clib.h>
#include <string.h>
static void _cogl_pipeline_free (CoglPipeline *tex);
@@ -98,10 +98,10 @@ void
_cogl_pipeline_init_default_pipeline (void)
{
/* Create new - blank - pipeline */
- CoglPipeline *pipeline = u_slice_new0 (CoglPipeline);
+ CoglPipeline *pipeline = c_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 = u_slice_new0 (CoglPipelineBigState);
+ CoglPipelineBigState *big_state = c_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;
@@ -223,8 +223,8 @@ recursively_free_layer_caches (CoglPipeline *pipeline)
if (pipeline->layers_cache_dirty)
return;
- if (U_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache))
- u_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers,
+ if (C_UNLIKELY (pipeline->layers_cache != pipeline->short_layers_cache))
+ c_slice_free1 (sizeof (CoglPipelineLayer *) * pipeline->n_layers,
pipeline->layers_cache);
pipeline->layers_cache_dirty = TRUE;
@@ -315,7 +315,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
static CoglPipeline *
_cogl_pipeline_copy (CoglPipeline *src, CoglBool is_weak)
{
- CoglPipeline *pipeline = u_slice_new (CoglPipeline);
+ CoglPipeline *pipeline = c_slice_new (CoglPipeline);
_cogl_pipeline_node_init (COGL_NODE (pipeline));
@@ -423,7 +423,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
destroy_weak_children_cb,
NULL);
- u_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children));
+ c_assert (_cogl_list_empty (&COGL_NODE (pipeline)->children));
_cogl_pipeline_unparent (COGL_NODE (pipeline));
@@ -436,7 +436,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
for (i = 0; i < n_overrides; i++)
_cogl_boxed_value_destroy (uniforms_state->override_values + i);
- u_free (uniforms_state->override_values);
+ c_free (uniforms_state->override_values);
_cogl_bitmask_destroy (&uniforms_state->override_mask);
_cogl_bitmask_destroy (&uniforms_state->changed_mask);
@@ -444,9 +444,9 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
{
- u_list_foreach (pipeline->layer_differences,
+ c_list_foreach (pipeline->layer_differences,
(GFunc)cogl_object_unref, NULL);
- u_list_free (pipeline->layer_differences);
+ c_list_free (pipeline->layer_differences);
}
if (pipeline->differences & COGL_PIPELINE_STATE_VERTEX_SNIPPETS)
@@ -458,9 +458,9 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
recursively_free_layer_caches (pipeline);
if (pipeline->differences & COGL_PIPELINE_STATE_NEEDS_BIG_STATE)
- u_slice_free (CoglPipelineBigState, pipeline->big_state);
+ c_slice_free (CoglPipelineBigState, pipeline->big_state);
- u_slice_free (CoglPipeline, pipeline);
+ c_slice_free (CoglPipeline, pipeline);
}
CoglBool
@@ -479,24 +479,24 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
CoglPipeline *current;
int layers_found;
- if (U_LIKELY (!pipeline->layers_cache_dirty) ||
+ if (C_LIKELY (!pipeline->layers_cache_dirty) ||
pipeline->n_layers == 0)
return;
pipeline->layers_cache_dirty = FALSE;
n_layers = pipeline->n_layers;
- if (U_LIKELY (n_layers < U_N_ELEMENTS (pipeline->short_layers_cache)))
+ if (C_LIKELY (n_layers < C_N_ELEMENTS (pipeline->short_layers_cache)))
{
pipeline->layers_cache = pipeline->short_layers_cache;
memset (pipeline->layers_cache, 0,
sizeof (CoglPipelineLayer *) *
- U_N_ELEMENTS (pipeline->short_layers_cache));
+ C_N_ELEMENTS (pipeline->short_layers_cache));
}
else
{
pipeline->layers_cache =
- u_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers);
+ c_slice_alloc0 (sizeof (CoglPipelineLayer *) * n_layers);
}
/* Notes:
@@ -527,7 +527,7 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
_cogl_pipeline_get_parent (current);
current = _cogl_pipeline_get_parent (current))
{
- UList *l;
+ CList *l;
if (!(current->differences & COGL_PIPELINE_STATE_LAYERS))
continue;
@@ -547,7 +547,7 @@ _cogl_pipeline_update_layers_cache (CoglPipeline *pipeline)
}
}
- u_warn_if_reached ();
+ c_warn_if_reached ();
}
/* XXX: Be carefull when using this API that the callback given doesn't result
@@ -638,7 +638,7 @@ cogl_pipeline_foreach_layer (CoglPipeline *pipeline,
* user doesn't remove layers. */
state.i = 0;
- state.indices = u_alloca (authority->n_layers * sizeof (int));
+ state.indices = c_alloca (authority->n_layers * sizeof (int));
_cogl_pipeline_foreach_layer_internal (pipeline,
append_layer_index_cb,
@@ -738,7 +738,7 @@ _cogl_pipeline_needs_blending_enabled (CoglPipeline *pipeline,
CoglPipelineBlendState *blend_state;
CoglPipelineBlendEnable enabled;
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
return FALSE;
/* We unconditionally check the _BLEND_ENABLE state first because
@@ -849,15 +849,15 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
if (differences & COGL_PIPELINE_STATE_LAYERS)
{
- UList *l;
+ CList *l;
if (dest->differences & COGL_PIPELINE_STATE_LAYERS &&
dest->layer_differences)
{
- u_list_foreach (dest->layer_differences,
+ c_list_foreach (dest->layer_differences,
(GFunc)cogl_object_unref,
NULL);
- u_list_free (dest->layer_differences);
+ c_list_free (dest->layer_differences);
}
for (l = src->layer_differences; l; l = l->next)
@@ -881,7 +881,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
{
if (!dest->has_big_state)
{
- dest->big_state = u_slice_new (CoglPipelineBigState);
+ dest->big_state = c_slice_new (CoglPipelineBigState);
dest->has_big_state = TRUE;
}
big_state = dest->big_state;
@@ -941,7 +941,7 @@ _cogl_pipeline_copy_differences (CoglPipeline *dest,
int i;
big_state->uniforms_state.override_values =
- u_malloc (n_overrides * sizeof (CoglBoxedValue));
+ c_malloc (n_overrides * sizeof (CoglBoxedValue));
for (i = 0; i < n_overrides; i++)
{
@@ -1005,7 +1005,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:
- u_return_if_reached ();
+ c_return_if_reached ();
case COGL_PIPELINE_STATE_LAYERS:
pipeline->n_layers = authority->n_layers;
@@ -1275,7 +1275,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
if (change & COGL_PIPELINE_STATE_NEEDS_BIG_STATE &&
!pipeline->has_big_state)
{
- pipeline->big_state = u_slice_new (CoglPipelineBigState);
+ pipeline->big_state = c_slice_new (CoglPipelineBigState);
pipeline->has_big_state = TRUE;
}
@@ -1344,7 +1344,7 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
pipeline->layer_differences =
- u_list_prepend (pipeline->layer_differences, layer);
+ c_list_prepend (pipeline->layer_differences, layer);
if (inc_n_layers)
pipeline->n_layers++;
@@ -1388,7 +1388,7 @@ _cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline,
cogl_object_unref (layer);
pipeline->layer_differences =
- u_list_remove (pipeline->layer_differences, layer);
+ c_list_remove (pipeline->layer_differences, layer);
}
pipeline->differences |= COGL_PIPELINE_STATE_LAYERS;
@@ -1493,8 +1493,8 @@ _cogl_pipeline_prune_to_n_layers (CoglPipeline *pipeline, int n)
CoglPipeline *authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
CoglPipelinePruneLayersInfo state;
- UList *l;
- UList *next;
+ CList *l;
+ CList *next;
if (authority->n_layers <= n)
return;
@@ -1659,7 +1659,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 =
- u_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
+ c_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
@@ -1683,7 +1683,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. */
- u_assert (new == layer);
+ c_assert (new == layer);
}
layer->index = layer_index;
@@ -1710,8 +1710,8 @@ void
_cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
CoglPipelineLayer *layer)
{
- /* Find the UList link that references the empty layer */
- UList *link = u_list_find (layers_authority->layer_differences, layer);
+ /* Find the CList link that references the empty layer */
+ CList *link = c_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;
@@ -1751,7 +1751,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 =
- u_alloca (sizeof (CoglPipelineLayer *) * layers_authority->n_layers);
+ c_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
@@ -1828,7 +1828,7 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data)
if (texture == NULL)
{
- u_warning ("We don't have a fallback texture we can use to fill "
+ c_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... */
@@ -1945,15 +1945,15 @@ unsigned long
_cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
CoglPipeline *pipeline1)
{
- USList *head0 = NULL;
- USList *head1 = NULL;
+ CSList *head0 = NULL;
+ CSList *head1 = NULL;
CoglPipeline *node0;
CoglPipeline *node1;
int len0 = 0;
int len1 = 0;
int count;
- USList *common_ancestor0;
- USList *common_ancestor1;
+ CSList *common_ancestor0;
+ CSList *common_ancestor1;
unsigned long pipelines_difference = 0;
/* Algorithm:
@@ -1971,7 +1971,7 @@ _cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
for (node0 = pipeline0; node0; node0 = _cogl_pipeline_get_parent (node0))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
link->next = head0;
link->data = node0;
head0 = link;
@@ -1979,7 +1979,7 @@ _cogl_pipeline_compare_differences (CoglPipeline *pipeline0,
}
for (node1 = pipeline1; node1; node1 = _cogl_pipeline_get_parent (node1))
{
- USList *link = alloca (sizeof (USList));
+ CSList *link = alloca (sizeof (CSList));
link->next = head1;
link->data = node1;
head1 = link;
@@ -2049,7 +2049,7 @@ _cogl_pipeline_resolve_authorities (CoglPipeline *pipeline,
}
while ((authority = _cogl_pipeline_get_parent (authority)));
- u_assert (remaining == 0);
+ c_assert (remaining == 0);
}
/* Comparison of two arbitrary pipelines is done by:
@@ -2221,7 +2221,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:
- u_warn_if_reached ();
+ c_warn_if_reached ();
}
}
COGL_FLAGS_FOREACH_END;
@@ -2254,7 +2254,7 @@ _cogl_pipeline_prune_redundant_ancestry (CoglPipeline *pipeline)
*/
if (pipeline->differences & COGL_PIPELINE_STATE_LAYERS)
{
- if (pipeline->n_layers != u_list_length (pipeline->layer_differences))
+ if (pipeline->n_layers != c_list_length (pipeline->layer_differences))
return;
}
@@ -2332,7 +2332,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 =
- u_alloca (sizeof (CoglPipelineLayer *) * authority->n_layers);
+ c_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
@@ -2776,7 +2776,7 @@ _cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline,
return authority0;
authority0_layers =
- u_alloca (sizeof (CoglPipelineLayer *) * n_layers);
+ c_alloca (sizeof (CoglPipelineLayer *) * n_layers);
state.i = 0;
state.layers = authority0_layers;
_cogl_pipeline_foreach_layer_internal (authority0,
@@ -2784,7 +2784,7 @@ _cogl_pipeline_find_equivalent_parent (CoglPipeline *pipeline,
&state);
authority1_layers =
- u_alloca (sizeof (CoglPipelineLayer *) * n_layers);
+ c_alloca (sizeof (CoglPipelineLayer *) * n_layers);
state.i = 0;
state.layers = authority1_layers;
_cogl_pipeline_foreach_layer_internal (authority1,
@@ -2885,15 +2885,15 @@ cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
be. */
/* Look for an existing uniform with this name */
- if (u_hash_table_lookup_extended (ctx->uniform_name_hash,
+ if (c_hash_table_lookup_extended (ctx->uniform_name_hash,
uniform_name,
NULL,
&location_ptr))
return GPOINTER_TO_INT (location_ptr);
- 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 = c_strdup (uniform_name);
+ c_ptr_array_add (ctx->uniform_names, uniform_name_copy);
+ c_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 1d4a58cf..a6b17498 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 <ulib.h>
+#include <clib.h>
COGL_BEGIN_DECLS
diff --git a/cogl/cogl-pixel-buffer.c b/cogl/cogl-pixel-buffer.c
index 20cb6700..218b02e3 100644
--- a/cogl/cogl-pixel-buffer.c
+++ b/cogl/cogl-pixel-buffer.c
@@ -43,7 +43,7 @@
#include <stdio.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.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 = u_slice_new0 (CoglPixelBuffer);
+ CoglPixelBuffer *pixel_buffer = c_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));
- u_slice_free (CoglPixelBuffer, buffer);
+ c_slice_free (CoglPixelBuffer, buffer);
}
diff --git a/cogl/cogl-point-in-poly-private.h b/cogl/cogl-point-in-poly-private.h
index df5cb6a9..f9a99183 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 <ulib.h>
+#include <clib.h>
COGL_BEGIN_DECLS
diff --git a/cogl/cogl-point-in-poly.c b/cogl/cogl-point-in-poly.c
index dea60ba7..5528771e 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 <ulib.h>
+#include <clib.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 deaec218..1f506733 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)
{
- UList *l, *next;
+ CList *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)
{
- UList *l, *next;
+ CList *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 = &u_array_index (renderer->poll_fds, CoglPollFD, i);
+ CoglPollFD *pollfd = &c_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);
- UList *l;
+ CList *l;
if (i < 0)
return;
- u_array_remove_index_fast (renderer->poll_fds, i);
+ c_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 =
- u_list_delete_link (renderer->poll_sources, l);
- u_slice_free (CoglPollSource, source);
+ c_list_delete_link (renderer->poll_sources, l);
+ c_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)
- u_warn_if_reached ();
+ c_warn_if_reached ();
else
{
CoglPollFD *pollfd =
- &u_array_index (renderer->poll_sources, CoglPollFD, fd_index);
+ &c_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 = u_slice_new0 (CoglPollSource);
+ source = c_slice_new0 (CoglPollSource);
source->fd = fd;
source->prepare = prepare;
source->dispatch = dispatch;
source->user_data = user_data;
- renderer->poll_sources = u_list_prepend (renderer->poll_sources, source);
+ renderer->poll_sources = c_list_prepend (renderer->poll_sources, source);
- u_array_append_val (renderer->poll_fds, pollfd);
+ c_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 = u_slice_new0 (CoglPollSource);
+ source = c_slice_new0 (CoglPollSource);
source->fd = -1;
source->prepare = prepare;
source->dispatch = dispatch;
source->user_data = user_data;
- renderer->poll_sources = u_list_prepend (renderer->poll_sources, source);
+ renderer->poll_sources = c_list_prepend (renderer->poll_sources, source);
return source;
}
@@ -240,15 +240,15 @@ void
_cogl_poll_renderer_remove_source (CoglRenderer *renderer,
CoglPollSource *source)
{
- UList *l;
+ CList *l;
for (l = renderer->poll_sources; l; l = l->next)
{
if (l->data == source)
{
renderer->poll_sources =
- u_list_delete_link (renderer->poll_sources, l);
- u_slice_free (CoglPollSource, source);
+ c_list_delete_link (renderer->poll_sources, l);
+ c_slice_free (CoglPollSource, source);
break;
}
}
diff --git a/cogl/cogl-primitive-texture.c b/cogl/cogl-primitive-texture.c
index 3a4d43bd..161fa67a 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);
- u_assert (texture->vtable->set_auto_mipmap != NULL);
+ c_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 cff9efd9..ca1fb7ae 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 = u_slice_alloc (sizeof (CoglPrimitive) +
+ primitive = c_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 = u_alloca (sizeof (CoglAttribute *) * n_attributes);
+ attributes = c_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)
- u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+ c_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
primitive->attributes);
if (primitive->indices)
cogl_object_unref (primitive->indices);
- u_slice_free1 (sizeof (CoglPrimitive) +
+ c_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)
{
- u_warning ("Mid-scene modification of primitives has "
+ c_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 (U_UNLIKELY (primitive->immutable_ref))
+ if (C_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)
- u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+ c_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
primitive->attributes);
primitive->attributes = &primitive->embedded_attribute;
}
else
{
if (primitive->attributes != &primitive->embedded_attribute)
- u_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
+ c_slice_free1 (sizeof (CoglAttribute *) * primitive->n_attributes,
primitive->attributes);
primitive->attributes =
- u_slice_alloc (sizeof (CoglAttribute *) * n_attributes);
+ c_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 (U_UNLIKELY (primitive->immutable_ref))
+ if (C_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 (U_UNLIKELY (primitive->immutable_ref))
+ if (C_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 (U_UNLIKELY (primitive->immutable_ref))
+ if (C_UNLIKELY (primitive->immutable_ref))
{
warn_about_midscene_changes ();
return;
diff --git a/cogl/cogl-primitives-private.h b/cogl/cogl-primitives-private.h
index 41038742..3da1392e 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 <ulib.h>
+#include <clib.h>
COGL_BEGIN_DECLS
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
index bf87808a..98b6656e 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)
- u_warning ("Skipping layers 1..n of your material since "
+ c_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)
- u_warning ("Skipping layer %d of your material "
+ c_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)
- u_warning ("Skipping layers 1..n of your pipeline since "
+ c_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)
- u_warning ("Skipping layer %d of your pipeline consisting of "
+ c_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 5e2bbc39..bb68e7a7 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)
{
- u_warning ("\n\n"
+ c_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"
- " u_main_loop_run (loop);\n"
+ " c_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) \
- U_STMT_START { \
+ C_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)); \
- } U_STMT_END;
+ } C_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);
- u_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, format, ap);
+ c_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 2d944699..91965a4b 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) 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_COUNTER_INC(A,B) C_STMT_START{ (void)0; }C_STMT_END
+#define COGL_COUNTER_DEC(A,B) C_STMT_START{ (void)0; }C_STMT_END
+#define COGL_TIMER_START(A,B) C_STMT_START{ (void)0; }C_STMT_END
+#define COGL_TIMER_STOP(A,B) C_STMT_START{ (void)0; }C_STMT_END
-#define _cogl_profile_trace_message u_message
+#define _cogl_profile_trace_message c_message
#endif
diff --git a/cogl/cogl-quaternion-private.h b/cogl/cogl-quaternion-private.h
index f079ca87..3dbe2ee7 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 <ulib.h>
+#include <clib.h>
/* squared length */
#define _COGL_QUATERNION_NORM(Q) \
diff --git a/cogl/cogl-quaternion.c b/cogl/cogl-quaternion.c
index 73eadd8d..014eeb77 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)
{
- u_print ("[ %6.4f (%6.4f, %6.4f, %6.4f)]\n",
+ c_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 (U_LIKELY (src))
+ if (C_LIKELY (src))
{
- CoglQuaternion *new = u_slice_new (CoglQuaternion);
+ CoglQuaternion *new = c_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)
{
- u_slice_free (CoglQuaternion, quaternion);
+ c_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 */
- u_assert (cos_difference < 1.1f);
+ c_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 */
- u_assert (cos_difference < 1.1f);
+ c_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 118ba6ae..92937567 100644
--- a/cogl/cogl-rectangle-map.c
+++ b/cogl/cogl-rectangle-map.c
@@ -35,7 +35,7 @@
#include "config.h"
#endif
-#include <ulib.h>
+#include <clib.h>
#include "cogl-util.h"
#include "cogl-rectangle-map.h"
@@ -79,12 +79,12 @@ struct _CoglRectangleMap
unsigned int space_remaining;
- UDestroyNotify value_destroy_func;
+ CDestroyNotify 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 */
- UArray *stack;
+ CArray *stack;
};
struct _CoglRectangleMapNode
@@ -123,21 +123,21 @@ struct _CoglRectangleMapStackEntry
static CoglRectangleMapNode *
_cogl_rectangle_map_node_new (void)
{
- return u_slice_new (CoglRectangleMapNode);
+ return c_slice_new (CoglRectangleMapNode);
}
static void
_cogl_rectangle_map_node_free (CoglRectangleMapNode *node)
{
- u_slice_free (CoglRectangleMapNode, node);
+ c_slice_free (CoglRectangleMapNode, node);
}
CoglRectangleMap *
_cogl_rectangle_map_new (unsigned int width,
unsigned int height,
- UDestroyNotify value_destroy_func)
+ CDestroyNotify value_destroy_func)
{
- CoglRectangleMap *map = u_new (CoglRectangleMap, 1);
+ CoglRectangleMap *map = c_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 = u_array_new (FALSE, FALSE, sizeof (CoglRectangleMapStackEntry));
+ map->stack = c_array_new (FALSE, FALSE, sizeof (CoglRectangleMapStackEntry));
return map;
}
static void
-_cogl_rectangle_map_stack_push (UArray *stack,
+_cogl_rectangle_map_stack_push (CArray *stack,
CoglRectangleMapNode *node,
CoglBool next_index)
{
CoglRectangleMapStackEntry *new_entry;
- u_array_set_size (stack, stack->len + 1);
+ c_array_set_size (stack, stack->len + 1);
- new_entry = &u_array_index (stack, CoglRectangleMapStackEntry,
+ new_entry = &c_array_index (stack, CoglRectangleMapStackEntry,
stack->len - 1);
new_entry->node = node;
@@ -175,15 +175,15 @@ _cogl_rectangle_map_stack_push (UArray *stack,
}
static void
-_cogl_rectangle_map_stack_pop (UArray *stack)
+_cogl_rectangle_map_stack_pop (CArray *stack)
{
- u_array_set_size (stack, stack->len - 1);
+ c_array_set_size (stack, stack->len - 1);
}
static CoglRectangleMapStackEntry *
-_cogl_rectangle_map_stack_get_top (UArray *stack)
+_cogl_rectangle_map_stack_get_top (CArray *stack)
{
- return &u_array_index (stack, CoglRectangleMapStackEntry,
+ return &c_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);
- u_assert (node->largest_gap ==
+ c_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:
- u_assert (node->largest_gap ==
+ c_assert (node->largest_gap ==
node->rectangle.width * node->rectangle.height);
return 0;
case COGL_RECTANGLE_MAP_FILLED_LEAF:
- u_assert (node->largest_gap == 0);
+ c_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);
- u_assert_cmpuint (actual_n_rectangles, ==, map->n_rectangles);
- u_assert_cmpuint (actual_space_remaining, ==, map->space_remaining);
+ c_assert_cmpuint (actual_n_rectangles, ==, map->n_rectangles);
+ c_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 */
- UArray *stack = map->stack;
+ CArray *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 */
- u_array_set_size (stack, 0);
+ c_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 */
- u_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
+ if (C_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 */
- u_return_if_reached ();
+ c_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 */
- u_assert (node->type == COGL_RECTANGLE_MAP_BRANCH);
+ c_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 */
- u_assert (map->n_rectangles > 0);
+ c_assert (map->n_rectangles > 0);
map->n_rectangles--;
/* and more space */
map->space_remaining += rectangle_size;
}
#ifdef COGL_ENABLE_DEBUG
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
+ if (C_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 */
- UArray *stack = map->stack;
+ CArray *stack = map->stack;
/* Start with the root node */
- u_array_set_size (stack, 0);
+ c_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 */
- u_assert (stack->len == 0);
+ c_assert (stack->len == 0);
}
typedef struct _CoglRectangleMapForeachClosure
@@ -701,9 +701,9 @@ _cogl_rectangle_map_free (CoglRectangleMap *map)
_cogl_rectangle_map_free_cb,
map);
- u_array_free (map->stack, TRUE);
+ c_array_free (map->stack, TRUE);
- u_free (map);
+ c_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 c2f11ce9..cd915d26 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 <ulib.h>
+#include <clib.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,
- UDestroyNotify value_destroy_func);
+ CDestroyNotify 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 98f2ae85..5d61f299 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 <umodule.h>
+#include <cmodule.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;
- UList *constraints;
+ CList *constraints;
- UArray *poll_fds;
+ CArray *poll_fds;
int poll_fds_age;
- UList *poll_sources;
+ CList *poll_sources;
CoglList idle_closures;
- UList *outputs;
+ CList *outputs;
#ifdef COGL_HAS_XLIB_SUPPORT
Display *foreign_xdpy;
@@ -98,7 +98,7 @@ struct _CoglRenderer
#endif
/* List of callback functions that will be given every native event */
- USList *event_filters;
+ CSList *event_filters;
void *winsys;
};
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 264ba264..0e4bda9e 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -222,7 +222,7 @@ typedef struct _CoglNativeFilterClosure
uint32_t
cogl_renderer_error_domain (void)
{
- return u_quark_from_static_string ("cogl-renderer-error-quark");
+ return c_quark_from_static_string ("cogl-renderer-error-quark");
}
static const CoglWinsysVtable *
@@ -234,7 +234,7 @@ _cogl_renderer_get_winsys (CoglRenderer *renderer)
static void
native_filter_closure_free (CoglNativeFilterClosure *closure)
{
- u_slice_free (CoglNativeFilterClosure, closure);
+ c_slice_free (CoglNativeFilterClosure, closure);
}
static void
@@ -249,30 +249,30 @@ _cogl_renderer_free (CoglRenderer *renderer)
#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
if (renderer->libgl_module)
- u_module_close (renderer->libgl_module);
+ c_module_close (renderer->libgl_module);
#endif
- u_slist_foreach (renderer->event_filters,
+ c_slist_foreach (renderer->event_filters,
(GFunc) native_filter_closure_free,
NULL);
- u_slist_free (renderer->event_filters);
+ c_slist_free (renderer->event_filters);
- u_array_free (renderer->poll_fds, TRUE);
+ c_array_free (renderer->poll_fds, TRUE);
- u_free (renderer);
+ c_free (renderer);
}
CoglRenderer *
cogl_renderer_new (void)
{
- CoglRenderer *renderer = u_new0 (CoglRenderer, 1);
+ CoglRenderer *renderer = c_new0 (CoglRenderer, 1);
_cogl_init ();
renderer->connected = FALSE;
renderer->event_filters = NULL;
- renderer->poll_fds = u_array_new (FALSE, TRUE, sizeof (CoglPollFD));
+ renderer->poll_fds = c_array_new (FALSE, TRUE, sizeof (CoglPollFD));
_cogl_list_init (&renderer->idle_closures);
@@ -369,7 +369,7 @@ foreach_driver_description (CoglDriver driver_override,
if (driver_override != COGL_DRIVER_ANY)
{
- for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
+ for (i = 0; i < C_N_ELEMENTS (_cogl_drivers); i++)
{
if (_cogl_drivers[i].id == driver_override)
{
@@ -378,15 +378,15 @@ foreach_driver_description (CoglDriver driver_override,
}
}
- u_warn_if_reached ();
+ c_warn_if_reached ();
return;
}
#ifdef COGL_DEFAULT_DRIVER
- for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
+ for (i = 0; i < C_N_ELEMENTS (_cogl_drivers); i++)
{
const CoglDriverDescription *desc = &_cogl_drivers[i];
- if (u_ascii_strcasecmp (desc->name, COGL_DEFAULT_DRIVER) == 0)
+ if (c_ascii_strcasecmp (desc->name, COGL_DEFAULT_DRIVER) == 0)
{
default_driver = desc;
break;
@@ -400,7 +400,7 @@ foreach_driver_description (CoglDriver driver_override,
}
#endif
- for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
+ for (i = 0; i < C_N_ELEMENTS (_cogl_drivers); i++)
{
#ifdef COGL_DEFAULT_DRIVER
if (&_cogl_drivers[i] == default_driver)
@@ -417,9 +417,9 @@ driver_name_to_id (const char *name)
{
int i;
- for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
+ for (i = 0; i < C_N_ELEMENTS (_cogl_drivers); i++)
{
- if (u_ascii_strcasecmp (_cogl_drivers[i].name, name) == 0)
+ if (c_ascii_strcasecmp (_cogl_drivers[i].name, name) == 0)
return _cogl_drivers[i].id;
}
@@ -442,17 +442,17 @@ driver_id_to_name (CoglDriver id)
case COGL_DRIVER_NOP:
return "nop";
case COGL_DRIVER_ANY:
- u_warn_if_reached ();
+ c_warn_if_reached ();
return "any";
}
- u_warn_if_reached ();
+ c_warn_if_reached ();
return "unknown";
}
typedef struct _SatisfyConstraintsState
{
- UList *constraints;
+ CList *constraints;
const CoglDriverDescription *driver_description;
} SatisfyConstraintsState;
@@ -461,7 +461,7 @@ satisfy_constraints (CoglDriverDescription *description,
void *user_data)
{
SatisfyConstraintsState *state = user_data;
- UList *l;
+ CList *l;
for (l = state->constraints; l; l = l->next)
{
@@ -487,7 +487,7 @@ static CoglBool
_cogl_renderer_choose_driver (CoglRenderer *renderer,
CoglError **error)
{
- const char *driver_name = u_getenv ("COGL_DRIVER");
+ const char *driver_name = c_getenv ("COGL_DRIVER");
CoglDriver driver_override = COGL_DRIVER_ANY;
const char *invalid_override = NULL;
const char *libgl_name;
@@ -526,7 +526,7 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
CoglBool found = FALSE;
int i;
- for (i = 0; i < U_N_ELEMENTS (_cogl_drivers); i++)
+ for (i = 0; i < C_N_ELEMENTS (_cogl_drivers); i++)
{
if (_cogl_drivers[i].id == driver_override)
{
@@ -580,8 +580,8 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (COGL_FLAGS_GET (renderer->private_features,
COGL_PRIVATE_FEATURE_ANY_GL))
{
- renderer->libgl_module = u_module_open (libgl_name,
- U_MODULE_BIND_LAZY);
+ renderer->libgl_module = c_module_open (libgl_name,
+ C_MODULE_BIND_LAZY);
if (renderer->libgl_module == NULL)
{
@@ -604,7 +604,7 @@ CoglBool
cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
{
int i;
- UString *error_message;
+ CString *error_message;
CoglBool constraints_failed = FALSE;
if (renderer->connected)
@@ -616,12 +616,12 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
if (!_cogl_renderer_choose_driver (renderer, error))
return FALSE;
- error_message = u_string_new ("");
- for (i = 0; i < U_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
+ error_message = c_string_new ("");
+ for (i = 0; i < C_N_ELEMENTS (_cogl_winsys_vtable_getters); i++)
{
const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i]();
CoglError *tmp_error = NULL;
- UList *l;
+ CList *l;
CoglBool skip_due_to_constraints = FALSE;
if (renderer->winsys_id_override != COGL_WINSYS_ID_ANY)
@@ -635,7 +635,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
if (!user_choice)
user_choice = _cogl_config_renderer;
if (user_choice &&
- u_ascii_strcasecmp (winsys->name, user_choice) != 0)
+ c_ascii_strcasecmp (winsys->name, user_choice) != 0)
continue;
}
@@ -661,14 +661,14 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
if (!winsys->renderer_connect (renderer, &tmp_error))
{
- u_string_append_c (error_message, '\n');
- u_string_append (error_message, tmp_error->message);
+ c_string_append_c (error_message, '\n');
+ c_string_append (error_message, tmp_error->message);
cogl_error_free (tmp_error);
}
else
{
renderer->connected = TRUE;
- u_string_free (error_message, TRUE);
+ c_string_free (error_message, TRUE);
return TRUE;
}
}
@@ -688,7 +688,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error)
COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s",
error_message->str);
- u_string_free (error_message, TRUE);
+ c_string_free (error_message, TRUE);
return FALSE;
}
@@ -699,7 +699,7 @@ CoglFilterReturn
_cogl_renderer_handle_native_event (CoglRenderer *renderer,
void *event)
{
- USList *l, *next;
+ CSList *l, *next;
/* Pass the event on to all of the registered filters in turn */
for (l = renderer->event_filters; l; l = next)
@@ -727,11 +727,11 @@ _cogl_renderer_add_native_filter (CoglRenderer *renderer,
{
CoglNativeFilterClosure *closure;
- closure = u_slice_new (CoglNativeFilterClosure);
+ closure = c_slice_new (CoglNativeFilterClosure);
closure->func = func;
closure->data = data;
- renderer->event_filters = u_slist_prepend (renderer->event_filters, closure);
+ renderer->event_filters = c_slist_prepend (renderer->event_filters, closure);
}
void
@@ -739,7 +739,7 @@ _cogl_renderer_remove_native_filter (CoglRenderer *renderer,
CoglNativeFilterFunc func,
void *data)
{
- USList *l, *prev = NULL;
+ CSList *l, *prev = NULL;
for (l = renderer->event_filters; l; prev = l, l = l->next)
{
@@ -749,10 +749,10 @@ _cogl_renderer_remove_native_filter (CoglRenderer *renderer,
{
native_filter_closure_free (closure);
if (prev)
- prev->next = u_slist_delete_link (prev->next, l);
+ prev->next = c_slist_delete_link (prev->next, l);
else
renderer->event_filters =
- u_slist_delete_link (renderer->event_filters, l);
+ c_slist_delete_link (renderer->event_filters, l);
break;
}
}
@@ -804,8 +804,8 @@ void
cogl_renderer_add_constraint (CoglRenderer *renderer,
CoglRendererConstraint constraint)
{
- u_return_if_fail (!renderer->connected);
- renderer->constraints = u_list_prepend (renderer->constraints,
+ c_return_if_fail (!renderer->connected);
+ renderer->constraints = c_list_prepend (renderer->constraints,
GUINT_TO_POINTER (constraint));
}
@@ -813,8 +813,8 @@ void
cogl_renderer_remove_constraint (CoglRenderer *renderer,
CoglRendererConstraint constraint)
{
- u_return_if_fail (!renderer->connected);
- renderer->constraints = u_list_remove (renderer->constraints,
+ c_return_if_fail (!renderer->connected);
+ renderer->constraints = c_list_remove (renderer->constraints,
GUINT_TO_POINTER (constraint));
}
@@ -839,7 +839,7 @@ cogl_renderer_foreach_output (CoglRenderer *renderer,
CoglOutputCallback callback,
void *user_data)
{
- UList *l;
+ CList *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 194d3345..405e8174 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. */
- UHashTable *hash_table_cogl;
- UHashTable *hash_table_gl;
+ CHashTable *hash_table_cogl;
+ CHashTable *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 = u_new (CoglSamplerCache, 1);
+ CoglSamplerCache *cache = c_new (CoglSamplerCache, 1);
/* No reference is taken on the context because it would create a
circular reference */
cache->context = context;
- cache->hash_table_gl = u_hash_table_new (hash_sampler_state_gl,
+ cache->hash_table_gl = c_hash_table_new (hash_sampler_state_gl,
sampler_state_equal_gl);
- cache->hash_table_cogl = u_hash_table_new (hash_sampler_state_cogl,
+ cache->hash_table_cogl = c_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 = u_hash_table_lookup (cache->hash_table_gl, key);
+ entry = c_hash_table_lookup (cache->hash_table_gl, key);
if (entry == NULL)
{
CoglContext *context = cache->context;
- entry = u_slice_dup (CoglSamplerCacheEntry, key);
+ entry = c_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++;
}
- u_hash_table_insert (cache->hash_table_gl, entry, entry);
+ c_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 = u_hash_table_lookup (cache->hash_table_cogl, key);
+ entry = c_hash_table_lookup (cache->hash_table_cogl, key);
if (entry == NULL)
{
CoglSamplerCacheEntry canonical_key;
CoglSamplerCacheEntry *gl_entry;
- entry = u_slice_dup (CoglSamplerCacheEntry, key);
+ entry = c_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;
- u_hash_table_insert (cache->hash_table_cogl, entry, entry);
+ c_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) );
- u_slice_free (CoglSamplerCacheEntry, entry);
+ c_slice_free (CoglSamplerCacheEntry, entry);
}
static void
@@ -349,23 +349,23 @@ hash_table_free_cogl_cb (void *key,
{
CoglSamplerCacheEntry *entry = value;
- u_slice_free (CoglSamplerCacheEntry, entry);
+ c_slice_free (CoglSamplerCacheEntry, entry);
}
void
_cogl_sampler_cache_free (CoglSamplerCache *cache)
{
- u_hash_table_foreach (cache->hash_table_gl,
+ c_hash_table_foreach (cache->hash_table_gl,
hash_table_free_gl_cb,
cache->context);
- u_hash_table_destroy (cache->hash_table_gl);
+ c_hash_table_destroy (cache->hash_table_gl);
- u_hash_table_foreach (cache->hash_table_cogl,
+ c_hash_table_foreach (cache->hash_table_cogl,
hash_table_free_cogl_cb,
cache->context);
- u_hash_table_destroy (cache->hash_table_cogl);
+ c_hash_table_destroy (cache->hash_table_cogl);
- u_free (cache);
+ c_free (cache);
}
diff --git a/cogl/cogl-snippet-private.h b/cogl/cogl-snippet-private.h
index 4869fa1f..4474f7bb 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 <ulib.h>
+#include <clib.h>
#include "cogl-snippet.h"
#include "cogl-object-private.h"
diff --git a/cogl/cogl-snippet.c b/cogl/cogl-snippet.c
index 0c5d7529..e1d82006 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 = u_slice_new0 (CoglSnippet);
+ CoglSnippet *snippet = c_slice_new0 (CoglSnippet);
_cogl_snippet_object_new (snippet);
@@ -74,7 +74,7 @@ _cogl_snippet_modify (CoglSnippet *snippet)
{
if (snippet->immutable)
{
- u_warning ("A CoglSnippet should not be modified once it has been "
+ c_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;
- u_free (snippet->declarations);
- snippet->declarations = declarations ? u_strdup (declarations) : NULL;
+ c_free (snippet->declarations);
+ snippet->declarations = declarations ? c_strdup (declarations) : NULL;
}
const char *
@@ -114,8 +114,8 @@ cogl_snippet_set_pre (CoglSnippet *snippet,
if (!_cogl_snippet_modify (snippet))
return;
- u_free (snippet->pre);
- snippet->pre = pre ? u_strdup (pre) : NULL;
+ c_free (snippet->pre);
+ snippet->pre = pre ? c_strdup (pre) : NULL;
}
const char *
@@ -135,8 +135,8 @@ cogl_snippet_set_replace (CoglSnippet *snippet,
if (!_cogl_snippet_modify (snippet))
return;
- u_free (snippet->replace);
- snippet->replace = replace ? u_strdup (replace) : NULL;
+ c_free (snippet->replace);
+ snippet->replace = replace ? c_strdup (replace) : NULL;
}
const char *
@@ -156,8 +156,8 @@ cogl_snippet_set_post (CoglSnippet *snippet,
if (!_cogl_snippet_modify (snippet))
return;
- u_free (snippet->post);
- snippet->post = post ? u_strdup (post) : NULL;
+ c_free (snippet->post);
+ snippet->post = post ? c_strdup (post) : NULL;
}
const char *
@@ -177,9 +177,9 @@ _cogl_snippet_make_immutable (CoglSnippet *snippet)
static void
_cogl_snippet_free (CoglSnippet *snippet)
{
- u_free (snippet->declarations);
- u_free (snippet->pre);
- u_free (snippet->replace);
- u_free (snippet->post);
- u_slice_free (CoglSnippet, snippet);
+ c_free (snippet->declarations);
+ c_free (snippet->pre);
+ c_free (snippet->replace);
+ c_free (snippet->post);
+ c_slice_free (CoglSnippet, snippet);
}
diff --git a/cogl/cogl-spans.c b/cogl/cogl-spans.c
index 5f2d59c9..5b7049ed 100644
--- a/cogl/cogl-spans.c
+++ b/cogl/cogl-spans.c
@@ -135,7 +135,7 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
}
}
else
- u_warn_if_reached ();
+ c_warn_if_reached ();
iter->cover_start = cover_start;
iter->cover_end = cover_end;
@@ -167,7 +167,7 @@ _cogl_span_iter_next (CoglSpanIter *iter)
}
}
else
- u_warn_if_reached ();
+ c_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 4ff411b7..5a10e5dd 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 <ulib.h>
+#include <clib.h>
struct _CoglSubTexture
{
diff --git a/cogl/cogl-sub-texture.c b/cogl/cogl-sub-texture.c
index 57702232..ba96e425 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 = u_new (CoglSubTexture, 1);
+ sub_tex = c_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 5598ee8e..83a9e5f8 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 <ulib.h>
+#include <clib.h>
struct _CoglTexture2DSliced
{
CoglTexture _parent;
- UArray *slice_x_spans;
- UArray *slice_y_spans;
- UArray *slice_textures;
+ CArray *slice_x_spans;
+ CArray *slice_y_spans;
+ CArray *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 3873e8e6..8a6c36c9 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 = &u_array_index (tex_2ds->slice_x_spans, CoglSpan,
+ last_x_span = &c_array_index (tex_2ds->slice_x_spans, CoglSpan,
tex_2ds->slice_x_spans->len - 1);
- last_y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan,
+ last_y_span = &c_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
- = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+ = &c_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
CoglSpan *first_y_span
- = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+ = &c_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 = u_malloc (MAX (right_size, bottom_size) * bpp);
+ waste_buf = c_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 = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
+ y_span = &c_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 = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
+ x_span = &c_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
/* Pick the gl texture object handle */
- slice_tex = u_array_index (tex_2ds->slice_textures,
+ slice_tex = c_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)
- u_free (waste_buf);
+ c_free (waste_buf);
return FALSE;
}
@@ -416,14 +416,14 @@ _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds,
error)) /* dst_y */
{
if (waste_buf)
- u_free (waste_buf);
+ c_free (waste_buf);
return FALSE;
}
}
}
if (waste_buf)
- u_free (waste_buf);
+ c_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 = &u_array_index (tex_2ds->slice_y_spans, CoglSpan,
+ y_span = &c_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 = &u_array_index (tex_2ds->slice_x_spans, CoglSpan,
+ x_span = &c_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 = u_array_index (tex_2ds->slice_textures,
+ slice_tex = c_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)
- u_free (waste_buf);
+ c_free (waste_buf);
return FALSE;
}
@@ -535,14 +535,14 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds,
error))
{
if (waste_buf)
- u_free (waste_buf);
+ c_free (waste_buf);
return FALSE;
}
}
}
if (waste_buf)
- u_free (waste_buf);
+ c_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,
- UArray *out_spans)
+ CArray *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)
- u_array_append_val (out_spans, span);
+ c_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)
- u_array_append_val (out_spans, span);
+ c_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,
- UArray *out_spans)
+ CArray *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)
- u_array_append_val (out_spans, span);
+ c_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)
- u_array_append_val (out_spans, span);
+ c_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;
- u_assert (span.size > 0);
+ c_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 = u_array_index (tex_2ds->slice_textures,
+ CoglTexture2D *slice_tex = c_array_index (tex_2ds->slice_textures,
CoglTexture2D *,
i);
@@ -671,13 +671,13 @@ free_spans (CoglTexture2DSliced *tex_2ds)
{
if (tex_2ds->slice_x_spans != NULL)
{
- u_array_free (tex_2ds->slice_x_spans, TRUE);
+ c_array_free (tex_2ds->slice_x_spans, TRUE);
tex_2ds->slice_x_spans = NULL;
}
if (tex_2ds->slice_y_spans != NULL)
{
- u_array_free (tex_2ds->slice_y_spans, TRUE);
+ c_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, UArray*);
+ int (*slices_for_size) (int, int, int, CArray*);
/* 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 = u_array_sized_new (FALSE, FALSE,
+ tex_2ds->slice_x_spans = c_array_sized_new (FALSE, FALSE,
sizeof (CoglSpan),
1);
- tex_2ds->slice_y_spans = u_array_sized_new (FALSE, FALSE,
+ tex_2ds->slice_y_spans = c_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;
- u_array_append_val (tex_2ds->slice_x_spans, span);
+ c_array_append_val (tex_2ds->slice_x_spans, span);
span.size = max_height;
span.waste = max_height - height;
- u_array_append_val (tex_2ds->slice_y_spans, span);
+ c_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 u_warn_if_reached() for this
+ /* Maybe it would be ok to just c_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 = u_array_sized_new (FALSE, FALSE,
+ tex_2ds->slice_x_spans = c_array_sized_new (FALSE, FALSE,
sizeof (CoglSpan),
n_x_slices);
- tex_2ds->slice_y_spans = u_array_sized_new (FALSE, FALSE,
+ tex_2ds->slice_y_spans = c_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 =
- u_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
+ c_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
cogl_object_unref (slice_tex);
}
- u_array_free (tex_2ds->slice_textures, TRUE);
+ c_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 = u_array_sized_new (FALSE, FALSE,
+ tex_2ds->slice_textures = c_array_sized_new (FALSE, FALSE,
sizeof (CoglTexture2D *),
n_slices);
/* Allocate each slice */
for (y = 0; y < n_y_slices; ++y)
{
- y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
+ y_span = &c_array_index (tex_2ds->slice_y_spans, CoglSpan, y);
for (x = 0; x < n_x_slices; ++x)
{
CoglTexture *slice;
- x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, x);
+ x_span = &c_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);
- u_array_append_val (tex_2ds->slice_textures, slice);
+ c_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 = u_new0 (CoglTexture2DSliced, 1);
+ CoglTexture2DSliced *tex_2ds = c_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;
}
- u_return_val_if_reached (FALSE);
+ c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+ slice_tex = c_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 = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
- y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+ x_span = &c_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+ y_span = &c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+ slice_tex = c_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;
- u_assert (!_cogl_texture_2d_sliced_is_sliced (tex));
+ c_assert (!_cogl_texture_2d_sliced_is_sliced (tex));
/* Don't include the waste in the texture coordinates */
- x_span = &u_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
- y_span = &u_array_index (tex_2ds->slice_y_spans, CoglSpan, 0);
+ x_span = &c_array_index (tex_2ds->slice_x_spans, CoglSpan, 0);
+ y_span = &c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+ slice_tex = c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+ slice_tex = c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, i);
+ slice_tex = c_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 = u_array_index (tex_2ds->slice_textures,
+ CoglTexture2D *slice_tex = c_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 = u_array_index (tex_2ds->slice_textures,
+ CoglTexture2D *slice_tex = c_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 = u_array_index (tex_2ds->slice_textures, CoglTexture2D *, 0);
+ slice_tex = c_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 305d474b..9823e2a4 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 = u_new (CoglTexture2D, 1);
+ CoglTexture2D *tex_2d = c_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:
- u_warn_if_reached ();
+ c_warn_if_reached ();
format = COGL_PIXEL_FORMAT_ARGB_8888;
}
diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c
index d2cc260a..a62097d2 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 = u_new (CoglTexture3D, 1);
+ CoglTexture3D *tex_3d = c_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
{
- u_warning ("Failed to read first pixel of bitmap for "
+ c_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;
}
- u_return_val_if_reached (FALSE);
+ c_return_val_if_reached (FALSE);
}
static CoglBool
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h
index ecb7173e..2833ad1f 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;
- UList *framebuffers;
+ CList *framebuffers;
int max_level;
int width;
int height;
@@ -327,7 +327,7 @@ void
_cogl_texture_associate_framebuffer (CoglTexture *texture,
CoglFramebuffer *framebuffer);
-const UList *
+const CList *
_cogl_texture_get_associated_framebuffers (CoglTexture *texture);
void
diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c
index 932366db..a9ea9944 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)
{
- u_assert (can_use_wrap_mode (wrap_mode_s));
- u_assert (can_use_wrap_mode (wrap_mode_t));
+ c_assert (can_use_wrap_mode (wrap_mode_s));
+ c_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 = u_new (CoglTextureRectangle, 1);
+ CoglTextureRectangle *tex_rect = c_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;
}
- u_return_val_if_reached (FALSE);
+ c_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 */
- u_assert (min_filter == GL_LINEAR || min_filter == GL_NEAREST);
+ c_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 */
- u_assert ((flags & COGL_TEXTURE_NEEDS_MIPMAP) == 0);
+ c_assert ((flags & COGL_TEXTURE_NEEDS_MIPMAP) == 0);
}
static void
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c
index 070a01ee..8abdb983 100644
--- a/cogl/cogl-texture.c
+++ b/cogl/cogl-texture.c
@@ -74,7 +74,7 @@
uint32_t
cogl_texture_error_domain (void)
{
- return u_quark_from_static_string ("cogl-texture-error-quark");
+ return c_quark_from_static_string ("cogl-texture-error-quark");
}
/* XXX:
@@ -83,19 +83,19 @@ cogl_texture_error_domain (void)
* abstract class manually.
*/
-static USList *_cogl_texture_types;
+static CSList *_cogl_texture_types;
void
_cogl_texture_register_texture_type (const CoglObjectClass *klass)
{
- _cogl_texture_types = u_slist_prepend (_cogl_texture_types, (void *) klass);
+ _cogl_texture_types = c_slist_prepend (_cogl_texture_types, (void *) klass);
}
CoglBool
cogl_is_texture (void *object)
{
CoglObject *obj = (CoglObject *)object;
- USList *l;
+ CSList *l;
if (object == NULL)
return FALSE;
@@ -160,7 +160,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
cogl_object_unref (loader->src.bitmap.bitmap);
break;
}
- u_slice_free (CoglTextureLoader, loader);
+ c_slice_free (CoglTextureLoader, loader);
texture->loader = NULL;
}
}
@@ -168,7 +168,7 @@ _cogl_texture_free_loader (CoglTexture *texture)
CoglTextureLoader *
_cogl_texture_create_loader (void)
{
- return u_slice_new0 (CoglTextureLoader);
+ return c_slice_new0 (CoglTextureLoader);
}
void
@@ -176,7 +176,7 @@ _cogl_texture_free (CoglTexture *texture)
{
_cogl_texture_free_loader (texture);
- u_free (texture);
+ c_free (texture);
}
CoglBool
@@ -836,7 +836,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 = u_malloc (full_rowstride * full_tex_height);
+ full_bits = c_malloc (full_rowstride * full_tex_height);
if (texture->vtable->get_data (texture,
dst_format,
@@ -857,7 +857,7 @@ get_texture_bits_via_copy (CoglTexture *texture,
else
ret = FALSE;
- u_free (full_bits);
+ c_free (full_bits);
return ret;
}
@@ -1125,7 +1125,7 @@ _cogl_texture_framebuffer_destroy_cb (void *user_data,
CoglTexture *tex = user_data;
CoglFramebuffer *framebuffer = instance;
- tex->framebuffers = u_list_remove (tex->framebuffers, framebuffer);
+ tex->framebuffers = c_list_remove (tex->framebuffers, framebuffer);
}
void
@@ -1136,7 +1136,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 = u_list_prepend (texture->framebuffers, framebuffer);
+ texture->framebuffers = c_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... */
@@ -1146,7 +1146,7 @@ _cogl_texture_associate_framebuffer (CoglTexture *texture,
_cogl_texture_framebuffer_destroy_cb);
}
-const UList *
+const CList *
_cogl_texture_get_associated_framebuffers (CoglTexture *texture)
{
return texture->framebuffers;
@@ -1155,7 +1155,7 @@ _cogl_texture_get_associated_framebuffers (CoglTexture *texture)
void
_cogl_texture_flush_journal_rendering (CoglTexture *texture)
{
- UList *l;
+ CList *l;
/* It could be that a referenced texture is part of a framebuffer
* which has an associated journal that must be flushed before it
@@ -1403,7 +1403,7 @@ _cogl_texture_derive_format (CoglContext *ctx,
}
}
- u_return_val_if_reached (COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+ c_return_val_if_reached (COGL_PIXEL_FORMAT_RGBA_8888_PRE);
}
CoglPixelFormat
diff --git a/cogl/cogl-util.c b/cogl/cogl-util.c
index 883c106b..57e4c99e 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 u_mask,
+ unsigned long c_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 && u_mask == 0xff00 && b_mask == 0xff)
+ r_mask == 0xff0000 && c_mask == 0xff00 && b_mask == 0xff)
{
return COGL_PIXEL_FORMAT_RGB_888;
}
else if ((depth == 24 || depth == 32) && bpp == 32 &&
- r_mask == 0xff0000 && u_mask == 0xff00 && b_mask == 0xff)
+ r_mask == 0xff0000 && c_mask == 0xff00 && b_mask == 0xff)
{
return COGL_PIXEL_FORMAT_ARGB_8888_PRE;
}
else if ((depth == 30 || depth == 32) &&
- r_mask == 0x3ff00000 && u_mask == 0xffc00 && b_mask == 0x3ff)
+ r_mask == 0x3ff00000 && c_mask == 0xffc00 && b_mask == 0x3ff)
{
return COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
}
else if (depth == 16 && bpp == 16 &&
- r_mask == 0xf800 && u_mask == 0x7e0 && b_mask == 0x1f)
+ r_mask == 0xf800 && c_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, u_mask, r_mask,
+ _cogl_util_pixel_format_from_masks_real (b_mask, c_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,
- u_mask >> shift,
+ c_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 u_mask,
+ unsigned long c_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, u_mask, b_mask,
+ _cogl_util_pixel_format_from_masks_real (r_mask, c_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" };
- u_warning ("Could not find a matching pixel format for red mask=0x%lx,"
+ c_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, u_mask, b_mask, depth, bpp,
+ "and byte order=%s\n", r_mask, c_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 50e2c9d8..1fa81227 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -31,7 +31,7 @@
#ifndef __COGL_UTIL_H
#define __COGL_UTIL_H
-#include <ulib.h>
+#include <clib.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) u_return_if_fail(EXPR)
-#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) u_return_val_if_fail(EXPR, VAL)
+#define _COGL_RETURN_IF_FAIL(EXPR) c_return_if_fail(EXPR)
+#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) c_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 u_mask,
+ unsigned long c_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 f937ccda..333cbe03 100644
--- a/cogl/cogl-vector.c
+++ b/cogl/cogl-vector.c
@@ -36,7 +36,7 @@
#include <cogl-util.h>
#include <cogl-vector.h>
-#include <ulib.h>
+#include <clib.h>
#include <math.h>
#include <string.h>
@@ -97,14 +97,14 @@ float *
cogl_vector3_copy (const float *vector)
{
if (vector)
- return u_slice_copy (sizeof (float) * 3, vector);
+ return c_slice_copy (sizeof (float) * 3, vector);
return NULL;
}
void
cogl_vector3_free (float *vector)
{
- u_slice_free1 (sizeof (float) * 3, vector);
+ c_slice_free1 (sizeof (float) * 3, vector);
}
void
@@ -239,14 +239,14 @@ float *
cogl_vector4_copy (float *vector)
{
if (vector)
- return u_slice_dup (CoglVector4, vector);
+ return c_slice_dup (CoglVector4, vector);
return NULL;
}
void
cogl_vector4_free (float *vector)
{
- u_slice_free (CoglVector4, vector);
+ c_slice_free (CoglVector4, vector);
}
void
diff --git a/cogl/cogl-xlib-renderer.c b/cogl/cogl-xlib-renderer.c
index fc0338ab..36fc81a9 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 UList *_cogl_xlib_renderers = NULL;
+static CList *_cogl_xlib_renderers = NULL;
static void
destroy_xlib_renderer_data (void *user_data)
{
- u_slice_free (CoglXlibRenderer, user_data);
+ c_slice_free (CoglXlibRenderer, user_data);
}
CoglXlibRenderer *
@@ -77,7 +77,7 @@ _cogl_xlib_renderer_get_data (CoglRenderer *renderer)
if (data == NULL)
{
- data = u_slice_new0 (CoglXlibRenderer);
+ data = c_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)
{
- UList *l;
+ CList *l;
for (l = _cogl_xlib_renderers; l; l = l->next)
if (l->data == renderer)
return;
- _cogl_xlib_renderers = u_list_prepend (_cogl_xlib_renderers, renderer);
+ _cogl_xlib_renderers = c_list_prepend (_cogl_xlib_renderers, renderer);
}
static void
unregister_xlib_renderer (CoglRenderer *renderer)
{
- _cogl_xlib_renderers = u_list_remove (_cogl_xlib_renderers, renderer);
+ _cogl_xlib_renderers = c_list_remove (_cogl_xlib_renderers, renderer);
}
static CoglRenderer *
get_renderer_for_xdisplay (Display *xdpy)
{
- UList *l;
+ CList *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);
- u_assert (xlib_renderer->trap_state);
+ c_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);
- u_assert (state == xlib_renderer->trap_state);
+ c_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;
- UList *new_outputs = NULL;
- UList *l, *m;
+ CList *new_outputs = NULL;
+ CList *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 = u_list_prepend (new_outputs, output);
+ new_outputs = c_list_prepend (new_outputs, output);
next:
if (crtc_info != NULL)
@@ -344,7 +344,7 @@ update_outputs (CoglRenderer *renderer,
if (!error)
{
- new_outputs = u_list_sort (new_outputs, (GCompareFunc)compare_outputs);
+ new_outputs = c_list_sort (new_outputs, (GCompareFunc)compare_outputs);
l = new_outputs;
m = renderer->outputs;
@@ -364,12 +364,12 @@ update_outputs (CoglRenderer *renderer,
if (cmp == 0)
{
- UList *m_next = m->next;
+ CList *m_next = m->next;
if (!_cogl_output_values_equal (output_l, output_m))
{
- renderer->outputs = u_list_remove_link (renderer->outputs, m);
- renderer->outputs = u_list_insert_before (renderer->outputs,
+ renderer->outputs = c_list_remove_link (renderer->outputs, m);
+ renderer->outputs = c_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 =
- u_list_insert_before (renderer->outputs, m, output_l);
+ c_list_insert_before (renderer->outputs, m, output_l);
cogl_object_ref (output_l);
changed = TRUE;
l = l->next;
}
else
{
- UList *m_next = m->next;
- renderer->outputs = u_list_remove_link (renderer->outputs, m);
+ CList *m_next = m->next;
+ renderer->outputs = c_list_remove_link (renderer->outputs, m);
changed = TRUE;
m = m_next;
}
}
}
- u_list_free_full (new_outputs, (UDestroyNotify)cogl_object_unref);
+ c_list_free_full (new_outputs, (CDestroyNotify)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);
- u_list_free_full (renderer->outputs, (UDestroyNotify)cogl_object_unref);
+ c_list_free_full (renderer->outputs, (CDestroyNotify)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;
- UList *l;
+ CList *l;
int xa1 = x, xa2 = x + width;
int ya1 = y, ya2 = y + height;
diff --git a/cogl/cogl.c b/cogl/cogl.c
index e285b22f..3b3270ba 100644
--- a/cogl/cogl.c
+++ b/cogl/cogl.c
@@ -103,7 +103,7 @@ cogl_foreach_feature (CoglContext *ctx,
void
_cogl_flush (CoglContext *ctx)
{
- UList *l;
+ CList *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 u_quark_from_static_string ("cogl-driver-error-quark");
+ return c_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 u_quark_from_static_string ("cogl-system-error-quark");
+ return c_quark_from_static_string ("cogl-system-error-quark");
}
void
diff --git a/cogl/driver/gl/cogl-attribute-gl.c b/cogl/driver/gl/cogl-attribute-gl.c
index 2ce8fca7..c4ec852b 100644
--- a/cogl/driver/gl/cogl-attribute-gl.c
+++ b/cogl/driver/gl/cogl-attribute-gl.c
@@ -161,7 +161,7 @@ setup_generic_const_attribute (CoglContext *context,
attribute->d.constant.boxed.v.matrix));
break;
default:
- u_warn_if_reached ();
+ c_warn_if_reached ();
}
}
@@ -214,7 +214,7 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
break;
}
- if (U_UNLIKELY (layers_state->options.flags))
+ if (C_UNLIKELY (layers_state->options.flags))
{
/* If we haven't already created a derived pipeline... */
if (!copy)
@@ -237,13 +237,13 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
* sizeof (options) != 0)
* {
* cogl_object_unref (overrides->weak_pipeline);
- * u_slice_free (Overrides, overrides);
+ * c_slice_free (Overrides, overrides);
* overrides = NULL;
* }
* }
* if (!overrides)
* {
- * overrides = u_slice_new (Overrides);
+ * overrides = c_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 17350292..704a51cf 100644
--- a/cogl/driver/gl/cogl-buffer-gl.c
+++ b/cogl/driver/gl/cogl-buffer-gl.c
@@ -107,7 +107,7 @@ update_hints_to_gl_enum (CoglBuffer *buffer)
return GL_STREAM_DRAW;
}
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
static GLenum
@@ -124,7 +124,7 @@ convert_bind_target_to_gl_target (CoglBufferBindTarget target)
case COGL_BUFFER_BIND_TARGET_INDEX_BUFFER:
return GL_ELEMENT_ARRAY_BUFFER;
default:
- u_return_val_if_reached (COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK);
+ c_return_val_if_reached (COGL_BUFFER_BIND_TARGET_PIXEL_UNPACK);
}
}
diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
index c0c83ff1..47fc3caf 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 <ulib.h>
+#include <clib.h>
#include <string.h>
#ifndef GL_FRAMEBUFFER
@@ -124,7 +124,7 @@ _cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
{
float gl_viewport_y;
- u_assert (framebuffer->viewport_width >=0 &&
+ c_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 (U_UNLIKELY (!draw_buffer->allocated))
+ if (C_UNLIKELY (!draw_buffer->allocated))
cogl_framebuffer_allocate (draw_buffer, NULL);
- if (U_UNLIKELY (!read_buffer->allocated))
+ if (C_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:
- u_warn_if_reached ();
+ c_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 */
- u_assert (_cogl_texture_get_format (depth_texture) ==
+ c_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 */
- u_assert (_cogl_texture_get_format (depth_texture) ==
+ c_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 UList *
+static CList *
try_creating_renderbuffers (CoglContext *ctx,
int width,
int height,
CoglOffscreenAllocateFlags flags,
int n_samples)
{
- UList *renderbuffers = NULL;
+ CList *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 =
- u_list_prepend (renderbuffers,
+ c_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 =
- u_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_depth_handle));
+ c_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 =
- u_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_stencil_handle));
+ c_list_prepend (renderbuffers, GUINT_TO_POINTER (gl_stencil_handle));
}
return renderbuffers;
}
static void
-delete_renderbuffers (CoglContext *ctx, UList *renderbuffers)
+delete_renderbuffers (CoglContext *ctx, CList *renderbuffers)
{
- UList *l;
+ CList *l;
for (l = renderbuffers; l; l = l->next)
{
@@ -578,7 +578,7 @@ delete_renderbuffers (CoglContext *ctx, UList *renderbuffers)
GE (ctx, glDeleteRenderbuffers (1, &renderbuffer));
}
- u_list_free (renderbuffers);
+ c_list_free (renderbuffers);
}
/*
@@ -953,7 +953,7 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
{
CoglContext *ctx = framebuffer->context;
- if (U_LIKELY (!framebuffer->dirty_bitmasks))
+ if (C_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 < U_N_ELEMENTS (params); i++)
+ for (i = 0; i < C_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;
}
- u_return_val_if_reached (0);
+ c_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 = u_alloca (rowstride * sizeof (uint8_t));
+ temprow = c_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-glsl.c b/cogl/driver/gl/cogl-pipeline-fragend-glsl.c
index 85db8b48..d6b2b6df 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 <ulib.h>
+#include <clib.h>
/*
* GL/GLES compatability defines for pipeline thingies:
@@ -91,7 +91,7 @@ typedef struct
int ref_count;
GLuint gl_shader;
- UString *header, *source;
+ CString *header, *source;
UnitState *unit_state;
/* List of layers that we haven't generated code for yet. These are
@@ -116,9 +116,9 @@ shader_state_new (int n_layers,
{
CoglPipelineShaderState *shader_state;
- shader_state = u_slice_new0 (CoglPipelineShaderState);
+ shader_state = c_slice_new0 (CoglPipelineShaderState);
shader_state->ref_count = 1;
- shader_state->unit_state = u_new0 (UnitState, n_layers);
+ shader_state->unit_state = c_new0 (UnitState, n_layers);
shader_state->cache_entry = cache_entry;
return shader_state;
@@ -147,9 +147,9 @@ destroy_shader_state (void *user_data,
if (shader_state->gl_shader)
GE( ctx, glDeleteShader (shader_state->gl_shader) );
- u_free (shader_state->unit_state);
+ c_free (shader_state->unit_state);
- u_slice_free (CoglPipelineShaderState, shader_state);
+ c_slice_free (CoglPipelineShaderState, shader_state);
}
}
@@ -216,7 +216,7 @@ static CoglBool
has_replace_hook (CoglPipelineLayer *layer,
CoglSnippetHook hook)
{
- UList *l;
+ CList *l;
for (l = get_layer_fragment_snippets (layer)->entries; l; l = l->next)
{
@@ -240,7 +240,7 @@ add_layer_declaration_cb (CoglPipelineLayer *layer,
_cogl_gl_util_get_texture_target_string (texture_type, &target_string, NULL);
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"in vec4 _cogl_tex_coord%i;\n"
"#define cogl_tex_coord%i_in _cogl_tex_coord%i\n"
"uniform sampler%s cogl_sampler%i;\n",
@@ -320,7 +320,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
{
/* Check if there is already a similar cached pipeline whose
shader state we can share */
- if (U_LIKELY (!(COGL_DEBUG_ENABLED
+ if (C_LIKELY (!(COGL_DEBUG_ENABLED
(COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
{
cache_entry =
@@ -357,13 +357,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 UStrings for code-gen. One string
+ /* We reuse two grow-only CStrings 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 */
- u_string_set_size (ctx->codegen_header_buffer, 0);
- u_string_set_size (ctx->codegen_source_buffer, 0);
+ c_string_set_size (ctx->codegen_header_buffer, 0);
+ c_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);
@@ -371,7 +371,7 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
add_layer_declarations (pipeline, shader_state);
add_global_declarations (pipeline, shader_state);
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
"void\n"
"cogl_generated_source ()\n"
"{\n");
@@ -389,7 +389,7 @@ add_constant_lookup (CoglPipelineShaderState *shader_state,
CoglPipelineLayer *layer,
const char *swizzle)
{
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"_cogl_layer_constant_%i.%s",
layer->index, swizzle);
}
@@ -417,11 +417,11 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
shader_state->unit_state[unit_index].sampled = TRUE;
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"vec4 cogl_texel%i;\n",
layer->index);
- u_string_append_printf (shader_state->source,
+ c_string_append_printf (shader_state->source,
" cogl_texel%i = cogl_texture_lookup%i ("
"cogl_sampler%i, ",
layer->index,
@@ -430,20 +430,20 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
if (cogl_pipeline_get_layer_point_sprite_coords_enabled (pipeline,
layer->index))
- u_string_append_printf (shader_state->source,
+ c_string_append_printf (shader_state->source,
"vec4 (cogl_point_coord, 0.0, 1.0)");
else
- u_string_append_printf (shader_state->source,
+ c_string_append_printf (shader_state->source,
"cogl_tex_coord%i_in",
layer->index);
- u_string_append (shader_state->source, ");\n");
+ c_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))
{
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"vec4\n"
"cogl_real_texture_lookup%i (sampler%s tex,\n"
" vec4 coords)\n"
@@ -452,52 +452,52 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
layer->index,
target_string);
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
- u_string_append (shader_state->header,
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
+ c_string_append (shader_state->header,
"vec4 (1.0, 1.0, 1.0, 1.0);\n");
else
{
if (ctx->glsl_version_to_use >= 130)
{
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"texture (tex, coords.%s);\n",
tex_coord_swizzle);
}
else
{
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"texture%s (tex, coords.%s);\n",
target_string, tex_coord_swizzle);
}
}
- u_string_append (shader_state->header, "}\n");
+ c_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 = u_strdup_printf ("cogl_real_texture_lookup%i",
+ snippet_data.chain_function = c_strdup_printf ("cogl_real_texture_lookup%i",
layer->index);
- snippet_data.final_name = u_strdup_printf ("cogl_texture_lookup%i",
+ snippet_data.final_name = c_strdup_printf ("cogl_texture_lookup%i",
layer->index);
- snippet_data.function_prefix = u_strdup_printf ("cogl_texture_lookup_hook%i",
+ snippet_data.function_prefix = c_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 =
- u_strdup_printf ("sampler%s cogl_sampler, vec4 cogl_tex_coord",
+ c_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);
- 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);
+ c_free ((char *) snippet_data.chain_function);
+ c_free ((char *) snippet_data.final_name);
+ c_free ((char *) snippet_data.function_prefix);
+ c_free ((char *) snippet_data.argument_declarations);
}
static void
@@ -509,14 +509,14 @@ add_arg (CoglPipelineShaderState *shader_state,
CoglPipelineCombineOp operand,
const char *swizzle)
{
- UString *shader_source = shader_state->header;
+ CString *shader_source = shader_state->header;
char alpha_swizzle[5] = "aaaa";
- u_string_append_c (shader_source, '(');
+ c_string_append_c (shader_source, '(');
if (operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_COLOR ||
operand == COGL_PIPELINE_COMBINE_OP_ONE_MINUS_SRC_ALPHA)
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
"vec4(1.0, 1.0, 1.0, 1.0).%s - ",
swizzle);
@@ -532,7 +532,7 @@ add_arg (CoglPipelineShaderState *shader_state,
switch (src)
{
case COGL_PIPELINE_COMBINE_SOURCE_TEXTURE:
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
"cogl_texel%i.%s",
layer->index,
swizzle);
@@ -548,7 +548,7 @@ add_arg (CoglPipelineShaderState *shader_state,
case COGL_PIPELINE_COMBINE_SOURCE_PREVIOUS:
if (previous_layer_index >= 0)
{
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
"cogl_layer%i.%s",
previous_layer_index,
swizzle);
@@ -556,7 +556,7 @@ add_arg (CoglPipelineShaderState *shader_state,
}
/* flow through */
case COGL_PIPELINE_COMBINE_SOURCE_PRIMARY_COLOR:
- u_string_append_printf (shader_source, "cogl_color_in.%s", swizzle);
+ c_string_append_printf (shader_source, "cogl_color_in.%s", swizzle);
break;
default:
@@ -571,16 +571,16 @@ add_arg (CoglPipelineShaderState *shader_state,
static CoglBool warning_seen = FALSE;
if (!warning_seen)
{
- u_warning ("The application is trying to use a texture "
+ c_warning ("The application is trying to use a texture "
"combine with a layer number that does not exist");
warning_seen = TRUE;
}
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
"vec4 (1.0, 1.0, 1.0, 1.0).%s",
swizzle);
}
else
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
"cogl_texel%i.%s",
other_layer->index,
swizzle);
@@ -588,7 +588,7 @@ add_arg (CoglPipelineShaderState *shader_state,
break;
}
- u_string_append_c (shader_source, ')');
+ c_string_append_c (shader_source, ')');
}
static void
@@ -611,7 +611,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)
{
- u_string_append_printf (shader_state->header,
+ c_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;
@@ -671,9 +671,9 @@ append_masked_combine (CoglPipeline *pipeline,
CoglPipelineCombineOp *op)
{
CoglPipelineShaderState *shader_state = get_shader_state (pipeline);
- UString *shader_source = shader_state->header;
+ CString *shader_source = shader_state->header;
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
" cogl_layer.%s = ",
swizzle);
@@ -687,7 +687,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);
- u_string_append (shader_source, " * ");
+ c_string_append (shader_source, " * ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], swizzle);
break;
@@ -695,7 +695,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);
- u_string_append (shader_source, " + ");
+ c_string_append (shader_source, " + ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], swizzle);
break;
@@ -703,10 +703,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);
- u_string_append (shader_source, " + ");
+ c_string_append (shader_source, " + ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], swizzle);
- u_string_append_printf (shader_source,
+ c_string_append_printf (shader_source,
" - vec4(0.5, 0.5, 0.5, 0.5).%s",
swizzle);
break;
@@ -714,7 +714,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);
- u_string_append (shader_source, " - ");
+ c_string_append (shader_source, " - ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], swizzle);
break;
@@ -722,45 +722,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);
- u_string_append (shader_source, " * ");
+ c_string_append (shader_source, " * ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[2], op[2], swizzle);
- u_string_append (shader_source, " + ");
+ c_string_append (shader_source, " + ");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], swizzle);
- u_string_append_printf (shader_source,
+ c_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);
- u_string_append_c (shader_source, ')');
+ c_string_append_c (shader_source, ')');
break;
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGB:
case COGL_PIPELINE_COMBINE_FUNC_DOT3_RGBA:
- u_string_append (shader_source, "vec4(4.0 * ((");
+ c_string_append (shader_source, "vec4(4.0 * ((");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[0], op[0], "r");
- u_string_append (shader_source, " - 0.5) * (");
+ c_string_append (shader_source, " - 0.5) * (");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], "r");
- u_string_append (shader_source, " - 0.5) + (");
+ c_string_append (shader_source, " - 0.5) + (");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[0], op[0], "g");
- u_string_append (shader_source, " - 0.5) * (");
+ c_string_append (shader_source, " - 0.5) * (");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], "g");
- u_string_append (shader_source, " - 0.5) + (");
+ c_string_append (shader_source, " - 0.5) + (");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[0], op[0], "b");
- u_string_append (shader_source, " - 0.5) * (");
+ c_string_append (shader_source, " - 0.5) * (");
add_arg (shader_state, pipeline, layer, previous_layer_index,
src[1], op[1], "b");
- u_string_append_printf (shader_source, " - 0.5))).%s", swizzle);
+ c_string_append_printf (shader_source, " - 0.5))).%s", swizzle);
break;
}
- u_string_append_printf (shader_source, ";\n");
+ c_string_append_printf (shader_source, ";\n");
}
static void
@@ -783,7 +783,7 @@ generate_layer (CoglPipelineShaderState *shader_state,
big_state = combine_authority->big_state;
/* Make a global variable for the result of the layer code */
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"vec4 cogl_layer%i;\n",
layer_index);
@@ -806,7 +806,7 @@ generate_layer (CoglPipelineShaderState *shader_state,
big_state->texture_combine_alpha_func,
big_state->texture_combine_alpha_src);
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"vec4\n"
"cogl_real_generate_layer%i ()\n"
"{\n"
@@ -844,7 +844,7 @@ generate_layer (CoglPipelineShaderState *shader_state,
big_state->texture_combine_alpha_op);
}
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
" return cogl_layer;\n"
"}\n");
}
@@ -853,11 +853,11 @@ generate_layer (CoglPipelineShaderState *shader_state,
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 = u_strdup_printf ("cogl_real_generate_layer%i",
+ snippet_data.chain_function = c_strdup_printf ("cogl_real_generate_layer%i",
layer_index);
- snippet_data.final_name = u_strdup_printf ("cogl_generate_layer%i",
+ snippet_data.final_name = c_strdup_printf ("cogl_generate_layer%i",
layer_index);
- snippet_data.function_prefix = u_strdup_printf ("cogl_generate_layer%i",
+ snippet_data.function_prefix = c_strdup_printf ("cogl_generate_layer%i",
layer_index);
snippet_data.return_type = "vec4";
snippet_data.return_variable = "cogl_layer";
@@ -865,16 +865,16 @@ generate_layer (CoglPipelineShaderState *shader_state,
_cogl_pipeline_snippet_generate_code (&snippet_data);
- u_free ((char *) snippet_data.chain_function);
- u_free ((char *) snippet_data.final_name);
- u_free ((char *) snippet_data.function_prefix);
+ c_free ((char *) snippet_data.chain_function);
+ c_free ((char *) snippet_data.final_name);
+ c_free ((char *) snippet_data.function_prefix);
- u_string_append_printf (shader_state->source,
+ c_string_append_printf (shader_state->source,
" cogl_layer%i = cogl_generate_layer%i ();\n",
layer_index,
layer_index);
- u_slice_free (LayerData, layer_data);
+ c_slice_free (LayerData, layer_data);
}
static void
@@ -914,7 +914,7 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
return TRUE;
/* Store the layers in reverse order */
- layer_data = u_slice_new (LayerData);
+ layer_data = c_slice_new (LayerData);
layer_data->layer = layer;
if (_cogl_list_empty (&shader_state->layers))
@@ -953,7 +953,7 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
if (alpha_func == COGL_PIPELINE_ALPHA_FUNC_NEVER)
{
/* Always discard the fragment */
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" discard;\n");
return;
}
@@ -961,40 +961,40 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
/* For all of the other alpha functions we need a uniform for the
reference */
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
"uniform float _cogl_alpha_test_ref;\n");
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" if (cogl_color_out.a ");
switch (alpha_func)
{
case COGL_PIPELINE_ALPHA_FUNC_LESS:
- u_string_append (shader_state->source, ">=");
+ c_string_append (shader_state->source, ">=");
break;
case COGL_PIPELINE_ALPHA_FUNC_EQUAL:
- u_string_append (shader_state->source, "!=");
+ c_string_append (shader_state->source, "!=");
break;
case COGL_PIPELINE_ALPHA_FUNC_LEQUAL:
- u_string_append (shader_state->source, ">");
+ c_string_append (shader_state->source, ">");
break;
case COGL_PIPELINE_ALPHA_FUNC_GREATER:
- u_string_append (shader_state->source, "<=");
+ c_string_append (shader_state->source, "<=");
break;
case COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL:
- u_string_append (shader_state->source, "==");
+ c_string_append (shader_state->source, "==");
break;
case COGL_PIPELINE_ALPHA_FUNC_GEQUAL:
- u_string_append (shader_state->source, "< ");
+ c_string_append (shader_state->source, "< ");
break;
case COGL_PIPELINE_ALPHA_FUNC_ALWAYS:
case COGL_PIPELINE_ALPHA_FUNC_NEVER:
- u_assert_not_reached ();
+ c_assert_not_reached ();
break;
}
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" _cogl_alpha_test_ref)\n discard;\n");
}
@@ -1039,7 +1039,7 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
*/
generate_layer (shader_state, pipeline, layer_data);
- u_string_append_printf (shader_state->source,
+ c_string_append_printf (shader_state->source,
" cogl_color_out = cogl_layer%i;\n",
last_layer->index);
@@ -1055,16 +1055,16 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
_cogl_list_for_each_safe (layer_data, tmp,
&shader_state->layers,
link)
- u_slice_free (LayerData, layer_data);
+ c_slice_free (LayerData, layer_data);
}
else
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" cogl_color_out = cogl_color_in;\n");
add_alpha_test_snippet (pipeline, shader_state);
/* Close the function surrounding the generated fragment processing */
- u_string_append (shader_state->source, "}\n");
+ c_string_append (shader_state->source, "}\n");
/* Add all of the hooks for fragment processing */
memset (&snippet_data, 0, sizeof (snippet_data));
@@ -1097,9 +1097,9 @@ _cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
char *shader_log;
GE( ctx, glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len) );
- shader_log = u_alloca (len);
+ shader_log = c_alloca (len);
GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) );
- u_warning ("Shader compilation failed:\n%s", shader_log);
+ c_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 ade94d19..14b41ba2 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 <ulib.h>
+#include <clib.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 = u_array_set_size (ctx->texture_units, index_ + 1);
+ ctx->texture_units = c_array_set_size (ctx->texture_units, index_ + 1);
for (i = prev_len; i <= index_; i++)
{
CoglTextureUnit *unit =
- &u_array_index (ctx->texture_units, CoglTextureUnit, i);
+ &c_array_index (ctx->texture_units, CoglTextureUnit, i);
texture_unit_init (ctx, unit, i);
}
}
- return &u_array_index (ctx->texture_units, CoglTextureUnit, index_);
+ return &c_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 =
- &u_array_index (ctx->texture_units, CoglTextureUnit, i);
+ &c_array_index (ctx->texture_units, CoglTextureUnit, i);
texture_unit_free (unit);
}
- u_array_free (ctx->texture_units, TRUE);
+ c_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 =
- &u_array_index (ctx->texture_units, CoglTextureUnit, i);
+ &c_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 =
- &u_array_index (ctx->texture_units, CoglTextureUnit, i);
+ &c_array_index (ctx->texture_units, CoglTextureUnit, i);
if (unit->layer &&
_cogl_pipeline_layer_get_texture (unit->layer) == texture)
@@ -333,21 +333,21 @@ UNIT_TEST (check_gl_blend_enable,
CoglPipeline *pipeline = cogl_pipeline_new (test_ctx);
/* By default blending should be disabled */
- u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+ c_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 */
- u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+ c_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 */
- u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 1);
+ c_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);
@@ -355,13 +355,13 @@ UNIT_TEST (check_gl_blend_enable,
/* After setting a blend string that effectively disables blending
* then blending should be disabled */
- u_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
+ c_assert_cmpint (test_ctx->gl_blend_enable_cache, ==, 0);
}
static int
get_max_activateable_texture_units (CoglContext *ctx)
{
- if (U_UNLIKELY (ctx->max_activateable_texture_units == -1))
+ if (C_UNLIKELY (ctx->max_activateable_texture_units == -1))
{
GLint values[3];
int n_values = 0;
@@ -402,7 +402,7 @@ get_max_activateable_texture_units (CoglContext *ctx)
}
#endif
- u_assert (n_values <= U_N_ELEMENTS (values) &&
+ c_assert (n_values <= C_N_ELEMENTS (values) &&
n_values > 0);
/* Use the maximum value */
@@ -435,13 +435,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 (U_UNLIKELY (unit_index >= get_max_activateable_texture_units (ctx)))
+ if (C_UNLIKELY (unit_index >= get_max_activateable_texture_units (ctx)))
{
static CoglBool shown_warning = FALSE;
if (!shown_warning)
{
- u_warning ("Your hardware does not have enough texture units"
+ c_warning ("Your hardware does not have enough texture units"
"to handle this many texture layers");
shown_warning = TRUE;
}
@@ -642,7 +642,7 @@ _cogl_pipeline_flush_common_gl_state (CoglContext *ctx,
switch (cull_face_state->mode)
{
case COGL_PIPELINE_CULL_FACE_MODE_NONE:
- u_assert_not_reached ();
+ c_assert_not_reached ();
case COGL_PIPELINE_CULL_FACE_MODE_FRONT:
GE( ctx, glCullFace (GL_FRONT) );
@@ -781,7 +781,7 @@ foreach_texture_unit_update_filter_and_wrap_modes (void)
for (i = 0; i < ctx->texture_units->len; i++)
{
CoglTextureUnit *unit =
- &u_array_index (ctx->texture_units, CoglTextureUnit, i);
+ &c_array_index (ctx->texture_units, CoglTextureUnit, i);
if (unit->layer)
{
@@ -863,7 +863,7 @@ vertend_add_layer_cb (CoglPipelineLayer *layer,
/* Either generate per layer code snippets or setup the
* fixed function glTexEnv for each layer... */
- if (U_LIKELY (vertend->add_layer (pipeline,
+ if (C_LIKELY (vertend->add_layer (pipeline,
layer,
state->layer_differences[unit_index],
state->framebuffer)))
@@ -888,7 +888,7 @@ fragend_add_layer_cb (CoglPipelineLayer *layer,
/* Either generate per layer code snippets or setup the
* fixed function glTexEnv for each layer... */
- if (U_LIKELY (fragend->add_layer (pipeline,
+ if (C_LIKELY (fragend->add_layer (pipeline,
layer,
state->layer_differences[unit_index])))
state->added_layer = TRUE;
@@ -1033,7 +1033,7 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
if (n_layers)
{
CoglPipelineCompareLayersState state;
- layer_differences = u_alloca (sizeof (unsigned long) * n_layers);
+ layer_differences = c_alloca (sizeof (unsigned long) * n_layers);
memset (layer_differences, 0, sizeof (unsigned long) * n_layers);
state.i = 0;
state.layer_differences = layer_differences;
@@ -1091,7 +1091,7 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
progend = _cogl_pipeline_progends[i];
- if (U_UNLIKELY (!progend->start (pipeline)))
+ if (C_UNLIKELY (!progend->start (pipeline)))
continue;
vertend = _cogl_pipeline_vertends[progend->vertend];
@@ -1111,10 +1111,10 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
vertend_add_layer_cb,
&state);
- if (U_UNLIKELY (state.error_adding_layer))
+ if (C_UNLIKELY (state.error_adding_layer))
continue;
- if (U_UNLIKELY (!vertend->end (pipeline, pipelines_difference)))
+ if (C_UNLIKELY (!vertend->end (pipeline, pipelines_difference)))
continue;
/* Now prepare the fragment processing state (fragend)
@@ -1135,17 +1135,17 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
fragend_add_layer_cb,
&state);
- if (U_UNLIKELY (state.error_adding_layer))
+ if (C_UNLIKELY (state.error_adding_layer))
continue;
if (!state.added_layer)
{
if (fragend->passthrough &&
- U_UNLIKELY (!fragend->passthrough (pipeline)))
+ C_UNLIKELY (!fragend->passthrough (pipeline)))
continue;
}
- if (U_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
+ if (C_UNLIKELY (!fragend->end (pipeline, pipelines_difference)))
continue;
if (progend->end)
diff --git a/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/driver/gl/cogl-pipeline-progend-glsl.c
index 1c8b1507..3a05ef1c 100644
--- a/cogl/driver/gl/cogl-pipeline-progend-glsl.c
+++ b/cogl/driver/gl/cogl-pipeline-progend-glsl.c
@@ -113,7 +113,7 @@ typedef struct
GLuint program;
unsigned long dirty_builtin_uniforms;
- GLint builtin_uniform_locations[U_N_ELEMENTS (builtin_uniforms)];
+ GLint builtin_uniform_locations[C_N_ELEMENTS (builtin_uniforms)];
GLint modelview_uniform;
GLint projection_uniform;
@@ -129,10 +129,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 */
- UArray *uniform_locations;
+ CArray *uniform_locations;
/* Array of attribute locations. */
- UArray *attribute_locations;
+ CArray *attribute_locations;
/* The 'flip' uniform is used to flip the geometry upside-down when
the framebuffer requires it only when there are vertex
@@ -182,25 +182,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 (U_UNLIKELY (program_state->attribute_locations == NULL))
+ if (C_UNLIKELY (program_state->attribute_locations == NULL))
program_state->attribute_locations =
- u_array_new (FALSE, FALSE, sizeof (int));
+ c_array_new (FALSE, FALSE, sizeof (int));
- if (U_UNLIKELY (program_state->attribute_locations->len <= name_index))
+ if (C_UNLIKELY (program_state->attribute_locations->len <= name_index))
{
int i = program_state->attribute_locations->len;
- u_array_set_size (program_state->attribute_locations, name_index + 1);
+ c_array_set_size (program_state->attribute_locations, name_index + 1);
for (; i < program_state->attribute_locations->len; i++)
- u_array_index (program_state->attribute_locations, int, i)
+ c_array_index (program_state->attribute_locations, int, i)
= ATTRIBUTE_LOCATION_UNKNOWN;
}
- locations = &u_array_index (program_state->attribute_locations, int, 0);
+ locations = &c_array_index (program_state->attribute_locations, int, 0);
if (locations[name_index] == ATTRIBUTE_LOCATION_UNKNOWN)
{
CoglAttributeNameState *name_state =
- u_array_index (ctx->attribute_name_index_map,
+ c_array_index (ctx->attribute_name_index_map,
CoglAttributeNameState *, name_index);
_COGL_RETURN_VAL_IF_FAIL (name_state != NULL, 0);
@@ -218,7 +218,7 @@ clear_attribute_cache (CoglPipelineProgramState *program_state)
{
if (program_state->attribute_locations)
{
- u_array_free (program_state->attribute_locations, TRUE);
+ c_array_free (program_state->attribute_locations, TRUE);
program_state->attribute_locations = NULL;
}
}
@@ -239,11 +239,11 @@ program_state_new (CoglContext *ctx,
{
CoglPipelineProgramState *program_state;
- program_state = u_slice_new (CoglPipelineProgramState);
+ program_state = c_slice_new (CoglPipelineProgramState);
program_state->ctx = ctx;
program_state->ref_count = 1;
program_state->program = 0;
- program_state->unit_state = u_new (UnitState, n_layers);
+ program_state->unit_state = c_new (UnitState, n_layers);
program_state->uniform_locations = NULL;
program_state->attribute_locations = NULL;
program_state->cache_entry = cache_entry;
@@ -282,12 +282,12 @@ destroy_program_state (void *user_data,
if (program_state->program)
GE( ctx, glDeleteProgram (program_state->program) );
- u_free (program_state->unit_state);
+ c_free (program_state->unit_state);
if (program_state->uniform_locations)
- u_array_free (program_state->uniform_locations, TRUE);
+ c_array_free (program_state->uniform_locations, TRUE);
- u_slice_free (CoglPipelineProgramState, program_state);
+ c_slice_free (CoglPipelineProgramState, program_state);
}
}
@@ -338,15 +338,15 @@ link_program (CoglContext *ctx, GLint gl_program)
GE( ctx, glGetProgramiv (gl_program, GL_INFO_LOG_LENGTH, &log_length) );
- log = u_malloc (log_length);
+ log = c_malloc (log_length);
GE( ctx, glGetProgramInfoLog (gl_program, log_length,
&out_log_length, log) );
- u_warning ("Failed to link GLSL program:\n%.*s\n",
+ c_warning ("Failed to link GLSL program:\n%.*s\n",
log_length, log);
- u_free (log);
+ c_free (log);
}
}
@@ -372,8 +372,8 @@ get_uniform_cb (CoglPipeline *pipeline,
/* We can reuse the source buffer to create the uniform name because
the program has now been linked */
- u_string_set_size (ctx->codegen_source_buffer, 0);
- u_string_append_printf (ctx->codegen_source_buffer,
+ c_string_set_size (ctx->codegen_source_buffer, 0);
+ c_string_append_printf (ctx->codegen_source_buffer,
"cogl_sampler%i", layer_index);
GE_RET( uniform_location,
@@ -387,8 +387,8 @@ get_uniform_cb (CoglPipeline *pipeline,
if (uniform_location != -1)
GE( ctx, glUniform1i (uniform_location, state->unit) );
- u_string_set_size (ctx->codegen_source_buffer, 0);
- u_string_append_printf (ctx->codegen_source_buffer,
+ c_string_set_size (ctx->codegen_source_buffer, 0);
+ c_string_append_printf (ctx->codegen_source_buffer,
"_cogl_layer_constant_%i", layer_index);
GE_RET( uniform_location,
@@ -438,7 +438,7 @@ update_builtin_uniforms (CoglContext *context,
if (program_state->dirty_builtin_uniforms == 0)
return;
- for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
+ for (i = 0; i < C_N_ELEMENTS (builtin_uniforms); i++)
{
if (!_cogl_has_private_feature (context,
builtin_uniforms[i].feature_replacement) &&
@@ -473,12 +473,12 @@ flush_uniform_cb (int uniform_num, void *user_data)
if (COGL_FLAGS_GET (data->uniform_differences, uniform_num))
{
- UArray *uniform_locations;
+ CArray *uniform_locations;
GLint uniform_location;
if (data->program_state->uniform_locations == NULL)
data->program_state->uniform_locations =
- u_array_new (FALSE, FALSE, sizeof (GLint));
+ c_array_new (FALSE, FALSE, sizeof (GLint));
uniform_locations = data->program_state->uniform_locations;
@@ -486,27 +486,27 @@ flush_uniform_cb (int uniform_num, void *user_data)
{
unsigned int old_len = uniform_locations->len;
- u_array_set_size (uniform_locations, uniform_num + 1);
+ c_array_set_size (uniform_locations, uniform_num + 1);
while (old_len <= uniform_num)
{
- u_array_index (uniform_locations, GLint, old_len) =
+ c_array_index (uniform_locations, GLint, old_len) =
UNIFORM_LOCATION_UNKNOWN;
old_len++;
}
}
- uniform_location = u_array_index (uniform_locations, GLint, uniform_num);
+ uniform_location = c_array_index (uniform_locations, GLint, uniform_num);
if (uniform_location == UNIFORM_LOCATION_UNKNOWN)
{
const char *uniform_name =
- u_ptr_array_index (data->ctx->uniform_names, uniform_num);
+ c_ptr_array_index (data->ctx->uniform_names, uniform_num);
uniform_location =
data->ctx->glGetUniformLocation (data->program_state->program,
uniform_name);
- u_array_index (uniform_locations, GLint, uniform_num) =
+ c_array_index (uniform_locations, GLint, uniform_num) =
uniform_location;
}
@@ -546,7 +546,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglContext *ctx,
n_uniform_longs = COGL_FLAGS_N_LONGS_FOR_SIZE (ctx->n_uniform_names);
- data.uniform_differences = u_newa (unsigned long, n_uniform_longs);
+ data.uniform_differences = c_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
@@ -559,7 +559,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglContext *ctx,
/* The program has changed so all of the uniform locations
are invalid */
if (program_state->uniform_locations)
- u_array_set_size (program_state->uniform_locations, 0);
+ c_array_set_size (program_state->uniform_locations, 0);
}
/* We need to flush everything so mark all of the uniforms as
@@ -662,7 +662,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
{
/* Check if there is already a similar cached pipeline whose
program state we can share */
- if (U_LIKELY (!(COGL_DEBUG_ENABLED
+ if (C_LIKELY (!(COGL_DEBUG_ENABLED
(COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
{
cache_entry =
@@ -751,7 +751,7 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline,
clear_flushed_matrix_stacks (program_state);
- for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
+ for (i = 0; i < C_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,
@@ -804,7 +804,7 @@ _cogl_pipeline_progend_glsl_pre_change_notify (CoglPipeline *pipeline,
{
int i;
- for (i = 0; i < U_N_ELEMENTS (builtin_uniforms); i++)
+ for (i = 0; i < C_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 067b9fa4..ce75a9af 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;
- UString *header, *source;
+ CString *header, *source;
CoglPipelineCacheEntry *cache_entry;
} CoglPipelineShaderState;
@@ -71,7 +71,7 @@ shader_state_new (CoglPipelineCacheEntry *cache_entry)
{
CoglPipelineShaderState *shader_state;
- shader_state = u_slice_new0 (CoglPipelineShaderState);
+ shader_state = c_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) );
- u_slice_free (CoglPipelineShaderState, shader_state);
+ c_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);
- u_string_append_printf (shader_state->header,
+ c_string_append_printf (shader_state->header,
"in vec4 cogl_tex_coord%i_in;\n"
"out 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 (U_LIKELY (!(COGL_DEBUG_ENABLED
+ if (C_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 UStrings for code-gen. One string
+ /* We reuse two grow-only CStrings 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 */
- u_string_set_size (ctx->codegen_header_buffer, 0);
- u_string_set_size (ctx->codegen_source_buffer, 0);
+ c_string_set_size (ctx->codegen_header_buffer, 0);
+ c_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);
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
"void\n"
"cogl_generated_source ()\n"
"{\n");
if (cogl_pipeline_get_per_vertex_point_size (pipeline))
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
"in 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)
{
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
"uniform float cogl_point_size_in;\n");
- u_string_append (shader_state->source,
+ c_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.
*/
- u_string_append_printf (shader_state->header,
+ c_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 = u_strdup_printf ("cogl_real_transform_layer%i",
+ snippet_data.chain_function = c_strdup_printf ("cogl_real_transform_layer%i",
layer_index);
- snippet_data.final_name = u_strdup_printf ("cogl_transform_layer%i",
+ snippet_data.final_name = c_strdup_printf ("cogl_transform_layer%i",
layer_index);
- snippet_data.function_prefix = u_strdup_printf ("cogl_transform_layer%i",
+ snippet_data.function_prefix = c_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);
- u_free ((char *) snippet_data.chain_function);
- u_free ((char *) snippet_data.final_name);
- u_free ((char *) snippet_data.function_prefix);
+ c_free ((char *) snippet_data.chain_function);
+ c_free ((char *) snippet_data.final_name);
+ c_free ((char *) snippet_data.function_prefix);
- u_string_append_printf (shader_state->source,
+ c_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);
- u_string_append (shader_state->header,
+ c_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");
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" cogl_vertex_transform ();\n");
if (has_per_vertex_point_size)
{
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
"void\n"
"cogl_real_point_size_calculation ()\n"
"{\n"
" cogl_point_size_out = cogl_point_size_in;\n"
"}\n");
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" cogl_point_size_calculation ();\n");
}
- u_string_append (shader_state->source,
+ c_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);
- u_string_append (shader_state->source,
+ c_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))
{
- u_string_append (shader_state->header,
+ c_string_append (shader_state->header,
"uniform vec4 _cogl_flip_vector;\n");
- u_string_append (shader_state->source,
+ c_string_append (shader_state->source,
" cogl_position_out *= _cogl_flip_vector;\n");
}
- u_string_append (shader_state->source,
+ c_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 = u_alloca (len);
+ shader_log = c_alloca (len);
GE( ctx, glGetShaderInfoLog (shader, len, &len, shader_log) );
- u_warning ("Shader compilation failed:\n%s", shader_log);
+ c_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[U_N_ELEMENTS (pipelines)];
+ CoglPipelineShaderState *shader_states[C_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 < U_N_ELEMENTS (pipelines); i++)
+ for (i = 0; i < C_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 < U_N_ELEMENTS (pipelines); i++)
+ for (i = 0; i < C_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))
- u_assert (shader_states[0] == shader_states[1]);
+ c_assert (shader_states[0] == shader_states[1]);
else
- u_assert (shader_states[0] != shader_states[1]);
+ c_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 */
- u_assert (shader_states[1] == shader_states[2]);
+ c_assert (shader_states[1] == shader_states[2]);
/* The fourth pipeline should be exactly the same as the first */
- u_assert (shader_states[0] == shader_states[3]);
+ c_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 47f39625..c9240a35 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
{
- u_warning ("Failed to read first pixel of bitmap for "
+ c_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
- u_return_val_if_reached (FALSE);
+ c_return_val_if_reached (FALSE);
#endif
case COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN:
return allocate_from_gl_foreign (tex_2d, loader, error);
}
- u_return_val_if_reached (FALSE);
+ c_return_val_if_reached (FALSE);
}
void
@@ -693,7 +693,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
}
else
{
- u_warning ("Failed to read first bitmap pixel for "
+ c_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 d106bcb7..0165c817 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) U_STMT_START { \
+#define GE(ctx, x) C_STMT_START { \
GLenum __err; \
(ctx)->x; \
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
{ \
- u_warning ("%s: GL error (%d): %s\n", \
+ c_warning ("%s: GL error (%d): %s\n", \
G_STRLOC, \
__err, \
_cogl_gl_error_to_string (__err)); \
- } } U_STMT_END
+ } } C_STMT_END
-#define GE_RET(ret, ctx, x) U_STMT_START { \
+#define GE_RET(ret, ctx, x) C_STMT_START { \
GLenum __err; \
ret = (ctx)->x; \
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
{ \
- u_warning ("%s: GL error (%d): %s\n", \
+ c_warning ("%s: GL error (%d): %s\n", \
G_STRLOC, \
__err, \
_cogl_gl_error_to_string (__err)); \
- } } U_STMT_END
+ } } C_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 8e6ad9ef..f1c1a8d2 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 = U_N_ELEMENTS (gl_errors);
+static const unsigned int n_gl_errors = C_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
{
- u_warning ("%s: GL error (%d): %s\n",
+ c_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 42fb6435..b87c5619 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:
- u_assert_not_reached ();
+ c_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 */
- u_assert (glformat != 0);
+ c_assert (glformat != 0);
if (out_glintformat != NULL)
*out_glintformat = glintformat;
@@ -403,9 +403,9 @@ _cogl_driver_update_features (CoglContext *ctx,
if (!check_gl_version (ctx, gl_extensions, error))
return FALSE;
- if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
{
- char *all_extensions = u_strjoinv (" ", gl_extensions);
+ char *all_extensions = c_strjoinv (" ", gl_extensions);
COGL_NOTE (WINSYS,
"Checking features\n"
@@ -418,12 +418,12 @@ _cogl_driver_update_features (CoglContext *ctx,
_cogl_context_get_gl_version (ctx),
all_extensions);
- u_free (all_extensions);
+ c_free (all_extensions);
}
_cogl_get_gl_version (ctx, &gl_major, &gl_minor);
- _cogl_gpu_info_init (ctx, &ctx->gpu);
+ _cogl_gpc_info_init (ctx, &ctx->gpu);
ctx->glsl_major = 1;
ctx->glsl_minor = 1;
@@ -637,10 +637,10 @@ _cogl_driver_update_features (CoglContext *ctx,
TRUE);
/* Cache features */
- for (i = 0; i < U_N_ELEMENTS (private_features); i++)
+ for (i = 0; i < C_N_ELEMENTS (private_features); i++)
ctx->private_features[i] |= private_features[i];
- u_strfreev (gl_extensions);
+ c_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-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c
index 6b3c648a..39b31216 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:
- u_assert_not_reached();
+ c_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 0e676d70..a124a35d 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:
- u_assert_not_reached ();
+ c_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 */
- u_assert (glformat != 0);
+ c_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 (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
+ if (C_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
{
- char *all_extensions = u_strjoinv (" ", gl_extensions);
+ char *all_extensions = c_strjoinv (" ", gl_extensions);
COGL_NOTE (WINSYS,
"Checking features\n"
@@ -247,14 +247,14 @@ _cogl_driver_update_features (CoglContext *context,
_cogl_context_get_gl_version (context),
all_extensions);
- u_free (all_extensions);
+ c_free (all_extensions);
}
context->glsl_major = 1;
context->glsl_minor = 0;
context->glsl_version_to_use = 100;
- _cogl_gpu_info_init (context, &context->gpu);
+ _cogl_gpc_info_init (context, &context->gpu);
_cogl_feature_check_ext_functions (context,
-1 /* GL major version */,
@@ -356,10 +356,10 @@ _cogl_driver_update_features (CoglContext *context,
TRUE);
/* Cache features */
- for (i = 0; i < U_N_ELEMENTS (private_features); i++)
+ for (i = 0; i < C_N_ELEMENTS (private_features); i++)
context->private_features[i] |= private_features[i];
- u_strfreev (gl_extensions);
+ c_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 aa22faa7..5d895247 100644
--- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -94,7 +94,7 @@ _cogl_texture_driver_gen (CoglContext *ctx,
break;
default:
- u_assert_not_reached();
+ c_assert_not_reached();
}
return tex;
@@ -117,8 +117,8 @@ prep_gl_for_pixels_upload_full (CoglContext *ctx,
}
else
{
- u_assert (pixels_src_x == 0);
- u_assert (pixels_src_y == 0);
+ c_assert (pixels_src_x == 0);
+ c_assert (pixels_src_y == 0);
}
_cogl_texture_gl_prep_alignment_for_pixels_upload (ctx, pixels_rowstride);
diff --git a/cogl/driver/nop/cogl-driver-nop.c b/cogl/driver/nop/cogl-driver-nop.c
index 0ca86051..9fe91197 100644
--- a/cogl/driver/nop/cogl-driver-nop.c
+++ b/cogl/driver/nop/cogl-driver-nop.c
@@ -48,7 +48,7 @@ static CoglBool
_cogl_driver_update_features (CoglContext *ctx,
CoglError **error)
{
- /* _cogl_gpu_info_init (ctx, &ctx->gpu); */
+ /* _cogl_gpc_info_init (ctx, &ctx->gpu); */
memset (ctx->private_features, 0, sizeof (ctx->private_features));
diff --git a/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/driver/nop/cogl-framebuffer-nop.c
index cc701a92..5ce5b5db 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 <ulib.h>
+#include <clib.h>
#include <string.h>
void
diff --git a/cogl/driver/nop/cogl-pipeline-fragend-nop.c b/cogl/driver/nop/cogl-pipeline-fragend-nop.c
index 99bf8705..315c0164 100644
--- a/cogl/driver/nop/cogl-pipeline-fragend-nop.c
+++ b/cogl/driver/nop/cogl-pipeline-fragend-nop.c
@@ -31,7 +31,7 @@
#include "cogl-pipeline-private.h"
-#include <ulib.h>
+#include <clib.h>
const CoglPipelineFragend _cogl_pipeline_nop_fragend;
diff --git a/cogl/stb_image.c b/cogl/stb_image.c
index 04138dad..a4c4ef5d 100644
--- a/cogl/stb_image.c
+++ b/cogl/stb_image.c
@@ -970,8 +970,8 @@ typedef struct
// sizes for components, interleaved MCUs
int img_h_max, img_v_max;
- int img_mcu_x, img_mcu_y;
- int img_mcu_w, img_mcu_h;
+ int img_mcc_x, img_mcc_y;
+ int img_mcc_w, img_mcc_h;
// definition of jpeg image component
struct
@@ -1386,8 +1386,8 @@ static int parse_entropy_coded_data(jpeg *z)
} else { // interleaved!
int i,j,k,x,y;
short data[64];
- for (j=0; j < z->img_mcu_y; ++j) {
- for (i=0; i < z->img_mcu_x; ++i) {
+ for (j=0; j < z->img_mcc_y; ++j) {
+ for (i=0; i < z->img_mcc_x; ++i) {
// scan an interleaved mcu... process scan_n components in order
for (k=0; k < z->scan_n; ++k) {
int n = z->order[k];
@@ -1556,10 +1556,10 @@ static int process_frame_header(jpeg *z, int scan)
// compute interleaved mcu info
z->img_h_max = h_max;
z->img_v_max = v_max;
- z->img_mcu_w = h_max * 8;
- z->img_mcu_h = v_max * 8;
- z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
- z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;
+ z->img_mcc_w = h_max * 8;
+ z->img_mcc_h = v_max * 8;
+ z->img_mcc_x = (s->img_x + z->img_mcc_w-1) / z->img_mcc_w;
+ z->img_mcc_y = (s->img_y + z->img_mcc_h-1) / z->img_mcc_h;
for (i=0; i < s->img_n; ++i) {
// number of effective pixels (e.g. for non-interleaved MCU)
@@ -1569,8 +1569,8 @@ static int process_frame_header(jpeg *z, int scan)
// the bogus oversized data from using interleaved MCUs and their
// big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
// discard the extra data until colorspace conversion
- z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
- z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
+ z->img_comp[i].w2 = z->img_mcc_x * z->img_comp[i].h * 8;
+ z->img_comp[i].h2 = z->img_mcc_y * z->img_comp[i].v * 8;
z->img_comp[i].raw_data = malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);
if (z->img_comp[i].raw_data == NULL) {
for(--i; i >= 0; --i) {
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 9a6b4607..37a2b8ba 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 u_quark_from_static_string ("cogl-texture-pixmap-error-quark");
+ return c_quark_from_static_string ("cogl-texture-pixmap-error-quark");
}
static void
@@ -167,7 +167,7 @@ process_damage_event (CoglTexturePixmapX11 *tex_pixmap,
break;
default:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
/* If the damage already covers the whole rectangle then we don't
@@ -286,7 +286,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctx,
CoglBool automatic_updates,
CoglError **error)
{
- CoglTexturePixmapX11 *tex_pixmap = u_new (CoglTexturePixmapX11, 1);
+ CoglTexturePixmapX11 *tex_pixmap = c_new (CoglTexturePixmapX11, 1);
Display *display = cogl_xlib_renderer_get_display (ctx->display->renderer);
Window pixmap_root_window;
int pixmap_x, pixmap_y;
@@ -303,7 +303,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctx,
&pixmap_width, &pixmap_height,
&pixmap_border_width, &tex_pixmap->depth))
{
- u_free (tex_pixmap);
+ c_free (tex_pixmap);
_cogl_set_error (error,
COGL_TEXTURE_PIXMAP_X11_ERROR,
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
@@ -333,7 +333,7 @@ cogl_texture_pixmap_x11_new (CoglContext *ctx,
it from the pixmap's root window */
if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes))
{
- u_free (tex_pixmap);
+ c_free (tex_pixmap);
_cogl_set_error (error,
COGL_TEXTURE_PIXMAP_X11_ERROR,
COGL_TEXTURE_PIXMAP_X11_ERROR_X11,
@@ -447,15 +447,15 @@ try_alloc_shm (CoglTexturePixmapX11 *tex_pixmap)
return;
failed_xshmattach:
- u_warning ("XShmAttach failed");
+ c_warning ("XShmAttach failed");
shmdt (tex_pixmap->shm_info.shmaddr);
failed_shmat:
- u_warning ("shmat failed");
+ c_warning ("shmat failed");
shmctl (tex_pixmap->shm_info.shmid, IPC_RMID, 0);
failed_shmget:
- u_warning ("shmget failed");
+ c_warning ("shmget failed");
XDestroyImage (dummy_image);
failed_image_create:
@@ -763,7 +763,7 @@ _cogl_texture_pixmap_x11_get_texture (CoglTexturePixmapX11 *tex_pixmap)
_cogl_texture_pixmap_x11_update (tex_pixmap, FALSE);
}
- u_assert_not_reached ();
+ c_assert_not_reached ();
return NULL;
}
diff --git a/cogl/winsys/cogl-winsys-egl-android.c b/cogl/winsys/cogl-winsys-egl-android.c
index fca958c8..7360351e 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);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_slice_free (CoglRendererEGL, egl_renderer);
}
static CoglBool
@@ -79,7 +79,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
{
CoglRendererEGL *egl_renderer;
- renderer->winsys = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_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 = u_slice_new0 (CoglDisplayAndroid);
+ android_display = c_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;
- u_slice_free (CoglDisplayAndroid, egl_display->platform);
+ c_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 81ce5ed6..620eee76 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);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_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 = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_slice_new0 (CoglRendererEGL);
egl_renderer = renderer->winsys;
- gdl_renderer = u_slice_new0 (CoglRendererGDL);
+ gdl_renderer = c_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 = u_slice_new0 (CoglDisplayGDL);
+ gdl_display = c_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;
- u_slice_free (CoglDisplayGDL, egl_display->platform);
+ c_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 9658a78d..4c3e2132 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 <ulib.h>
+#include <clib.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <string.h>
@@ -86,8 +86,8 @@ typedef struct _CoglOutputKMS
typedef struct _CoglDisplayKMS
{
- UList *outputs;
- UList *crtcs;
+ CList *outputs;
+ CList *crtcs;
int width, height;
CoglBool pending_set_crtc;
@@ -125,8 +125,8 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
if (kms_renderer->opened_fd >= 0)
close (kms_renderer->opened_fd);
- u_slice_free (CoglRendererKMS, kms_renderer);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_slice_free (CoglRendererKMS, kms_renderer);
+ c_slice_free (CoglRendererEGL, egl_renderer);
}
static void
@@ -143,7 +143,7 @@ flush_pending_swap_notify_cb (void *data,
if (kms_onscreen->pending_swap_notify)
{
- CoglFrameInfo *info = u_queue_pop_head (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_queue_pop_head (&onscreen->pending_frame_infos);
_cogl_onscreen_notify_frame_sync (onscreen, info);
_cogl_onscreen_notify_complete (onscreen, info);
@@ -166,7 +166,7 @@ flush_pending_swap_notify_idle (void *user_data)
_cogl_closure_disconnect (kms_renderer->swap_notify_idle);
kms_renderer->swap_notify_idle = NULL;
- u_list_foreach (context->framebuffers,
+ c_list_foreach (context->framebuffers,
flush_pending_swap_notify_cb,
NULL);
}
@@ -241,7 +241,7 @@ page_flip_handler (int fd,
cogl_object_unref (flip->onscreen);
- u_slice_free (CoglFlipKMS, flip);
+ c_slice_free (CoglFlipKMS, flip);
}
}
@@ -276,11 +276,11 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
CoglRendererEGL *egl_renderer;
CoglRendererKMS *kms_renderer;
- renderer->winsys = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_slice_new0 (CoglRendererEGL);
egl_renderer = renderer->winsys;
egl_renderer->platform_vtable = &_cogl_winsys_egl_vtable;
- egl_renderer->platform = u_slice_new0 (CoglRendererKMS);
+ egl_renderer->platform = c_slice_new0 (CoglRendererKMS);
kms_renderer = egl_renderer->platform;
kms_renderer->fd = -1;
@@ -438,7 +438,7 @@ find_output (int _index,
int n_excluded_connectors,
CoglError **error)
{
- char *connector_env_name = u_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
+ char *connector_env_name = c_strdup_printf ("COGL_KMS_CONNECTOR%d", _index);
char *mode_env_name;
drmModeConnector *connector;
drmModeEncoder *encoder;
@@ -453,7 +453,7 @@ find_output (int _index,
}
else
connector = NULL;
- u_free (connector_env_name);
+ c_free (connector_env_name);
if (connector == NULL)
connector = find_connector (fd, resources,
@@ -471,7 +471,7 @@ find_output (int _index,
* seems more reliable. */
encoder = drmModeGetEncoder (fd, connector->encoders[0]);
- output = u_slice_new0 (CoglOutputKMS);
+ output = c_slice_new0 (CoglOutputKMS);
output->connector = connector;
output->encoder = encoder;
output->saved_crtc = drmModeGetCrtc (fd, encoder->crtc_id);
@@ -479,7 +479,7 @@ find_output (int _index,
if (is_panel (connector->connector_type))
{
n_modes = connector->count_modes + 1;
- modes = u_new (drmModeModeInfo, n_modes);
+ modes = c_new (drmModeModeInfo, n_modes);
memcpy (modes, connector->modes,
sizeof (drmModeModeInfo) * connector->count_modes);
/* TODO: parse EDID */
@@ -488,12 +488,12 @@ find_output (int _index,
else
{
n_modes = connector->count_modes;
- modes = u_new (drmModeModeInfo, n_modes);
+ modes = c_new (drmModeModeInfo, n_modes);
memcpy (modes, connector->modes,
sizeof (drmModeModeInfo) * n_modes);
}
- mode_env_name = u_strdup_printf ("COGL_KMS_CONNECTOR%d_MODE", _index);
+ mode_env_name = c_strdup_printf ("COGL_KMS_CONNECTOR%d_MODE", _index);
if (getenv (mode_env_name))
{
const char *name = getenv (mode_env_name);
@@ -511,7 +511,7 @@ find_output (int _index,
}
if (!found)
{
- u_free (mode_env_name);
+ c_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",
@@ -520,11 +520,11 @@ find_output (int _index,
}
n_modes = 1;
mode = modes[i];
- u_free (modes);
- modes = u_new (drmModeModeInfo, 1);
+ c_free (modes);
+ modes = c_new (drmModeModeInfo, 1);
modes[0] = mode;
}
- u_free (mode_env_name);
+ c_free (mode_env_name);
output->modes = modes;
output->n_modes = n_modes;
@@ -539,7 +539,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;
- UList *l;
+ CList *l;
for (l = kms_display->crtcs; l; l = l->next)
{
@@ -551,7 +551,7 @@ setup_crtc_modes (CoglDisplay *display, int fb_id)
crtc->connectors, crtc->count,
crtc->count ? &crtc->mode : NULL);
if (ret)
- u_warning ("Failed to set crtc mode %s: %m", crtc->mode.name);
+ c_warning ("Failed to set crtc mode %s: %m", crtc->mode.name);
}
}
@@ -562,7 +562,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;
- UList *l;
+ CList *l;
for (l = kms_display->crtcs; l; l = l->next)
{
@@ -578,7 +578,7 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
if (ret)
{
- u_warning ("Failed to flip: %m");
+ c_warning ("Failed to flip: %m");
continue;
}
@@ -589,8 +589,8 @@ flip_all_crtcs (CoglDisplay *display, CoglFlipKMS *flip, int fb_id)
static void
crtc_free (CoglKmsCrtc *crtc)
{
- u_free (crtc->connectors);
- u_slice_free (CoglKmsCrtc, crtc);
+ c_free (crtc->connectors);
+ c_slice_free (CoglKmsCrtc, crtc);
}
static CoglKmsCrtc *
@@ -598,10 +598,10 @@ crtc_copy (CoglKmsCrtc *from)
{
CoglKmsCrtc *new;
- new = u_slice_new (CoglKmsCrtc);
+ new = c_slice_new (CoglKmsCrtc);
*new = *from;
- new->connectors = u_memdup (from->connectors, from->count * sizeof(uint32_t));
+ new->connectors = c_memdup (from->connectors, from->count * sizeof(uint32_t));
return new;
}
@@ -619,7 +619,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
CoglBool mirror;
CoglKmsCrtc *crtc0, *crtc1;
- kms_display = u_slice_new0 (CoglDisplayKMS);
+ kms_display = c_slice_new0 (CoglDisplayKMS);
egl_display->platform = kms_display;
resources = drmModeGetResources (kms_renderer->fd);
@@ -637,7 +637,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
NULL,
0, /* n excluded connectors */
error);
- kms_display->outputs = u_list_append (kms_display->outputs, output0);
+ kms_display->outputs = c_list_append (kms_display->outputs, output0);
if (!output0)
return FALSE;
@@ -658,7 +658,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
if (!output1)
return FALSE;
- kms_display->outputs = u_list_append (kms_display->outputs, output1);
+ kms_display->outputs = c_list_append (kms_display->outputs, output1);
if (!find_mirror_modes (output0->modes, output0->n_modes,
output1->modes, output1->n_modes,
@@ -677,27 +677,27 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
output1 = NULL;
}
- crtc0 = u_slice_new (CoglKmsCrtc);
+ crtc0 = c_slice_new (CoglKmsCrtc);
crtc0->id = output0->encoder->crtc_id;
crtc0->x = 0;
crtc0->y = 0;
crtc0->mode = output0->mode;
- crtc0->connectors = u_new (uint32_t, 1);
+ crtc0->connectors = c_new (uint32_t, 1);
crtc0->connectors[0] = output0->connector->connector_id;
crtc0->count = 1;
- kms_display->crtcs = u_list_prepend (kms_display->crtcs, crtc0);
+ kms_display->crtcs = c_list_prepend (kms_display->crtcs, crtc0);
if (output1)
{
- crtc1 = u_slice_new (CoglKmsCrtc);
+ crtc1 = c_slice_new (CoglKmsCrtc);
crtc1->id = output1->encoder->crtc_id;
crtc1->x = 0;
crtc1->y = 0;
crtc1->mode = output1->mode;
- crtc1->connectors = u_new (uint32_t, 1);
+ crtc1->connectors = c_new (uint32_t, 1);
crtc1->connectors[0] = output1->connector->connector_id;
crtc1->count = 1;
- kms_display->crtcs = u_list_prepend (kms_display->crtcs, crtc1);
+ kms_display->crtcs = c_list_prepend (kms_display->crtcs, crtc1);
}
kms_display->width = output0->mode.hdisplay;
@@ -714,7 +714,7 @@ static void
output_free (int fd, CoglOutputKMS *output)
{
if (output->modes)
- u_free (output->modes);
+ c_free (output->modes);
if (output->encoder)
drmModeFreeEncoder (output->encoder);
@@ -731,12 +731,12 @@ output_free (int fd, CoglOutputKMS *output)
&output->connector->connector_id, 1,
&output->saved_crtc->mode);
if (ret)
- u_warning (G_STRLOC ": Error restoring saved CRTC");
+ c_warning (G_STRLOC ": Error restoring saved CRTC");
}
drmModeFreeConnector (output->connector);
}
- u_slice_free (CoglOutputKMS, output);
+ c_slice_free (CoglOutputKMS, output);
}
static void
@@ -747,16 +747,16 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererKMS *kms_renderer = egl_renderer->platform;
- UList *l;
+ CList *l;
for (l = kms_display->outputs; l; l = l->next)
output_free (kms_renderer->fd, l->data);
- u_list_free (kms_display->outputs);
+ c_list_free (kms_display->outputs);
kms_display->outputs = NULL;
- u_list_free_full (kms_display->crtcs, (UDestroyNotify) crtc_free);
+ c_list_free_full (kms_display->crtcs, (CDestroyNotify) crtc_free);
- u_slice_free (CoglDisplayKMS, egl_display->platform);
+ c_slice_free (CoglDisplayKMS, egl_display->platform);
}
static CoglBool
@@ -873,7 +873,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
handle,
&kms_onscreen->next_fb_id))
{
- u_warning ("Failed to create new back buffer handle: %m");
+ c_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;
@@ -889,7 +889,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
kms_display->pending_set_crtc = FALSE;
}
- flip = u_slice_new0 (CoglFlipKMS);
+ flip = c_slice_new0 (CoglFlipKMS);
flip->onscreen = onscreen;
flip_all_crtcs (context->display, flip, kms_onscreen->next_fb_id);
@@ -901,7 +901,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;
- u_slice_free (CoglFlipKMS, flip);
+ c_slice_free (CoglFlipKMS, flip);
flip = NULL;
}
else
@@ -949,10 +949,10 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
kms_display->onscreen = onscreen;
- onscreen->winsys = u_slice_new0 (CoglOnscreenEGL);
+ onscreen->winsys = c_slice_new0 (CoglOnscreenEGL);
egl_onscreen = onscreen->winsys;
- kms_onscreen = u_slice_new0 (CoglOnscreenKMS);
+ kms_onscreen = c_slice_new0 (CoglOnscreenKMS);
egl_onscreen->platform = kms_onscreen;
kms_onscreen->surface =
@@ -1014,7 +1014,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. */
- u_return_if_fail (kms_onscreen->next_fb_id == 0);
+ c_return_if_fail (kms_onscreen->next_fb_id == 0);
free_current_bo (onscreen);
@@ -1030,8 +1030,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
kms_onscreen->surface = NULL;
}
- u_slice_free (CoglOnscreenKMS, kms_onscreen);
- u_slice_free (CoglOnscreenEGL, onscreen->winsys);
+ c_slice_free (CoglOnscreenKMS, kms_onscreen);
+ c_slice_free (CoglOnscreenEGL, onscreen->winsys);
onscreen->winsys = NULL;
}
@@ -1129,7 +1129,7 @@ cogl_kms_display_set_layout (CoglDisplay *display,
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererKMS *kms_renderer = egl_renderer->platform;
- UList *crtc_list;
+ CList *crtc_list;
int i;
if ((width != kms_display->width ||
@@ -1183,14 +1183,14 @@ cogl_kms_display_set_layout (CoglDisplay *display,
kms_display->width = width;
kms_display->height = height;
- u_list_free_full (kms_display->crtcs, (UDestroyNotify) crtc_free);
+ c_list_free_full (kms_display->crtcs, (CDestroyNotify) crtc_free);
crtc_list = NULL;
for (i = 0; i < n_crtcs; i++)
{
- crtc_list = u_list_prepend (crtc_list, crtc_copy (crtcs[i]));
+ crtc_list = c_list_prepend (crtc_list, crtc_copy (crtcs[i]));
}
- crtc_list = u_list_reverse (crtc_list);
+ crtc_list = c_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 69df3e1f..15efffb2 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);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_slice_free (CoglRendererEGL, egl_renderer);
}
static CoglBool
@@ -66,7 +66,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
{
CoglRendererEGL *egl_renderer;
- renderer->winsys = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_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 = u_slice_new0 (CoglDisplayNull);
+ null_display = c_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;
- u_slice_free (CoglDisplayNull, egl_display->platform);
+ c_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 f3fe63c2..dfc560c6 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);
}
- u_slice_free (CoglRendererWayland, egl_renderer->platform);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_slice_free (CoglRendererWayland, egl_renderer->platform);
+ c_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 = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_slice_new0 (CoglRendererEGL);
egl_renderer = renderer->winsys;
- wayland_renderer = u_slice_new0 (CoglRendererWayland);
+ wayland_renderer = c_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... */
- u_setenv ("EGL_PLATFORM", "wayland", 1);
+ c_setenv ("EGL_PLATFORM", "wayland", 1);
if (renderer->foreign_wayland_display)
{
@@ -315,7 +315,7 @@ _cogl_winsys_egl_display_setup (CoglDisplay *display,
CoglDisplayEGL *egl_display = display->winsys;
CoglDisplayWayland *wayland_display;
- wayland_display = u_slice_new0 (CoglDisplayWayland);
+ wayland_display = c_slice_new0 (CoglDisplayWayland);
egl_display->platform = wayland_display;
return TRUE;
@@ -326,7 +326,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display)
{
CoglDisplayEGL *egl_display = display->winsys;
- u_slice_free (CoglDisplayWayland, egl_display->platform);
+ c_slice_free (CoglDisplayWayland, egl_display->platform);
}
static CoglBool
@@ -456,7 +456,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererWayland *wayland_renderer = egl_renderer->platform;
- wayland_onscreen = u_slice_new0 (CoglOnscreenWayland);
+ wayland_onscreen = c_slice_new0 (CoglOnscreenWayland);
egl_onscreen->platform = wayland_onscreen;
_cogl_list_init (&wayland_onscreen->frame_callbacks);
@@ -509,7 +509,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);
- u_slice_free (FrameCallbackData, callback_data);
+ c_slice_free (FrameCallbackData, callback_data);
}
static void
@@ -549,7 +549,7 @@ _cogl_winsys_egl_onscreen_deinit (CoglOnscreen *onscreen)
}
}
- u_slice_free (CoglOnscreenWayland, wayland_onscreen);
+ c_slice_free (CoglOnscreenWayland, wayland_onscreen);
}
static void
@@ -587,7 +587,7 @@ frame_cb (void *data,
CoglFrameInfo *info = callback_data->frame_info;
CoglOnscreen *onscreen = callback_data->onscreen;
- u_assert (callback_data->callback == callback);
+ c_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);
@@ -608,7 +608,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 = u_slice_new (FrameCallbackData);
+ FrameCallbackData *frame_callback_data = c_slice_new (FrameCallbackData);
flush_pending_resize (onscreen);
@@ -620,7 +620,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 =
- u_queue_pop_tail (&onscreen->pending_frame_infos);
+ c_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 b669306a..be28b7bc 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)
{
- UList *l;
+ CList *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;
- u_list_foreach (context->framebuffers,
+ c_list_foreach (context->framebuffers,
flush_pending_resize_notifications_cb,
NULL);
}
@@ -258,7 +258,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
eglTerminate (egl_renderer->edpy);
- u_slice_free (CoglRendererEGL, egl_renderer);
+ c_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 = u_slice_new0 (CoglRendererEGL);
+ renderer->winsys = c_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 = u_slice_new0 (CoglDisplayXlib);
+ xlib_display = c_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;
- u_slice_free (CoglDisplayXlib, egl_display->platform);
+ c_slice_free (CoglDisplayXlib, egl_display->platform);
}
static CoglBool
@@ -471,7 +471,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
}
}
- xlib_onscreen = u_slice_new (CoglOnscreenXlib);
+ xlib_onscreen = c_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)
- u_warning ("X Error while destroying X window");
+ c_warning ("X Error while destroying X window");
- u_slice_free (CoglOnscreenXlib, xlib_onscreen);
+ c_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 = u_new0 (CoglTexturePixmapEGL, 1);
+ egl_tex_pixmap = c_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)
{
- u_free (egl_tex_pixmap);
+ c_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;
- u_free (egl_tex_pixmap);
+ c_free (egl_tex_pixmap);
}
static CoglBool
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 69a9157e..9024008d 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), U_STRUCT_OFFSET (CoglRendererEGL, pf_ ## name) },
+ { G_STRINGIFY (name), C_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:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
}
@@ -152,7 +152,7 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
/* eglGetProcAddress doesn't support fetching core API so we need to
get that separately with UModule */
if (ptr == NULL)
- u_module_symbol (renderer->libgl_module, name, &ptr);
+ c_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 */
- u_assert_not_reached ();
+ c_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 = u_strsplit (egl_extensions, " ", 0 /* max_tokens */);
+ split_extensions = c_strsplit (egl_extensions, " ", 0 /* max_tokens */);
COGL_NOTE (WINSYS, " EGL Extensions: %s", egl_extensions);
egl_renderer->private_features = 0;
- for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
+ for (i = 0; i < C_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;
}
- u_strfreev (split_extensions);
+ c_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 */
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
static void
@@ -278,7 +278,7 @@ egl_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = EGL_NONE;
- u_assert (i < MAX_EGL_CONFIG_ATTRIBS);
+ c_assert (i < MAX_EGL_CONFIG_ATTRIBS);
}
EGLBoolean
@@ -436,7 +436,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
if (egl_renderer->platform_vtable->display_destroy)
egl_renderer->platform_vtable->display_destroy (display);
- u_slice_free (CoglDisplayEGL, display->winsys);
+ c_slice_free (CoglDisplayEGL, display->winsys);
display->winsys = NULL;
}
@@ -450,7 +450,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
_COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
- egl_display = u_slice_new0 (CoglDisplayEGL);
+ egl_display = c_slice_new0 (CoglDisplayEGL);
display->winsys = egl_display;
#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
@@ -488,7 +488,7 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
CoglDisplayEGL *egl_display = context->display->winsys;
CoglRendererEGL *egl_renderer = renderer->winsys;
- context->winsys = u_new0 (CoglContextEGL, 1);
+ context->winsys = c_new0 (CoglContextEGL, 1);
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE);
@@ -540,7 +540,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
if (egl_renderer->platform_vtable->context_deinit)
egl_renderer->platform_vtable->context_deinit (context);
- u_free (context->winsys);
+ c_free (context->winsys);
}
typedef struct _CoglGLES2ContextEGL
@@ -632,18 +632,18 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
status = eglGetConfigAttrib (egl_renderer->edpy,
egl_config,
EGL_SAMPLES, &samples);
- u_return_val_if_fail (status == EGL_TRUE, TRUE);
+ c_return_val_if_fail (status == EGL_TRUE, TRUE);
framebuffer->samples_per_pixel = samples;
}
- onscreen->winsys = u_slice_new0 (CoglOnscreenEGL);
+ onscreen->winsys = c_slice_new0 (CoglOnscreenEGL);
if (egl_renderer->platform_vtable->onscreen_init &&
!egl_renderer->platform_vtable->onscreen_init (onscreen,
egl_config,
error))
{
- u_slice_free (CoglOnscreenEGL, onscreen->winsys);
+ c_slice_free (CoglOnscreenEGL, onscreen->winsys);
return FALSE;
}
@@ -681,14 +681,14 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
if (eglDestroySurface (egl_renderer->edpy, egl_onscreen->egl_surface)
== EGL_FALSE)
- u_warning ("Failed to destroy EGL surface");
+ c_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);
- u_slice_free (CoglOnscreenEGL, onscreen->winsys);
+ c_slice_free (CoglOnscreenEGL, onscreen->winsys);
onscreen->winsys = NULL;
}
@@ -767,7 +767,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 = u_alloca (sizeof (int) * n_rectangles * 4);
+ int *rectangles = c_alloca (sizeof (int) * n_rectangles * 4);
int i;
/* eglSwapBuffersRegion expects rectangles relative to the
@@ -792,7 +792,7 @@ _cogl_winsys_onscreen_swap_region (CoglOnscreen *onscreen,
egl_onscreen->egl_surface,
n_rectangles,
rectangles) == EGL_FALSE)
- u_warning ("Error reported by eglSwapBuffersRegion");
+ c_warning ("Error reported by eglSwapBuffersRegion");
}
static void
@@ -833,7 +833,7 @@ _cogl_winsys_onscreen_swap_buffers_with_damage (CoglOnscreen *onscreen,
egl_onscreen->egl_surface,
flipped,
n_rectangles) == EGL_FALSE)
- u_warning ("Error reported by eglSwapBuffersWithDamage");
+ c_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 fbb950a6..bd9818b1 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), U_STRUCT_OFFSET (CoglGLXRenderer, name) },
+ { G_STRINGIFY (name), C_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)
{
- UList *l;
+ CList *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:
- u_assert_not_reached ();
+ c_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)
}
}
- u_assert_not_reached();
+ c_assert_not_reached();
return 0;
}
@@ -326,14 +326,14 @@ flush_pending_notifications_cb (void *data,
if (pending_sync_notify)
{
- CoglFrameInfo *info = u_queue_peek_head (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_queue_peek_head (&onscreen->pending_frame_infos);
_cogl_onscreen_notify_frame_sync (onscreen, info);
}
if (pending_complete_notify)
{
- CoglFrameInfo *info = u_queue_pop_head (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_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;
- u_list_foreach (context->framebuffers,
+ c_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 = u_queue_peek_head (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_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)
- u_module_close (glx_renderer->libgl_module);
+ c_module_close (glx_renderer->libgl_module);
- u_slice_free (CoglGLXRenderer, renderer->winsys);
+ c_slice_free (CoglGLXRenderer, renderer->winsys);
}
static CoglBool
update_all_outputs (CoglRenderer *renderer)
{
- UList *l;
+ CList *l;
_COGL_GET_CONTEXT (context, FALSE);
@@ -635,17 +635,17 @@ resolve_core_glx_functions (CoglRenderer *renderer,
glx_renderer = renderer->winsys;
- if (!u_module_symbol (glx_renderer->libgl_module, "glXQueryExtension",
+ if (!c_module_symbol (glx_renderer->libgl_module, "glXQueryExtension",
(void **) &glx_renderer->glXQueryExtension) ||
- !u_module_symbol (glx_renderer->libgl_module, "glXQueryVersion",
+ !c_module_symbol (glx_renderer->libgl_module, "glXQueryVersion",
(void **) &glx_renderer->glXQueryVersion) ||
- !u_module_symbol (glx_renderer->libgl_module, "glXQueryExtensionsString",
+ !c_module_symbol (glx_renderer->libgl_module, "glXQueryExtensionsString",
(void **) &glx_renderer->glXQueryExtensionsString) ||
- (!u_module_symbol (glx_renderer->libgl_module, "glXGetProcAddress",
+ (!c_module_symbol (glx_renderer->libgl_module, "glXGetProcAddress",
(void **) &glx_renderer->glXGetProcAddress) &&
- !u_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
+ !c_module_symbol (glx_renderer->libgl_module, "glXGetProcAddressARB",
(void **) &glx_renderer->glXGetProcAddress)) ||
- !u_module_symbol (glx_renderer->libgl_module, "glXQueryDrawable",
+ !c_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 = u_strsplit (glx_extensions, " ", 0 /* max_tokens */);
+ split_extensions = c_strsplit (glx_extensions, " ", 0 /* max_tokens */);
- for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
+ for (i = 0; i < C_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);
}
- u_strfreev (split_extensions);
+ c_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 = u_slice_new0 (CoglGLXRenderer);
+ renderer->winsys = c_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 = u_module_open (COGL_GL_LIBNAME,
- U_MODULE_BIND_LAZY);
+ glx_renderer->libgl_module = c_module_open (COGL_GL_LIBNAME,
+ C_MODULE_BIND_LAZY);
if (glx_renderer->libgl_module == NULL)
{
@@ -901,7 +901,7 @@ glx_attributes_from_framebuffer_config (CoglDisplay *display,
attributes[i++] = None;
- u_assert (i < MAX_GLX_CONFIG_ATTRIBS);
+ c_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;
}
- u_slice_free (CoglGLXDisplay, display->winsys);
+ c_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 = u_slice_new0 (CoglGLXDisplay);
+ glx_display = c_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 = u_new0 (CoglContextGLX, 1);
+ context->winsys = c_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);
- u_free (context->winsys);
+ c_free (context->winsys);
}
static CoglBool
@@ -1262,7 +1262,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
fbconfig,
GLX_SAMPLES,
&samples);
- u_return_val_if_fail (status == Success, TRUE);
+ c_return_val_if_fail (status == Success, TRUE);
framebuffer->samples_per_pixel = samples;
}
@@ -1374,7 +1374,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
}
}
- onscreen->winsys = u_slice_new0 (CoglOnscreenGLX);
+ onscreen->winsys = c_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);
- u_slice_free (CoglOnscreenGLX, onscreen->winsys);
+ c_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))
{
- u_warning ("X Error received while making drawable 0x%08lX current",
+ c_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 = u_queue_peek_tail (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_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 = u_queue_peek_tail (&onscreen->pending_frame_infos);
+ CoglFrameInfo *info = c_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 = u_alloca (sizeof (int) * n_rectangles * 4);
+ int *rectangles = c_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 = u_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
+ if ((rect_env = c_getenv ("COGL_PIXMAP_TEXTURE_RECTANGLE")) ||
/* For compatibility, we'll also look at the old Clutter
environment variable */
- (rect_env = u_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
+ (rect_env = c_getenv ("CLUTTER_PIXMAP_TEXTURE_RECTANGLE")))
{
- if (u_ascii_strcasecmp (rect_env, "force") == 0)
+ if (c_ascii_strcasecmp (rect_env, "force") == 0)
context->rectangle_state =
COGL_WINSYS_RECTANGLE_STATE_ENABLE;
- else if (u_ascii_strcasecmp (rect_env, "disable") == 0)
+ else if (c_ascii_strcasecmp (rect_env, "disable") == 0)
context->rectangle_state =
COGL_WINSYS_RECTANGLE_STATE_DISABLE;
- else if (u_ascii_strcasecmp (rect_env, "allow"))
- u_warning ("Unknown value for COGL_PIXMAP_TEXTURE_RECTANGLE, "
+ else if (c_ascii_strcasecmp (rect_env, "allow"))
+ c_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 = u_new0 (CoglTexturePixmapGLX, 1);
+ glx_tex_pixmap = c_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;
- u_free (glx_tex_pixmap);
+ c_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;
- u_free (glx_tex_pixmap);
+ c_free (glx_tex_pixmap);
}
static CoglBool
diff --git a/cogl/winsys/cogl-winsys-sdl.c b/cogl/winsys/cogl-winsys-sdl.c
index 96137e9c..f6233c7f 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 ();
- u_slice_free (CoglRendererSdl, renderer->winsys);
+ c_slice_free (CoglRendererSdl, renderer->winsys);
}
static CoglBool
@@ -123,7 +123,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
return FALSE;
}
- renderer->winsys = u_slice_new0 (CoglRendererSdl);
+ renderer->winsys = c_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 */
- u_slice_free (CoglDisplaySdl, display->winsys);
+ c_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 = u_slice_new0 (CoglDisplaySdl);
+ sdl_display = c_slice_new0 (CoglDisplaySdl);
display->winsys = sdl_display;
set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config);
@@ -197,7 +197,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
#endif
default:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
/* There's no way to know what size the application will need until
@@ -303,8 +303,8 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
{
CoglRenderer *renderer = context->display->renderer;
- if (U_UNLIKELY (renderer->sdl_event_type_set == FALSE))
- u_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
+ if (C_UNLIKELY (renderer->sdl_event_type_set == FALSE))
+ c_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 48588f19..59cfa6e6 100644
--- a/cogl/winsys/cogl-winsys-sdl2.c
+++ b/cogl/winsys/cogl-winsys-sdl2.c
@@ -96,7 +96,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer)
{
SDL_VideoQuit ();
- u_slice_free (CoglRendererSdl2, renderer->winsys);
+ c_slice_free (CoglRendererSdl2, renderer->winsys);
}
static CoglBool
@@ -112,7 +112,7 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer,
return FALSE;
}
- renderer->winsys = u_slice_new0 (CoglRendererSdl2);
+ renderer->winsys = c_slice_new0 (CoglRendererSdl2);
return TRUE;
}
@@ -130,7 +130,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
if (sdl_display->dummy_window)
SDL_DestroyWindow (sdl_display->dummy_window);
- u_slice_free (CoglDisplaySdl2, display->winsys);
+ c_slice_free (CoglDisplaySdl2, display->winsys);
display->winsys = NULL;
}
@@ -161,7 +161,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
_COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
- sdl_display = u_slice_new0 (CoglDisplaySdl2);
+ sdl_display = c_slice_new0 (CoglDisplaySdl2);
display->winsys = sdl_display;
set_gl_attribs_from_framebuffer_config (&display->onscreen_template->config);
@@ -223,7 +223,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 (!u_ascii_isdigit (gl_version[0]))
+ if (!c_ascii_isdigit (gl_version[0]))
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,
@@ -243,8 +243,8 @@ _cogl_winsys_display_setup (CoglDisplay *display,
break;
case COGL_DRIVER_GLES2:
- if (!u_str_has_prefix (gl_version, "OpenGL ES 2") &&
- !u_str_has_prefix (gl_version, "OpenGL ES 3"))
+ if (!c_str_has_prefix (gl_version, "OpenGL ES 2") &&
+ !c_str_has_prefix (gl_version, "OpenGL ES 3"))
{
_cogl_set_error (error, COGL_WINSYS_ERROR,
COGL_WINSYS_ERROR_INIT,
@@ -255,7 +255,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
break;
default:
- u_assert_not_reached ();
+ c_assert_not_reached ();
}
return TRUE;
@@ -296,7 +296,7 @@ flush_pending_resize_notifications_idle (void *user_data)
_cogl_closure_disconnect (sdl_renderer->resize_notify_idle);
sdl_renderer->resize_notify_idle = NULL;
- u_list_foreach (context->framebuffers,
+ c_list_foreach (context->framebuffers,
flush_pending_notifications_cb,
NULL);
}
@@ -381,10 +381,10 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
{
CoglRenderer *renderer = context->display->renderer;
- context->winsys = u_new0 (CoglContextSdl2, 1);
+ context->winsys = c_new0 (CoglContextSdl2, 1);
- if (U_UNLIKELY (renderer->sdl_event_type_set == FALSE))
- u_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
+ if (C_UNLIKELY (renderer->sdl_event_type_set == FALSE))
+ c_error ("cogl_sdl_renderer_set_event_type() or cogl_sdl_context_new() "
"must be called during initialization");
if (!_cogl_context_update_features (context, error))
@@ -418,7 +418,7 @@ _cogl_winsys_context_deinit (CoglContext *context)
sdl_event_filter_cb,
context);
- u_free (context->winsys);
+ c_free (context->winsys);
}
static void
@@ -480,7 +480,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
sdl_onscreen->window = NULL;
}
- u_slice_free (CoglOnscreenSdl2, sdl_onscreen);
+ c_slice_free (CoglOnscreenSdl2, sdl_onscreen);
onscreen->winsys = NULL;
}
@@ -547,7 +547,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
SDL_SetWindowData (window, COGL_SDL_WINDOW_DATA_KEY, onscreen);
- onscreen->winsys = u_slice_new (CoglOnscreenSdl2);
+ onscreen->winsys = c_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 a8ba5101..6316484e 100644
--- a/cogl/winsys/cogl-winsys-stub.c
+++ b/cogl/winsys/cogl-winsys-stub.c
@@ -60,14 +60,14 @@ _cogl_winsys_renderer_get_proc_address (CoglRenderer *renderer,
/* this should find the right function if the program is linked against a
* library providing it */
- if (U_UNLIKELY (module == NULL))
- module = u_module_open (NULL, 0);
+ if (C_UNLIKELY (module == NULL))
+ module = c_module_open (NULL, 0);
if (module)
{
void *symbol;
- if (u_module_symbol (module, name, &symbol))
+ if (c_module_symbol (module, name, &symbol))
return symbol;
}
diff --git a/cogl/winsys/cogl-winsys-wgl.c b/cogl/winsys/cogl-winsys-wgl.c
index 797dd283..3a00ff0a 100644
--- a/cogl/winsys/cogl-winsys-wgl.c
+++ b/cogl/winsys/cogl-winsys-wgl.c
@@ -51,7 +51,7 @@
#include "cogl-error-private.h"
#include "cogl-poll-private.h"
-/* This magic handle will cause u_poll to wakeup when there is a
+/* This magic handle will cause c_poll to wakeup when there is a
* pending message */
#define WIN32_MSG_HANDLE 19981206
@@ -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), U_STRUCT_OFFSET (CoglRendererWgl, pf_ ## name) },
+ { G_STRINGIFY (name), C_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 = u_module_open ("opengl32", 0);
+ wgl_renderer->gl_module = c_module_open ("opengl32", 0);
if (wgl_renderer->gl_module)
- u_module_symbol (wgl_renderer->gl_module, name, &proc);
+ c_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)
- u_module_close (wgl_renderer->gl_module);
+ c_module_close (wgl_renderer->gl_module);
- u_slice_free (CoglRendererWgl, renderer->winsys);
+ c_slice_free (CoglRendererWgl, renderer->winsys);
}
static CoglOnscreen *
find_onscreen_for_hwnd (CoglContext *context, HWND hwnd)
{
CoglDisplayWgl *display_wgl = context->display->winsys;
- UList *l;
+ CList *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 = u_slice_new0 (CoglRendererWgl);
+ renderer->winsys = c_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 = u_strdup_printf ("CoglWindow0x%0*" G_GINTPTR_MODIFIER "x",
+ class_name_ascii = c_strdup_printf ("CoglWindow0x%0*" G_GINTPTR_MODIFIER "x",
sizeof (guintptr) * 2,
(guintptr) display);
/* Convert it to WCHARs */
- class_name_wchar = u_malloc ((strlen (class_name_ascii) + 1) *
+ class_name_wchar = c_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);
- u_free (class_name_wchar);
- u_free (class_name_ascii);
+ c_free (class_name_wchar);
+ c_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));
- u_slice_free (CoglDisplayWgl, display->winsys);
+ c_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 = u_slice_new0 (CoglDisplayWgl);
+ wgl_display = c_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);
- u_strfreev (extensions);
+ c_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 =
- u_strsplit (wgl_extensions, " ", 0 /* max_tokens */);
+ c_strsplit (wgl_extensions, " ", 0 /* max_tokens */);
COGL_NOTE (WINSYS, " WGL Extensions: %s", wgl_extensions);
- for (i = 0; i < U_N_ELEMENTS (winsys_feature_data); i++)
+ for (i = 0; i < C_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);
}
- u_strfreev (split_extensions);
+ c_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 = u_new0 (CoglContextWgl, 1);
+ context->winsys = c_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);
- u_free (context->winsys);
+ c_free (context->winsys);
}
static void
@@ -809,7 +809,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
DestroyWindow (win32_onscreen->hwnd);
}
- u_slice_free (CoglOnscreenWgl, onscreen->winsys);
+ c_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 = u_slice_new0 (CoglOnscreenWgl);
+ onscreen->winsys = c_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 c87c5efd..b0a0d120 100644
--- a/cogl/winsys/cogl-winsys.c
+++ b/cogl/winsys/cogl-winsys.c
@@ -34,12 +34,12 @@
#include "cogl-context-private.h"
-#include <umodule.h>
+#include <cmodule.h>
uint32_t
_cogl_winsys_error_domain (void)
{
- return u_quark_from_static_string ("cogl-winsys-error-quark");
+ return c_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 f0a1ee9e..406c07ba 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/ulib/src"
- COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/ulib/src"
+ COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_srcdir)/deps/clib/src"
+ COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -I\$(top_builddir)/deps/clib/src"
EXPERIMENTAL_CONFIG=yes
EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
enable_nls=no
@@ -1324,7 +1324,7 @@ LIBS="$save_libs"
dnl ================================================================
-dnl ulib checks.
+dnl clib checks.
dnl ================================================================
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
@@ -1468,10 +1468,9 @@ build/win32/Makefile
build/win32/vs9/Makefile
build/win32/vs10/Makefile
deps/Makefile
-deps/ulib/Makefile
-deps/ulib/src/Makefile
-deps/ulib/src/ulib-config.h
-deps/ulib/test/Makefile
+deps/clib/Makefile
+deps/clib/src/Makefile
+deps/clib/src/clib-config.h
test-fixtures/Makefile
cogl/Makefile
cogl/cogl2.pc
diff --git a/deps/Makefile.am b/deps/Makefile.am
index 04573f8d..f4f0e71e 100644
--- a/deps/Makefile.am
+++ b/deps/Makefile.am
@@ -1 +1 @@
-SUBDIRS = ulib
+SUBDIRS = clib
diff --git a/deps/ulib/.gitignore b/deps/clib/.gitignore
index 61e1af8f..61e1af8f 100644
--- a/deps/ulib/.gitignore
+++ b/deps/clib/.gitignore
diff --git a/deps/clib/Makefile.am b/deps/clib/Makefile.am
new file mode 100644
index 00000000..65eff75b
--- /dev/null
+++ b/deps/clib/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = src
+
+EXTRA_DIST = README winconfig.h
diff --git a/deps/ulib/src/.gitignore b/deps/clib/src/.gitignore
index 6635df1a..6635df1a 100644
--- a/deps/ulib/src/.gitignore
+++ b/deps/clib/src/.gitignore
diff --git a/deps/clib/src/Makefile.am b/deps/clib/src/Makefile.am
new file mode 100644
index 00000000..2d091720
--- /dev/null
+++ b/deps/clib/src/Makefile.am
@@ -0,0 +1,81 @@
+noinst_LTLIBRARIES = libclib.la libclib-static.la
+
+win_files = \
+ clib-config.hw \
+ cdate-win32.c cdir-win32.c cfile-win32.c cmisc-win32.c \
+ cmodule-win32.c ctimer-win32.c
+
+unix_files = \
+ cdate-unix.c cdir-unix.c cfile-unix.c cmisc-unix.c \
+ cmodule-unix.c ctimer-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 OS_WIN32
+os_files = $(win_files)
+else
+os_files = $(unix_files)
+endif
+
+libclib_la_SOURCES = \
+ sort.frag.h \
+ clib.h \
+ cdebugkey.c \
+ cquark.c \
+ carray.c \
+ cbytearray.c \
+ cerror.c \
+ chashtable.c \
+ ciconv.c \
+ cmem.c \
+ cmodule.h \
+ coutput.c \
+ cqsort.c \
+ cstr.c \
+ cslist.c \
+ cstring.c \
+ cptrarray.c \
+ clist.c \
+ chooklist.c \
+ cqueue.c \
+ cpath.c \
+ cshell.c \
+ cspawn.c \
+ cfile.c \
+ cfile-posix.c \
+ cutf8.c \
+ cunicode.c \
+ cnicode-data.h \
+ $(os_files) \
+ $(vasprintf_files)
+
+AM_CPPFLAGS = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(srcdir) \
+ -Wall \
+ $(RIG_DEP_CFLAGS) \
+ $(RIG_EXTRA_CPPFLAGS) \
+ $(NULL)
+
+#libclib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+#libclib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+libclib_static_la_SOURCES=$(libclib_la_SOURCES)
+libclib_static_la_CFLAGS = $(libclib_la_CFLAGS)
+
+if OS_WIN32
+libclib_la_LIBADD = -lm $(LTLIBICONV) -lpsapi
+endif
+
+libclib_static_la_LIBADD = $(libclib_la_LIBADD) $(LTLIBICONV)
+libclib_static_la_LDFLAGS = -static
+
+MAINTAINERCLEANFILES = Makefile.in
+
+EXTRA_DIST = clib-config.h.in $(win_files) $(unix_files)
diff --git a/deps/ulib/src/uarray.c b/deps/clib/src/carray.c
index bebd0ec8..762962d9 100644
--- a/deps/ulib/src/uarray.c
+++ b/deps/clib/src/carray.c
@@ -29,7 +29,7 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
#define INITIAL_CAPACITY 16
@@ -37,15 +37,15 @@
#define element_length(p,i) ((i) * (p)->element_size)
typedef struct {
- UArray array;
- uboolean clear_;
+ CArray array;
+ cboolean clear_;
unsigned int element_size;
- uboolean zero_terminated;
+ cboolean zero_terminated;
unsigned int capacity;
-} UArrayPriv;
+} CArrayPriv;
static void
-ensure_capacity (UArrayPriv *priv, unsigned int capacity)
+ensure_capacity (CArrayPriv *priv, unsigned int capacity)
{
unsigned int new_capacity;
@@ -57,7 +57,7 @@ ensure_capacity (UArrayPriv *priv, unsigned int capacity)
new_capacity *= 2)
;
- priv->array.data = u_realloc (priv->array.data, element_length (priv, new_capacity));
+ priv->array.data = c_realloc (priv->array.data, element_length (priv, new_capacity));
if (priv->clear_) {
memset (element_offset (priv, priv->capacity),
@@ -68,63 +68,63 @@ ensure_capacity (UArrayPriv *priv, unsigned int capacity)
priv->capacity = new_capacity;
}
-UArray *
-u_array_new (uboolean zero_terminated,
- uboolean clear_,
+CArray *
+c_array_new (cboolean zero_terminated,
+ cboolean clear_,
unsigned int element_size)
{
- UArrayPriv *rv = u_new0 (UArrayPriv, 1);
+ CArrayPriv *rv = c_new0 (CArrayPriv, 1);
rv->zero_terminated = zero_terminated;
rv->clear_ = clear_;
rv->element_size = element_size;
ensure_capacity (rv, INITIAL_CAPACITY);
- return (UArray*)rv;
+ return (CArray*)rv;
}
-UArray *
-u_array_sized_new (uboolean zero_terminated,
- uboolean clear_,
+CArray *
+c_array_sized_new (cboolean zero_terminated,
+ cboolean clear_,
unsigned int element_size,
unsigned int reserved_size)
{
- UArrayPriv *rv = u_new0 (UArrayPriv, 1);
+ CArrayPriv *rv = c_new0 (CArrayPriv, 1);
rv->zero_terminated = zero_terminated;
rv->clear_ = clear_;
rv->element_size = element_size;
ensure_capacity (rv, reserved_size);
- return (UArray*)rv;
+ return (CArray*)rv;
}
char*
-u_array_free (UArray *array,
- uboolean free_segment)
+c_array_free (CArray *array,
+ cboolean free_segment)
{
char* rv = NULL;
- u_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
if (free_segment)
- u_free (array->data);
+ c_free (array->data);
else
rv = array->data;
- u_free (array);
+ c_free (array);
return rv;
}
-UArray *
-u_array_append_vals (UArray *array,
+CArray *
+c_array_append_vals (CArray *array,
const void * data,
unsigned int len)
{
- UArrayPriv *priv = (UArrayPriv*)array;
+ CArrayPriv *priv = (CArrayPriv*)array;
- u_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
ensure_capacity (priv, priv->array.len + len + (priv->zero_terminated ? 1 : 0));
@@ -143,16 +143,16 @@ u_array_append_vals (UArray *array,
return array;
}
-UArray*
-u_array_insert_vals (UArray *array,
+CArray*
+c_array_insert_vals (CArray *array,
unsigned int index_,
const void * data,
unsigned int len)
{
- UArrayPriv *priv = (UArrayPriv*)array;
+ CArrayPriv *priv = (CArrayPriv*)array;
unsigned int extra = (priv->zero_terminated ? 1 : 0);
- u_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
ensure_capacity (priv, array->len + len + extra);
@@ -177,13 +177,13 @@ u_array_insert_vals (UArray *array,
return array;
}
-UArray*
-u_array_remove_index (UArray *array,
+CArray*
+c_array_remove_index (CArray *array,
unsigned int index_)
{
- UArrayPriv *priv = (UArrayPriv*)array;
+ CArrayPriv *priv = (CArrayPriv*)array;
- u_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
memmove (element_offset (priv, index_),
element_offset (priv, index_ + 1),
@@ -200,13 +200,13 @@ u_array_remove_index (UArray *array,
return array;
}
-UArray*
-u_array_remove_index_fast (UArray *array,
+CArray*
+c_array_remove_index_fast (CArray *array,
unsigned int index_)
{
- UArrayPriv *priv = (UArrayPriv*)array;
+ CArrayPriv *priv = (CArrayPriv*)array;
- u_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
memmove (element_offset (priv, index_),
element_offset (priv, array->len - 1),
@@ -223,13 +223,13 @@ u_array_remove_index_fast (UArray *array,
return array;
}
-UArray *
-u_array_set_size (UArray *array, int length)
+CArray *
+c_array_set_size (CArray *array, int length)
{
- UArrayPriv *priv = (UArrayPriv*)array;
+ CArrayPriv *priv = (CArrayPriv*)array;
- u_return_val_if_fail (array != NULL, NULL);
- u_return_val_if_fail (length >= 0, NULL);
+ c_return_val_if_fail (array != NULL, NULL);
+ c_return_val_if_fail (length >= 0, NULL);
if (length > priv->capacity) {
// grow the array
@@ -240,3 +240,19 @@ u_array_set_size (UArray *array, int length)
return array;
}
+
+unsigned int
+c_array_get_element_size (CArray *array)
+{
+ CArrayPriv *priv = (CArrayPriv*)array;
+ return priv->element_size;
+}
+
+void
+c_array_sort (CArray *array, CCompareFunc compare)
+{
+ CArrayPriv *priv = (CArrayPriv*)array;
+
+ qsort (array->data, array->len, priv->element_size, compare);
+}
+
diff --git a/deps/ulib/src/ubytearray.c b/deps/clib/src/cbytearray.c
index adfe1227..619ffead 100644
--- a/deps/ulib/src/ubytearray.c
+++ b/deps/clib/src/cbytearray.c
@@ -30,33 +30,33 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
-UByteArray *
-u_byte_array_new ()
+CByteArray *
+c_byte_array_new ()
{
- return (UByteArray *) u_array_new (FALSE, TRUE, 1);
+ return (CByteArray *) c_array_new (FALSE, TRUE, 1);
}
uint8_t*
-u_byte_array_free (UByteArray *array,
- uboolean free_segment)
+c_byte_array_free (CByteArray *array,
+ cboolean free_segment)
{
- return (uint8_t*) u_array_free ((UArray *)array, free_segment);
+ return (uint8_t*) c_array_free ((CArray *)array, free_segment);
}
-UByteArray *
-u_byte_array_append (UByteArray *array,
+CByteArray *
+c_byte_array_append (CByteArray *array,
const uint8_t *data,
unsigned int len)
{
- return (UByteArray *)u_array_append_vals ((UArray *)array, data, len);
+ return (CByteArray *)c_array_append_vals ((CArray *)array, data, len);
}
-UByteArray *
-u_byte_array_set_size (UByteArray *array,
+CByteArray *
+c_byte_array_set_size (CByteArray *array,
unsigned int len)
{
- u_array_set_size ((UArray*)array, len);
+ c_array_set_size ((CArray*)array, len);
return array;
}
diff --git a/deps/ulib/src/udate-unix.c b/deps/clib/src/cdate-unix.c
index 8be341c5..ec6ff6ff 100644
--- a/deps/ulib/src/udate-unix.c
+++ b/deps/clib/src/cdate-unix.c
@@ -29,24 +29,24 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
#include <time.h>
#include <errno.h>
#include <sys/time.h>
void
-u_get_current_time (UTimeVal *result)
+c_get_current_time (CTimeVal *result)
{
struct timeval tv;
- u_return_if_fail (result != NULL);
+ c_return_if_fail (result != NULL);
gettimeofday (&tv, NULL);
result->tv_sec = tv.tv_sec;
result->tv_usec = tv.tv_usec;
}
void
-u_usleep (unsigned long microseconds)
+c_usleep (unsigned long microseconds)
{
struct timespec req, rem;
diff --git a/deps/ulib/src/udate-win32.c b/deps/clib/src/cdate-win32.c
index e23d5c8b..746493d5 100644
--- a/deps/ulib/src/udate-win32.c
+++ b/deps/clib/src/cdate-win32.c
@@ -29,16 +29,16 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
#include <winsock2.h>
void
-u_get_current_time (UTimeVal *result)
+c_get_current_time (CTimeVal *result)
{
long int l;
- u_return_if_fail (result != NULL);
+ c_return_if_fail (result != NULL);
l = UetTickCount();
result->tv_sec = l / 1000;
@@ -46,7 +46,7 @@ u_get_current_time (UTimeVal *result)
}
void
-u_usleep (unsigned long microseconds)
+c_usleep (unsigned long microseconds)
{
Sleep (microseconds/1000);
}
diff --git a/deps/ulib/src/udebugkey.c b/deps/clib/src/cdebugkey.c
index 9a8050bd..f224da4c 100644
--- a/deps/ulib/src/udebugkey.c
+++ b/deps/clib/src/cdebugkey.c
@@ -28,27 +28,27 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
unsigned int
-u_parse_debug_string (const char *string,
- const UDebugKey *keys,
+c_parse_debug_string (const char *string,
+ const CDebugKey *keys,
unsigned int nkeys)
{
- char **strv = u_strsplit_set (string, ":;, \t", 0);
- uboolean needs_invert = FALSE;
+ char **strv = c_strsplit_set (string, ":;, \t", 0);
+ cboolean needs_invert = FALSE;
unsigned int value = 0;
int i;
if (strcasecmp (string, "help") == 0)
{
- u_printerr ("Supported debug keys:\n");
+ c_printerr ("Supported debug keys:\n");
for (i = 0; strv[i]; i++)
{
- u_printerr (" %s:\n", keys[i].key);
+ c_printerr (" %s:\n", keys[i].key);
}
- u_printerr (" all\n");
- u_printerr (" help\n");
+ c_printerr (" all\n");
+ c_printerr (" help\n");
}
for (i = 0; strv[i]; i++)
@@ -65,7 +65,7 @@ u_parse_debug_string (const char *string,
if (needs_invert)
value = value ^ (~0);
- u_strfreev (strv);
+ c_strfreev (strv);
return value;
}
diff --git a/deps/ulib/src/udir-unix.c b/deps/clib/src/cdir-unix.c
index 6a473a00..f20a5b8b 100644
--- a/deps/ulib/src/udir-unix.c
+++ b/deps/clib/src/cdir-unix.c
@@ -28,7 +28,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -45,38 +45,38 @@ struct _UDir {
};
UDir *
-u_dir_open (const char *path, unsigned int flags, UError **error)
+c_dir_open (const char *path, unsigned int flags, UError **error)
{
UDir *dir;
- u_return_val_if_fail (path != NULL, NULL);
- u_return_val_if_fail (error == NULL || *error == NULL, NULL);
+ c_return_val_if_fail (path != NULL, NULL);
+ c_return_val_if_fail (error == NULL || *error == NULL, NULL);
(void) flags; /* this is not used */
- dir = u_new (UDir, 1);
+ dir = c_new (UDir, 1);
dir->dir = opendir (path);
if (dir->dir == NULL) {
if (error) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
- u_strerror (err));
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
+ c_strerror (err));
}
- u_free (dir);
+ c_free (dir);
return NULL;
}
#ifndef HAVE_REWINDDIR
- dir->path = u_strdup (path);
+ dir->path = c_strdup (path);
#endif
return dir;
}
const char *
-u_dir_read_name (UDir *dir)
+c_dir_read_name (UDir *dir)
{
struct dirent *entry;
- u_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
+ c_return_val_if_fail (dir != NULL && dir->dir != NULL, NULL);
do {
entry = readdir (dir->dir);
if (entry == NULL)
@@ -87,9 +87,9 @@ u_dir_read_name (UDir *dir)
}
void
-u_dir_rewind (UDir *dir)
+c_dir_rewind (UDir *dir)
{
- u_return_if_fail (dir != NULL && dir->dir != NULL);
+ c_return_if_fail (dir != NULL && dir->dir != NULL);
#ifndef HAVE_REWINDDIR
closedir (dir->dir);
dir->dir = opendir (dir->path);
@@ -99,19 +99,19 @@ u_dir_rewind (UDir *dir)
}
void
-u_dir_close (UDir *dir)
+c_dir_close (UDir *dir)
{
- u_return_if_fail (dir != NULL && dir->dir != 0);
+ c_return_if_fail (dir != NULL && dir->dir != 0);
closedir (dir->dir);
#ifndef HAVE_REWINDDIR
- u_free (dir->path);
+ c_free (dir->path);
#endif
dir->dir = NULL;
- u_free (dir);
+ c_free (dir);
}
int
-u_mkdir_with_parents (const char *pathname, int mode)
+c_mkdir_with_parents (const char *pathname, int mode)
{
char *path, *d;
int rv;
@@ -121,7 +121,7 @@ u_mkdir_with_parents (const char *pathname, int mode)
return -1;
}
- d = path = u_strdup (pathname);
+ d = path = c_strdup (pathname);
if (*d == '/')
d++;
@@ -131,7 +131,7 @@ u_mkdir_with_parents (const char *pathname, int mode)
*d = '\0';
rv = mkdir (path, mode);
if (rv == -1 && errno != EEXIST) {
- u_free (path);
+ c_free (path);
return -1;
}
@@ -145,7 +145,7 @@ u_mkdir_with_parents (const char *pathname, int mode)
}
}
- u_free (path);
+ c_free (path);
return 0;
}
diff --git a/deps/ulib/src/udir-win32.c b/deps/clib/src/cdir-win32.c
index 0710e71b..38f7fbfd 100644
--- a/deps/ulib/src/udir-win32.c
+++ b/deps/clib/src/cdir-win32.c
@@ -28,7 +28,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -45,19 +45,19 @@ struct _UDir {
};
UDir *
-u_dir_open (const char *path, unsigned int flags, UError **error)
+c_dir_open (const char *path, unsigned int flags, UError **error)
{
UDir *dir;
- uunichar2* path_utf16;
- uunichar2* path_utf16_search;
+ cunichar2* path_utf16;
+ cunichar2* path_utf16_search;
WIN32_FIND_DATAW find_data;
- u_return_val_if_fail (path != NULL, NULL);
- u_return_val_if_fail (error == NULL || *error == NULL, NULL);
+ c_return_val_if_fail (path != NULL, NULL);
+ c_return_val_if_fail (error == NULL || *error == NULL, NULL);
- dir = u_new0 (UDir, 1);
+ dir = c_new0 (UDir, 1);
path_utf16 = u8to16 (path);
- path_utf16_search = u_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(uunichar2));
+ path_utf16_search = c_malloc ((wcslen((wchar_t *) path_utf16) + 3)*sizeof(cunichar2));
wcscpy (path_utf16_search, path_utf16);
wcscat (path_utf16_search, L"\\*");
@@ -65,27 +65,27 @@ u_dir_open (const char *path, unsigned int flags, UError **error)
if (dir->handle == INVALID_HANDLE_VALUE) {
if (error) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
- u_strerror (err));
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
+ c_strerror (err));
}
- u_free (path_utf16_search);
- u_free (path_utf16);
- u_free (dir);
+ c_free (path_utf16_search);
+ c_free (path_utf16);
+ c_free (dir);
return NULL;
}
- u_free (path_utf16_search);
- u_free (path_utf16);
+ c_free (path_utf16_search);
+ c_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) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
- u_strerror (err));
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
+ c_strerror (err));
}
- u_free (dir);
+ c_free (dir);
return NULL;
}
}
@@ -96,14 +96,14 @@ u_dir_open (const char *path, unsigned int flags, UError **error)
}
const char *
-u_dir_read_name (UDir *dir)
+c_dir_read_name (UDir *dir)
{
WIN32_FIND_DATAW find_data;
- u_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
+ c_return_val_if_fail (dir != NULL && dir->handle != 0, NULL);
if (dir->current)
- u_free (dir->current);
+ c_free (dir->current);
dir->current = NULL;
dir->current = dir->next;
@@ -125,24 +125,24 @@ u_dir_read_name (UDir *dir)
}
void
-u_dir_rewind (UDir *dir)
+c_dir_rewind (UDir *dir)
{
}
void
-u_dir_close (UDir *dir)
+c_dir_close (UDir *dir)
{
- u_return_if_fail (dir != NULL && dir->handle != 0);
+ c_return_if_fail (dir != NULL && dir->handle != 0);
if (dir->current)
- u_free (dir->current);
+ c_free (dir->current);
dir->current = NULL;
if (dir->next)
- u_free (dir->next);
+ c_free (dir->next);
dir->next = NULL;
FindClose (dir->handle);
dir->handle = 0;
- u_free (dir);
+ c_free (dir);
}
diff --git a/deps/ulib/src/uerror.c b/deps/clib/src/cerror.c
index a36bfacb..bd29d97d 100644
--- a/deps/ulib/src/uerror.c
+++ b/deps/clib/src/cerror.c
@@ -30,91 +30,91 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.h>
UError *
-u_error_new (UQuark domain, int code, const char *format, ...)
+c_error_new (UQuark domain, int code, const char *format, ...)
{
va_list args;
- UError *err = u_new (UError, 1);
+ UError *err = c_new (UError, 1);
err->domain = domain;
err->code = code;
va_start (args, format);
if (vasprintf (&err->message, format, args) == -1)
- err->message = u_strdup_printf ("internal: invalid format string %s", format);
+ err->message = c_strdup_printf ("internal: invalid format string %s", format);
va_end (args);
return err;
}
UError *
-u_error_new_valist (UQuark domain, int code, const char *format, va_list ap)
+c_error_new_valist (UQuark domain, int code, const char *format, va_list ap)
{
- UError *err = u_new (UError, 1);
+ UError *err = c_new (UError, 1);
err->domain = domain;
err->code = code;
- err->message = u_strdup_vprintf (format, ap);
+ err->message = c_strdup_vprintf (format, ap);
return err;
}
void
-u_clear_error (UError **error)
+c_clear_error (UError **error)
{
if (error && *error) {
- u_error_free (*error);
+ c_error_free (*error);
*error = NULL;
}
}
void
-u_error_free (UError *error)
+c_error_free (UError *error)
{
- u_return_if_fail (error != NULL);
+ c_return_if_fail (error != NULL);
- u_free (error->message);
- u_free (error);
+ c_free (error->message);
+ c_free (error);
}
void
-u_set_error (UError **err, UQuark domain, int code, const char *format, ...)
+c_set_error (UError **err, UQuark domain, int code, const char *format, ...)
{
va_list args;
if (err) {
va_start (args, format);
- *err = u_error_new_valist (domain, code, format, args);
+ *err = c_error_new_valist (domain, code, format, args);
va_end (args);
}
}
void
-u_propagate_error (UError **dest, UError *src)
+c_propagate_error (UError **dest, UError *src)
{
if (dest == NULL) {
if (src)
- u_error_free (src);
+ c_error_free (src);
} else {
*dest = src;
}
}
UError *
-u_error_copy (const UError *error)
+c_error_copy (const UError *error)
{
- UError *copy = u_new (UError, 1);
+ UError *copy = c_new (UError, 1);
copy->domain = error->domain;
copy->code = error->code;
- copy->message = u_strdup (error->message);
+ copy->message = c_strdup (error->message);
return copy;
}
-uboolean
-u_error_matches (const UError *error, UQuark domain, int code)
+cboolean
+c_error_matches (const UError *error, UQuark domain, int code)
{
if (error)
{
diff --git a/deps/ulib/src/ufile-posix.c b/deps/clib/src/cfile-posix.c
index 57f27c91..63f6e856 100644
--- a/deps/ulib/src/ufile-posix.c
+++ b/deps/clib/src/cfile-posix.c
@@ -26,7 +26,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -40,7 +40,7 @@
#ifdef _MSC_VER
#include <direct.h>
#endif
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
int mkstemp (char *tmp_template);
#endif
@@ -49,8 +49,8 @@ int mkstemp (char *tmp_template);
#else
#define OPEN_FLAGS (O_RDONLY | O_LARGEFILE)
#endif
-uboolean
-u_file_get_contents (const char *filename, char **contents, size_t *length, UError **error)
+cboolean
+c_file_get_contents (const char *filename, char **contents, size_t *length, UError **error)
{
char *str;
int fd;
@@ -58,9 +58,9 @@ u_file_get_contents (const char *filename, char **contents, size_t *length, UErr
long offset;
int nread;
- 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);
+ c_return_val_if_fail (filename != NULL, FALSE);
+ c_return_val_if_fail (contents != NULL, FALSE);
+ c_return_val_if_fail (error == NULL || *error == NULL, FALSE);
*contents = NULL;
if (length)
@@ -70,11 +70,11 @@ u_file_get_contents (const char *filename, char **contents, size_t *length, UErr
if (fd == -1) {
if (error != NULL) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
"Error opening file '%s': %s",
filename,
- u_strerror (err));
+ c_strerror (err));
}
return FALSE;
}
@@ -82,17 +82,17 @@ u_file_get_contents (const char *filename, char **contents, size_t *length, UErr
if (fstat (fd, &st) != 0) {
if (error != NULL) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
"Error in fstat() for file '%s': %s",
filename,
- u_strerror (err));
+ c_strerror (err));
}
close (fd);
return FALSE;
}
- str = u_malloc (st.st_size + 1);
+ str = c_malloc (st.st_size + 1);
offset = 0;
do {
nread = read (fd, str + offset, st.st_size - offset);
@@ -111,23 +111,23 @@ u_file_get_contents (const char *filename, char **contents, size_t *length, UErr
}
int
-u_file_open_tmp (const char *tmpl, char **name_used, UError **error)
+c_file_open_tmp (const char *tmpl, char **name_used, UError **error)
{
const static char *default_tmpl = ".XXXXXX";
char *t;
int fd;
size_t len;
- u_return_val_if_fail (error == NULL || *error == NULL, -1);
+ c_return_val_if_fail (error == NULL || *error == NULL, -1);
if (tmpl == NULL)
tmpl = default_tmpl;
- if (strchr (tmpl, U_DIR_SEPARATOR) != NULL) {
+ if (strchr (tmpl, C_DIR_SEPARATOR) != NULL) {
if (error) {
- *error = u_error_new (U_FILE_ERROR,
- U_FILE_ERROR_FAILED,
- "Template should not have any " U_DIR_SEPARATOR_S);
+ *error = c_error_new (C_FILE_ERROR,
+ C_FILE_ERROR_FAILED,
+ "Template should not have any " C_DIR_SEPARATOR_S);
}
return -1;
}
@@ -135,55 +135,55 @@ u_file_open_tmp (const char *tmpl, char **name_used, UError **error)
len = strlen (tmpl);
if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) {
if (error) {
- *error = u_error_new (U_FILE_ERROR,
- U_FILE_ERROR_FAILED,
+ *error = c_error_new (C_FILE_ERROR,
+ C_FILE_ERROR_FAILED,
"Template should end with XXXXXX");
}
return -1;
}
- t = u_build_filename (u_get_tmp_dir (), tmpl, NULL);
+ t = c_build_filename (c_get_tmp_dir (), tmpl, NULL);
fd = mkstemp (t);
if (fd == -1) {
if (error) {
int err = errno;
- *error = u_error_new (U_FILE_ERROR,
- u_file_error_from_errno (err),
+ *error = c_error_new (C_FILE_ERROR,
+ c_file_error_from_errno (err),
"Error in mkstemp(): %s",
- u_strerror (err));
+ c_strerror (err));
}
- u_free (t);
+ c_free (t);
return -1;
}
if (name_used) {
*name_used = t;
} else {
- u_free (t);
+ c_free (t);
}
return fd;
}
char *
-u_get_current_dir (void)
+c_get_current_dir (void)
{
#ifdef __native_client__
char *buffer;
- if ((buffer = u_getenv("NACL_PWD"))) {
- buffer = u_strdup(buffer);
+ if ((buffer = c_getenv("NACL_PWD"))) {
+ buffer = c_strdup(buffer);
} else {
- buffer = u_strdup(".");
+ buffer = c_strdup(".");
}
return buffer;
#else
int s = 32;
char *buffer = NULL, *r;
- uboolean fail;
+ cboolean fail;
do {
- buffer = u_realloc (buffer, s);
+ buffer = c_realloc (buffer, s);
r = getcwd (buffer, s);
fail = (r == NULL && errno == ERANGE);
if (fail) {
diff --git a/deps/ulib/src/ufile-unix.c b/deps/clib/src/cfile-unix.c
index ae630b57..6fa6c306 100644
--- a/deps/ulib/src/ufile-unix.c
+++ b/deps/clib/src/cfile-unix.c
@@ -26,7 +26,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -38,39 +38,39 @@
#include <unistd.h>
#endif
-uboolean
-u_file_test (const char *filename, UFileTest test)
+cboolean
+c_file_test (const char *filename, UFileTest test)
{
struct stat st;
- uboolean have_stat;
+ cboolean have_stat;
if (filename == NULL || test == 0)
return FALSE;
have_stat = FALSE;
- if ((test & U_FILE_TEST_EXISTS) != 0) {
+ if ((test & C_FILE_TEST_EXISTS) != 0) {
if (access (filename, F_OK) == 0)
return TRUE;
}
- if ((test & U_FILE_TEST_IS_EXECUTABLE) != 0) {
+ if ((test & C_FILE_TEST_IS_EXECUTABLE) != 0) {
if (access (filename, X_OK) == 0)
return TRUE;
}
- if ((test & U_FILE_TEST_IS_SYMLINK) != 0) {
+ if ((test & C_FILE_TEST_IS_SYMLINK) != 0) {
have_stat = (lstat (filename, &st) == 0);
if (have_stat && S_ISLNK (st.st_mode))
return TRUE;
}
- if ((test & U_FILE_TEST_IS_REGULAR) != 0) {
+ if ((test & C_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 & U_FILE_TEST_IS_DIR) != 0) {
+ if ((test & C_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/ulib/src/ufile-win32.c b/deps/clib/src/cfile-win32.c
index 81cde52a..f1d7256f 100644
--- a/deps/ulib/src/ufile-win32.c
+++ b/deps/clib/src/cfile-win32.c
@@ -27,7 +27,7 @@
*/
#include <config.h>
#include <windows.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -36,7 +36,7 @@
#include <fcntl.h>
#include <sys/types.h>
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
#include <io.h>
#define open _open
#ifndef S_ISREG
@@ -50,7 +50,7 @@
int mkstemp (char *tmp_template)
{
int fd;
- uunichar2* utf16_template;
+ cunichar2* 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);
- u_free (utf16_template);
+ c_free (utf16_template);
return fd;
}
@@ -72,10 +72,10 @@ int mkstemp (char *tmp_template)
#pragma warning(disable:4701)
#endif
-uboolean
-u_file_test (const char *filename, UFileTest test)
+cboolean
+c_file_test (const char *filename, UFileTest test)
{
- uunichar2* utf16_filename = NULL;
+ cunichar2* utf16_filename = NULL;
DWORD attr;
if (filename == NULL || test == 0)
@@ -83,16 +83,16 @@ u_file_test (const char *filename, UFileTest test)
utf16_filename = u8to16 (filename);
attr = UetFileAttributesW (utf16_filename);
- u_free (utf16_filename);
+ c_free (utf16_filename);
if (attr == INVALID_FILE_ATTRIBUTES)
return FALSE;
- if ((test & U_FILE_TEST_EXISTS) != 0) {
+ if ((test & C_FILE_TEST_EXISTS) != 0) {
return TRUE;
}
- if ((test & U_FILE_TEST_IS_EXECUTABLE) != 0) {
+ if ((test & C_FILE_TEST_IS_EXECUTABLE) != 0) {
size_t len = strlen (filename);
if (len > 4 && strcmp (filename + len-3, "exe"))
return TRUE;
@@ -100,19 +100,19 @@ u_file_test (const char *filename, UFileTest test)
return FALSE;
}
- if ((test & U_FILE_TEST_IS_REGULAR) != 0) {
+ if ((test & C_FILE_TEST_IS_REGULAR) != 0) {
if (attr & (FILE_ATTRIBUTE_DEVICE|FILE_ATTRIBUTE_DIRECTORY))
return FALSE;
return TRUE;
}
- if ((test & U_FILE_TEST_IS_DIR) != 0) {
+ if ((test & C_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 & U_FILE_TEST_IS_SYMLINK) != 0) {
+ if ((test & C_FILE_TEST_IS_SYMLINK) != 0) {
return FALSE;
}
diff --git a/deps/ulib/src/ufile.c b/deps/clib/src/cfile.c
index 2cc476e7..82c9fc06 100644
--- a/deps/ulib/src/ufile.c
+++ b/deps/clib/src/cfile.c
@@ -28,7 +28,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
@@ -37,94 +37,94 @@
#include <errno.h>
UQuark
-u_file_error_quark (void)
+c_file_error_quark (void)
{
- return u_quark_from_static_string ("g-file-error-quark");
+ return c_quark_from_static_string ("g-file-error-quark");
}
UFileError
-u_file_error_from_errno (int err_no)
+c_file_error_from_errno (int err_no)
{
switch (err_no) {
case EEXIST:
- return U_FILE_ERROR_EXIST;
+ return C_FILE_ERROR_EXIST;
case EISDIR:
- return U_FILE_ERROR_ISDIR;
+ return C_FILE_ERROR_ISDIR;
case EACCES:
- return U_FILE_ERROR_ACCES;
+ return C_FILE_ERROR_ACCES;
case ENAMETOOLONG:
- return U_FILE_ERROR_NAMETOOLONG;
+ return C_FILE_ERROR_NAMETOOLONG;
case ENOENT:
- return U_FILE_ERROR_NOENT;
+ return C_FILE_ERROR_NOENT;
case ENOTDIR:
- return U_FILE_ERROR_NOTDIR;
+ return C_FILE_ERROR_NOTDIR;
case ENXIO:
- return U_FILE_ERROR_NXIO;
+ return C_FILE_ERROR_NXIO;
case ENODEV:
- return U_FILE_ERROR_NODEV;
+ return C_FILE_ERROR_NODEV;
case EROFS:
- return U_FILE_ERROR_ROFS;
+ return C_FILE_ERROR_ROFS;
#ifdef ETXTBSY
case ETXTBSY:
- return U_FILE_ERROR_TXTBSY;
+ return C_FILE_ERROR_TXTBSY;
#endif
case EFAULT:
- return U_FILE_ERROR_FAULT;
+ return C_FILE_ERROR_FAULT;
#ifdef ELOOP
case ELOOP:
- return U_FILE_ERROR_LOOP;
+ return C_FILE_ERROR_LOOP;
#endif
case ENOSPC:
- return U_FILE_ERROR_NOSPC;
+ return C_FILE_ERROR_NOSPC;
case ENOMEM:
- return U_FILE_ERROR_NOMEM;
+ return C_FILE_ERROR_NOMEM;
case EMFILE:
- return U_FILE_ERROR_MFILE;
+ return C_FILE_ERROR_MFILE;
case ENFILE:
- return U_FILE_ERROR_NFILE;
+ return C_FILE_ERROR_NFILE;
case EBADF:
- return U_FILE_ERROR_BADF;
+ return C_FILE_ERROR_BADF;
case EINVAL:
- return U_FILE_ERROR_INVAL;
+ return C_FILE_ERROR_INVAL;
case EPIPE:
- return U_FILE_ERROR_PIPE;
+ return C_FILE_ERROR_PIPE;
case EAGAIN:
- return U_FILE_ERROR_AGAIN;
+ return C_FILE_ERROR_AGAIN;
case EINTR:
- return U_FILE_ERROR_INTR;
+ return C_FILE_ERROR_INTR;
case EIO:
- return U_FILE_ERROR_IO;
+ return C_FILE_ERROR_IO;
case EPERM:
- return U_FILE_ERROR_PERM;
+ return C_FILE_ERROR_PERM;
case ENOSYS:
- return U_FILE_ERROR_NOSYS;
+ return C_FILE_ERROR_NOSYS;
default:
- return U_FILE_ERROR_FAILED;
+ return C_FILE_ERROR_FAILED;
}
}
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
#define TMP_FILE_FORMAT "%.*s%s.tmp"
#else
#define TMP_FILE_FORMAT "%.*s.%s~"
#endif
-uboolean
-u_file_set_contents (const char *filename, const char *contents, ussize length, UError **err)
+cboolean
+c_file_set_contents (const char *filename, const char *contents, ussize length, UError **err)
{
const char *name;
char *path;
FILE *fp;
- if (!(name = strrchr (filename, U_DIR_SEPARATOR)))
+ if (!(name = strrchr (filename, C_DIR_SEPARATOR)))
name = filename;
else
name++;
- path = u_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
+ path = c_strdup_printf (TMP_FILE_FORMAT, name - filename, filename, name);
if (!(fp = fopen (path, "wb"))) {
- u_set_error (err, U_FILE_ERROR, u_file_error_from_errno (errno), "%s", u_strerror (errno));
- u_free (path);
+ c_set_error (err, C_FILE_ERROR, c_file_error_from_errno (errno), "%s", c_strerror (errno));
+ c_free (path);
return FALSE;
}
@@ -132,9 +132,9 @@ u_file_set_contents (const char *filename, const char *contents, ussize length,
length = strlen (contents);
if (fwrite (contents, 1, length, fp) < length) {
- 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);
+ c_set_error (err, C_FILE_ERROR, c_file_error_from_errno (ferror (fp)), "%s", c_strerror (ferror (fp)));
+ c_unlink (path);
+ c_free (path);
fclose (fp);
return FALSE;
@@ -142,14 +142,14 @@ u_file_set_contents (const char *filename, const char *contents, ussize length,
fclose (fp);
- 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);
+ if (c_rename (path, filename) != 0) {
+ c_set_error (err, C_FILE_ERROR, c_file_error_from_errno (errno), "%s", c_strerror (errno));
+ c_unlink (path);
+ c_free (path);
return FALSE;
}
- u_free (path);
+ c_free (path);
return TRUE;
}
diff --git a/deps/ulib/src/uhashtable.c b/deps/clib/src/chashtable.c
index 2152325f..12f38c2e 100644
--- a/deps/ulib/src/uhashtable.c
+++ b/deps/clib/src/chashtable.c
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <math.h>
-#include <ulib.h>
+#include <clib.h>
typedef struct _Slot Slot;
@@ -42,20 +42,20 @@ struct _Slot {
static void * KEYMARKER_REMOVED = &KEYMARKER_REMOVED;
-struct _UHashTable {
- UHashFunc hash_func;
- UEqualFunc key_equal_func;
+struct _CHashTable {
+ CHashFunc hash_func;
+ CEqualFunc key_equal_func;
Slot **table;
int table_size;
int in_use;
int threshold;
int last_rehash;
- UDestroyNotify value_destroy_func, key_destroy_func;
+ CDestroyNotify value_destroy_func, key_destroy_func;
};
typedef struct {
- UHashTable *ht;
+ CHashTable *ht;
int slot_index;
Slot *slot;
} Iter;
@@ -68,7 +68,7 @@ static const unsigned int prime_tbl[] = {
6153409, 9230113, 13845163
};
-static uboolean
+static cboolean
test_prime (int x)
{
if ((x & 1) != 0) {
@@ -88,7 +88,7 @@ calc_prime (int x)
{
int i;
- for (i = (x & (~1))-1; i< U_MAXINT32; i += 2) {
+ for (i = (x & (~1))-1; i< C_MAXINT32; i += 2) {
if (test_prime (i))
return i;
}
@@ -96,43 +96,43 @@ calc_prime (int x)
}
unsigned int
-u_spaced_primes_closest (unsigned int x)
+c_spaced_primes_closest (unsigned int x)
{
int i;
- for (i = 0; i < U_N_ELEMENTS (prime_tbl); i++) {
+ for (i = 0; i < C_N_ELEMENTS (prime_tbl); i++) {
if (x <= prime_tbl [i])
return prime_tbl [i];
}
return calc_prime (x);
}
-UHashTable *
-u_hash_table_new (UHashFunc hash_func, UEqualFunc key_equal_func)
+CHashTable *
+c_hash_table_new (CHashFunc hash_func, CEqualFunc key_equal_func)
{
- UHashTable *hash;
+ CHashTable *hash;
if (hash_func == NULL)
- hash_func = u_direct_hash;
+ hash_func = c_direct_hash;
if (key_equal_func == NULL)
- key_equal_func = u_direct_equal;
- hash = u_new0 (UHashTable, 1);
+ key_equal_func = c_direct_equal;
+ hash = c_new0 (CHashTable, 1);
hash->hash_func = hash_func;
hash->key_equal_func = key_equal_func;
- hash->table_size = u_spaced_primes_closest (1);
- hash->table = u_new0 (Slot *, hash->table_size);
+ hash->table_size = c_spaced_primes_closest (1);
+ hash->table = c_new0 (Slot *, hash->table_size);
hash->last_rehash = hash->table_size;
return hash;
}
-UHashTable *
-u_hash_table_new_full (UHashFunc hash_func, UEqualFunc key_equal_func,
- UDestroyNotify key_destroy_func, UDestroyNotify value_destroy_func)
+CHashTable *
+c_hash_table_new_full (CHashFunc hash_func, CEqualFunc key_equal_func,
+ CDestroyNotify key_destroy_func, CDestroyNotify value_destroy_func)
{
- UHashTable *hash = u_hash_table_new (hash_func, key_equal_func);
+ CHashTable *hash = c_hash_table_new (hash_func, key_equal_func);
if (hash == NULL)
return NULL;
@@ -144,7 +144,7 @@ u_hash_table_new_full (UHashFunc hash_func, UEqualFunc key_equal_func,
#if 0
static void
-dump_hash_table (UHashTable *hash)
+dump_hash_table (CHashTable *hash)
{
int i;
@@ -162,7 +162,7 @@ dump_hash_table (UHashTable *hash)
#ifdef SANITY_CHECK
static void
-sanity_check (UHashTable *hash)
+sanity_check (CHashTable *hash)
{
int i;
@@ -176,7 +176,7 @@ sanity_check (UHashTable *hash)
dump_hashcode_func = 1;
hashcode = (*hash->hash_func) (s->key);
dump_hashcode_func = 0;
- u_error ("Key %p (bucket %d) on invalid bucket %d (hashcode %x) (tb size %d)", s->key, slot, i, hashcode, hash->table_size);
+ c_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 (UHashTable *hash)
#endif
static void
-do_rehash (UHashTable *hash)
+do_rehash (CHashTable *hash)
{
int current_size, i;
Slot **table;
@@ -196,10 +196,10 @@ do_rehash (UHashTable *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 = u_spaced_primes_closest (hash->in_use);
+ hash->table_size = c_spaced_primes_closest (hash->in_use);
/* printf ("New size: %d\n", hash->table_size); */
table = hash->table;
- hash->table = u_new0 (Slot *, hash->table_size);
+ hash->table = c_new0 (Slot *, hash->table_size);
for (i = 0; i < current_size; i++){
Slot *s, *next;
@@ -212,11 +212,11 @@ do_rehash (UHashTable *hash)
hash->table [hashcode] = s;
}
}
- u_free (table);
+ c_free (table);
}
static void
-rehash (UHashTable *hash)
+rehash (CHashTable *hash)
{
int diff = ABS (hash->last_rehash - hash->in_use);
@@ -230,13 +230,13 @@ rehash (UHashTable *hash)
}
void
-u_hash_table_insert_replace (UHashTable *hash, void * key, void * value, uboolean replace)
+c_hash_table_insert_replace (CHashTable *hash, void * key, void * value, cboolean replace)
{
unsigned int hashcode;
Slot *s;
- UEqualFunc equal;
+ CEqualFunc equal;
- u_return_if_fail (hash != NULL);
+ c_return_if_fail (hash != NULL);
sanity_check (hash);
equal = hash->key_equal_func;
@@ -258,7 +258,7 @@ u_hash_table_insert_replace (UHashTable *hash, void * key, void * value, uboolea
return;
}
}
- s = u_new (Slot, 1);
+ s = c_new (Slot, 1);
s->key = key;
s->value = value;
s->next = hash->table [hashcode];
@@ -267,64 +267,64 @@ u_hash_table_insert_replace (UHashTable *hash, void * key, void * value, uboolea
sanity_check (hash);
}
-UList*
-u_hash_table_get_keys (UHashTable *hash)
+CList*
+c_hash_table_get_keys (CHashTable *hash)
{
- UHashTableIter iter;
- UList *rv = NULL;
+ CHashTableIter iter;
+ CList *rv = NULL;
void * key;
- u_hash_table_iter_init (&iter, hash);
+ c_hash_table_iter_init (&iter, hash);
- while (u_hash_table_iter_next (&iter, &key, NULL))
- rv = u_list_prepend (rv, key);
+ while (c_hash_table_iter_next (&iter, &key, NULL))
+ rv = c_list_prepend (rv, key);
- return u_list_reverse (rv);
+ return c_list_reverse (rv);
}
-UList*
-u_hash_table_get_values (UHashTable *hash)
+CList*
+c_hash_table_get_values (CHashTable *hash)
{
- UHashTableIter iter;
- UList *rv = NULL;
+ CHashTableIter iter;
+ CList *rv = NULL;
void * value;
- u_hash_table_iter_init (&iter, hash);
+ c_hash_table_iter_init (&iter, hash);
- while (u_hash_table_iter_next (&iter, NULL, &value))
- rv = u_list_prepend (rv, value);
+ while (c_hash_table_iter_next (&iter, NULL, &value))
+ rv = c_list_prepend (rv, value);
- return u_list_reverse (rv);
+ return c_list_reverse (rv);
}
unsigned int
-u_hash_table_size (UHashTable *hash)
+c_hash_table_size (CHashTable *hash)
{
- u_return_val_if_fail (hash != NULL, 0);
+ c_return_val_if_fail (hash != NULL, 0);
return hash->in_use;
}
void *
-u_hash_table_lookup (UHashTable *hash, const void * key)
+c_hash_table_lookup (CHashTable *hash, const void * key)
{
void *orig_key, *value;
- if (u_hash_table_lookup_extended (hash, key, &orig_key, &value))
+ if (c_hash_table_lookup_extended (hash, key, &orig_key, &value))
return value;
else
return NULL;
}
-uboolean
-u_hash_table_lookup_extended (UHashTable *hash, const void * key, void * *orig_key, void * *value)
+cboolean
+c_hash_table_lookup_extended (CHashTable *hash, const void * key, void * *orig_key, void * *value)
{
- UEqualFunc equal;
+ CEqualFunc equal;
Slot *s;
unsigned int hashcode;
- u_return_val_if_fail (hash != NULL, FALSE);
+ c_return_val_if_fail (hash != NULL, FALSE);
sanity_check (hash);
equal = hash->key_equal_func;
@@ -343,12 +343,12 @@ u_hash_table_lookup_extended (UHashTable *hash, const void * key, void * *orig_k
}
void
-u_hash_table_foreach (UHashTable *hash, UHFunc func, void * user_data)
+c_hash_table_foreach (CHashTable *hash, CHFunc func, void * user_data)
{
int i;
- u_return_if_fail (hash != NULL);
- u_return_if_fail (func != NULL);
+ c_return_if_fail (hash != NULL);
+ c_return_if_fail (func != NULL);
for (i = 0; i < hash->table_size; i++){
Slot *s;
@@ -359,12 +359,12 @@ u_hash_table_foreach (UHashTable *hash, UHFunc func, void * user_data)
}
void *
-u_hash_table_find (UHashTable *hash, UHRFunc predicate, void * user_data)
+c_hash_table_find (CHashTable *hash, CHRFunc predicate, void * user_data)
{
int i;
- u_return_val_if_fail (hash != NULL, NULL);
- u_return_val_if_fail (predicate != NULL, NULL);
+ c_return_val_if_fail (hash != NULL, NULL);
+ c_return_val_if_fail (predicate != NULL, NULL);
for (i = 0; i < hash->table_size; i++){
Slot *s;
@@ -377,30 +377,30 @@ u_hash_table_find (UHashTable *hash, UHRFunc predicate, void * user_data)
}
void
-u_hash_table_remove_all (UHashTable *hash)
+c_hash_table_remove_all (CHashTable *hash)
{
int i;
- u_return_if_fail (hash != NULL);
+ c_return_if_fail (hash != NULL);
for (i = 0; i < hash->table_size; i++){
Slot *s;
while (hash->table [i]) {
s = hash->table [i];
- u_hash_table_remove (hash, s->key);
+ c_hash_table_remove (hash, s->key);
}
}
}
-uboolean
-u_hash_table_remove (UHashTable *hash, const void * key)
+cboolean
+c_hash_table_remove (CHashTable *hash, const void * key)
{
- UEqualFunc equal;
+ CEqualFunc equal;
Slot *s, *last;
unsigned int hashcode;
- u_return_val_if_fail (hash != NULL, FALSE);
+ c_return_val_if_fail (hash != NULL, FALSE);
sanity_check (hash);
equal = hash->key_equal_func;
@@ -416,7 +416,7 @@ u_hash_table_remove (UHashTable *hash, const void * key)
hash->table [hashcode] = s->next;
else
last->next = s->next;
- u_free (s);
+ c_free (s);
hash->in_use--;
sanity_check (hash);
return TRUE;
@@ -428,13 +428,13 @@ u_hash_table_remove (UHashTable *hash, const void * key)
}
unsigned int
-u_hash_table_foreach_remove (UHashTable *hash, UHRFunc func, void * user_data)
+c_hash_table_foreach_remove (CHashTable *hash, CHRFunc func, void * user_data)
{
int i;
int count = 0;
- u_return_val_if_fail (hash != NULL, 0);
- u_return_val_if_fail (func != NULL, 0);
+ c_return_val_if_fail (hash != NULL, 0);
+ c_return_val_if_fail (func != NULL, 0);
sanity_check (hash);
for (i = 0; i < hash->table_size; i++){
@@ -456,7 +456,7 @@ u_hash_table_foreach_remove (UHashTable *hash, UHRFunc func, void * user_data)
last->next = s->next;
n = last->next;
}
- u_free (s);
+ c_free (s);
hash->in_use--;
count++;
s = n;
@@ -472,14 +472,14 @@ u_hash_table_foreach_remove (UHashTable *hash, UHRFunc func, void * user_data)
return count;
}
-uboolean
-u_hash_table_steal (UHashTable *hash, const void * key)
+cboolean
+c_hash_table_steal (CHashTable *hash, const void * key)
{
- UEqualFunc equal;
+ CEqualFunc equal;
Slot *s, *last;
unsigned int hashcode;
- u_return_val_if_fail (hash != NULL, FALSE);
+ c_return_val_if_fail (hash != NULL, FALSE);
sanity_check (hash);
equal = hash->key_equal_func;
@@ -491,7 +491,7 @@ u_hash_table_steal (UHashTable *hash, const void * key)
hash->table [hashcode] = s->next;
else
last->next = s->next;
- u_free (s);
+ c_free (s);
hash->in_use--;
sanity_check (hash);
return TRUE;
@@ -504,13 +504,13 @@ u_hash_table_steal (UHashTable *hash, const void * key)
}
unsigned int
-u_hash_table_foreach_steal (UHashTable *hash, UHRFunc func, void * user_data)
+c_hash_table_foreach_steal (CHashTable *hash, CHRFunc func, void * user_data)
{
int i;
int count = 0;
- u_return_val_if_fail (hash != NULL, 0);
- u_return_val_if_fail (func != NULL, 0);
+ c_return_val_if_fail (hash != NULL, 0);
+ c_return_val_if_fail (func != NULL, 0);
sanity_check (hash);
for (i = 0; i < hash->table_size; i++){
@@ -528,7 +528,7 @@ u_hash_table_foreach_steal (UHashTable *hash, UHRFunc func, void * user_data)
last->next = s->next;
n = last->next;
}
- u_free (s);
+ c_free (s);
hash->in_use--;
count++;
s = n;
@@ -545,11 +545,11 @@ u_hash_table_foreach_steal (UHashTable *hash, UHRFunc func, void * user_data)
}
void
-u_hash_table_destroy (UHashTable *hash)
+c_hash_table_destroy (CHashTable *hash)
{
int i;
- u_return_if_fail (hash != NULL);
+ c_return_if_fail (hash != NULL);
for (i = 0; i < hash->table_size; i++){
Slot *s, *next;
@@ -561,16 +561,16 @@ u_hash_table_destroy (UHashTable *hash)
(*hash->key_destroy_func)(s->key);
if (hash->value_destroy_func != NULL)
(*hash->value_destroy_func)(s->value);
- u_free (s);
+ c_free (s);
}
}
- u_free (hash->table);
+ c_free (hash->table);
- u_free (hash);
+ c_free (hash);
}
void
-u_hash_table_print_stats (UHashTable *table)
+c_hash_table_print_stats (CHashTable *table)
{
int i, max_chain_index, chain_size, max_chain_size;
Slot *node;
@@ -591,7 +591,7 @@ u_hash_table_print_stats (UHashTable *table)
}
void
-u_hash_table_iter_init (UHashTableIter *it, UHashTable *hash_table)
+c_hash_table_iter_init (CHashTableIter *it, CHashTable *hash_table)
{
Iter *iter = (Iter*)it;
@@ -600,14 +600,14 @@ u_hash_table_iter_init (UHashTableIter *it, UHashTable *hash_table)
iter->slot_index = -1;
}
-uboolean u_hash_table_iter_next (UHashTableIter *it, void * *key, void * *value)
+cboolean c_hash_table_iter_next (CHashTableIter *it, void * *key, void * *value)
{
Iter *iter = (Iter*)it;
- UHashTable *hash = iter->ht;
+ CHashTable *hash = iter->ht;
- u_assert (iter->slot_index != -2);
- u_assert (sizeof (Iter) <= sizeof (UHashTableIter));
+ c_assert (iter->slot_index != -2);
+ c_assert (sizeof (Iter) <= sizeof (CHashTableIter));
if (!iter->slot) {
while (TRUE) {
@@ -631,38 +631,38 @@ uboolean u_hash_table_iter_next (UHashTableIter *it, void * *key, void * *value)
return TRUE;
}
-uboolean
-u_direct_equal (const void * v1, const void * v2)
+cboolean
+c_direct_equal (const void * v1, const void * v2)
{
return v1 == v2;
}
unsigned int
-u_direct_hash (const void * v1)
+c_direct_hash (const void * v1)
{
- return U_POINTER_TO_UINT (v1);
+ return C_POINTER_TO_UINT (v1);
}
-uboolean
-u_int_equal (const void * v1, const void * v2)
+cboolean
+c_int_equal (const void * v1, const void * v2)
{
return *(int *)v1 == *(int *)v2;
}
unsigned int
-u_int_hash (const void * v1)
+c_int_hash (const void * v1)
{
return *(unsigned int *)v1;
}
-uboolean
-u_str_equal (const void * v1, const void * v2)
+cboolean
+c_str_equal (const void * v1, const void * v2)
{
return strcmp (v1, v2) == 0;
}
unsigned int
-u_str_hash (const void * v1)
+c_str_hash (const void * v1)
{
unsigned int hash = 0;
char *p = (char *) v1;
diff --git a/deps/ulib/src/uhooklist.c b/deps/clib/src/chooklist.c
index c71e8bb2..f07d7ec2 100644
--- a/deps/ulib/src/uhooklist.c
+++ b/deps/clib/src/chooklist.c
@@ -28,26 +28,26 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
void
-u_hook_list_init (UHookList *hook_list,
+c_hook_list_init (CHookList *hook_list,
unsigned int hook_size)
{
hook_list->hooks = NULL;
}
void
-u_hook_list_invoke (UHookList *hook_list,
- uboolean may_recurse)
+c_hook_list_invoke (CHookList *hook_list,
+ cboolean may_recurse)
{
- UHook *h;
+ CHook *h;
if (may_recurse)
{
for (h = hook_list->hooks; h; h = h->next)
{
- UHookFunc func = h->func;
+ CHookFunc func = h->func;
func (h->data);
}
}
@@ -55,7 +55,7 @@ u_hook_list_invoke (UHookList *hook_list,
{
for (h = hook_list->hooks; h && !h->in_call; h = h->next)
{
- UHookFunc func = h->func;
+ CHookFunc func = h->func;
h->in_call = TRUE;
func (h->data);
h->in_call = FALSE;
@@ -64,25 +64,25 @@ u_hook_list_invoke (UHookList *hook_list,
}
void
-u_hook_list_clear (UHookList *hook_list)
+c_hook_list_clear (CHookList *hook_list)
{
while (hook_list->hooks)
- u_hook_destroy_link (hook_list, hook_list->hooks);
+ c_hook_destroy_link (hook_list, hook_list->hooks);
}
-UHook *
-u_hook_alloc (UHookList *hook_list)
+CHook *
+c_hook_alloc (CHookList *hook_list)
{
- return u_new (UHook, 1);
+ return c_new (CHook, 1);
}
-UHook *
-u_hook_find_func_data (UHookList *hook_list,
- uboolean need_valids,
+CHook *
+c_hook_find_func_data (CHookList *hook_list,
+ cboolean need_valids,
void * func,
void * data)
{
- UHook *h;
+ CHook *h;
for (h = hook_list->hooks; h; h = h->next)
{
@@ -94,8 +94,8 @@ u_hook_find_func_data (UHookList *hook_list,
}
void
-u_hook_destroy_link (UHookList *hook_list,
- UHook *hook)
+c_hook_destroy_link (CHookList *hook_list,
+ CHook *hook)
{
if (hook_list->hooks == hook)
hook_list->hooks = hook->next;
@@ -105,15 +105,15 @@ u_hook_destroy_link (UHookList *hook_list,
if (hook->prev)
hook->prev->next = hook->next;
- u_free (hook);
+ c_free (hook);
}
void
-u_hook_prepend (UHookList *hook_list,
- UHook *hook)
+c_hook_prepend (CHookList *hook_list,
+ CHook *hook)
{
- UHook *prev = hook_list->hooks ? hook_list->hooks->prev : NULL;
- UHook *next = hook_list->hooks;
+ CHook *prev = hook_list->hooks ? hook_list->hooks->prev : NULL;
+ CHook *next = hook_list->hooks;
hook->prev = prev;
hook->next = next;
diff --git a/deps/ulib/src/uiconv.c b/deps/clib/src/ciconv.c
index 15746256..fc05c754 100644
--- a/deps/ulib/src/uiconv.c
+++ b/deps/clib/src/ciconv.c
@@ -27,7 +27,7 @@
#include <config.h>
#endif
-#include <ulib.h>
+#include <clib.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, uunichar *outchar);
-typedef int (* Encoder) (uunichar c, char *outbuf, size_t outleft);
+typedef int (* Decoder) (char *inbuf, size_t inleft, cunichar *outchar);
+typedef int (* Encoder) (cunichar c, char *outbuf, size_t outleft);
struct _UIConv {
Decoder decode;
Encoder encode;
- uunichar c;
+ cunichar c;
#ifdef HAVE_ICONV
iconv_t cd;
#endif
};
-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_utf32be (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_utf32be (cunichar 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_utf32le (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_utf32le (cunichar 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_utf16be (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_utf16be (cunichar 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 int decode_utf16le (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_utf16le (cunichar 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 FORCE_INLINE (int) decode_utf8 (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_utf8 (cunichar 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);
+static int decode_latin1 (char *inbuf, size_t inleft, cunichar *outchar);
+static int encode_latin1 (cunichar c, char *outbuf, size_t outleft);
-#if U_BYTE_ORDER == U_LITTLE_ENDIAN
+#if C_BYTE_ORDER == C_LITTLE_ENDIAN
#define decode_utf32 decode_utf32le
#define encode_utf32 encode_utf32le
#define decode_utf16 decode_utf16le
@@ -110,7 +110,7 @@ static struct {
UIConv
-u_iconv_open (const char *to_charset, const char *from_charset)
+c_iconv_open (const char *to_charset, const char *from_charset)
{
#ifdef HAVE_ICONV
iconv_t icd = (iconv_t) -1;
@@ -126,11 +126,11 @@ u_iconv_open (const char *to_charset, const char *from_charset)
return (UIConv) -1;
}
- for (i = 0; i < U_N_ELEMENTS (charsets); i++) {
- if (!u_ascii_strcasecmp (charsets[i].name, from_charset))
+ for (i = 0; i < C_N_ELEMENTS (charsets); i++) {
+ if (!c_ascii_strcasecmp (charsets[i].name, from_charset))
decoder = charsets[i].decoder;
- if (!u_ascii_strcasecmp (charsets[i].name, to_charset))
+ if (!c_ascii_strcasecmp (charsets[i].name, to_charset))
encoder = charsets[i].encoder;
}
@@ -145,7 +145,7 @@ u_iconv_open (const char *to_charset, const char *from_charset)
#endif
}
- cd = (UIConv) u_malloc (sizeof (struct _UIConv));
+ cd = (UIConv) c_malloc (sizeof (struct _UIConv));
cd->decode = decoder;
cd->encode = encoder;
cd->c = -1;
@@ -158,25 +158,25 @@ u_iconv_open (const char *to_charset, const char *from_charset)
}
int
-u_iconv_close (UIConv cd)
+c_iconv_close (UIConv cd)
{
#ifdef HAVE_ICONV
if (cd->cd != (iconv_t) -1)
iconv_close (cd->cd);
#endif
- u_free (cd);
+ c_free (cd);
return 0;
}
size_t
-u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
+c_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
char **outbytes, size_t *outbytesleft)
{
size_t inleft, outleft;
char *inptr, *outptr;
- uunichar c;
+ cunichar c;
int rc = 0;
#ifdef HAVE_ICONV
@@ -215,7 +215,7 @@ u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
outleft = *outbytesleft;
outptr = *outbytes;
- if ((c = cd->c) != (uunichar) -1)
+ if ((c = cd->c) != (cunichar) -1)
goto encode;
while (inleft > 0) {
@@ -229,7 +229,7 @@ u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
if ((rc = cd->encode (c, outptr, outleft)) < 0)
break;
- c = (uunichar) -1;
+ c = (cunichar) -1;
outleft -= rc;
outptr += rc;
}
@@ -252,10 +252,10 @@ u_iconv (UIConv cd, char **inbytes, size_t *inbytesleft,
*/
static int
-decode_utf32be (char *inbuf, size_t inleft, uunichar *outchar)
+decode_utf32be (char *inbuf, size_t inleft, cunichar *outchar)
{
unsigned char *inptr = (unsigned char *) inbuf;
- uunichar c;
+ cunichar c;
if (inleft < 4) {
errno = EINVAL;
@@ -278,10 +278,10 @@ decode_utf32be (char *inbuf, size_t inleft, uunichar *outchar)
}
static int
-decode_utf32le (char *inbuf, size_t inleft, uunichar *outchar)
+decode_utf32le (char *inbuf, size_t inleft, cunichar *outchar)
{
unsigned char *inptr = (unsigned char *) inbuf;
- uunichar c;
+ cunichar c;
if (inleft < 4) {
errno = EINVAL;
@@ -304,7 +304,7 @@ decode_utf32le (char *inbuf, size_t inleft, uunichar *outchar)
}
static int
-encode_utf32be (uunichar c, char *outbuf, size_t outleft)
+encode_utf32be (cunichar c, char *outbuf, size_t outleft)
{
unsigned char *outptr = (unsigned char *) outbuf;
@@ -322,7 +322,7 @@ encode_utf32be (uunichar c, char *outbuf, size_t outleft)
}
static int
-encode_utf32le (uunichar c, char *outbuf, size_t outleft)
+encode_utf32le (cunichar c, char *outbuf, size_t outleft)
{
unsigned char *outptr = (unsigned char *) outbuf;
@@ -340,11 +340,11 @@ encode_utf32le (uunichar c, char *outbuf, size_t outleft)
}
static int
-decode_utf16be (char *inbuf, size_t inleft, uunichar *outchar)
+decode_utf16be (char *inbuf, size_t inleft, cunichar *outchar)
{
unsigned char *inptr = (unsigned char *) inbuf;
- uunichar2 c;
- uunichar u;
+ cunichar2 c;
+ cunichar u;
if (inleft < 2) {
errno = EINVAL;
@@ -387,11 +387,11 @@ decode_utf16be (char *inbuf, size_t inleft, uunichar *outchar)
}
static int
-decode_utf16le (char *inbuf, size_t inleft, uunichar *outchar)
+decode_utf16le (char *inbuf, size_t inleft, cunichar *outchar)
{
unsigned char *inptr = (unsigned char *) inbuf;
- uunichar2 c;
- uunichar u;
+ cunichar2 c;
+ cunichar u;
if (inleft < 2) {
errno = EINVAL;
@@ -434,11 +434,11 @@ decode_utf16le (char *inbuf, size_t inleft, uunichar *outchar)
}
static int
-encode_utf16be (uunichar c, char *outbuf, size_t outleft)
+encode_utf16be (cunichar c, char *outbuf, size_t outleft)
{
unsigned char *outptr = (unsigned char *) outbuf;
- uunichar2 ch;
- uunichar c2;
+ cunichar2 ch;
+ cunichar c2;
if (c < 0x10000) {
if (outleft < 2) {
@@ -458,11 +458,11 @@ encode_utf16be (uunichar c, char *outbuf, size_t outleft)
c2 = c - 0x10000;
- ch = (uunichar2) ((c2 >> 10) + 0xd800);
+ ch = (cunichar2) ((c2 >> 10) + 0xd800);
outptr[0] = (ch >> 8) & 0xff;
outptr[1] = ch & 0xff;
- ch = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
+ ch = (cunichar2) ((c2 & 0x3ff) + 0xdc00);
outptr[2] = (ch >> 8) & 0xff;
outptr[3] = ch & 0xff;
@@ -471,11 +471,11 @@ encode_utf16be (uunichar c, char *outbuf, size_t outleft)
}
static int
-encode_utf16le (uunichar c, char *outbuf, size_t outleft)
+encode_utf16le (cunichar c, char *outbuf, size_t outleft)
{
unsigned char *outptr = (unsigned char *) outbuf;
- uunichar2 ch;
- uunichar c2;
+ cunichar2 ch;
+ cunichar c2;
if (c < 0x10000) {
if (outleft < 2) {
@@ -495,11 +495,11 @@ encode_utf16le (uunichar c, char *outbuf, size_t outleft)
c2 = c - 0x10000;
- ch = (uunichar2) ((c2 >> 10) + 0xd800);
+ ch = (cunichar2) ((c2 >> 10) + 0xd800);
outptr[0] = ch & 0xff;
outptr[1] = (ch >> 8) & 0xff;
- ch = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
+ ch = (cunichar2) ((c2 & 0x3ff) + 0xdc00);
outptr[2] = ch & 0xff;
outptr[3] = (ch >> 8) & 0xff;
@@ -508,10 +508,10 @@ encode_utf16le (uunichar c, char *outbuf, size_t outleft)
}
static FORCE_INLINE (int)
-decode_utf8 (char *inbuf, size_t inleft, uunichar *outchar)
+decode_utf8 (char *inbuf, size_t inleft, cunichar *outchar)
{
unsigned char *inptr = (unsigned char *) inbuf;
- uunichar u;
+ cunichar u;
int n, i;
u = *inptr;
@@ -567,7 +567,7 @@ decode_utf8 (char *inbuf, size_t inleft, uunichar *outchar)
}
static int
-encode_utf8 (uunichar c, char *outbuf, size_t outleft)
+encode_utf8 (cunichar c, char *outbuf, size_t outleft)
{
unsigned char *outptr = (unsigned char *) outbuf;
int base, n, i;
@@ -619,14 +619,14 @@ encode_utf8 (uunichar c, char *outbuf, size_t outleft)
}
static int
-decode_latin1 (char *inbuf, size_t inleft, uunichar *outchar)
+decode_latin1 (char *inbuf, size_t inleft, cunichar *outchar)
{
*outchar = (unsigned char) *inbuf;
return 1;
}
static int
-encode_latin1 (uunichar c, char *outbuf, size_t outleft)
+encode_latin1 (cunichar c, char *outbuf, size_t outleft)
{
if (outleft < 1) {
errno = E2BIG;
@@ -649,27 +649,27 @@ encode_latin1 (uunichar c, char *outbuf, size_t outleft)
*/
UQuark
-u_convert_error_quark (void)
+c_convert_error_quark (void)
{
- return u_quark_from_static_string ("g-convert-error-quark");
+ return c_quark_from_static_string ("g-convert-error-quark");
}
char *
-u_convert (const char *str, ussize len, const char *to_charset, const char *from_charset,
+c_convert (const char *str, ussize len, const char *to_charset, const char *from_charset,
size_t *bytes_read, size_t *bytes_written, UError **err)
{
size_t outsize, outused, outleft, inleft, grow, rc;
char *result, *outbuf, *inbuf;
- uboolean flush = FALSE;
- uboolean done = FALSE;
+ cboolean flush = FALSE;
+ cboolean done = FALSE;
UIConv cd;
- 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);
+ c_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (to_charset != NULL, NULL);
+ c_return_val_if_fail (from_charset != NULL, NULL);
- if ((cd = u_iconv_open (to_charset, from_charset)) == (UIConv) -1) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_NO_CONVERSION,
+ if ((cd = c_iconv_open (to_charset, from_charset)) == (UIConv) -1) {
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_NO_CONVERSION,
"Conversion from %s to %s not supported.",
from_charset, to_charset);
@@ -686,13 +686,13 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
inbuf = (char *) str;
outleft = outsize = MAX (inleft, 8);
- outbuf = result = u_malloc (outsize + 4);
+ outbuf = result = c_malloc (outsize + 4);
do {
if (!flush)
- rc = u_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
+ rc = c_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
else
- rc = u_iconv (cd, NULL, NULL, &outbuf, &outleft);
+ rc = c_iconv (cd, NULL, NULL, &outbuf, &outleft);
if (rc == (size_t) -1) {
switch (errno) {
@@ -702,7 +702,7 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
outused = outbuf - result;
outsize += grow;
outleft += grow;
- result = u_realloc (result, outsize + 4);
+ result = c_realloc (result, outsize + 4);
outbuf = result + outused;
break;
case EINVAL:
@@ -714,7 +714,7 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
break;
case EILSEQ:
/* illegal sequence in the input */
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", u_strerror (errno));
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_ILLEGAL_SEQUENCE, "%s", c_strerror (errno));
if (bytes_read) {
/* save offset of the illegal input sequence */
@@ -724,12 +724,12 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
if (bytes_written)
*bytes_written = 0;
- u_iconv_close (cd);
- u_free (result);
+ c_iconv_close (cd);
+ c_free (result);
return NULL;
default:
/* unknown errno */
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_FAILED, "%s", u_strerror (errno));
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_FAILED, "%s", c_strerror (errno));
if (bytes_written)
*bytes_written = 0;
@@ -737,8 +737,8 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
if (bytes_read)
*bytes_read = 0;
- u_iconv_close (cd);
- u_free (result);
+ c_iconv_close (cd);
+ c_free (result);
return NULL;
}
} else if (flush) {
@@ -750,7 +750,7 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
}
} while (!done);
- u_iconv_close (cd);
+ c_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
@@ -813,7 +813,7 @@ u_convert (const char *str, ussize len, const char *to_charset, const char *from
* byte 6 = 128 + (ud mod 64)
**/
int
-u_unichar_to_utf8 (uunichar c, char *outbuf)
+c_unichar_to_utf8 (cunichar c, char *outbuf)
{
int base, n, i;
@@ -854,28 +854,28 @@ u_unichar_to_utf8 (uunichar c, char *outbuf)
}
static FORCE_INLINE (int)
-u_unichar_to_utf16 (uunichar c, uunichar2 *outbuf)
+c_unichar_to_utf16 (cunichar c, cunichar2 *outbuf)
{
- uunichar c2;
+ cunichar c2;
if (c < 0xd800) {
if (outbuf)
- *outbuf = (uunichar2) c;
+ *outbuf = (cunichar2) c;
return 1;
} else if (c < 0xe000) {
return -1;
} else if (c < 0x10000) {
if (outbuf)
- *outbuf = (uunichar2) c;
+ *outbuf = (cunichar2) c;
return 1;
} else if (c < 0x110000) {
if (outbuf) {
c2 = c - 0x10000;
- outbuf[0] = (uunichar2) ((c2 >> 10) + 0xd800);
- outbuf[1] = (uunichar2) ((c2 & 0x3ff) + 0xdc00);
+ outbuf[0] = (cunichar2) ((c2 >> 10) + 0xd800);
+ outbuf[1] = (cunichar2) ((c2 & 0x3ff) + 0xdc00);
}
return 2;
@@ -884,26 +884,26 @@ u_unichar_to_utf16 (uunichar c, uunichar2 *outbuf)
}
}
-uunichar *
-u_utf8_to_ucs4_fast (const char *str, long len, long *items_written)
+cunichar *
+c_utf8_to_ucs4_fast (const char *str, long len, long *items_written)
{
- uunichar *outbuf, *outptr;
+ cunichar *outbuf, *outptr;
char *inptr;
long n, i;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
- n = u_utf8_strlen (str, len);
+ n = c_utf8_strlen (str, len);
if (items_written)
*items_written = n;
- outptr = outbuf = u_malloc ((n + 1) * sizeof (uunichar));
+ outptr = outbuf = c_malloc ((n + 1) * sizeof (cunichar));
inptr = (char *) str;
for (i = 0; i < n; i++) {
- *outptr++ = u_utf8_get_char (inptr);
- inptr = u_utf8_next_char (inptr);
+ *outptr++ = c_utf8_get_char (inptr);
+ inptr = c_utf8_next_char (inptr);
}
*outptr = 0;
@@ -911,21 +911,21 @@ u_utf8_to_ucs4_fast (const char *str, long len, long *items_written)
return outbuf;
}
-static uunichar2 *
-eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *items_written, uboolean include_nuls, UError **err)
+static cunichar2 *
+eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *items_written, cboolean include_nuls, UError **err)
{
- uunichar2 *outbuf, *outptr;
+ cunichar2 *outbuf, *outptr;
size_t outlen = 0;
size_t inleft;
char *inptr;
- uunichar c;
+ cunichar c;
int u, n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0) {
if (include_nuls) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
return NULL;
}
@@ -942,7 +942,7 @@ eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *ite
if (c == 0 && !include_nuls)
break;
- if ((u = u_unichar_to_utf16 (c, NULL)) < 0) {
+ if ((u = c_unichar_to_utf16 (c, NULL)) < 0) {
errno = EILSEQ;
goto error;
}
@@ -958,7 +958,7 @@ eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *ite
if (items_written)
*items_written = outlen;
- outptr = outbuf = u_malloc ((outlen + 1) * sizeof (uunichar2));
+ outptr = outbuf = c_malloc ((outlen + 1) * sizeof (cunichar2));
inptr = (char *) str;
inleft = len;
@@ -969,7 +969,7 @@ eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *ite
if (c == 0 && !include_nuls)
break;
- outptr += u_unichar_to_utf16 (c, outptr);
+ outptr += c_unichar_to_utf16 (c, outptr);
inleft -= n;
inptr += n;
}
@@ -980,12 +980,12 @@ eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *ite
error:
if (errno == EILSEQ) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ c_set_error (err, C_CONVERT_ERROR, C_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 {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
@@ -998,29 +998,29 @@ eg_utf8_to_utf16_general (const char *str, long len, long *items_read, long *ite
return NULL;
}
-uunichar2 *
-u_utf8_to_utf16 (const char *str, long len, long *items_read, long *items_written, UError **err)
+cunichar2 *
+c_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);
}
-uunichar2 *
+cunichar2 *
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);
}
-uunichar *
-u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written, UError **err)
+cunichar *
+c_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written, UError **err)
{
- uunichar *outbuf, *outptr;
+ cunichar *outbuf, *outptr;
size_t outlen = 0;
size_t inleft;
char *inptr;
- uunichar c;
+ cunichar c;
int n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0)
len = strlen (str);
@@ -1031,13 +1031,13 @@ u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written
while (inleft > 0) {
if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
if (errno == EILSEQ) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ c_set_error (err, C_CONVERT_ERROR, C_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 {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
@@ -1062,7 +1062,7 @@ u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written
if (items_read)
*items_read = inptr - str;
- outptr = outbuf = u_malloc (outlen + 4);
+ outptr = outbuf = c_malloc (outlen + 4);
inptr = (char *) str;
inleft = len;
@@ -1083,15 +1083,15 @@ u_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written
}
char *
-u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_written, UError **err)
+c_utf16_to_utf8 (const cunichar2 *str, long len, long *items_read, long *items_written, UError **err)
{
char *inptr, *outbuf, *outptr;
size_t outlen = 0;
size_t inleft;
- uunichar c;
+ cunichar c;
int n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0) {
len = 0;
@@ -1111,13 +1111,13 @@ u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_w
}
if (errno == EILSEQ) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ c_set_error (err, C_CONVERT_ERROR, C_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 {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
@@ -1131,7 +1131,7 @@ u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_w
} else if (c == 0)
break;
- outlen += u_unichar_to_utf8 (c, NULL);
+ outlen += c_unichar_to_utf8 (c, NULL);
inleft -= n;
inptr += n;
}
@@ -1142,7 +1142,7 @@ u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_w
if (items_written)
*items_written = outlen;
- outptr = outbuf = u_malloc (outlen + 1);
+ outptr = outbuf = c_malloc (outlen + 1);
inptr = (char *) str;
inleft = len * 2;
@@ -1152,7 +1152,7 @@ u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_w
else if (c == 0)
break;
- outptr += u_unichar_to_utf8 (c, outptr);
+ outptr += c_unichar_to_utf8 (c, outptr);
inleft -= n;
inptr += n;
}
@@ -1162,17 +1162,17 @@ u_utf16_to_utf8 (const uunichar2 *str, long len, long *items_read, long *items_w
return outbuf;
}
-uunichar *
-u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_written, UError **err)
+cunichar *
+c_utf16_to_ucs4 (const cunichar2 *str, long len, long *items_read, long *items_written, UError **err)
{
- uunichar *outbuf, *outptr;
+ cunichar *outbuf, *outptr;
size_t outlen = 0;
size_t inleft;
char *inptr;
- uunichar c;
+ cunichar c;
int n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0) {
len = 0;
@@ -1192,13 +1192,13 @@ u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_w
}
if (errno == EILSEQ) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ c_set_error (err, C_CONVERT_ERROR, C_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 {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_PARTIAL_INPUT,
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
@@ -1223,7 +1223,7 @@ u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_w
if (items_written)
*items_written = outlen / 4;
- outptr = outbuf = u_malloc (outlen + 4);
+ outptr = outbuf = c_malloc (outlen + 4);
inptr = (char *) str;
inleft = len * 2;
@@ -1244,19 +1244,19 @@ u_utf16_to_ucs4 (const uunichar2 *str, long len, long *items_read, long *items_w
}
char *
-u_ucs4_to_utf8 (const uunichar *str, long len, long *items_read, long *items_written, UError **err)
+c_ucs4_to_utf8 (const cunichar *str, long len, long *items_read, long *items_written, UError **err)
{
char *outbuf, *outptr;
size_t outlen = 0;
long i;
int n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0) {
for (i = 0; str[i] != 0; i++) {
- if ((n = u_unichar_to_utf8 (str[i], NULL)) < 0) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ if ((n = c_unichar_to_utf8 (str[i], NULL)) < 0) {
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
if (items_written)
@@ -1272,8 +1272,8 @@ u_ucs4_to_utf8 (const uunichar *str, long len, long *items_read, long *items_wri
}
} else {
for (i = 0; i < len && str[i] != 0; i++) {
- if ((n = u_unichar_to_utf8 (str[i], NULL)) < 0) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ if ((n = c_unichar_to_utf8 (str[i], NULL)) < 0) {
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
if (items_written)
@@ -1291,9 +1291,9 @@ u_ucs4_to_utf8 (const uunichar *str, long len, long *items_read, long *items_wri
len = i;
- outptr = outbuf = u_malloc (outlen + 1);
+ outptr = outbuf = c_malloc (outlen + 1);
for (i = 0; i < len; i++)
- outptr += u_unichar_to_utf8 (str[i], outptr);
+ outptr += c_unichar_to_utf8 (str[i], outptr);
*outptr = 0;
if (items_written)
@@ -1305,20 +1305,20 @@ u_ucs4_to_utf8 (const uunichar *str, long len, long *items_read, long *items_wri
return outbuf;
}
-uunichar2 *
-u_ucs4_to_utf16 (const uunichar *str, long len, long *items_read, long *items_written, UError **err)
+cunichar2 *
+c_ucs4_to_utf16 (const cunichar *str, long len, long *items_read, long *items_written, UError **err)
{
- uunichar2 *outbuf, *outptr;
+ cunichar2 *outbuf, *outptr;
size_t outlen = 0;
long i;
int n;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len < 0) {
for (i = 0; str[i] != 0; i++) {
- if ((n = u_unichar_to_utf16 (str[i], NULL)) < 0) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ if ((n = c_unichar_to_utf16 (str[i], NULL)) < 0) {
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
if (items_written)
@@ -1334,8 +1334,8 @@ u_ucs4_to_utf16 (const uunichar *str, long len, long *items_read, long *items_wr
}
} else {
for (i = 0; i < len && str[i] != 0; i++) {
- if ((n = u_unichar_to_utf16 (str[i], NULL)) < 0) {
- u_set_error (err, U_CONVERT_ERROR, U_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ if ((n = c_unichar_to_utf16 (str[i], NULL)) < 0) {
+ c_set_error (err, C_CONVERT_ERROR, C_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
if (items_written)
@@ -1353,9 +1353,9 @@ u_ucs4_to_utf16 (const uunichar *str, long len, long *items_read, long *items_wr
len = i;
- outptr = outbuf = u_malloc ((outlen + 1) * sizeof (uunichar2));
+ outptr = outbuf = c_malloc ((outlen + 1) * sizeof (cunichar2));
for (i = 0; i < len; i++)
- outptr += u_unichar_to_utf16 (str[i], outptr);
+ outptr += c_unichar_to_utf16 (str[i], outptr);
*outptr = 0;
if (items_written)
diff --git a/deps/clib/src/clib-config.h b/deps/clib/src/clib-config.h
new file mode 100644
index 00000000..b9793524
--- /dev/null
+++ b/deps/clib/src/clib-config.h
@@ -0,0 +1,19 @@
+#ifndef __CLIB_CONFIG_H
+#define __CLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define C_SEARCHPATH_SEPARATOR_S ":"
+#define C_SEARCHPATH_SEPARATOR ':'
+#define C_DIR_SEPARATOR '/'
+#define C_DIR_SEPARATOR_S "/"
+#define C_OS_UNIX
+
+#if 1 == 1
+#define C_HAVE_ALLOCA_H
+#endif
+
+typedef int UPid;
+
+#endif
diff --git a/deps/clib/src/clib-config.h.in b/deps/clib/src/clib-config.h.in
new file mode 100644
index 00000000..82134ebd
--- /dev/null
+++ b/deps/clib/src/clib-config.h.in
@@ -0,0 +1,19 @@
+#ifndef __CLIB_CONFIG_H
+#define __CLIB_CONFIG_H
+
+/*
+ * System-dependent settings
+ */
+#define C_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
+#define C_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
+#define C_DIR_SEPARATOR '@PATHSEP@'
+#define C_DIR_SEPARATOR_S "@PATHSEP@"
+#define C_OS_@OS@
+
+#if @HAVE_ALLOCA_H@ == 1
+#define C_HAVE_ALLOCA_H
+#endif
+
+typedef @PIDTYPE@ UPid;
+
+#endif
diff --git a/deps/clib/src/clib.h b/deps/clib/src/clib.h
new file mode 100644
index 00000000..466353ea
--- /dev/null
+++ b/deps/clib/src/clib.h
@@ -0,0 +1,1232 @@
+#ifndef __CLIB_H
+#define __CLIB_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(<clib-config.h>, <clib-config.hw>)
+#endif
+
+#include <stdint.h>
+#include <inttypes.h>
+
+#include <clib-config.h>
+
+#ifdef C_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 __CLIB_X11 1
+
+#ifdef __cplusplus
+#define C_BEGIN_DECLS extern "C" {
+#define C_END_DECLS }
+#else
+#define C_BEGIN_DECLS
+#define C_END_DECLS
+#endif
+
+C_BEGIN_DECLS
+
+#ifdef C_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 cboolean;
+typedef uint16_t cunichar2;
+typedef uint32_t cunichar;
+
+
+/*
+ * Macros
+ */
+#define C_N_ELEMENTS(s) (sizeof(s) / sizeof ((s) [0]))
+#define C_STRINGIFY_ARG(arg) #arg
+#define C_STRINGIFY(arg) C_STRINGIFY_ARG(arg)
+#define C_PASTE_ARGS(part0, part1) part0 ## part1
+#define C_PASTE(part0, part1) C_PASTE_ARGS (part0, part1)
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#define C_MINSHORT SHRT_MIN
+#define C_MAXSHORT SHRT_MAX
+#define C_MAXUSHORT USHRT_MAX
+#define C_MAXINT INT_MAX
+#define C_MININT INT_MIN
+#define C_MAXINT32 INT32_MAX
+#define C_MAXUINT32 UINT32_MAX
+#define C_MININT32 INT32_MIN
+#define C_MININT64 INT64_MIN
+#define C_MAXINT64 INT64_MAX
+#define C_MAXUINT64 UINT64_MAX
+#define C_MAXFLOAT FLT_MAX
+
+#define C_UINT64_FORMAT PRIu64
+#define C_INT64_FORMAT PRId64
+#define C_UINT32_FORMAT PRIu32
+#define C_INT32_FORMAT PRId32
+
+#define C_LITTLE_ENDIAN 1234
+#define C_BIC_ENDIAN 4321
+#define C_STMT_START do
+#define C_STMT_END while (0)
+
+#define C_USEC_PER_SEC 1000000
+#define C_PI 3.141592653589793238462643383279502884L
+#define C_PI_2 1.570796326794896619231321691639751442L
+
+#define C_INT64_CONSTANT(val) (val##LL)
+#define C_UINT64_CONSTANT(val) (val##UL)
+
+#define C_POINTER_TO_INT(ptr) ((int)(intptr_t)(ptr))
+#define C_POINTER_TO_UINT(ptr) ((unsigned int)(uintptr_t)(ptr))
+#define C_INT_TO_POINTER(v) ((void *)(intptr_t)(v))
+#define C_UINT_TO_POINTER(v) ((void *)(uintptr_t)(v))
+
+#define C_STRUCT_OFFSET(p_type,field) offsetof(p_type,field)
+
+#define C_STRLOC __FILE__ ":" C_STRINGIFY(__LINE__) ":"
+
+#define C_CONST_RETURN const
+
+#define C_BYTE_ORDER C_LITTLE_ENDIAN
+
+#if defined(__GNUC__)
+# define C_GNUC_GNUSED __attribute__((__unused__))
+# define C_GNUC_NORETURN __attribute__((__noreturn__))
+# define C_LIKELY(expr) (__builtin_expect ((expr) != 0, 1))
+# define C_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
+# define C_GNUC_PRINTF(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
+#else
+# define C_GNUC_GNUSED
+# define C_GNUC_NORETURN
+# define C_LIKELY(expr) (expr)
+# define C_UNLIKELY(expr) (expr)
+# define C_GNUC_PRINTF(format_idx, arg_idx)
+#endif
+
+#if defined(__GNUC__)
+# define C_STRFUNC ((const char *)(__PRETTY_FUNCTION__))
+#elif defined (_MSC_VER)
+# define C_STRFUNC ((const char*) (__FUNCTION__))
+#else
+# define C_STRFUNC ((const char*) (__func__))
+#endif
+
+#if defined (_MSC_VER)
+# define C_VA_COPY(dest, src) ((dest) = (src))
+#else
+# define C_VA_COPY(dest, src) va_copy (dest, src)
+#endif
+
+#ifdef OS_UNIX
+#define C_BREAKPOINT() C_STMT_START { raise (SIGTRAP); } C_STMT_END
+#else
+#define C_BREAKPOINT()
+#endif
+
+#if defined (__native_client__)
+#undef C_BREAKPOINT
+#define C_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 c_free (void *ptr);
+void * c_realloc (void * obj, size_t size);
+void * c_malloc (size_t x);
+void * c_malloc0 (size_t x);
+void * c_try_malloc (size_t x);
+void * c_try_realloc (void * obj, size_t size);
+void * c_memdup (const void * mem, unsigned int byte_size);
+
+#define c_new(type,size) ((type *) c_malloc (sizeof (type) * (size)))
+#define c_new0(type,size) ((type *) c_malloc0 (sizeof (type)* (size)))
+#define c_newa(type,size) ((type *) alloca (sizeof (type) * (size)))
+
+#define c_memmove(dest,src,len) memmove (dest, src, len)
+#define c_renew(struct_type, mem, n_structs) c_realloc (mem, sizeof (struct_type) * n_structs)
+#define c_alloca(size) alloca (size)
+
+#define c_slice_new(type) ((type *) c_malloc (sizeof (type)))
+#define c_slice_new0(type) ((type *) c_malloc0 (sizeof (type)))
+#define c_slice_free(type, mem) c_free (mem)
+#define c_slice_free1(size, mem) c_free (mem)
+#define c_slice_alloc(size) c_malloc (size)
+#define c_slice_alloc0(size) c_malloc0 (size)
+#define c_slice_dup(type, mem) c_memdup (mem, sizeof (type))
+#define c_slice_copy(size, mem) c_memdup (mem, size)
+
+static inline char *c_strdup (const char *str) { if (str) {return strdup (str);} return NULL; }
+char **c_strdupv (char **str_array);
+int c_strcmp0 (const char *str1, const char *str2);
+
+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 c_mem_set_vtable(x)
+
+struct _UMemChunk {
+ unsigned int alloc_size;
+};
+
+typedef struct _UMemChunk UMemChunk;
+/*
+ * Misc.
+ */
+#define c_atexit(func) ((void) atexit (func))
+
+const char * c_getenv(const char *variable);
+cboolean c_setenv(const char *variable, const char *value, cboolean overwrite);
+void c_unsetenv(const char *variable);
+
+char* c_win32_getlocale(void);
+
+/*
+ * Precondition macros
+ */
+#define c_warn_if_fail(x) C_STMT_START { if (!(x)) { c_warning ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); } } C_STMT_END
+#define c_warn_if_reached() c_warning ("%s:%d: code should not be reached!", __FILE__, __LINE__)
+
+#define c_return_if_fail(x) C_STMT_START { if (!(x)) { c_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return; } } C_STMT_END
+#define c_return_val_if_fail(x,e) C_STMT_START { if (!(x)) { c_critical ("%s:%d: assertion '%s' failed", __FILE__, __LINE__, #x); return (e); } } C_STMT_END
+#define c_return_if_reached(e) C_STMT_START { c_warning ("%s:%d: code should not be reached, returning!", __FILE__, __LINE__); return; } C_STMT_END
+#define c_return_val_if_reached(e) C_STMT_START { c_warning ("%s:%d: code should not be reached, returning!", __FILE__, __LINE__); return (e); } C_STMT_END
+
+/*
+ * DebugKeys
+ */
+typedef struct _CDebugKey {
+ const char *key;
+ unsigned int value;
+} CDebugKey;
+
+unsigned int c_parse_debug_string (const char *string, const CDebugKey *keys, unsigned int nkeys);
+
+/*
+ * Quark
+ */
+
+typedef uint32_t UQuark;
+
+UQuark
+c_quark_from_static_string (const char *string);
+
+/*
+ * Errors
+ */
+typedef struct {
+ UQuark domain;
+ int code;
+ char *message;
+} UError;
+
+void c_clear_error (UError **error);
+void c_error_free (UError *error);
+UError *c_error_new (UQuark domain, int code, const char *format, ...);
+UError *c_error_new_valist (UQuark domain, int code, const char *format, va_list ap);
+void c_set_error (UError **err, UQuark domain, int code, const char *format, ...);
+void c_propagate_error (UError **dest, UError *src);
+UError *c_error_copy (const UError *error);
+cboolean c_error_matches (const UError *error, UQuark domain, int code);
+
+/*
+ * Strings utility
+ */
+char *c_strdup_printf (const char *format, ...);
+char *c_strdup_vprintf (const char *format, va_list args);
+char *c_strndup (const char *str, size_t n);
+const char *c_strerror (int errnum);
+char *c_strndup (const char *str, size_t n);
+void c_strfreev (char **str_array);
+char *c_strconcat (const char *first, ...);
+char **c_strsplit (const char *string, const char *delimiter, int max_tokens);
+char **c_strsplit_set (const char *string, const char *delimiter, int max_tokens);
+char *c_strreverse (char *str);
+cboolean c_str_has_prefix (const char *str, const char *prefix);
+cboolean c_str_has_suffix (const char *str, const char *suffix);
+unsigned int c_strv_length (char **str_array);
+char *c_strjoin (const char *separator, ...);
+char *c_strjoinv (const char *separator, char **str_array);
+char *c_strchug (char *str);
+char *c_strchomp (char *str);
+void c_strdown (char *string);
+char *c_strnfill (size_t length, char fill_char);
+
+char *c_strdelimit (char *string, const char *delimiters, char new_delimiter);
+char *c_strescape (const char *source, const char *exceptions);
+
+char *c_filename_to_uri (const char *filename, const char *hostname, UError **error);
+char *c_filename_from_uri (const char *uri, char **hostname, UError **error);
+
+int c_printf (char const *format, ...);
+int c_fprintf (FILE *file, char const *format, ...);
+int c_sprintf (char *string, char const *format, ...);
+int c_snprintf (char *string, unsigned long n, char const *format, ...);
+#define c_vprintf vprintf
+#define c_vfprintf vfprintf
+#define c_vsprintf vsprintf
+#define c_vsnprintf vsnprintf
+#define c_vasprintf vasprintf
+
+size_t c_strlcpy (char *dest, const char *src, size_t dest_size);
+char *c_stpcpy (char *dest, const char *src);
+
+
+char c_ascii_tolower (char c);
+char c_ascii_toupper (char c);
+char *c_ascii_strdown (const char *str, ussize len);
+char *c_ascii_strup (const char *str, ussize len);
+int c_ascii_strncasecmp (const char *s1, const char *s2, size_t n);
+int c_ascii_strcasecmp (const char *s1, const char *s2);
+int c_ascii_xdigit_value (char c);
+#define c_ascii_isspace(c) (isspace (c) != 0)
+#define c_ascii_isalpha(c) (isalpha (c) != 0)
+#define c_ascii_isprint(c) (isprint (c) != 0)
+#define c_ascii_isxdigit(c) (isxdigit (c) != 0)
+
+/* FIXME: c_strcasecmp supports utf8 unicode stuff */
+#ifdef _MSC_VER
+#define c_strcasecmp stricmp
+#define c_strncasecmp strnicmp
+#define c_strstrip(a) c_strchug (c_strchomp (a))
+#else
+#define c_strcasecmp strcasecmp
+#define c_ascii_strtoull strtoull
+#define c_strncasecmp strncasecmp
+#define c_strstrip(a) c_strchug (c_strchomp (a))
+#endif
+#define c_ascii_strdup strdup
+
+
+#define C_STR_DELIMITERS "_-|> <."
+
+/*
+ * String type
+ */
+typedef struct {
+ char *str;
+ size_t len;
+ size_t allocated_len;
+} CString;
+
+CString *c_string_new (const char *init);
+CString *c_string_new_len (const char *init, ussize len);
+CString *c_string_sized_new (size_t default_size);
+char *c_string_free (CString *string, cboolean free_segment);
+CString *c_string_assign (CString *string, const char *val);
+CString *c_string_append (CString *string, const char *val);
+void c_string_printf (CString *string, const char *format, ...);
+void c_string_append_printf (CString *string, const char *format, ...);
+void c_string_append_vprintf (CString *string, const char *format, va_list args);
+CString *c_string_append_unichar (CString *string, cunichar c);
+CString *c_string_append_c (CString *string, char c);
+CString *c_string_append (CString *string, const char *val);
+CString *c_string_append_len (CString *string, const char *val, ussize len);
+CString *c_string_truncate (CString *string, size_t len);
+CString *c_string_prepend (CString *string, const char *val);
+CString *c_string_insert (CString *string, ussize pos, const char *val);
+CString *c_string_set_size (CString *string, size_t len);
+CString *c_string_erase (CString *string, ussize pos, ussize len);
+
+#define c_string_sprintfa c_string_append_printf
+
+typedef void (*CFunc) (void * data, void * user_data);
+typedef int (*CCompareFunc) (const void * a, const void * b);
+typedef int (*CCompareDataFunc) (const void * a, const void * b, void * user_data);
+typedef void (*CHFunc) (void * key, void * value, void * user_data);
+typedef cboolean (*CHRFunc) (void * key, void * value, void * user_data);
+typedef void (*CDestroyNotify) (void * data);
+typedef unsigned int (*CHashFunc) (const void * key);
+typedef cboolean (*CEqualFunc) (const void * a, const void * b);
+typedef void (*CFreeFunc) (void * data);
+
+/*
+ * Lists
+ */
+typedef struct _CSList CSList;
+struct _CSList {
+ void * data;
+ CSList *next;
+};
+
+CSList *c_slist_alloc (void);
+CSList *c_slist_append (CSList *list,
+ void * data);
+CSList *c_slist_prepend (CSList *list,
+ void * data);
+void c_slist_free (CSList *list);
+void c_slist_free_1 (CSList *list);
+CSList *c_slist_copy (CSList *list);
+CSList *c_slist_concat (CSList *list1,
+ CSList *list2);
+void c_slist_foreach (CSList *list,
+ CFunc func,
+ void * user_data);
+CSList *c_slist_last (CSList *list);
+CSList *c_slist_find (CSList *list,
+ const void * data);
+CSList *c_slist_find_custom (CSList *list,
+ const void * data,
+ CCompareFunc func);
+CSList *c_slist_remove (CSList *list,
+ const void * data);
+CSList *c_slist_remove_all (CSList *list,
+ const void * data);
+CSList *c_slist_reverse (CSList *list);
+unsigned int c_slist_length (CSList *list);
+CSList *c_slist_remove_link (CSList *list,
+ CSList *link);
+CSList *c_slist_delete_link (CSList *list,
+ CSList *link);
+CSList *c_slist_insert_sorted (CSList *list,
+ void * data,
+ CCompareFunc func);
+CSList *c_slist_insert_before (CSList *list,
+ CSList *sibling,
+ void * data);
+CSList *c_slist_sort (CSList *list,
+ CCompareFunc func);
+int c_slist_index (CSList *list,
+ const void * data);
+CSList *c_slist_nth (CSList *list,
+ unsigned int n);
+void * c_slist_nth_data (CSList *list,
+ unsigned int n);
+
+#define c_slist_next(slist) ((slist) ? (((CSList *) (slist))->next) : NULL)
+
+
+typedef struct _CList CList;
+struct _CList {
+ void * data;
+ CList *next;
+ CList *prev;
+};
+
+#define c_list_next(list) ((list) ? (((CList *) (list))->next) : NULL)
+#define c_list_previous(list) ((list) ? (((CList *) (list))->prev) : NULL)
+
+CList *c_list_alloc (void);
+CList *c_list_append (CList *list,
+ void * data);
+CList *c_list_prepend (CList *list,
+ void * data);
+void c_list_free (CList *list);
+void c_list_free_full (CList *list,
+ CDestroyNotify free_func);
+void c_list_free_1 (CList *list);
+CList *c_list_copy (CList *list);
+unsigned int c_list_length (CList *list);
+int c_list_index (CList *list,
+ const void * data);
+CList *c_list_nth (CList *list,
+ unsigned int n);
+void * c_list_nth_data (CList *list,
+ unsigned int n);
+CList *c_list_last (CList *list);
+CList *c_list_concat (CList *list1,
+ CList *list2);
+void c_list_foreach (CList *list,
+ CFunc func,
+ void * user_data);
+CList *c_list_first (CList *list);
+CList *c_list_find (CList *list,
+ const void * data);
+CList *c_list_find_custom (CList *list,
+ const void * data,
+ CCompareFunc func);
+CList *c_list_remove (CList *list,
+ const void * data);
+CList *c_list_remove_all (CList *list,
+ const void * data);
+CList *c_list_reverse (CList *list);
+CList *c_list_remove_link (CList *list,
+ CList *link);
+CList *c_list_delete_link (CList *list,
+ CList *link);
+CList *c_list_insert_sorted (CList *list,
+ void * data,
+ CCompareFunc func);
+CList *c_list_insert_before (CList *list,
+ CList *sibling,
+ void * data);
+CList *c_list_sort (CList *sort,
+ CCompareFunc func);
+
+/*
+ * HookLists
+ */
+typedef void (*CHookFunc) (void * data);
+
+typedef struct _CHook CHook;
+typedef struct _CHookList CHookList;
+
+struct _CHook {
+ CHook *next;
+ CHook *prev;
+ void * data;
+ void * func;
+ cboolean in_call;
+};
+
+struct _CHookList {
+ CHook *hooks;
+};
+
+void
+c_hook_list_init (CHookList *hook_list,
+ unsigned int hook_size);
+
+void
+c_hook_list_invoke (CHookList *hook_list,
+ cboolean may_recurse);
+
+void
+c_hook_list_clear (CHookList *hook_list);
+
+CHook *
+c_hook_alloc (CHookList *hook_list);
+
+CHook *
+c_hook_find_func_data (CHookList *hook_list,
+ cboolean need_valids,
+ void * func,
+ void * data);
+
+void
+c_hook_destroy_link (CHookList *hook_list,
+ CHook *hook);
+
+void
+c_hook_prepend (CHookList *hook_list,
+ CHook *hook);
+
+
+/*
+ * Hashtables
+ */
+typedef struct _CHashTable CHashTable;
+typedef struct _CHashTableIter CHashTableIter;
+
+/* Private, but needed for stack allocation */
+struct _CHashTableIter
+{
+ void * dummy [8];
+};
+
+CHashTable *c_hash_table_new (CHashFunc hash_func, CEqualFunc key_equal_func);
+CHashTable *c_hash_table_new_full (CHashFunc hash_func, CEqualFunc key_equal_func,
+ CDestroyNotify key_destroy_func, CDestroyNotify value_destroy_func);
+void c_hash_table_insert_replace (CHashTable *hash, void * key, void * value, cboolean replace);
+unsigned int c_hash_table_size (CHashTable *hash);
+CList *c_hash_table_get_keys (CHashTable *hash);
+CList *c_hash_table_get_values (CHashTable *hash);
+void * c_hash_table_lookup (CHashTable *hash, const void * key);
+cboolean c_hash_table_lookup_extended (CHashTable *hash, const void * key, void * *orig_key, void * *value);
+void c_hash_table_foreach (CHashTable *hash, CHFunc func, void * user_data);
+void * c_hash_table_find (CHashTable *hash, CHRFunc predicate, void * user_data);
+cboolean c_hash_table_remove (CHashTable *hash, const void * key);
+cboolean c_hash_table_steal (CHashTable *hash, const void * key);
+void c_hash_table_remove_all (CHashTable *hash);
+unsigned int c_hash_table_foreach_remove (CHashTable *hash, CHRFunc func, void * user_data);
+unsigned int c_hash_table_foreach_steal (CHashTable *hash, CHRFunc func, void * user_data);
+void c_hash_table_destroy (CHashTable *hash);
+void c_hash_table_print_stats (CHashTable *table);
+
+void c_hash_table_iter_init (CHashTableIter *iter, CHashTable *hash_table);
+cboolean c_hash_table_iter_next (CHashTableIter *iter, void * *key, void * *value);
+
+unsigned int c_spaced_primes_closest (unsigned int x);
+
+#define c_hash_table_insert(h,k,v) c_hash_table_insert_replace ((h),(k),(v),FALSE)
+#define c_hash_table_replace(h,k,v) c_hash_table_insert_replace ((h),(k),(v),TRUE)
+
+cboolean c_direct_equal (const void * v1, const void * v2);
+unsigned int c_direct_hash (const void * v1);
+cboolean c_int_equal (const void * v1, const void * v2);
+unsigned int c_int_hash (const void * v1);
+cboolean c_str_equal (const void * v1, const void * v2);
+unsigned int c_str_hash (const void * v1);
+
+/*
+ * ByteArray
+ */
+
+typedef struct _CByteArray CByteArray;
+struct _CByteArray {
+ uint8_t *data;
+ int len;
+};
+
+CByteArray *c_byte_array_new (void);
+CByteArray *c_byte_array_append (CByteArray *array, const uint8_t *data, unsigned int len);
+CByteArray *c_byte_array_set_size (CByteArray *array, unsigned int len);
+uint8_t *c_byte_array_free (CByteArray *array, cboolean free_segment);
+
+/*
+ * Array
+ */
+
+typedef struct _CArray CArray;
+struct _CArray {
+ char *data;
+ int len;
+};
+
+CArray *c_array_new (cboolean zero_terminated, cboolean clear_, unsigned int element_size);
+CArray *c_array_sized_new (cboolean zero_terminated, cboolean clear_, unsigned int element_size, unsigned int reserved_size);
+char* c_array_free (CArray *array, cboolean free_segment);
+CArray *c_array_append_vals (CArray *array, const void * data, unsigned int len);
+CArray* c_array_insert_vals (CArray *array, unsigned int index_, const void * data, unsigned int len);
+CArray* c_array_remove_index (CArray *array, unsigned int index_);
+CArray* c_array_remove_index_fast (CArray *array, unsigned int index_);
+unsigned int c_array_get_element_size (CArray *array);
+void c_array_sort (CArray *array, CCompareFunc compare);
+CArray *c_array_set_size (CArray *array, int length);
+
+#define c_array_append_val(a,v) (c_array_append_vals((a),&(v),1))
+#define c_array_insert_val(a,i,v) (c_array_insert_vals((a),(i),&(v),1))
+#define c_array_index(a,t,i) (((t*)(a)->data)[(i)])
+
+/*
+ * QSort
+*/
+
+void c_qsort_with_data (void * base, size_t nmemb, size_t size, CCompareDataFunc compare, void * user_data);
+
+/*
+ * Pointer Array
+ */
+
+typedef struct _UPtrArray UPtrArray;
+struct _UPtrArray {
+ void * *pdata;
+ unsigned int len;
+};
+
+UPtrArray *c_ptr_array_new (void);
+UPtrArray *c_ptr_array_sized_new (unsigned int reserved_size);
+UPtrArray *c_ptr_array_new_with_free_func (CDestroyNotify element_free_func);
+void c_ptr_array_add (UPtrArray *array, void * data);
+cboolean c_ptr_array_remove (UPtrArray *array, void * data);
+void * c_ptr_array_remove_index (UPtrArray *array, unsigned int index);
+cboolean c_ptr_array_remove_fast (UPtrArray *array, void * data);
+void * c_ptr_array_remove_index_fast (UPtrArray *array, unsigned int index);
+void c_ptr_array_sort (UPtrArray *array, CCompareFunc compare_func);
+void c_ptr_array_sort_with_data (UPtrArray *array, CCompareDataFunc compare_func, void * user_data);
+void c_ptr_array_set_size (UPtrArray *array, int length);
+void * *c_ptr_array_free (UPtrArray *array, cboolean free_seg);
+void c_ptr_array_foreach (UPtrArray *array, CFunc func, void * user_data);
+#define c_ptr_array_index(array,index) (array)->pdata[(index)]
+
+/*
+ * Queues
+ */
+typedef struct {
+ CList *head;
+ CList *tail;
+ unsigned int length;
+} CQueue;
+
+#define C_QUEUE_INIT { NULL, NULL, 0 }
+
+void c_queue_init (CQueue *queue);
+void * c_queue_peek_head (CQueue *queue);
+void * c_queue_pop_head (CQueue *queue);
+void * c_queue_peek_tail (CQueue *queue);
+void * c_queue_pop_tail (CQueue *queue);
+void c_queue_push_head (CQueue *queue,
+ void * data);
+void c_queue_push_tail (CQueue *queue,
+ void * data);
+cboolean c_queue_is_empty (CQueue *queue);
+CQueue *c_queue_new (void);
+void c_queue_free (CQueue *queue);
+void c_queue_foreach (CQueue *queue, CFunc func, void * user_data);
+CList *c_queue_find (CQueue *queue, const void * data);
+void c_queue_clear (CQueue *queue);
+
+/*
+ * Messages
+ */
+#ifndef C_LOG_DOMAIN
+#define C_LOG_DOMAIN ((char*) 0)
+#endif
+
+typedef enum {
+ C_LOG_FLAC_RECURSION = 1 << 0,
+ C_LOG_FLAC_FATAL = 1 << 1,
+
+ C_LOG_LEVEL_ERROR = 1 << 2,
+ C_LOG_LEVEL_CRITICAL = 1 << 3,
+ C_LOG_LEVEL_WARNING = 1 << 4,
+ C_LOG_LEVEL_MESSAGE = 1 << 5,
+ C_LOG_LEVEL_INFO = 1 << 6,
+ C_LOG_LEVEL_DEBUG = 1 << 7,
+
+ C_LOG_LEVEL_MASK = ~(C_LOG_FLAC_RECURSION | C_LOG_FLAC_FATAL)
+} CLogLevelFlags;
+
+void c_print (const char *format, ...);
+void c_printerr (const char *format, ...);
+CLogLevelFlags c_log_set_always_fatal (CLogLevelFlags fatal_mask);
+CLogLevelFlags c_log_set_fatal_mask (const char *log_domain, CLogLevelFlags fatal_mask);
+void c_logv (const char *log_domain, CLogLevelFlags log_level, const char *format, va_list args);
+void c_log (const char *log_domain, CLogLevelFlags log_level, const char *format, ...);
+void c_assertion_message (const char *format, ...) C_GNUC_NORETURN;
+
+#ifdef HAVE_C99_SUPPORT
+/* The for (;;) tells gc thats c_error () doesn't return, avoiding warnings */
+#define c_error(format, ...) do { c_log (C_LOG_DOMAIN, C_LOG_LEVEL_ERROR, format, __VA_ARGS__); for (;;); } while (0)
+#define c_critical(format, ...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_CRITICAL, format, __VA_ARGS__)
+#define c_warning(format, ...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_WARNING, format, __VA_ARGS__)
+#define c_message(format, ...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_MESSAGE, format, __VA_ARGS__)
+#define c_debug(format, ...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_DEBUG, format, __VA_ARGS__)
+#else /* HAVE_C99_SUPPORT */
+#define c_error(...) do { c_log (C_LOG_DOMAIN, C_LOG_LEVEL_ERROR, __VA_ARGS__); for (;;); } while (0)
+#define c_critical(...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_CRITICAL, __VA_ARGS__)
+#define c_warning(...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_WARNING, __VA_ARGS__)
+#define c_message(...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_MESSAGE, __VA_ARGS__)
+#define c_debug(...) c_log (C_LOG_DOMAIN, C_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#endif /* ndef HAVE_C99_SUPPORT */
+#define c_log_set_handler(a,b,c,d)
+
+#define C_GNUC_INTERNAL
+
+/*
+ * Conversions
+ */
+
+UQuark c_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 {
+ C_UNICODE_CONTROL,
+ C_UNICODE_FORMAT,
+ C_UNICODE_UNASSIGNED,
+ C_UNICODE_PRIVATE_USE,
+ C_UNICODE_SURROGATE,
+ C_UNICODE_LOWERCASE_LETTER,
+ C_UNICODE_MODIFIER_LETTER,
+ C_UNICODE_OTHER_LETTER,
+ C_UNICODE_TITLECASE_LETTER,
+ C_UNICODE_UPPERCASE_LETTER,
+ C_UNICODE_COMBININC_MARK,
+ C_UNICODE_ENCLOSINC_MARK,
+ C_UNICODE_NON_SPACINC_MARK,
+ C_UNICODE_DECIMAL_NUMBER,
+ C_UNICODE_LETTER_NUMBER,
+ C_UNICODE_OTHER_NUMBER,
+ C_UNICODE_CONNECT_PUNCTUATION,
+ C_UNICODE_DASH_PUNCTUATION,
+ C_UNICODE_CLOSE_PUNCTUATION,
+ C_UNICODE_FINAL_PUNCTUATION,
+ C_UNICODE_INITIAL_PUNCTUATION,
+ C_UNICODE_OTHER_PUNCTUATION,
+ C_UNICODE_OPEN_PUNCTUATION,
+ C_UNICODE_CURRENCY_SYMBOL,
+ C_UNICODE_MODIFIER_SYMBOL,
+ C_UNICODE_MATH_SYMBOL,
+ C_UNICODE_OTHER_SYMBOL,
+ C_UNICODE_LINE_SEPARATOR,
+ C_UNICODE_PARAGRAPH_SEPARATOR,
+ C_UNICODE_SPACE_SEPARATOR
+} UUnicodeType;
+
+typedef enum {
+ C_UNICODE_BREAK_MANDATORY,
+ C_UNICODE_BREAK_CARRIAGE_RETURN,
+ C_UNICODE_BREAK_LINE_FEED,
+ C_UNICODE_BREAK_COMBININC_MARK,
+ C_UNICODE_BREAK_SURROGATE,
+ C_UNICODE_BREAK_ZERO_WIDTH_SPACE,
+ C_UNICODE_BREAK_INSEPARABLE,
+ C_UNICODE_BREAK_NON_BREAKING_GLUE,
+ C_UNICODE_BREAK_CONTINGENT,
+ C_UNICODE_BREAK_SPACE,
+ C_UNICODE_BREAK_AFTER,
+ C_UNICODE_BREAK_BEFORE,
+ C_UNICODE_BREAK_BEFORE_AND_AFTER,
+ C_UNICODE_BREAK_HYPHEN,
+ C_UNICODE_BREAK_NON_STARTER,
+ C_UNICODE_BREAK_OPEN_PUNCTUATION,
+ C_UNICODE_BREAK_CLOSE_PUNCTUATION,
+ C_UNICODE_BREAK_QUOTATION,
+ C_UNICODE_BREAK_EXCLAMATION,
+ C_UNICODE_BREAK_IDEOGRAPHIC,
+ C_UNICODE_BREAK_NUMERIC,
+ C_UNICODE_BREAK_INFIX_SEPARATOR,
+ C_UNICODE_BREAK_SYMBOL,
+ C_UNICODE_BREAK_ALPHABETIC,
+ C_UNICODE_BREAK_PREFIX,
+ C_UNICODE_BREAK_POSTFIX,
+ C_UNICODE_BREAK_COMPLEX_CONTEXT,
+ C_UNICODE_BREAK_AMBIGUOUS,
+ C_UNICODE_BREAK_UNKNOWN,
+ C_UNICODE_BREAK_NEXT_LINE,
+ C_UNICODE_BREAK_WORD_JOINER,
+ C_UNICODE_BREAK_HANGUL_L_JAMO,
+ C_UNICODE_BREAK_HANGUL_V_JAMO,
+ C_UNICODE_BREAK_HANGUL_T_JAMO,
+ C_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
+ C_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
+} UUnicodeBreakType;
+
+cunichar c_unichar_toupper (cunichar c);
+cunichar c_unichar_tolower (cunichar c);
+cunichar c_unichar_totitle (cunichar c);
+UUnicodeType c_unichar_type (cunichar c);
+cboolean c_unichar_isspace (cunichar c);
+cboolean c_unichar_isxdigit (cunichar c);
+int c_unichar_xdigit_value (cunichar c);
+UUnicodeBreakType c_unichar_break_type (cunichar c);
+
+#define c_assert(x) C_STMT_START { if (C_UNLIKELY (!(x))) c_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } C_STMT_END
+#define c_assert_not_reached() C_STMT_START { c_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); } C_STMT_END
+
+#define c_assert_cmpstr(s1, cmp, s2) \
+ C_STMT_START { \
+ const char *_s1 = s1; \
+ const char *_s2 = s2; \
+ if (!(strcmp (_s1, _s2) cmp 0)) \
+ c_assertion_message ("* Assertion at %s:%d, condition \"%s\" " #cmp " \"%s\" failed\n", __FILE__, __LINE__, _s1, _s2); \
+ } C_STMT_END
+#define c_assert_cmpint(n1, cmp, n2) \
+ C_STMT_START { \
+ int _n1 = n1; \
+ int _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ c_assertion_message ("* Assertion at %s:%d, condition %d " #cmp " %d failed\n", __FILE__, __LINE__, _n1, _n2); \
+ } C_STMT_END
+#define c_assert_cmpuint(n1, cmp, n2) \
+ C_STMT_START { \
+ int _n1 = n1; \
+ int _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ c_assertion_message ("* Assertion at %s:%d, condition %u " #cmp " %u failed\n", __FILE__, __LINE__, _n1, _n2); \
+ } C_STMT_END
+#define c_assert_cmpfloat(n1, cmp, n2) \
+ C_STMT_START { \
+ float _n1 = n1; \
+ float _n2 = n2; \
+ if (!(_n1 cmp _n2)) \
+ c_assertion_message ("* Assertion at %s:%d, condition %f " #cmp " %f failed\n", __FILE__, __LINE__, _n1, _n2); \
+ } C_STMT_END
+
+/*
+ * Unicode conversion
+ */
+
+#define C_CONVERT_ERROR c_convert_error_quark()
+
+typedef enum {
+ C_CONVERT_ERROR_NO_CONVERSION,
+ C_CONVERT_ERROR_ILLEGAL_SEQUENCE,
+ C_CONVERT_ERROR_FAILED,
+ C_CONVERT_ERROR_PARTIAL_INPUT,
+ C_CONVERT_ERROR_BAD_URI,
+ C_CONVERT_ERROR_NOT_ABSOLUTE_PATH
+} UConvertError;
+
+char *c_utf8_strup (const char *str, ussize len);
+char *c_utf8_strdown (const char *str, ussize len);
+int c_unichar_to_utf8 (cunichar c, char *outbuf);
+cunichar *c_utf8_to_ucs4_fast (const char *str, long len, long *items_written);
+cunichar *c_utf8_to_ucs4 (const char *str, long len, long *items_read, long *items_written, UError **err);
+cunichar2 *c_utf8_to_utf16 (const char *str, long len, long *items_read, long *items_written, UError **err);
+cunichar2 *eg_utf8_to_utf16_with_nuls (const char *str, long len, long *items_read, long *items_written, UError **err);
+char *c_utf16_to_utf8 (const cunichar2 *str, long len, long *items_read, long *items_written, UError **err);
+cunichar *c_utf16_to_ucs4 (const cunichar2 *str, long len, long *items_read, long *items_written, UError **err);
+char *c_ucs4_to_utf8 (const cunichar *str, long len, long *items_read, long *items_written, UError **err);
+cunichar2 *c_ucs4_to_utf16 (const cunichar *str, long len, long *items_read, long *items_written, UError **err);
+
+#define u8to16(str) c_utf8_to_utf16(str, (long)strlen(str), NULL, NULL, NULL)
+
+#ifdef C_OS_WIN32
+#define u16to8(str) c_utf16_to_utf8((cunichar2 *) (str), (long)wcslen((wchar_t *) (str)), NULL, NULL, NULL)
+#else
+#define u16to8(str) c_utf16_to_utf8(str, (long)strlen(str), NULL, NULL, NULL)
+#endif
+
+/*
+ * Path
+ */
+char *c_build_path (const char *separator, const char *first_element, ...);
+#define c_build_filename(x, ...) c_build_path(C_DIR_SEPARATOR_S, x, __VA_ARGS__)
+char *c_path_get_dirname (const char *filename);
+char *c_path_get_basename (const char *filename);
+char *c_find_program_in_path (const char *program);
+char *c_get_current_dir (void);
+cboolean c_path_is_absolute (const char *filename);
+
+const char *c_get_home_dir (void);
+const char *c_get_tmp_dir (void);
+const char *c_get_user_name (void);
+char *c_get_prgname (void);
+void c_set_prgname (const char *prgname);
+
+/*
+ * Shell
+ */
+
+UQuark c_shell_error_get_quark (void);
+
+#define C_SHELL_ERROR c_shell_error_get_quark ()
+
+typedef enum {
+ C_SHELL_ERROR_BAD_QUOTING,
+ C_SHELL_ERROR_EMPTY_STRING,
+ C_SHELL_ERROR_FAILED
+} UShellError;
+
+
+cboolean c_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError **error);
+char *c_shell_unquote (const char *quoted_string, UError **error);
+char *c_shell_quote (const char *unquoted_string);
+
+/*
+ * Spawn
+ */
+UQuark c_shell_error_get_quark (void);
+
+#define C_SPAWN_ERROR c_shell_error_get_quark ()
+
+typedef enum {
+ C_SPAWN_ERROR_FORK,
+ C_SPAWN_ERROR_READ,
+ C_SPAWN_ERROR_CHDIR,
+ C_SPAWN_ERROR_ACCES,
+ C_SPAWN_ERROR_PERM,
+ C_SPAWN_ERROR_TOO_BIG,
+ C_SPAWN_ERROR_NOEXEC,
+ C_SPAWN_ERROR_NAMETOOLONG,
+ C_SPAWN_ERROR_NOENT,
+ C_SPAWN_ERROR_NOMEM,
+ C_SPAWN_ERROR_NOTDIR,
+ C_SPAWN_ERROR_LOOP,
+ C_SPAWN_ERROR_TXTBUSY,
+ C_SPAWN_ERROR_IO,
+ C_SPAWN_ERROR_NFILE,
+ C_SPAWN_ERROR_MFILE,
+ C_SPAWN_ERROR_INVAL,
+ C_SPAWN_ERROR_ISDIR,
+ C_SPAWN_ERROR_LIBBAD,
+ C_SPAWN_ERROR_FAILED
+} USpawnError;
+
+typedef enum {
+ C_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1,
+ C_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
+ C_SPAWN_SEARCH_PATH = 1 << 2,
+ C_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
+ C_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
+ C_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
+ C_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
+} USpawnFlags;
+
+typedef void (*USpawnChildSetupFunc) (void * user_data);
+
+cboolean c_spawn_command_line_sync (const char *command_line, char **standard_output, char **standard_error, int *exit_status, UError **error);
+cboolean c_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 *c_timer_new (void);
+void c_timer_destroy (UTimer *timer);
+double c_timer_elapsed (UTimer *timer, unsigned long *microseconds);
+void c_timer_stop (UTimer *timer);
+void c_timer_start (UTimer *timer);
+
+/*
+ * Date and time
+ */
+typedef struct {
+ long tv_sec;
+ long tv_usec;
+} CTimeVal;
+
+void c_get_current_time (CTimeVal *result);
+void c_usleep (unsigned long microseconds);
+
+/*
+ * File
+ */
+
+UQuark c_file_error_quark (void);
+
+#define C_FILE_ERROR c_file_error_quark ()
+
+typedef enum {
+ C_FILE_ERROR_EXIST,
+ C_FILE_ERROR_ISDIR,
+ C_FILE_ERROR_ACCES,
+ C_FILE_ERROR_NAMETOOLONG,
+ C_FILE_ERROR_NOENT,
+ C_FILE_ERROR_NOTDIR,
+ C_FILE_ERROR_NXIO,
+ C_FILE_ERROR_NODEV,
+ C_FILE_ERROR_ROFS,
+ C_FILE_ERROR_TXTBSY,
+ C_FILE_ERROR_FAULT,
+ C_FILE_ERROR_LOOP,
+ C_FILE_ERROR_NOSPC,
+ C_FILE_ERROR_NOMEM,
+ C_FILE_ERROR_MFILE,
+ C_FILE_ERROR_NFILE,
+ C_FILE_ERROR_BADF,
+ C_FILE_ERROR_INVAL,
+ C_FILE_ERROR_PIPE,
+ C_FILE_ERROR_AGAIN,
+ C_FILE_ERROR_INTR,
+ C_FILE_ERROR_IO,
+ C_FILE_ERROR_PERM,
+ C_FILE_ERROR_NOSYS,
+ C_FILE_ERROR_FAILED
+} UFileError;
+
+typedef enum {
+ C_FILE_TEST_IS_REGULAR = 1 << 0,
+ C_FILE_TEST_IS_SYMLINK = 1 << 1,
+ C_FILE_TEST_IS_DIR = 1 << 2,
+ C_FILE_TEST_IS_EXECUTABLE = 1 << 3,
+ C_FILE_TEST_EXISTS = 1 << 4
+} UFileTest;
+
+
+cboolean c_file_set_contents (const char *filename, const char *contents, ussize length, UError **error);
+cboolean c_file_get_contents (const char *filename, char **contents, size_t *length, UError **error);
+UFileError c_file_error_from_errno (int err_no);
+int c_file_open_tmp (const char *tmpl, char **name_used, UError **error);
+cboolean c_file_test (const char *filename, UFileTest test);
+
+#define c_open open
+#define c_rename rename
+#define c_stat stat
+#define c_unlink unlink
+#define c_fopen fopen
+#define c_lstat lstat
+#define c_rmdir rmdir
+#define c_mkstemp mkstemp
+#define c_ascii_isdigit isdigit
+#define c_ascii_strtod strtod
+#define c_ascii_isalnum isalnum
+
+/*
+ * Pattern matching
+ */
+typedef struct _UPatternSpec UPatternSpec;
+UPatternSpec * c_pattern_spec_new (const char *pattern);
+void c_pattern_spec_free (UPatternSpec *pspec);
+cboolean c_pattern_match_string (UPatternSpec *pspec, const char *string);
+
+/*
+ * Directory
+ */
+typedef struct _UDir UDir;
+UDir *c_dir_open (const char *path, unsigned int flags, UError **error);
+const char *c_dir_read_name (UDir *dir);
+void c_dir_rewind (UDir *dir);
+void c_dir_close (UDir *dir);
+
+int c_mkdir_with_parents (const char *pathname, int mode);
+#define c_mkdir mkdir
+
+/*
+ * UMarkup
+ */
+
+UQuark c_markup_error_quark (void);
+
+#define C_MARKUP_ERROR c_markup_error_quark()
+
+typedef enum {
+ C_MARKUP_ERROR_BAD_UTF8,
+ C_MARKUP_ERROR_EMPTY,
+ C_MARKUP_ERROR_PARSE,
+ C_MARKUP_ERROR_UNKNOWN_ELEMENT,
+ C_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
+ C_MARKUP_ERROR_INVALID_CONTENT,
+ C_MARKUP_ERROR_MISSINC_ATTRIBUTE
+} UMarkupError;
+
+typedef struct _UMarkupParseContext UMarkupParseContext;
+
+typedef enum
+{
+ C_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1 << 0,
+ C_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 *c_markup_parse_context_new (const UMarkupParser *parser,
+ UMarkupParseFlags flags,
+ void * user_data,
+ CDestroyNotify user_data_dnotify);
+void c_markup_parse_context_free (UMarkupParseContext *context);
+cboolean c_markup_parse_context_parse (UMarkupParseContext *context,
+ const char *text, ussize text_len,
+ UError **error);
+cboolean c_markup_parse_context_end_parse (UMarkupParseContext *context,
+ UError **error);
+
+/*
+ * Character set conversion
+ */
+typedef struct _UIConv *UIConv;
+
+size_t c_iconv (UIConv cd, char **inbytes, size_t *inbytesleft, char **outbytes, size_t *outbytesleft);
+UIConv c_iconv_open (const char *to_charset, const char *from_charset);
+int c_iconv_close (UIConv cd);
+
+cboolean c_get_charset (C_CONST_RETURN char **charset);
+char *c_locale_to_utf8 (const char *opsysstring, ussize len,
+ size_t *bytes_read, size_t *bytes_written,
+ UError **error);
+char *c_locale_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read,
+ size_t *bytes_written, UError **error);
+char *c_filename_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read,
+ size_t *bytes_written, UError **error);
+char *c_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 c_utf8_jump_table[256];
+
+cboolean c_utf8_validate (const char *str, ussize max_len, const char **end);
+cunichar c_utf8_get_char_validated (const char *str, ussize max_len);
+char *c_utf8_find_prev_char (const char *str, const char *p);
+char *c_utf8_prev_char (const char *str);
+#define c_utf8_next_char(p) ((p) + c_utf8_jump_table[(unsigned char)(*p)])
+cunichar c_utf8_get_char (const char *src);
+long c_utf8_strlen (const char *str, ussize max);
+char *c_utf8_offset_to_pointer (const char *str, long offset);
+long c_utf8_pointer_to_offset (const char *str, const char *pos);
+
+/*
+ * priorities
+ */
+#define C_PRIORITY_DEFAULT 0
+#define C_PRIORITY_DEFAULT_IDLE 200
+
+/*
+ * Empty thread functions, not used by eglib
+ */
+#define c_thread_supported() TRUE
+#define c_thread_init(x) C_STMT_START { if (x != NULL) { c_error ("No vtable supported in c_thread_init"); } } C_STMT_END
+
+#define C_LOCK_DEFINE(name) int name;
+#define C_LOCK_DEFINE_STATIC(name) static int name;
+#define C_LOCK_EXTERN(name)
+#define C_LOCK(name)
+#define C_TRYLOCK(name)
+#define C_UNLOCK(name)
+
+
+#define _CLIB_MAJOR 2
+#define _CLIB_MIDDLE 4
+#define _CLIB_MINOR 0
+
+#define CLIB_CHECK_VERSION(a,b,c) ((a < _CLIB_MAJOR) || (a == _CLIB_MAJOR && (b < _CLIB_MIDDLE || (b == _CLIB_MIDDLE && c <= _CLIB_MINOR))))
+
+C_END_DECLS
+
+#endif
+
+
+
diff --git a/deps/ulib/src/ulist.c b/deps/clib/src/clist.c
index b470595e..614815ff 100644
--- a/deps/ulib/src/ulist.c
+++ b/deps/clib/src/clist.c
@@ -30,18 +30,18 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
-UList*
-u_list_alloc ()
+CList*
+c_list_alloc ()
{
- return u_new0 (UList, 1);
+ return c_new0 (CList, 1);
}
-static inline UList*
-new_node (UList *prev, void * data, UList *next)
+static inline CList*
+new_node (CList *prev, void * data, CList *next)
{
- UList *node = u_list_alloc ();
+ CList *node = c_list_alloc ();
node->data = data;
node->prev = prev;
node->next = next;
@@ -52,8 +52,8 @@ new_node (UList *prev, void * data, UList *next)
return node;
}
-static inline UList*
-disconnect_node (UList *node)
+static inline CList*
+disconnect_node (CList *node)
{
if (node->next)
node->next->prev = node->prev;
@@ -62,58 +62,58 @@ disconnect_node (UList *node)
return node;
}
-UList *
-u_list_prepend (UList *list, void * data)
+CList *
+c_list_prepend (CList *list, void * data)
{
return new_node (list ? list->prev : NULL, data, list);
}
void
-u_list_free_1 (UList *list)
+c_list_free_1 (CList *list)
{
- u_free (list);
+ c_free (list);
}
void
-u_list_free (UList *list)
+c_list_free (CList *list)
{
while (list){
- UList *next = list->next;
- u_list_free_1 (list);
+ CList *next = list->next;
+ c_list_free_1 (list);
list = next;
}
}
void
-u_list_free_full (UList *list, UDestroyNotify free_func)
+c_list_free_full (CList *list, CDestroyNotify free_func)
{
while (list){
- UList *next = list->next;
+ CList *next = list->next;
free_func (list->data);
- u_list_free_1 (list);
+ c_list_free_1 (list);
list = next;
}
}
-UList*
-u_list_append (UList *list, void * data)
+CList*
+c_list_append (CList *list, void * data)
{
- UList *node = new_node (u_list_last (list), data, NULL);
+ CList *node = new_node (c_list_last (list), data, NULL);
return list ? list : node;
}
-UList *
-u_list_concat (UList *list1, UList *list2)
+CList *
+c_list_concat (CList *list1, CList *list2)
{
if (list1 && list2) {
- list2->prev = u_list_last (list1);
+ list2->prev = c_list_last (list1);
list2->prev->next = list2;
}
return list1 ? list1 : list2;
}
unsigned int
-u_list_length (UList *list)
+c_list_length (CList *list)
{
unsigned int length = 0;
@@ -125,24 +125,24 @@ u_list_length (UList *list)
return length;
}
-UList*
-u_list_remove (UList *list, const void * data)
+CList*
+c_list_remove (CList *list, const void * data)
{
- UList *current = u_list_find (list, data);
+ CList *current = c_list_find (list, data);
if (!current)
return list;
if (current == list)
list = list->next;
- u_list_free_1 (disconnect_node (current));
+ c_list_free_1 (disconnect_node (current));
return list;
}
-UList*
-u_list_remove_all (UList *list, const void * data)
+CList*
+c_list_remove_all (CList *list, const void * data)
{
- UList *current = u_list_find (list, data);
+ CList *current = c_list_find (list, data);
if (!current)
return list;
@@ -150,16 +150,16 @@ u_list_remove_all (UList *list, const void * data)
while (current) {
if (current == list)
list = list->next;
- u_list_free_1 (disconnect_node (current));
+ c_list_free_1 (disconnect_node (current));
- current = u_list_find (list, data);
+ current = c_list_find (list, data);
}
return list;
}
-UList*
-u_list_remove_link (UList *list, UList *link)
+CList*
+c_list_remove_link (CList *list, CList *link)
{
if (list == link)
list = list->next;
@@ -171,17 +171,17 @@ u_list_remove_link (UList *list, UList *link)
return list;
}
-UList*
-u_list_delete_link (UList *list, UList *link)
+CList*
+c_list_delete_link (CList *list, CList *link)
{
- list = u_list_remove_link (list, link);
- u_list_free_1 (link);
+ list = c_list_remove_link (list, link);
+ c_list_free_1 (link);
return list;
}
-UList*
-u_list_find (UList *list, const void * data)
+CList*
+c_list_find (CList *list, const void * data)
{
while (list){
if (list->data == data)
@@ -193,8 +193,8 @@ u_list_find (UList *list, const void * data)
return NULL;
}
-UList*
-u_list_find_custom (UList *list, const void * data, UCompareFunc func)
+CList*
+c_list_find_custom (CList *list, const void * data, CCompareFunc func)
{
if (!func)
return NULL;
@@ -209,10 +209,10 @@ u_list_find_custom (UList *list, const void * data, UCompareFunc func)
return NULL;
}
-UList*
-u_list_reverse (UList *list)
+CList*
+c_list_reverse (CList *list)
{
- UList *reverse = NULL;
+ CList *reverse = NULL;
while (list) {
reverse = list;
@@ -225,8 +225,8 @@ u_list_reverse (UList *list)
return reverse;
}
-UList*
-u_list_first (UList *list)
+CList*
+c_list_first (CList *list)
{
if (!list)
return NULL;
@@ -237,8 +237,8 @@ u_list_first (UList *list)
return list;
}
-UList*
-u_list_last (UList *list)
+CList*
+c_list_last (CList *list)
{
if (!list)
return NULL;
@@ -249,12 +249,12 @@ u_list_last (UList *list)
return list;
}
-UList*
-u_list_insert_sorted (UList *list, void * data, UCompareFunc func)
+CList*
+c_list_insert_sorted (CList *list, void * data, CCompareFunc func)
{
- UList *prev = NULL;
- UList *current;
- UList *node;
+ CList *prev = NULL;
+ CList *current;
+ CList *node;
if (!func)
return list;
@@ -270,18 +270,18 @@ u_list_insert_sorted (UList *list, void * data, UCompareFunc func)
return list == current ? node : list;
}
-UList*
-u_list_insert_before (UList *list, UList *sibling, void * data)
+CList*
+c_list_insert_before (CList *list, CList *sibling, void * data)
{
if (sibling) {
- UList *node = new_node (sibling->prev, data, sibling);
+ CList *node = new_node (sibling->prev, data, sibling);
return list == sibling ? node : list;
}
- return u_list_append (list, data);
+ return c_list_append (list, data);
}
void
-u_list_foreach (UList *list, UFunc func, void * user_data)
+c_list_foreach (CList *list, CFunc func, void * user_data)
{
while (list){
(*func) (list->data, user_data);
@@ -290,7 +290,7 @@ u_list_foreach (UList *list, UFunc func, void * user_data)
}
int
-u_list_index (UList *list, const void * data)
+c_list_index (CList *list, const void * data)
{
int index = 0;
@@ -305,8 +305,8 @@ u_list_index (UList *list, const void * data)
return -1;
}
-UList*
-u_list_nth (UList *list, unsigned int n)
+CList*
+c_list_nth (CList *list, unsigned int n)
{
for (; list; list = list->next) {
if (n == 0)
@@ -317,19 +317,19 @@ u_list_nth (UList *list, unsigned int n)
}
void *
-u_list_nth_data (UList *list, unsigned int n)
+c_list_nth_data (CList *list, unsigned int n)
{
- UList *node = u_list_nth (list, n);
+ CList *node = c_list_nth (list, n);
return node ? node->data : NULL;
}
-UList*
-u_list_copy (UList *list)
+CList*
+c_list_copy (CList *list)
{
- UList *copy = NULL;
+ CList *copy = NULL;
if (list) {
- UList *tmp = new_node (NULL, list->data, NULL);
+ CList *tmp = new_node (NULL, list->data, NULL);
copy = tmp;
for (list = list->next; list; list = list->next)
@@ -339,13 +339,13 @@ u_list_copy (UList *list)
return copy;
}
-typedef UList list_node;
+typedef CList list_node;
#include "sort.frag.h"
-UList*
-u_list_sort (UList *list, UCompareFunc func)
+CList*
+c_list_sort (CList *list, CCompareFunc func)
{
- UList *current;
+ CList *current;
if (!list || !list->next)
return list;
list = do_sort (list, func);
diff --git a/deps/ulib/src/umem.c b/deps/clib/src/cmem.c
index 763d0594..57a12678 100644
--- a/deps/ulib/src/umem.c
+++ b/deps/clib/src/cmem.c
@@ -30,45 +30,45 @@
#include <stdio.h>
#include <string.h>
-#include <ulib.h>
+#include <clib.h>
void
-u_free (void *ptr)
+c_free (void *ptr)
{
if (ptr != NULL)
free (ptr);
}
void *
-u_memdup (const void * mem, unsigned int byte_size)
+c_memdup (const void * mem, unsigned int byte_size)
{
void * ptr;
if (mem == NULL)
return NULL;
- ptr = u_malloc (byte_size);
+ ptr = c_malloc (byte_size);
if (ptr != NULL)
memcpy (ptr, mem, byte_size);
return ptr;
}
-void * u_realloc (void * obj, size_t size)
+void * c_realloc (void * obj, size_t size)
{
void * ptr;
if (!size) {
- u_free (obj);
+ c_free (obj);
return 0;
}
ptr = realloc (obj, size);
if (ptr)
return ptr;
- u_error ("Could not allocate %i bytes", size);
+ c_error ("Could not allocate %i bytes", size);
}
void *
-u_malloc (size_t x)
+c_malloc (size_t x)
{
void * ptr;
if (!x)
@@ -76,10 +76,10 @@ u_malloc (size_t x)
ptr = malloc (x);
if (ptr)
return ptr;
- u_error ("Could not allocate %i bytes", x);
+ c_error ("Could not allocate %i bytes", x);
}
-void * u_malloc0 (size_t x)
+void * c_malloc0 (size_t x)
{
void * ptr;
if (!x)
@@ -87,10 +87,10 @@ void * u_malloc0 (size_t x)
ptr = calloc(1,x);
if (ptr)
return ptr;
- u_error ("Could not allocate %i bytes", x);
+ c_error ("Could not allocate %i bytes", x);
}
-void * u_try_malloc (size_t x)
+void * c_try_malloc (size_t x)
{
if (x)
return malloc (x);
@@ -98,10 +98,10 @@ void * u_try_malloc (size_t x)
}
-void * u_try_realloc (void * obj, size_t size)
+void * c_try_realloc (void * obj, size_t size)
{
if (!size) {
- u_free (obj);
+ c_free (obj);
return 0;
}
return realloc (obj, size);
diff --git a/deps/ulib/src/umisc-unix.c b/deps/clib/src/cmisc-unix.c
index e8a34220..afa33e0f 100644
--- a/deps/ulib/src/umisc-unix.c
+++ b/deps/clib/src/cmisc-unix.c
@@ -28,7 +28,7 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
#include <pthread.h>
#ifdef HAVE_PWD_H
@@ -41,33 +41,33 @@
const char *
-u_getenv(const char *variable)
+c_getenv(const char *variable)
{
return getenv(variable);
}
-uboolean
-u_setenv(const char *variable, const char *value, uboolean overwrite)
+cboolean
+c_setenv(const char *variable, const char *value, cboolean overwrite)
{
return setenv(variable, value, overwrite) == 0;
}
void
-u_unsetenv(const char *variable)
+c_unsetenv(const char *variable)
{
unsetenv(variable);
}
char*
-u_win32_getlocale(void)
+c_win32_getlocale(void)
{
return NULL;
}
-uboolean
-u_path_is_absolute (const char *filename)
+cboolean
+c_path_is_absolute (const char *filename)
{
- u_return_val_if_fail (filename != NULL, FALSE);
+ c_return_val_if_fail (filename != NULL, FALSE);
return (*filename == '/');
}
@@ -95,15 +95,15 @@ get_pw_data (void)
}
#ifdef HAVE_UETPWUID_R
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
- home_dir = u_strdup (pw.pw_dir);
- user_name = u_strdup (pw.pw_name);
+ home_dir = c_strdup (pw.pw_dir);
+ user_name = c_strdup (pw.pw_name);
}
#endif
if (home_dir == NULL)
- home_dir = u_getenv ("HOME");
+ home_dir = c_getenv ("HOME");
if (user_name == NULL) {
- user_name = u_getenv ("USER");
+ user_name = c_getenv ("USER");
if (user_name == NULL)
user_name = "somebody";
}
@@ -112,14 +112,14 @@ get_pw_data (void)
/* Uive preference to /etc/passwd than HOME */
const char *
-u_get_home_dir (void)
+c_get_home_dir (void)
{
get_pw_data ();
return home_dir;
}
const char *
-u_get_user_name (void)
+c_get_user_name (void)
{
get_pw_data ();
return user_name;
@@ -130,16 +130,16 @@ static const char *tmp_dir;
static pthread_mutex_t tmp_lock = PTHREAD_MUTEX_INITIALIZER;
const char *
-u_get_tmp_dir (void)
+c_get_tmp_dir (void)
{
if (tmp_dir == NULL){
pthread_mutex_lock (&tmp_lock);
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TMPDIR");
+ tmp_dir = c_getenv ("TMPDIR");
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TMP");
+ tmp_dir = c_getenv ("TMP");
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TEMP");
+ tmp_dir = c_getenv ("TEMP");
if (tmp_dir == NULL)
tmp_dir = "/tmp";
}
diff --git a/deps/ulib/src/umisc-win32.c b/deps/clib/src/cmisc-win32.c
index a1b218b9..2ef8aa54 100644
--- a/deps/ulib/src/umisc-win32.c
+++ b/deps/clib/src/cmisc-win32.c
@@ -30,65 +30,65 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
#include <windows.h>
#include <direct.h>
#include <io.h>
const char *
-u_getenv(const char *variable)
+c_getenv(const char *variable)
{
- uunichar2 *var, *buffer;
+ cunichar2 *var, *buffer;
char* val = NULL;
int32_tbuffer_size = 1024;
int32_tretval;
var = u8to16(variable);
- buffer = u_malloc(buffer_size*sizeof(uunichar2));
+ buffer = c_malloc(buffer_size*sizeof(cunichar2));
retval = UetEnvironmentVariableW (var, buffer, buffer_size);
if (retval != 0) {
if (retval > buffer_size) {
- u_free (buffer);
+ c_free (buffer);
buffer_size = retval;
- buffer = u_malloc(buffer_size*sizeof(uunichar2));
+ buffer = c_malloc(buffer_size*sizeof(cunichar2));
retval = UetEnvironmentVariableW (var, buffer, buffer_size);
}
val = u16to8 (buffer);
} else {
if (UetLastError () != ERROR_ENVVAR_NOT_FOUND){
- val = u_malloc (1);
+ val = c_malloc (1);
*val = 0;
}
}
- u_free(var);
- u_free(buffer);
+ c_free(var);
+ c_free(buffer);
return val;
}
-uboolean
-u_setenv(const char *variable, const char *value, uboolean overwrite)
+cboolean
+c_setenv(const char *variable, const char *value, cboolean overwrite)
{
- uunichar2 *var, *val;
- uboolean result;
+ cunichar2 *var, *val;
+ cboolean result;
var = u8to16(variable);
val = u8to16(value);
result = (SetEnvironmentVariableW(var, val) != 0) ? TRUE : FALSE;
- u_free(var);
- u_free(val);
+ c_free(var);
+ c_free(val);
return result;
}
void
-u_unsetenv(const char *variable)
+c_unsetenv(const char *variable)
{
- uunichar2 *var;
+ cunichar2 *var;
var = u8to16(variable);
SetEnvironmentVariableW(var, L"");
- u_free(var);
+ c_free(var);
}
char*
-u_win32_getlocale(void)
+c_win32_getlocale(void)
{
LCID lcid = UetThreadLocale();
char buf[19];
@@ -98,10 +98,10 @@ u_win32_getlocale(void)
return strdup(buf);
}
-uboolean
-u_path_is_absolute (const char *filename)
+cboolean
+c_path_is_absolute (const char *filename)
{
- u_return_val_if_fail (filename != NULL, FALSE);
+ c_return_val_if_fail (filename != NULL, FALSE);
if (filename[0] != '\0' && filename[1] != '\0') {
if (filename[1] == ':' && filename[2] != '\0' &&
@@ -117,15 +117,15 @@ u_path_is_absolute (const char *filename)
}
const char *
-u_get_home_dir (void)
+c_get_home_dir (void)
{
/* FIXME */
- const char *drive = u_getenv ("HOMEDRIVE");
- const char *path = u_getenv ("HOMEPATH");
+ const char *drive = c_getenv ("HOMEDRIVE");
+ const char *path = c_getenv ("HOMEPATH");
char *home_dir = NULL;
if (drive && path) {
- home_dir = u_malloc(strlen(drive) + strlen(path) +1);
+ home_dir = c_malloc(strlen(drive) + strlen(path) +1);
if (home_dir) {
sprintf(home_dir, "%s%s", drive, path);
}
@@ -135,26 +135,26 @@ u_get_home_dir (void)
}
const char *
-u_get_user_name (void)
+c_get_user_name (void)
{
- const char * retName = u_getenv ("USER");
+ const char * retName = c_getenv ("USER");
if (!retName)
- retName = u_getenv ("USERNAME");
+ retName = c_getenv ("USERNAME");
return retName;
}
static const char *tmp_dir;
const char *
-u_get_tmp_dir (void)
+c_get_tmp_dir (void)
{
if (tmp_dir == NULL){
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TMPDIR");
+ tmp_dir = c_getenv ("TMPDIR");
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TMP");
+ tmp_dir = c_getenv ("TMP");
if (tmp_dir == NULL){
- tmp_dir = u_getenv ("TEMP");
+ tmp_dir = c_getenv ("TEMP");
if (tmp_dir == NULL)
tmp_dir = "C:\\temp";
}
diff --git a/deps/ulib/src/umodule-unix.c b/deps/clib/src/cmodule-unix.c
index 07baef46..9341d929 100644
--- a/deps/ulib/src/umodule-unix.c
+++ b/deps/clib/src/cmodule-unix.c
@@ -30,10 +30,10 @@
*/
#include <config.h>
-#include <ulib.h>
-#include <umodule.h>
+#include <clib.h>
+#include <cmodule.h>
-#if defined(U_OS_UNIX) && defined(HAVE_DLFCN_H)
+#if defined(C_OS_UNIX) && defined(HAVE_DLFCN_H)
#include <dlfcn.h>
/* For Linux and Solaris, need to add others as we port this */
@@ -45,30 +45,30 @@ struct _UModule {
};
UModule *
-u_module_open (const char *file, UModuleFlags flags)
+c_module_open (const char *file, UModuleFlags flags)
{
int f = 0;
UModule *module;
void *handle;
- flags &= U_MODULE_BIND_MASK;
- if ((flags & U_MODULE_BIND_LAZY) != 0)
+ flags &= C_MODULE_BIND_MASK;
+ if ((flags & C_MODULE_BIND_LAZY) != 0)
f |= RTLD_LAZY;
- if ((flags & U_MODULE_BIND_LOCAL) != 0)
+ if ((flags & C_MODULE_BIND_LOCAL) != 0)
f |= RTLD_LOCAL;
handle = dlopen (file, f);
if (handle == NULL)
return NULL;
- module = u_new (UModule,1);
+ module = c_new (UModule,1);
module->handle = handle;
return module;
}
-uboolean
-u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
+cboolean
+c_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
{
if (symbol_name == NULL || symbol == NULL)
return FALSE;
@@ -81,13 +81,13 @@ u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
}
const char *
-u_module_error (void)
+c_module_error (void)
{
return dlerror ();
}
-uboolean
-u_module_close (UModule *module)
+cboolean
+c_module_close (UModule *module)
{
void *handle;
if (module == NULL || module->handle == NULL)
@@ -95,11 +95,11 @@ u_module_close (UModule *module)
handle = module->handle;
module->handle = NULL;
- u_free (module);
+ c_free (module);
return (0 == dlclose (handle));
}
-#elif defined (U_OS_WIN32)
+#elif defined (C_OS_WIN32)
#include <windows.h>
#include <psapi.h>
@@ -112,21 +112,21 @@ struct _UModule {
};
UModule *
-u_module_open (const char *file, UModuleFlags flags)
+c_module_open (const char *file, UModuleFlags flags)
{
UModule *module;
- module = u_malloc (sizeof (UModule));
+ module = c_malloc (sizeof (UModule));
if (module == NULL)
return NULL;
if (file != NULL) {
- uunichar2 *file16;
+ cunichar2 *file16;
file16 = u8to16(file);
module->main_module = FALSE;
module->handle = LoadLibrary (file16);
- u_free(file16);
+ c_free(file16);
if (!module->handle) {
- u_free (module);
+ c_free (module);
return NULL;
}
@@ -145,30 +145,30 @@ w32_find_symbol (const char *symbol_name)
DWORD buffer_size = sizeof (HMODULE) * 1024;
DWORD needed, i;
- modules = (HMODULE *) u_malloc (buffer_size);
+ modules = (HMODULE *) c_malloc (buffer_size);
if (modules == NULL)
return NULL;
if (!EnumProcessModules (UetCurrentProcess (), modules,
buffer_size, &needed)) {
- u_free (modules);
+ c_free (modules);
return NULL;
}
/* check whether the supplied buffer was too small, realloc, retry */
if (needed > buffer_size) {
- u_free (modules);
+ c_free (modules);
buffer_size = needed;
- modules = (HMODULE *) u_malloc (buffer_size);
+ modules = (HMODULE *) c_malloc (buffer_size);
if (modules == NULL)
return NULL;
if (!EnumProcessModules (UetCurrentProcess (), modules,
buffer_size, &needed)) {
- u_free (modules);
+ c_free (modules);
return NULL;
}
}
@@ -176,17 +176,17 @@ w32_find_symbol (const char *symbol_name)
for (i = 0; i < needed / sizeof (HANDLE); i++) {
void * proc = (void *)(intptr_t)UetProcAddress (modules [i], symbol_name);
if (proc != NULL) {
- u_free (modules);
+ c_free (modules);
return proc;
}
}
- u_free (modules);
+ c_free (modules);
return NULL;
}
-uboolean
-u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
+cboolean
+c_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
{
if (module == NULL || symbol_name == NULL || symbol == NULL)
return FALSE;
@@ -205,14 +205,14 @@ u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
}
const char *
-u_module_error (void)
+c_module_error (void)
{
char* ret = NULL;
TCHAR* buf = NULL;
DWORD code = UetLastError ();
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
- code, MAKELANGID(LANU_NEUTRAL, SUBLANU_DEFAULT), buf, 0, NULL);
+ code, MAKELANGID(LANC_NEUTRAL, SUBLANC_DEFAULT), buf, 0, NULL);
ret = u16to8 (buf);
LocalFree(buf);
@@ -220,8 +220,8 @@ u_module_error (void)
return ret;
}
-uboolean
-u_module_close (UModule *module)
+cboolean
+c_module_close (UModule *module)
{
HMODULE handle;
int main_module;
@@ -232,7 +232,7 @@ u_module_close (UModule *module)
handle = module->handle;
main_module = module->main_module;
module->handle = NULL;
- u_free (module);
+ c_free (module);
return (main_module ? 1 : (0 == FreeLibrary (handle)));
}
@@ -242,36 +242,36 @@ u_module_close (UModule *module)
#define LIBPREFIX ""
UModule *
-u_module_open (const char *file, UModuleFlags flags)
+c_module_open (const char *file, UModuleFlags flags)
{
- u_error ("%s", "u_module_open not implemented on this platform");
+ c_error ("%s", "c_module_open not implemented on this platform");
return NULL;
}
-uboolean
-u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
+cboolean
+c_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
{
- u_error ("%s", "u_module_open not implemented on this platform");
+ c_error ("%s", "c_module_open not implemented on this platform");
return FALSE;
}
const char *
-u_module_error (void)
+c_module_error (void)
{
- u_error ("%s", "u_module_open not implemented on this platform");
+ c_error ("%s", "c_module_open not implemented on this platform");
return NULL;
}
-uboolean
-u_module_close (UModule *module)
+cboolean
+c_module_close (UModule *module)
{
- u_error ("%s", "u_module_open not implemented on this platform");
+ c_error ("%s", "c_module_open not implemented on this platform");
return FALSE;
}
#endif
char *
-u_module_build_path (const char *directory, const char *module_name)
+c_module_build_path (const char *directory, const char *module_name)
{
char *lib_prefix = "";
@@ -283,8 +283,8 @@ u_module_build_path (const char *directory, const char *module_name)
if (directory && *directory){
- return u_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ return c_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
}
- return u_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+ return c_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
}
diff --git a/deps/ulib/src/umodule-win32.c b/deps/clib/src/cmodule-win32.c
index f3a05a1b..afb60064 100644
--- a/deps/ulib/src/umodule-win32.c
+++ b/deps/clib/src/cmodule-win32.c
@@ -31,7 +31,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <gmodule.h>
#include <windows.h>
#include <psapi.h>
@@ -45,21 +45,21 @@ struct _UModule {
};
UModule *
-u_module_open (const char *file, UModuleFlags flags)
+c_module_open (const char *file, UModuleFlags flags)
{
UModule *module;
- module = u_malloc (sizeof (UModule));
+ module = c_malloc (sizeof (UModule));
if (module == NULL)
return NULL;
if (file != NULL) {
- uunichar2 *file16;
+ cunichar2 *file16;
file16 = u8to16(file);
module->main_module = FALSE;
module->handle = LoadLibraryW (file16);
- u_free(file16);
+ c_free(file16);
if (!module->handle) {
- u_free (module);
+ c_free (module);
return NULL;
}
@@ -78,30 +78,30 @@ w32_find_symbol (const char *symbol_name)
DWORD buffer_size = sizeof (HMODULE) * 1024;
DWORD needed, i;
- modules = (HMODULE *) u_malloc (buffer_size);
+ modules = (HMODULE *) c_malloc (buffer_size);
if (modules == NULL)
return NULL;
if (!EnumProcessModules (UetCurrentProcess (), modules,
buffer_size, &needed)) {
- u_free (modules);
+ c_free (modules);
return NULL;
}
/* check whether the supplied buffer was too small, realloc, retry */
if (needed > buffer_size) {
- u_free (modules);
+ c_free (modules);
buffer_size = needed;
- modules = (HMODULE *) u_malloc (buffer_size);
+ modules = (HMODULE *) c_malloc (buffer_size);
if (modules == NULL)
return NULL;
if (!EnumProcessModules (UetCurrentProcess (), modules,
buffer_size, &needed)) {
- u_free (modules);
+ c_free (modules);
return NULL;
}
}
@@ -109,17 +109,17 @@ w32_find_symbol (const char *symbol_name)
for (i = 0; i < needed / sizeof (HANDLE); i++) {
void * proc = (void *)(intptr_t)UetProcAddress (modules [i], symbol_name);
if (proc != NULL) {
- u_free (modules);
+ c_free (modules);
return proc;
}
}
- u_free (modules);
+ c_free (modules);
return NULL;
}
-uboolean
-u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
+cboolean
+c_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
{
if (module == NULL || symbol_name == NULL || symbol == NULL)
return FALSE;
@@ -138,7 +138,7 @@ u_module_symbol (UModule *module, const char *symbol_name, void * *symbol)
}
const char *
-u_module_error (void)
+c_module_error (void)
{
char* ret = NULL;
TCHAR* buf = NULL;
@@ -146,7 +146,7 @@ u_module_error (void)
/* FIXME: buf must not be NULL! */
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
- code, MAKELANGID(LANU_NEUTRAL, SUBLANU_DEFAULT), buf, 0, NULL);
+ code, MAKELANGID(LANC_NEUTRAL, SUBLANC_DEFAULT), buf, 0, NULL);
ret = u16to8 (buf);
LocalFree(buf);
@@ -154,8 +154,8 @@ u_module_error (void)
return ret;
}
-uboolean
-u_module_close (UModule *module)
+cboolean
+c_module_close (UModule *module)
{
HMODULE handle;
int main_module;
@@ -166,12 +166,12 @@ u_module_close (UModule *module)
handle = module->handle;
main_module = module->main_module;
module->handle = NULL;
- u_free (module);
+ c_free (module);
return (main_module ? 1 : (0 == FreeLibrary (handle)));
}
char *
-u_module_build_path (const char *directory, const char *module_name)
+c_module_build_path (const char *directory, const char *module_name)
{
char *lib_prefix = "";
@@ -183,7 +183,7 @@ u_module_build_path (const char *directory, const char *module_name)
if (directory && *directory){
- return u_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
+ return c_strdup_printf ("%s/%s%s" LIBSUFFIX, directory, lib_prefix, module_name);
}
- return u_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
+ return c_strdup_printf ("%s%s" LIBSUFFIX, lib_prefix, module_name);
}
diff --git a/deps/clib/src/cmodule.h b/deps/clib/src/cmodule.h
new file mode 100644
index 00000000..66b6c232
--- /dev/null
+++ b/deps/clib/src/cmodule.h
@@ -0,0 +1,37 @@
+#ifndef __CLIB_UMODULE_H
+#define __CLIB_UMODULE_H
+
+#include <clib.h>
+
+#define C_MODULE_IMPORT extern
+#ifdef C_OS_WIN32
+#define C_MODULE_EXPORT __declspec(dllexport)
+#else
+#define C_MODULE_EXPORT
+#endif
+
+C_BEGIN_DECLS
+
+/*
+ * Modules
+ */
+typedef enum {
+ C_MODULE_BIND_LAZY = 0x01,
+ C_MODULE_BIND_LOCAL = 0x02,
+ C_MODULE_BIND_MASK = 0x03
+} UModuleFlags;
+typedef struct _UModule UModule;
+
+UModule *c_module_open (const char *file, UModuleFlags flags);
+cboolean c_module_symbol (UModule *module, const char *symbol_name,
+ void * *symbol);
+const char *c_module_error (void);
+cboolean c_module_close (UModule *module);
+char * c_module_build_path (const char *directory, const char *module_name);
+
+extern char *gmodule_libprefix;
+extern char *gmodule_libsuffix;
+
+C_END_DECLS
+
+#endif
diff --git a/deps/ulib/src/uoutput.c b/deps/clib/src/coutput.c
index 20d2abde..61389cf6 100644
--- a/deps/ulib/src/uoutput.c
+++ b/deps/clib/src/coutput.c
@@ -29,25 +29,25 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
/* The current fatal levels, error is always fatal */
-static ULogLevelFlags fatal = U_LOG_LEVEL_ERROR;
+static CLogLevelFlags fatal = C_LOG_LEVEL_ERROR;
#if PLATFORM_ANDROID
#include <android/log.h>
static android_LogPriority
-to_android_priority (ULogLevelFlags log_level)
+to_android_priority (CLogLevelFlags log_level)
{
- switch (log_level & U_LOG_LEVEL_MASK)
+ switch (log_level & C_LOG_LEVEL_MASK)
{
- 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;
+ case C_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
+ case C_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
+ case C_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
+ case C_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
+ case C_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
+ case C_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
}
return ANDROID_LOG_UNKNOWN;
}
@@ -62,16 +62,16 @@ out_vfprintf (FILE *ignore, const char *format, va_list args)
#include <asl.h>
static int
-to_asl_priority (ULogLevelFlags log_level)
+to_asl_priority (CLogLevelFlags log_level)
{
- switch (log_level & U_LOG_LEVEL_MASK)
+ switch (log_level & C_LOG_LEVEL_MASK)
{
- 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;
+ case C_LOG_LEVEL_ERROR: return ASL_LEVEL_CRIT;
+ case C_LOG_LEVEL_CRITICAL: return ASL_LEVEL_ERR;
+ case C_LOG_LEVEL_WARNING: return ASL_LEVEL_WARNING;
+ case C_LOG_LEVEL_MESSAGE: return ASL_LEVEL_NOTICE;
+ case C_LOG_LEVEL_INFO: return ASL_LEVEL_INFO;
+ case C_LOG_LEVEL_DEBUG: return ASL_LEVEL_DEBUG;
}
return ASL_LEVEL_ERR;
}
@@ -91,7 +91,7 @@ out_vfprintf (FILE *file, const char *format, va_list args)
#endif
void
-u_print (const char *format, ...)
+c_print (const char *format, ...)
{
va_list args;
@@ -103,7 +103,7 @@ u_print (const char *format, ...)
}
void
-u_printerr (const char *format, ...)
+c_printerr (const char *format, ...)
{
va_list args;
@@ -114,29 +114,29 @@ u_printerr (const char *format, ...)
va_end (args);
}
-ULogLevelFlags
-u_log_set_always_fatal (ULogLevelFlags fatal_mask)
+CLogLevelFlags
+c_log_set_always_fatal (CLogLevelFlags fatal_mask)
{
- ULogLevelFlags old_fatal = fatal;
+ CLogLevelFlags old_fatal = fatal;
fatal |= fatal_mask;
return old_fatal;
}
-ULogLevelFlags
-u_log_set_fatal_mask (const char *log_domain, ULogLevelFlags fatal_mask)
+CLogLevelFlags
+c_log_set_fatal_mask (const char *log_domain, CLogLevelFlags fatal_mask)
{
/*
- * 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
+ * Mono does not use a C_LOG_DOMAIN currently, so we just assume things are fatal
+ * if we decide to set C_LOG_DOMAIN (we probably should) we should implement
* this.
*/
return fatal_mask;
}
void
-u_logv (const char *log_domain, ULogLevelFlags log_level, const char *format, va_list args)
+c_logv (const char *log_domain, CLogLevelFlags 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 @@ u_logv (const char *log_domain, ULogLevelFlags log_level, const char *format, va
if (vasprintf (&msg, format, args) < 0)
return;
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
printf ("%s%s%s\n",
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
@@ -177,22 +177,22 @@ u_logv (const char *log_domain, ULogLevelFlags log_level, const char *format, va
}
void
-u_log (const char *log_domain, ULogLevelFlags log_level, const char *format, ...)
+c_log (const char *log_domain, CLogLevelFlags log_level, const char *format, ...)
{
va_list args;
va_start (args, format);
- u_logv (log_domain, log_level, format, args);
+ c_logv (log_domain, log_level, format, args);
va_end (args);
}
void
-u_assertion_message (const char *format, ...)
+c_assertion_message (const char *format, ...)
{
va_list args;
va_start (args, format);
- u_logv (U_LOG_DOMAIN, U_LOG_LEVEL_ERROR, format, args);
+ c_logv (C_LOG_DOMAIN, C_LOG_LEVEL_ERROR, format, args);
va_end (args);
abort ();
}
diff --git a/deps/ulib/src/upath.c b/deps/clib/src/cpath.c
index e8177947..09dc93aa 100644
--- a/deps/ulib/src/upath.c
+++ b/deps/clib/src/cpath.c
@@ -27,10 +27,10 @@
*/
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
#include <errno.h>
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
#include <direct.h>
#endif
@@ -39,17 +39,17 @@
#endif
char *
-u_build_path (const char *separator, const char *first_element, ...)
+c_build_path (const char *separator, const char *first_element, ...)
{
const char *elem, *next, *endptr;
- uboolean trimmed;
- UString *path;
+ cboolean trimmed;
+ CString *path;
va_list args;
size_t slen;
- u_return_val_if_fail (separator != NULL, NULL);
+ c_return_val_if_fail (separator != NULL, NULL);
- path = u_string_sized_new (48);
+ path = c_string_sized_new (48);
slen = strlen (separator);
va_start (args, first_element);
@@ -68,7 +68,7 @@ u_build_path (const char *separator, const char *first_element, ...)
/* append elem, not including any trailing separators */
if (endptr > elem)
- u_string_append_len (path, elem, endptr - elem);
+ c_string_append_len (path, elem, endptr - elem);
/* get the next element */
do {
@@ -81,23 +81,23 @@ u_build_path (const char *separator, const char *first_element, ...)
} while (*next == '\0');
if (next || trimmed)
- u_string_append_len (path, separator, slen);
+ c_string_append_len (path, separator, slen);
}
va_end (args);
- return u_string_free (path, FALSE);
+ return c_string_free (path, FALSE);
}
static char*
strrchr_seperator (const char* filename)
{
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
char *p2;
#endif
char *p;
- p = strrchr (filename, U_DIR_SEPARATOR);
-#ifdef U_OS_WIN32
+ p = strrchr (filename, C_DIR_SEPARATOR);
+#ifdef C_OS_WIN32
p2 = strrchr (filename, '/');
if (p2 > p)
p = p2;
@@ -107,19 +107,19 @@ strrchr_seperator (const char* filename)
}
char *
-u_path_get_dirname (const char *filename)
+c_path_get_dirname (const char *filename)
{
char *p, *r;
size_t count;
- u_return_val_if_fail (filename != NULL, NULL);
+ c_return_val_if_fail (filename != NULL, NULL);
p = strrchr_seperator (filename);
if (p == NULL)
- return u_strdup (".");
+ return c_strdup (".");
if (p == filename)
- return u_strdup ("/");
+ return c_strdup ("/");
count = p - filename;
- r = u_malloc (count + 1);
+ r = c_malloc (count + 1);
strncpy (r, filename, count);
r [count] = 0;
@@ -127,36 +127,36 @@ u_path_get_dirname (const char *filename)
}
char *
-u_path_get_basename (const char *filename)
+c_path_get_basename (const char *filename)
{
char *r;
- u_return_val_if_fail (filename != NULL, NULL);
+ c_return_val_if_fail (filename != NULL, NULL);
/* Empty filename -> . */
if (!*filename)
- return u_strdup (".");
+ return c_strdup (".");
/* No separator -> filename */
r = strrchr_seperator (filename);
if (r == NULL)
- return u_strdup (filename);
+ return c_strdup (filename);
/* Trailing slash, remove component */
if (r [1] == 0){
- char *copy = u_strdup (filename);
+ char *copy = c_strdup (filename);
copy [r-filename] = 0;
r = strrchr_seperator (copy);
if (r == NULL){
- u_free (copy);
- return u_strdup ("/");
+ c_free (copy);
+ return c_strdup ("/");
}
- r = u_strdup (&r[1]);
- u_free (copy);
+ r = c_strdup (&r[1]);
+ c_free (copy);
return r;
}
- return u_strdup (&r[1]);
+ return c_strdup (&r[1]);
}
#ifndef HAVE_STRTOK_R
@@ -214,83 +214,83 @@ cont:
#endif
char *
-u_find_program_in_path (const char *program)
+c_find_program_in_path (const char *program)
{
char *p;
char *x, *l;
char *curdir = NULL;
char *save = NULL;
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
char *program_exe;
char *suffix_list[5] = {".exe",".cmd",".bat",".com",NULL};
int listx;
- uboolean hasSuffix;
+ cboolean hasSuffix;
#endif
- u_return_val_if_fail (program != NULL, NULL);
- x = p = u_strdup (u_getenv ("PATH"));
+ c_return_val_if_fail (program != NULL, NULL);
+ x = p = c_strdup (c_getenv ("PATH"));
if (x == NULL || *x == '\0') {
- curdir = u_get_current_dir ();
+ curdir = c_get_current_dir ();
x = curdir;
}
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
/* see if program already has a suffix */
listx = 0;
hasSuffix = FALSE;
while (!hasSuffix && suffix_list[listx]) {
- hasSuffix = u_str_has_suffix(program,suffix_list[listx++]);
+ hasSuffix = c_str_has_suffix(program,suffix_list[listx++]);
}
#endif
- while ((l = strtok_r (x, U_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
+ while ((l = strtok_r (x, C_SEARCHPATH_SEPARATOR_S, &save)) != NULL){
char *probe_path;
x = NULL;
- probe_path = u_build_path (U_DIR_SEPARATOR_S, l, program, NULL);
+ probe_path = c_build_path (C_DIR_SEPARATOR_S, l, program, NULL);
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
- u_free (curdir);
- u_free (p);
+ c_free (curdir);
+ c_free (p);
return probe_path;
}
- u_free (probe_path);
+ c_free (probe_path);
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
/* check for program with a suffix attached */
if (!hasSuffix) {
listx = 0;
while (suffix_list[listx]) {
- program_exe = u_strjoin(NULL,program,suffix_list[listx],NULL);
- probe_path = u_build_path (U_DIR_SEPARATOR_S, l, program_exe, NULL);
+ program_exe = c_strjoin(NULL,program,suffix_list[listx],NULL);
+ probe_path = c_build_path (C_DIR_SEPARATOR_S, l, program_exe, NULL);
if (access (probe_path, X_OK) == 0){ /* FIXME: on windows this is just a read permissions test */
- u_free (curdir);
- u_free (p);
- u_free (program_exe);
+ c_free (curdir);
+ c_free (p);
+ c_free (program_exe);
return probe_path;
}
listx++;
- u_free (probe_path);
- u_free (program_exe);
+ c_free (probe_path);
+ c_free (program_exe);
}
}
#endif
}
- u_free (curdir);
- u_free (p);
+ c_free (curdir);
+ c_free (p);
return NULL;
}
static char *name;
void
-u_set_prgname (const char *prgname)
+c_set_prgname (const char *prgname)
{
- name = u_strdup (prgname);
+ name = c_strdup (prgname);
}
char *
-u_get_prgname (void)
+c_get_prgname (void)
{
return name;
}
diff --git a/deps/ulib/src/uptrarray.c b/deps/clib/src/cptrarray.c
index 81d2b76f..75f89a5f 100644
--- a/deps/ulib/src/uptrarray.c
+++ b/deps/clib/src/cptrarray.c
@@ -32,21 +32,21 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.h>
typedef struct _UPtrArrayPriv {
void * *pdata;
unsigned int len;
unsigned int size;
- UDestroyNotify element_free_func;
+ CDestroyNotify element_free_func;
} UPtrArrayPriv;
static void
-u_ptr_array_grow(UPtrArrayPriv *array, unsigned int length)
+c_ptr_array_grow(UPtrArrayPriv *array, unsigned int length)
{
unsigned int new_length = array->len + length;
- u_return_if_fail(array != NULL);
+ c_return_if_fail(array != NULL);
if(new_length <= array->size) {
return;
@@ -59,74 +59,74 @@ u_ptr_array_grow(UPtrArrayPriv *array, unsigned int length)
}
array->size = MAX(array->size, 16);
- array->pdata = u_realloc(array->pdata, array->size * sizeof(void *));
+ array->pdata = c_realloc(array->pdata, array->size * sizeof(void *));
}
UPtrArray *
-u_ptr_array_new(void)
+c_ptr_array_new(void)
{
- return u_ptr_array_sized_new(0);
+ return c_ptr_array_sized_new(0);
}
UPtrArray *
-u_ptr_array_sized_new(unsigned int reserved_size)
+c_ptr_array_sized_new(unsigned int reserved_size)
{
- UPtrArrayPriv *array = u_new0(UPtrArrayPriv, 1);
+ UPtrArrayPriv *array = c_new0(UPtrArrayPriv, 1);
array->pdata = NULL;
array->len = 0;
array->size = 0;
if(reserved_size > 0) {
- u_ptr_array_grow(array, reserved_size);
+ c_ptr_array_grow(array, reserved_size);
}
return (UPtrArray *)array;
}
UPtrArray *
-u_ptr_array_new_with_free_func(UDestroyNotify element_free_func)
+c_ptr_array_new_with_free_func(CDestroyNotify element_free_func)
{
- UPtrArrayPriv *array = (UPtrArrayPriv *)u_ptr_array_sized_new (0);
+ UPtrArrayPriv *array = (UPtrArrayPriv *)c_ptr_array_sized_new (0);
array->element_free_func = element_free_func;
return (UPtrArray *)array;
}
void * *
-u_ptr_array_free(UPtrArray *array, uboolean free_seg)
+c_ptr_array_free(UPtrArray *array, cboolean free_seg)
{
void * *data = NULL;
- u_return_val_if_fail(array != NULL, NULL);
+ c_return_val_if_fail(array != NULL, NULL);
if(free_seg) {
UPtrArrayPriv *priv = (UPtrArrayPriv *)array;
void * *pdata = priv->pdata;
if (priv->element_free_func) {
- UDestroyNotify free_func = priv->element_free_func;
+ CDestroyNotify free_func = priv->element_free_func;
int i;
for (i = priv->len - 1; i > 0; i--)
free_func (pdata[i]);
}
- u_free(pdata);
+ c_free(pdata);
} else {
data = array->pdata;
}
- u_free(array);
+ c_free(array);
return data;
}
void
-u_ptr_array_set_size(UPtrArray *array, int length)
+c_ptr_array_set_size(UPtrArray *array, int length)
{
- u_return_if_fail(array != NULL);
+ c_return_if_fail(array != NULL);
if((size_t)length > array->len) {
- u_ptr_array_grow((UPtrArrayPriv *)array, length);
+ c_ptr_array_grow((UPtrArrayPriv *)array, length);
memset(array->pdata + array->len, 0, (length - array->len)
* sizeof(void *));
}
@@ -135,25 +135,25 @@ u_ptr_array_set_size(UPtrArray *array, int length)
}
void
-u_ptr_array_add(UPtrArray *array, void * data)
+c_ptr_array_add(UPtrArray *array, void * data)
{
- u_return_if_fail(array != NULL);
- u_ptr_array_grow((UPtrArrayPriv *)array, 1);
+ c_return_if_fail(array != NULL);
+ c_ptr_array_grow((UPtrArrayPriv *)array, 1);
array->pdata[array->len++] = data;
}
void *
-u_ptr_array_remove_index(UPtrArray *array, unsigned int index)
+c_ptr_array_remove_index(UPtrArray *array, unsigned int index)
{
void * removed_node;
- u_return_val_if_fail(array != NULL, NULL);
- u_return_val_if_fail(index >= 0 || index < array->len, NULL);
+ c_return_val_if_fail(array != NULL, NULL);
+ c_return_val_if_fail(index >= 0 || index < array->len, NULL);
removed_node = array->pdata[index];
if(index != array->len - 1) {
- u_memmove(array->pdata + index, array->pdata + index + 1,
+ c_memmove(array->pdata + index, array->pdata + index + 1,
(array->len - index - 1) * sizeof(void *));
}
@@ -164,17 +164,17 @@ u_ptr_array_remove_index(UPtrArray *array, unsigned int index)
}
void *
-u_ptr_array_remove_index_fast(UPtrArray *array, unsigned int index)
+c_ptr_array_remove_index_fast(UPtrArray *array, unsigned int index)
{
void * removed_node;
- u_return_val_if_fail(array != NULL, NULL);
- u_return_val_if_fail(index >= 0 || index < array->len, NULL);
+ c_return_val_if_fail(array != NULL, NULL);
+ c_return_val_if_fail(index >= 0 || index < array->len, NULL);
removed_node = array->pdata[index];
if(index != array->len - 1) {
- u_memmove(array->pdata + index, array->pdata + array->len - 1,
+ c_memmove(array->pdata + index, array->pdata + array->len - 1,
sizeof(void *));
}
@@ -184,16 +184,16 @@ u_ptr_array_remove_index_fast(UPtrArray *array, unsigned int index)
return removed_node;
}
-uboolean
-u_ptr_array_remove(UPtrArray *array, void * data)
+cboolean
+c_ptr_array_remove(UPtrArray *array, void * data)
{
unsigned int i;
- u_return_val_if_fail(array != NULL, FALSE);
+ c_return_val_if_fail(array != NULL, FALSE);
for(i = 0; i < array->len; i++) {
if(array->pdata[i] == data) {
- u_ptr_array_remove_index(array, i);
+ c_ptr_array_remove_index(array, i);
return TRUE;
}
}
@@ -201,12 +201,12 @@ u_ptr_array_remove(UPtrArray *array, void * data)
return FALSE;
}
-uboolean
-u_ptr_array_remove_fast(UPtrArray *array, void * data)
+cboolean
+c_ptr_array_remove_fast(UPtrArray *array, void * data)
{
unsigned int i;
- u_return_val_if_fail(array != NULL, FALSE);
+ c_return_val_if_fail(array != NULL, FALSE);
for(i = 0; i < array->len; i++) {
if(array->pdata[i] == data) {
@@ -223,26 +223,26 @@ u_ptr_array_remove_fast(UPtrArray *array, void * data)
}
void
-u_ptr_array_foreach(UPtrArray *array, UFunc func, void * user_data)
+c_ptr_array_foreach(UPtrArray *array, CFunc func, void * user_data)
{
unsigned int i;
for(i = 0; i < array->len; i++) {
- func(u_ptr_array_index(array, i), user_data);
+ func(c_ptr_array_index(array, i), user_data);
}
}
void
-u_ptr_array_sort(UPtrArray *array, UCompareFunc compare)
+c_ptr_array_sort(UPtrArray *array, CCompareFunc compare)
{
- u_return_if_fail(array != NULL);
+ c_return_if_fail(array != NULL);
qsort(array->pdata, array->len, sizeof(void *), compare);
}
void
-u_ptr_array_sort_with_data (UPtrArray *array, UCompareDataFunc compare, void * user_data)
+c_ptr_array_sort_with_data (UPtrArray *array, CCompareDataFunc compare, void * user_data)
{
- u_return_if_fail (array != NULL);
+ c_return_if_fail (array != NULL);
- u_qsort_with_data (array->pdata, array->len, sizeof (void *), compare, user_data);
+ c_qsort_with_data (array->pdata, array->len, sizeof (void *), compare, user_data);
}
diff --git a/deps/ulib/src/uqsort.c b/deps/clib/src/cqsort.c
index 784870c8..03b86ab5 100644
--- a/deps/ulib/src/uqsort.c
+++ b/deps/clib/src/cqsort.c
@@ -29,7 +29,7 @@
#include <config.h>
#include <stdlib.h>
-#include <ulib.h>
+#include <clib.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
-u_qsort_with_data (void * base, size_t nmemb, size_t size, UCompareDataFunc compare, void * user_data)
+c_qsort_with_data (void * base, size_t nmemb, size_t size, CCompareDataFunc compare, void * user_data)
{
QSortStack stack[STACK_SIZE], *sp;
register char *i, *k, *mid;
diff --git a/deps/ulib/src/uquark.c b/deps/clib/src/cquark.c
index c7417385..c6d2d5ec 100644
--- a/deps/ulib/src/uquark.c
+++ b/deps/clib/src/cquark.c
@@ -28,30 +28,30 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
-static UHashTable *_quark_hash_table;
+static CHashTable *_quark_hash_table;
static uint32_t _next_quark;
UQuark
-u_quark_from_static_string (const char *string)
+c_quark_from_static_string (const char *string)
{
void *quark_ptr;
- if (U_UNLIKELY (_quark_hash_table == NULL))
+ if (C_UNLIKELY (_quark_hash_table == NULL))
{
- _quark_hash_table = u_hash_table_new (u_str_hash, u_str_equal);
+ _quark_hash_table = c_hash_table_new (c_str_hash, c_str_equal);
_next_quark++;
}
- quark_ptr = u_hash_table_lookup (_quark_hash_table, string);
+ quark_ptr = c_hash_table_lookup (_quark_hash_table, string);
if (!quark_ptr)
{
UQuark new_quark = _next_quark++;
- u_hash_table_insert (_quark_hash_table,
- (void *)string, U_UINT_TO_POINTER (new_quark));
+ c_hash_table_insert (_quark_hash_table,
+ (void *)string, C_UINT_TO_POINTER (new_quark));
return new_quark;
}
else
- return U_POINTER_TO_UINT (quark_ptr);
+ return C_POINTER_TO_UINT (quark_ptr);
}
diff --git a/deps/ulib/src/uqueue.c b/deps/clib/src/cqueue.c
index 781d27aa..9a36c3a6 100644
--- a/deps/ulib/src/uqueue.c
+++ b/deps/clib/src/cqueue.c
@@ -32,10 +32,10 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
void
-u_queue_init (UQueue *queue)
+c_queue_init (CQueue *queue)
{
queue->head = NULL;
queue->tail = NULL;
@@ -43,19 +43,19 @@ u_queue_init (UQueue *queue)
}
void *
-u_queue_peek_head (UQueue *queue)
+c_queue_peek_head (CQueue *queue)
{
- u_return_val_if_fail (queue, NULL);
+ c_return_val_if_fail (queue, NULL);
return queue->head ? queue->head->data : NULL;
}
void *
-u_queue_pop_head (UQueue *queue)
+c_queue_pop_head (CQueue *queue)
{
void * result;
- UList *old_head;
+ CList *old_head;
- u_return_val_if_fail (queue, NULL);
+ c_return_val_if_fail (queue, NULL);
if (!queue->head)
return NULL;
@@ -63,7 +63,7 @@ u_queue_pop_head (UQueue *queue)
result = queue->head->data;
old_head = queue->head;
queue->head = old_head->next;
- u_list_free_1 (old_head);
+ c_list_free_1 (old_head);
if (--queue->length)
queue->head->prev = NULL;
@@ -74,19 +74,19 @@ u_queue_pop_head (UQueue *queue)
}
void *
-u_queue_peek_tail (UQueue *queue)
+c_queue_peek_tail (CQueue *queue)
{
- u_return_val_if_fail (queue, NULL);
+ c_return_val_if_fail (queue, NULL);
return queue->tail ? queue->tail->data : NULL;
}
void *
-u_queue_pop_tail (UQueue *queue)
+c_queue_pop_tail (CQueue *queue)
{
void * result;
- UList *old_tail;
+ CList *old_tail;
- u_return_val_if_fail (queue, NULL);
+ c_return_val_if_fail (queue, NULL);
if (!queue->tail)
return NULL;
@@ -101,24 +101,24 @@ u_queue_pop_tail (UQueue *queue)
queue->head = NULL;
queue->length--;
- u_list_free_1 (old_tail);
+ c_list_free_1 (old_tail);
return result;
}
-uboolean
-u_queue_is_empty (UQueue *queue)
+cboolean
+c_queue_is_empty (CQueue *queue)
{
- u_return_val_if_fail (queue, TRUE);
+ c_return_val_if_fail (queue, TRUE);
return queue->length == 0;
}
void
-u_queue_push_head (UQueue *queue, void * head)
+c_queue_push_head (CQueue *queue, void * head)
{
- u_return_if_fail (queue);
+ c_return_if_fail (queue);
- queue->head = u_list_prepend (queue->head, head);
+ queue->head = c_list_prepend (queue->head, head);
if (!queue->tail)
queue->tail = queue->head;
@@ -127,11 +127,11 @@ u_queue_push_head (UQueue *queue, void * head)
}
void
-u_queue_push_tail (UQueue *queue, void * data)
+c_queue_push_tail (CQueue *queue, void * data)
{
- u_return_if_fail (queue);
+ c_return_if_fail (queue);
- queue->tail = u_list_append (queue->tail, data);
+ queue->tail = c_list_append (queue->tail, data);
if (queue->head == NULL)
queue->head = queue->tail;
else
@@ -139,34 +139,34 @@ u_queue_push_tail (UQueue *queue, void * data)
queue->length++;
}
-UQueue *
-u_queue_new (void)
+CQueue *
+c_queue_new (void)
{
- return u_new0 (UQueue, 1);
+ return c_new0 (CQueue, 1);
}
void
-u_queue_free (UQueue *queue)
+c_queue_free (CQueue *queue)
{
- u_return_if_fail (queue);
+ c_return_if_fail (queue);
- u_list_free (queue->head);
- u_free (queue);
+ c_list_free (queue->head);
+ c_free (queue);
}
void
-u_queue_foreach (UQueue *queue, UFunc func, void * user_data)
+c_queue_foreach (CQueue *queue, CFunc func, void * user_data)
{
- u_return_if_fail (queue);
- u_return_if_fail (func);
+ c_return_if_fail (queue);
+ c_return_if_fail (func);
- u_list_foreach (queue->head, func, user_data);
+ c_list_foreach (queue->head, func, user_data);
}
-UList *
-u_queue_find (UQueue *queue, const void * data)
+CList *
+c_queue_find (CQueue *queue, const void * data)
{
- UList *l;
+ CList *l;
for (l = queue->head; l; l = l->next)
if (l->data == data)
@@ -176,11 +176,11 @@ u_queue_find (UQueue *queue, const void * data)
}
void
-u_queue_clear (UQueue *queue)
+c_queue_clear (CQueue *queue)
{
- u_return_if_fail (queue);
+ c_return_if_fail (queue);
- u_list_free (queue->head);
+ c_list_free (queue->head);
queue->length = 0;
queue->head = NULL;
queue->tail = NULL;
diff --git a/deps/ulib/src/ushell.c b/deps/clib/src/cshell.c
index 96568cf9..b1ca90cb 100644
--- a/deps/ulib/src/ushell.c
+++ b/deps/clib/src/cshell.c
@@ -29,12 +29,12 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
UQuark
-u_shell_error_get_quark (void)
+c_shell_error_get_quark (void)
{
- return u_quark_from_static_string ("g-shell-error-quark");
+ return c_quark_from_static_string ("g-shell-error-quark");
}
static int
@@ -42,11 +42,11 @@ split_cmdline (const char *cmdline, UPtrArray *array, UError **error)
{
char *ptr;
char c;
- uboolean escaped = FALSE, fresh = TRUE;
+ cboolean escaped = FALSE, fresh = TRUE;
char quote_char = '\0';
- UString *str;
+ CString *str;
- str = u_string_new ("");
+ str = c_string_new ("");
ptr = (char *) cmdline;
while ((c = *ptr++) != '\0') {
if (escaped) {
@@ -56,28 +56,28 @@ split_cmdline (const char *cmdline, UPtrArray *array, UError **error)
*/
if (quote_char == '\"'){
if (!(c == '$' || c == '`' || c == '"' || c == '\\'))
- u_string_append_c (str, '\\');
- u_string_append_c (str, c);
+ c_string_append_c (str, '\\');
+ c_string_append_c (str, c);
} else {
- if (!u_ascii_isspace (c))
- u_string_append_c (str, c);
+ if (!c_ascii_isspace (c))
+ c_string_append_c (str, c);
}
escaped = FALSE;
} else if (quote_char) {
if (c == quote_char) {
quote_char = '\0';
- if (fresh && (u_ascii_isspace (*ptr) || *ptr == '\0')){
- u_ptr_array_add (array, u_string_free (str, FALSE));
- str = u_string_new ("");
+ if (fresh && (c_ascii_isspace (*ptr) || *ptr == '\0')){
+ c_ptr_array_add (array, c_string_free (str, FALSE));
+ str = c_string_new ("");
}
} else if (c == '\\'){
escaped = TRUE;
} else
- u_string_append_c (str, c);
- } else if (u_ascii_isspace (c)) {
+ c_string_append_c (str, c);
+ } else if (c_ascii_isspace (c)) {
if (str->len > 0) {
- u_ptr_array_add (array, u_string_free (str, FALSE));
- str = u_string_new ("");
+ c_ptr_array_add (array, c_string_free (str, FALSE));
+ str = c_string_new ("");
}
} else if (c == '\\') {
escaped = TRUE;
@@ -85,52 +85,52 @@ split_cmdline (const char *cmdline, UPtrArray *array, UError **error)
fresh = str->len == 0;
quote_char = c;
} else {
- u_string_append_c (str, c);
+ c_string_append_c (str, c);
}
}
if (escaped) {
if (error)
- *error = u_error_new (U_SHELL_ERROR,
- U_SHELL_ERROR_BAD_QUOTING,
+ *error = c_error_new (C_SHELL_ERROR,
+ C_SHELL_ERROR_BAD_QUOTING,
"Unfinished escape.");
- u_string_free (str, TRUE);
+ c_string_free (str, TRUE);
return -1;
}
if (quote_char) {
if (error)
- *error = u_error_new (U_SHELL_ERROR,
- U_SHELL_ERROR_BAD_QUOTING,
+ *error = c_error_new (C_SHELL_ERROR,
+ C_SHELL_ERROR_BAD_QUOTING,
"Unfinished quote.");
- u_string_free (str, TRUE);
+ c_string_free (str, TRUE);
return -1;
}
if (str->len > 0) {
- u_ptr_array_add (array, u_string_free (str, FALSE));
+ c_ptr_array_add (array, c_string_free (str, FALSE));
} else {
- u_string_free (str, TRUE);
+ c_string_free (str, TRUE);
}
- u_ptr_array_add (array, NULL);
+ c_ptr_array_add (array, NULL);
return 0;
}
-uboolean
-u_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError **error)
+cboolean
+c_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError **error)
{
UPtrArray *array;
int argc;
char **argv;
- u_return_val_if_fail (command_line, FALSE);
- u_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ c_return_val_if_fail (command_line, FALSE);
+ c_return_val_if_fail (error == NULL || *error == NULL, FALSE);
- array = u_ptr_array_new();
+ array = c_ptr_array_new();
if (split_cmdline (command_line, array, error)) {
- u_ptr_array_add (array, NULL);
- u_strfreev ((char **) array->pdata);
- u_ptr_array_free (array, FALSE);
+ c_ptr_array_add (array, NULL);
+ c_strfreev ((char **) array->pdata);
+ c_ptr_array_free (array, FALSE);
return FALSE;
}
@@ -138,8 +138,8 @@ u_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError
argv = (char **) array->pdata;
if (argc == 1) {
- u_strfreev (argv);
- u_ptr_array_free (array, FALSE);
+ c_strfreev (argv);
+ c_ptr_array_free (array, FALSE);
return FALSE;
}
@@ -150,32 +150,32 @@ u_shell_parse_argv (const char *command_line, int *argcp, char ***argvp, UError
if (argvp) {
*argvp = argv;
} else {
- u_strfreev (argv);
+ c_strfreev (argv);
}
- u_ptr_array_free (array, FALSE);
+ c_ptr_array_free (array, FALSE);
return TRUE;
}
char *
-u_shell_quote (const char *unquoted_string)
+c_shell_quote (const char *unquoted_string)
{
- UString *result = u_string_new ("'");
+ CString *result = c_string_new ("'");
const char *p;
for (p = unquoted_string; *p; p++){
if (*p == '\'')
- u_string_append (result, "'\\'");
- u_string_append_c (result, *p);
+ c_string_append (result, "'\\'");
+ c_string_append_c (result, *p);
}
- u_string_append_c (result, '\'');
- return u_string_free (result, FALSE);
+ c_string_append_c (result, '\'');
+ return c_string_free (result, FALSE);
}
char *
-u_shell_unquote (const char *quoted_string, UError **error)
+c_shell_unquote (const char *quoted_string, UError **error)
{
- UString *result;
+ CString *result;
const char *p;
int do_unquote = 0;
@@ -191,10 +191,10 @@ u_shell_unquote (const char *quoted_string, UError **error)
}
if (!do_unquote)
- return u_strdup (quoted_string);
+ return c_strdup (quoted_string);
/* We do need to unquote */
- result = u_string_new ("");
+ result = c_string_new ("");
for (p = quoted_string; *p; p++){
if (*p == '\''){
@@ -202,10 +202,10 @@ u_shell_unquote (const char *quoted_string, UError **error)
for (p++; *p; p++){
if (*p == '\'')
break;
- u_string_append_c (result, *p);
+ c_string_append_c (result, *p);
}
if (!*p){
- u_set_error (error, 0, 0, "Open quote");
+ c_set_error (error, 0, 0, "Open quote");
return NULL;
}
} else if (*p == '"'){
@@ -216,7 +216,7 @@ u_shell_unquote (const char *quoted_string, UError **error)
if (*p == '\\'){
p++;
if (*p == 0){
- u_set_error (error, 0, 0, "Open quote");
+ c_set_error (error, 0, 0, "Open quote");
return NULL;
}
switch (*p){
@@ -226,28 +226,28 @@ u_shell_unquote (const char *quoted_string, UError **error)
case '`':
break;
default:
- u_string_append_c (result, '\\');
+ c_string_append_c (result, '\\');
break;
}
}
- u_string_append_c (result, *p);
+ c_string_append_c (result, *p);
}
if (!*p){
- u_set_error (error, 0, 0, "Open quote");
+ c_set_error (error, 0, 0, "Open quote");
return NULL;
}
} else if (*p == '\\'){
char c = *(++p);
if (!(c == '$' || c == '"' || c == '\\' || c == '`' || c == '\'' || c == 0 ))
- u_string_append_c (result, '\\');
+ c_string_append_c (result, '\\');
if (c == 0)
break;
else
- u_string_append_c (result, c);
+ c_string_append_c (result, c);
} else
- u_string_append_c (result, *p);
+ c_string_append_c (result, *p);
}
- return u_string_free (result, FALSE);
+ return c_string_free (result, FALSE);
}
#if JOINT_TEST
@@ -282,7 +282,7 @@ main ()
int i;
while (*s){
- char *r1 = u_shell_unquote (*s, NULL);
+ char *r1 = c_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, u_shell_unquote (buffer, NULL));
+ printf ("%d [%s] -> [%s]\n", i, buffer, c_shell_unquote (buffer, NULL));
}
}
#endif
diff --git a/deps/ulib/src/uslist.c b/deps/clib/src/cslist.c
index dd444602..8053629d 100644
--- a/deps/ulib/src/uslist.c
+++ b/deps/clib/src/cslist.c
@@ -31,31 +31,31 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
-USList*
-u_slist_alloc (void)
+CSList*
+c_slist_alloc (void)
{
- return u_new0 (USList, 1);
+ return c_new0 (CSList, 1);
}
void
-u_slist_free_1 (USList *list)
+c_slist_free_1 (CSList *list)
{
- u_free (list);
+ c_free (list);
}
-USList*
-u_slist_append (USList *list, void * data)
+CSList*
+c_slist_append (CSList *list, void * data)
{
- return u_slist_concat (list, u_slist_prepend (NULL, data));
+ return c_slist_concat (list, c_slist_prepend (NULL, data));
}
/* This is also a list node constructor. */
-USList*
-u_slist_prepend (USList *list, void * data)
+CSList*
+c_slist_prepend (CSList *list, void * data)
{
- USList *head = u_slist_alloc ();
+ CSList *head = c_slist_alloc ();
head->data = data;
head->next = list;
@@ -66,10 +66,10 @@ u_slist_prepend (USList *list, void * data)
* Insert the given data in a new node after the current node.
* Return new node.
*/
-static inline USList *
-insert_after (USList *list, void * data)
+static inline CSList *
+insert_after (CSList *list, void * data)
{
- list->next = u_slist_prepend (list->next, data);
+ list->next = c_slist_prepend (list->next, data);
return list->next;
}
@@ -78,10 +78,10 @@ insert_after (USList *list, void * 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 USList*
-find_prev (USList *list, const void * data)
+static inline CSList*
+find_prev (CSList *list, const void * data)
{
- USList *prev = NULL;
+ CSList *prev = NULL;
while (list) {
if (list->data == data)
break;
@@ -92,10 +92,10 @@ find_prev (USList *list, const void * data)
}
/* like 'find_prev', but searches for node 'link' */
-static inline USList*
-find_prev_link (USList *list, USList *link)
+static inline CSList*
+find_prev_link (CSList *list, CSList *link)
{
- USList *prev = NULL;
+ CSList *prev = NULL;
while (list) {
if (list == link)
break;
@@ -105,37 +105,37 @@ find_prev_link (USList *list, USList *link)
return prev;
}
-USList*
-u_slist_insert_before (USList *list, USList *sibling, void * data)
+CSList*
+c_slist_insert_before (CSList *list, CSList *sibling, void * data)
{
- USList *prev = find_prev_link (list, sibling);
+ CSList *prev = find_prev_link (list, sibling);
if (!prev)
- return u_slist_prepend (list, data);
+ return c_slist_prepend (list, data);
insert_after (prev, data);
return list;
}
void
-u_slist_free (USList *list)
+c_slist_free (CSList *list)
{
while (list) {
- USList *next = list->next;
- u_slist_free_1 (list);
+ CSList *next = list->next;
+ c_slist_free_1 (list);
list = next;
}
}
-USList*
-u_slist_copy (USList *list)
+CSList*
+c_slist_copy (CSList *list)
{
- USList *copy, *tmp;
+ CSList *copy, *tmp;
if (!list)
return NULL;
- copy = u_slist_prepend (NULL, list->data);
+ copy = c_slist_prepend (NULL, list->data);
tmp = copy;
for (list = list->next; list; list = list->next)
@@ -144,18 +144,18 @@ u_slist_copy (USList *list)
return copy;
}
-USList*
-u_slist_concat (USList *list1, USList *list2)
+CSList*
+c_slist_concat (CSList *list1, CSList *list2)
{
if (!list1)
return list2;
- u_slist_last (list1)->next = list2;
+ c_slist_last (list1)->next = list2;
return list1;
}
void
-u_slist_foreach (USList *list, UFunc func, void * user_data)
+c_slist_foreach (CSList *list, CFunc func, void * user_data)
{
while (list) {
(*func) (list->data, user_data);
@@ -163,8 +163,8 @@ u_slist_foreach (USList *list, UFunc func, void * user_data)
}
}
-USList*
-u_slist_last (USList *list)
+CSList*
+c_slist_last (CSList *list)
{
if (!list)
return NULL;
@@ -175,8 +175,8 @@ u_slist_last (USList *list)
return list;
}
-USList*
-u_slist_find (USList *list, const void * data)
+CSList*
+c_slist_find (CSList *list, const void * data)
{
for (; list; list = list->next)
if (list->data == data)
@@ -184,8 +184,8 @@ u_slist_find (USList *list, const void * data)
return NULL;
}
-USList *
-u_slist_find_custom (USList *list, const void * data, UCompareFunc func)
+CSList *
+c_slist_find_custom (CSList *list, const void * data, CCompareFunc func)
{
if (!func)
return NULL;
@@ -201,7 +201,7 @@ u_slist_find_custom (USList *list, const void * data, UCompareFunc func)
}
unsigned int
-u_slist_length (USList *list)
+c_slist_length (CSList *list)
{
unsigned int length = 0;
@@ -213,32 +213,32 @@ u_slist_length (USList *list)
return length;
}
-USList*
-u_slist_remove (USList *list, const void * data)
+CSList*
+c_slist_remove (CSList *list, const void * data)
{
- USList *prev = find_prev (list, data);
- USList *current = prev ? prev->next : list;
+ CSList *prev = find_prev (list, data);
+ CSList *current = prev ? prev->next : list;
if (current) {
if (prev)
prev->next = current->next;
else
list = current->next;
- u_slist_free_1 (current);
+ c_slist_free_1 (current);
}
return list;
}
-USList*
-u_slist_remove_all (USList *list, const void * data)
+CSList*
+c_slist_remove_all (CSList *list, const void * data)
{
- USList *next = list;
- USList *prev = NULL;
- USList *current;
+ CSList *next = list;
+ CSList *prev = NULL;
+ CSList *current;
while (next) {
- USList *tmp_prev = find_prev (next, data);
+ CSList *tmp_prev = find_prev (next, data);
if (tmp_prev)
prev = tmp_prev;
current = prev ? prev->next : list;
@@ -252,17 +252,17 @@ u_slist_remove_all (USList *list, const void * data)
prev->next = next;
else
list = next;
- u_slist_free_1 (current);
+ c_slist_free_1 (current);
}
return list;
}
-USList*
-u_slist_remove_link (USList *list, USList *link)
+CSList*
+c_slist_remove_link (CSList *list, CSList *link)
{
- USList *prev = find_prev_link (list, link);
- USList *current = prev ? prev->next : list;
+ CSList *prev = find_prev_link (list, link);
+ CSList *current = prev ? prev->next : list;
if (current) {
if (prev)
@@ -275,21 +275,21 @@ u_slist_remove_link (USList *list, USList *link)
return list;
}
-USList*
-u_slist_delete_link (USList *list, USList *link)
+CSList*
+c_slist_delete_link (CSList *list, CSList *link)
{
- list = u_slist_remove_link (list, link);
- u_slist_free_1 (link);
+ list = c_slist_remove_link (list, link);
+ c_slist_free_1 (link);
return list;
}
-USList*
-u_slist_reverse (USList *list)
+CSList*
+c_slist_reverse (CSList *list)
{
- USList *prev = NULL;
+ CSList *prev = NULL;
while (list){
- USList *next = list->next;
+ CSList *next = list->next;
list->next = prev;
prev = list;
list = next;
@@ -298,16 +298,16 @@ u_slist_reverse (USList *list)
return prev;
}
-USList*
-u_slist_insert_sorted (USList *list, void * data, UCompareFunc func)
+CSList*
+c_slist_insert_sorted (CSList *list, void * data, CCompareFunc func)
{
- USList *prev = NULL;
+ CSList *prev = NULL;
if (!func)
return list;
if (!list || func (list->data, data) > 0)
- return u_slist_prepend (list, data);
+ return c_slist_prepend (list, data);
/* Invariant: func (prev->data, data) <= 0) */
for (prev = list; prev->next; prev = prev->next)
@@ -320,7 +320,7 @@ u_slist_insert_sorted (USList *list, void * data, UCompareFunc func)
}
int
-u_slist_index (USList *list, const void * data)
+c_slist_index (CSList *list, const void * data)
{
int index = 0;
@@ -335,8 +335,8 @@ u_slist_index (USList *list, const void * data)
return -1;
}
-USList*
-u_slist_nth (USList *list, unsigned int n)
+CSList*
+c_slist_nth (CSList *list, unsigned int n)
{
for (; list; list = list->next) {
if (n == 0)
@@ -347,17 +347,17 @@ u_slist_nth (USList *list, unsigned int n)
}
void *
-u_slist_nth_data (USList *list, unsigned int n)
+c_slist_nth_data (CSList *list, unsigned int n)
{
- USList *node = u_slist_nth (list, n);
+ CSList *node = c_slist_nth (list, n);
return node ? node->data : NULL;
}
-typedef USList list_node;
+typedef CSList list_node;
#include "sort.frag.h"
-USList*
-u_slist_sort (USList *list, UCompareFunc func)
+CSList*
+c_slist_sort (CSList *list, CCompareFunc func)
{
if (!list || !list->next)
return list;
diff --git a/deps/ulib/src/uspawn.c b/deps/clib/src/cspawn.c
index 8d01e198..48f80b98 100644
--- a/deps/ulib/src/uspawn.c
+++ b/deps/clib/src/cspawn.c
@@ -32,7 +32,7 @@
#include <fcntl.h>
#include <sys/types.h>
-#include <ulib.h>
+#include <clib.h>
#ifdef HAVE_UNISTD_H
#ifndef __USE_GNU
@@ -49,7 +49,7 @@
#include <sys/wait.h>
#endif
-#ifdef U_OS_WIN32
+#ifdef C_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 = 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 set_error(msg, ...) do { if (error != NULL) *error = c_error_new (C_SPAWN_ERROR, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = c_error_new (C_SPAWN_ERROR, 1, msg, __VA_ARGS__); } while (0)
+#define set_error_status(status,msg, ...) do { if (error != NULL) *error = c_error_new (C_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)
@@ -80,13 +80,13 @@ extern char **environ;
#endif
UQuark
-u_spawn_error_get_quark (void)
+c_spawn_error_get_quark (void)
{
- return u_quark_from_static_string ("g-spawn-error-quark");
+ return c_quark_from_static_string ("g-spawn-error-quark");
}
-#ifndef U_OS_WIN32
+#ifndef C_OS_WIN32
static int
safe_read (int fd, char *buffer, int count, UError **error)
{
@@ -102,10 +102,10 @@ read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error
{
fd_set rfds;
int res;
- uboolean out_closed;
- uboolean err_closed;
- UString *out = NULL;
- UString *err = NULL;
+ cboolean out_closed;
+ cboolean err_closed;
+ CString *out = NULL;
+ CString *err = NULL;
char *buffer = NULL;
int nread;
@@ -113,12 +113,12 @@ read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error
err_closed = (errfd < 0);
if (out_str) {
*out_str = NULL;
- out = u_string_new ("");
+ out = c_string_new ("");
}
if (err_str) {
*err_str = NULL;
- err = u_string_new ("");
+ err = c_string_new ("");
}
do {
@@ -143,7 +143,7 @@ read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error
res = select (MAX (outfd, errfd) + 1, &rfds, NULL, NULL, NULL);
if (res > 0) {
if (buffer == NULL)
- buffer = u_malloc (1024);
+ buffer = c_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, char **out_str, int errfd, char **err_str, UError **error
close (outfd);
return -1;
}
- u_string_append_len (out, buffer, nread);
+ c_string_append_len (out, buffer, nread);
if (nread <= 0) {
out_closed = TRUE;
close (outfd);
@@ -165,7 +165,7 @@ read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error
close (outfd);
return -1;
}
- u_string_append_len (err, buffer, nread);
+ c_string_append_len (err, buffer, nread);
if (nread <= 0) {
err_closed = TRUE;
close (errfd);
@@ -174,17 +174,17 @@ read_pipes (int outfd, char **out_str, int errfd, char **err_str, UError **error
}
} while (res > 0 || (res == -1 && errno == EINTR));
- u_free (buffer);
+ c_free (buffer);
if (out_str)
- *out_str = u_string_free (out, FALSE);
+ *out_str = c_string_free (out, FALSE);
if (err_str)
- *err_str = u_string_free (err, FALSE);
+ *err_str = c_string_free (err, FALSE);
return 0;
}
-static uboolean
+static cboolean
create_pipe (int *fds, UError **error)
{
if (pipe (fds) == -1) {
@@ -193,7 +193,7 @@ create_pipe (int *fds, UError **error)
}
return TRUE;
}
-#endif /* U_OS_WIN32 */
+#endif /* C_OS_WIN32 */
static int
write_all (int fd, const void *vbuf, size_t n)
@@ -216,14 +216,14 @@ write_all (int fd, const void *vbuf, size_t n)
return nwritten;
}
-uboolean
-u_spawn_command_line_sync (const char *command_line,
+cboolean
+c_spawn_command_line_sync (const char *command_line,
char **standard_output,
char **standard_error,
int *exit_status,
UError **error)
{
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
#else
pid_t pid;
char **argv;
@@ -233,7 +233,7 @@ u_spawn_command_line_sync (const char *command_line,
int status;
int res;
- if (!u_shell_parse_argv (command_line, &argc, &argv, error))
+ if (!c_shell_parse_argv (command_line, &argc, &argv, error))
return FALSE;
if (standard_output && !create_pipe (stdout_pipe, error))
@@ -262,22 +262,22 @@ u_spawn_command_line_sync (const char *command_line,
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
- /* U_SPAWN_SEARCH_PATH is always enabled for u_spawn_command_line_sync */
- if (!u_path_is_absolute (argv [0])) {
+ /* C_SPAWN_SEARCH_PATH is always enabled for c_spawn_command_line_sync */
+ if (!c_path_is_absolute (argv [0])) {
char *arg0;
- arg0 = u_find_program_in_path (argv [0]);
+ arg0 = c_find_program_in_path (argv [0]);
if (arg0 == NULL) {
exit (1);
}
- //u_free (argv [0]);
+ //c_free (argv [0]);
argv [0] = arg0;
}
execv (argv [0], argv);
exit (1); /* TODO: What now? */
}
- u_strfreev (argv);
+ c_strfreev (argv);
if (standard_output)
close (stdout_pipe [1]);
@@ -304,10 +304,10 @@ u_spawn_command_line_sync (const char *command_line,
/*
* This is the only use we have in mono/metadata
-!u_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, U_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &ch_in, &ch_out, NULL, NULL)
+!c_spawn_async_with_pipes (NULL, (char**)addr_argv, NULL, C_SPAWN_SEARCH_PATH, NULL, NULL, &child_pid, &ch_in, &ch_out, NULL, NULL)
*/
-uboolean
-u_spawn_async_with_pipes (const char *working_directory,
+cboolean
+c_spawn_async_with_pipes (const char *working_directory,
char **argv,
char **envp,
USpawnFlags flags,
@@ -319,7 +319,7 @@ u_spawn_async_with_pipes (const char *working_directory,
int *standard_error,
UError **error)
{
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
#else
pid_t pid;
int info_pipe [2];
@@ -328,7 +328,7 @@ u_spawn_async_with_pipes (const char *working_directory,
int err_pipe [2] = { -1, -1 };
int status;
- u_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
+ c_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */
if (!create_pipe (info_pipe, error))
return FALSE;
@@ -363,7 +363,7 @@ u_spawn_async_with_pipes (const char *working_directory,
if (pid == 0) {
/* No zombie left behind */
- if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ if ((flags & C_SPAWN_DO_NOT_REAP_CHILD) == 0) {
pid = fork ();
}
@@ -387,7 +387,7 @@ u_spawn_async_with_pipes (const char *working_directory,
*/
fcntl (info_pipe [1], F_SETFD, FD_CLOEXEC);
- if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ if ((flags & C_SPAWN_DO_NOT_REAP_CHILD) == 0) {
pid = getpid ();
NO_INTR (unused, write_all (info_pipe [1], &pid, sizeof (pid_t)));
}
@@ -400,31 +400,31 @@ u_spawn_async_with_pipes (const char *working_directory,
if (standard_output) {
dup2 (out_pipe [1], STDOUT_FILENO);
- } else if ((flags & U_SPAWN_STDOUT_TO_DEV_NULL) != 0) {
+ } else if ((flags & C_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 & U_SPAWN_STDERR_TO_DEV_NULL) != 0) {
+ } else if ((flags & C_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 & U_SPAWN_CHILD_INHERITS_STDIN) == 0) {
+ } else if ((flags & C_SPAWN_CHILD_INHERITS_STDIN) == 0) {
fd = open ("/dev/null", O_RDONLY);
dup2 (fd, STDIN_FILENO);
}
- if ((flags & U_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
+ if ((flags & C_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
for (i = getdtablesize () - 1; i >= 3; i--)
close (i);
}
- actual_args = ((flags & U_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
+ actual_args = ((flags & C_SPAWN_FILE_AND_ARGV_ZERO) == 0) ? argv : argv + 1;
if (envp == NULL)
envp = environ;
@@ -432,8 +432,8 @@ u_spawn_async_with_pipes (const char *working_directory,
child_setup (user_data);
arg0 = argv [0];
- if (!u_path_is_absolute (arg0) || (flags & U_SPAWN_SEARCH_PATH) != 0) {
- arg0 = u_find_program_in_path (argv [0]);
+ if (!c_path_is_absolute (arg0) || (flags & C_SPAWN_SEARCH_PATH) != 0) {
+ arg0 = c_find_program_in_path (argv [0]);
if (arg0 == NULL) {
int err = ENOENT;
write_all (info_pipe [1], &err, sizeof (int));
@@ -445,7 +445,7 @@ u_spawn_async_with_pipes (const char *working_directory,
write_all (info_pipe [1], &errno, sizeof (int));
exit (0);
}
- } else if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ } else if ((flags & C_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 @@ u_spawn_async_with_pipes (const char *working_directory,
close (out_pipe [1]);
close (err_pipe [1]);
- if ((flags & U_SPAWN_DO_NOT_REAP_CHILD) == 0) {
+ if ((flags & C_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/ulib/src/ustr.c b/deps/clib/src/cstr.c
index ed1494c1..4b30b841 100644
--- a/deps/ulib/src/ustr.c
+++ b/deps/clib/src/cstr.c
@@ -30,17 +30,17 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <ulib.h>
+#include <clib.h>
-/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
+/* This is not a macro, because I dont want to put _GNC_SOURCE in the glib.h header */
char *
-u_strndup (const char *str, size_t n)
+c_strndup (const char *str, size_t n)
{
#ifdef HAVE_STRNDUP
return strndup (str, n);
#else
if (str) {
- char *retval = u_malloc(n+1);
+ char *retval = c_malloc(n+1);
if (retval) {
strncpy(retval, str, n)[n] = 0;
}
@@ -51,20 +51,20 @@ u_strndup (const char *str, size_t n)
}
void
-u_strfreev (char **str_array)
+c_strfreev (char **str_array)
{
char **orig = str_array;
if (str_array == NULL)
return;
while (*str_array != NULL){
- u_free (*str_array);
+ c_free (*str_array);
str_array++;
}
- u_free (orig);
+ c_free (orig);
}
char **
-u_strdupv (char **str_array)
+c_strdupv (char **str_array)
{
unsigned int length;
char **ret;
@@ -73,32 +73,32 @@ u_strdupv (char **str_array)
if (!str_array)
return NULL;
- length = u_strv_length(str_array);
- ret = u_new0(char *, length + 1);
+ length = c_strv_length(str_array);
+ ret = c_new0(char *, length + 1);
for (i = 0; str_array[i]; i++) {
- ret[i] = u_strdup(str_array[i]);
+ ret[i] = c_strdup(str_array[i]);
}
ret[length] = NULL;
return ret;
}
unsigned int
-u_strv_length(char **str_array)
+c_strv_length(char **str_array)
{
int length = 0;
- u_return_val_if_fail(str_array != NULL, 0);
+ c_return_val_if_fail(str_array != NULL, 0);
for(length = 0; str_array[length] != NULL; length++);
return length;
}
-uboolean
-u_str_has_suffix(const char *str, const char *suffix)
+cboolean
+c_str_has_suffix(const char *str, const char *suffix)
{
size_t str_length;
size_t suffix_length;
- u_return_val_if_fail(str != NULL, FALSE);
- u_return_val_if_fail(suffix != NULL, FALSE);
+ c_return_val_if_fail(str != NULL, FALSE);
+ c_return_val_if_fail(suffix != NULL, FALSE);
str_length = strlen(str);
suffix_length = strlen(suffix);
@@ -108,14 +108,14 @@ u_str_has_suffix(const char *str, const char *suffix)
FALSE;
}
-uboolean
-u_str_has_prefix(const char *str, const char *prefix)
+cboolean
+c_str_has_prefix(const char *str, const char *prefix)
{
size_t str_length;
size_t prefix_length;
- u_return_val_if_fail(str != NULL, FALSE);
- u_return_val_if_fail(prefix != NULL, FALSE);
+ c_return_val_if_fail(str != NULL, FALSE);
+ c_return_val_if_fail(prefix != NULL, FALSE);
str_length = strlen(str);
prefix_length = strlen(prefix);
@@ -126,7 +126,7 @@ u_str_has_prefix(const char *str, const char *prefix)
}
char *
-u_strdup_vprintf (const char *format, va_list args)
+c_strdup_vprintf (const char *format, va_list args)
{
int n;
char *ret;
@@ -139,7 +139,7 @@ u_strdup_vprintf (const char *format, va_list args)
}
char *
-u_strdup_printf (const char *format, ...)
+c_strdup_printf (const char *format, ...)
{
char *ret;
va_list args;
@@ -155,18 +155,18 @@ u_strdup_printf (const char *format, ...)
}
const char *
-u_strerror (int errnum)
+c_strerror (int errnum)
{
return strerror (errnum);
}
char *
-u_strconcat (const char *first, ...)
+c_strconcat (const char *first, ...)
{
va_list args;
size_t total = 0;
char *s, *ret;
- u_return_val_if_fail (first != NULL, NULL);
+ c_return_val_if_fail (first != NULL, NULL);
total += strlen (first);
va_start (args, first);
@@ -175,7 +175,7 @@ u_strconcat (const char *first, ...)
}
va_end (args);
- ret = u_malloc (total + 1);
+ ret = c_malloc (total + 1);
if (ret == NULL)
return NULL;
@@ -194,26 +194,26 @@ static void
add_to_vector (char ***vector, int size, char *token)
{
*vector = *vector == NULL ?
- (char **)u_malloc(2 * sizeof(*vector)) :
- (char **)u_realloc(*vector, (size + 1) * sizeof(*vector));
+ (char **)c_malloc(2 * sizeof(*vector)) :
+ (char **)c_realloc(*vector, (size + 1) * sizeof(*vector));
(*vector)[size - 1] = token;
}
char **
-u_strsplit (const char *string, const char *delimiter, int max_tokens)
+c_strsplit (const char *string, const char *delimiter, int max_tokens)
{
const char *c;
char *token, **vector;
int size = 1;
- 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);
+ c_return_val_if_fail (string != NULL, NULL);
+ c_return_val_if_fail (delimiter != NULL, NULL);
+ c_return_val_if_fail (delimiter[0] != 0, NULL);
if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
- vector = (char **)u_malloc (2 * sizeof(vector));
- vector[0] = u_strdup ("");
+ vector = (char **)c_malloc (2 * sizeof(vector));
+ vector[0] = c_strdup ("");
size++;
string += strlen (delimiter);
} else {
@@ -223,7 +223,7 @@ u_strsplit (const char *string, const char *delimiter, int max_tokens)
while (*string && !(max_tokens > 0 && size >= max_tokens)) {
c = string;
if (strncmp (string, delimiter, strlen (delimiter)) == 0) {
- token = u_strdup ("");
+ token = c_strdup ("");
string += strlen (delimiter);
} else {
while (*string && strncmp (string, delimiter, strlen (delimiter)) != 0) {
@@ -232,7 +232,7 @@ u_strsplit (const char *string, const char *delimiter, int max_tokens)
if (*string) {
size_t toklen = (string - c);
- token = u_strndup (c, toklen);
+ token = c_strndup (c, toklen);
/* Need to leave a trailing empty
* token if the delimiter is the last
@@ -242,7 +242,7 @@ u_strsplit (const char *string, const char *delimiter, int max_tokens)
string += strlen (delimiter);
}
} else {
- token = u_strdup (c);
+ token = c_strdup (c);
}
}
@@ -252,16 +252,16 @@ u_strsplit (const char *string, const char *delimiter, int max_tokens)
if (*string) {
if (strcmp (string, delimiter) == 0)
- add_to_vector (&vector, size, u_strdup (""));
+ add_to_vector (&vector, size, c_strdup (""));
else {
/* Add the rest of the string as the last element */
- add_to_vector (&vector, size, u_strdup (string));
+ add_to_vector (&vector, size, c_strdup (string));
}
size++;
}
if (vector == NULL) {
- vector = (char **) u_malloc (2 * sizeof (vector));
+ vector = (char **) c_malloc (2 * sizeof (vector));
vector [0] = NULL;
} else if (size > 0) {
vector[size - 1] = NULL;
@@ -270,7 +270,7 @@ u_strsplit (const char *string, const char *delimiter, int max_tokens)
return vector;
}
-static uboolean
+static cboolean
charcmp (char testchar, const char *compare)
{
while(*compare) {
@@ -284,19 +284,19 @@ charcmp (char testchar, const char *compare)
}
char **
-u_strsplit_set (const char *string, const char *delimiter, int max_tokens)
+c_strsplit_set (const char *string, const char *delimiter, int max_tokens)
{
const char *c;
char *token, **vector;
int size = 1;
- 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);
+ c_return_val_if_fail (string != NULL, NULL);
+ c_return_val_if_fail (delimiter != NULL, NULL);
+ c_return_val_if_fail (delimiter[0] != 0, NULL);
if (charcmp (*string, delimiter)) {
- vector = (char **)u_malloc (2 * sizeof(vector));
- vector[0] = u_strdup ("");
+ vector = (char **)c_malloc (2 * sizeof(vector));
+ vector[0] = c_strdup ("");
size++;
string++;
} else {
@@ -308,9 +308,9 @@ u_strsplit_set (const char *string, const char *delimiter, int max_tokens)
if (charcmp (*string, delimiter)) {
size_t toklen = (string - c);
if (toklen == 0) {
- token = u_strdup ("");
+ token = c_strdup ("");
} else {
- token = u_strndup (c, toklen);
+ token = c_strndup (c, toklen);
}
c = string + 1;
@@ -325,25 +325,25 @@ u_strsplit_set (const char *string, const char *delimiter, int 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, u_strdup (string));
+ add_to_vector (&vector, size, c_strdup (string));
size++;
}
} else {
if (*c) {
/* Fill in the trailing last token */
- add_to_vector (&vector, size, u_strdup (c));
+ add_to_vector (&vector, size, c_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, u_strdup (""));
+ add_to_vector (&vector, size, c_strdup (""));
size++;
}
}
if (vector == NULL) {
- vector = (char **) u_malloc (2 * sizeof (vector));
+ vector = (char **) c_malloc (2 * sizeof (vector));
vector [0] = NULL;
} else if (size > 0) {
vector[size - 1] = NULL;
@@ -353,7 +353,7 @@ u_strsplit_set (const char *string, const char *delimiter, int max_tokens)
}
char *
-u_strreverse (char *str)
+c_strreverse (char *str)
{
size_t i, j;
char c;
@@ -374,7 +374,7 @@ u_strreverse (char *str)
}
char *
-u_strjoin (const char *separator, ...)
+c_strjoin (const char *separator, ...)
{
va_list args;
char *res, *s, *r;
@@ -394,20 +394,20 @@ u_strjoin (const char *separator, ...)
va_end (args);
if (len == 0)
- return u_strdup ("");
+ return c_strdup ("");
/* Remove the last separator */
if (slen > 0 && len > 0)
len -= slen;
- res = u_malloc (len + 1);
+ res = c_malloc (len + 1);
va_start (args, separator);
s = va_arg (args, char *);
- r = u_stpcpy (res, s);
+ r = c_stpcpy (res, s);
for (s = va_arg (args, char *); s != NULL; s = va_arg (args, char *)){
if (separator != NULL)
- r = u_stpcpy (r, separator);
- r = u_stpcpy (r, s);
+ r = c_stpcpy (r, separator);
+ r = c_stpcpy (r, s);
}
va_end (args);
@@ -415,7 +415,7 @@ u_strjoin (const char *separator, ...)
}
char *
-u_strjoinv (const char *separator, char **str_array)
+c_strjoinv (const char *separator, char **str_array)
{
char *res, *r;
size_t slen, len, i;
@@ -432,24 +432,24 @@ u_strjoinv (const char *separator, char **str_array)
}
if (len == 0)
- return u_strdup ("");
+ return c_strdup ("");
if (slen > 0 && len > 0)
len -= slen;
- res = u_malloc (len + 1);
- r = u_stpcpy (res, str_array [0]);
+ res = c_malloc (len + 1);
+ r = c_stpcpy (res, str_array [0]);
for (i = 1; str_array [i] != NULL; i++){
if (separator != NULL)
- r = u_stpcpy (r, separator);
- r = u_stpcpy (r, str_array [i]);
+ r = c_stpcpy (r, separator);
+ r = c_stpcpy (r, str_array [i]);
}
return res;
}
char *
-u_strchug (char *str)
+c_strchug (char *str)
{
size_t len;
char *tmp;
@@ -467,7 +467,7 @@ u_strchug (char *str)
}
char *
-u_strchomp (char *str)
+c_strchomp (char *str)
{
char *tmp;
@@ -481,7 +481,7 @@ u_strchomp (char *str)
}
int
-u_printf(char const *format, ...)
+c_printf(char const *format, ...)
{
va_list args;
int ret;
@@ -494,7 +494,7 @@ u_printf(char const *format, ...)
}
int
-u_fprintf(FILE *file, char const *format, ...)
+c_fprintf(FILE *file, char const *format, ...)
{
va_list args;
int ret;
@@ -507,7 +507,7 @@ u_fprintf(FILE *file, char const *format, ...)
}
int
-u_sprintf(char *string, char const *format, ...)
+c_sprintf(char *string, char const *format, ...)
{
va_list args;
int ret;
@@ -520,7 +520,7 @@ u_sprintf(char *string, char const *format, ...)
}
int
-u_snprintf(char *string, unsigned long n, char const *format, ...)
+c_snprintf(char *string, unsigned long n, char const *format, ...)
{
va_list args;
int ret;
@@ -535,7 +535,7 @@ u_snprintf(char *string, unsigned long n, char const *format, ...)
static const char hx [] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-static uboolean
+static cboolean
char_needs_encoding (char c)
{
if (((unsigned char)c) >= 0x80)
@@ -550,26 +550,26 @@ char_needs_encoding (char c)
}
char *
-u_filename_to_uri (const char *filename, const char *hostname, UError **error)
+c_filename_to_uri (const char *filename, const char *hostname, UError **error)
{
size_t n;
char *ret, *rp;
const char *p;
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
const char *uriPrefix = "file:///";
#else
const char *uriPrefix = "file://";
#endif
- u_return_val_if_fail (filename != NULL, NULL);
+ c_return_val_if_fail (filename != NULL, NULL);
if (hostname != NULL)
- u_warning ("%s", "eglib: u_filename_to_uri: hostname not handled");
+ c_warning ("%s", "eglib: c_filename_to_uri: hostname not handled");
- if (!u_path_is_absolute (filename)){
+ if (!c_path_is_absolute (filename)){
if (error != NULL) {
- *error = u_error_new (U_CONVERT_ERROR,
- U_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
+ *error = c_error_new (C_CONVERT_ERROR,
+ C_CONVERT_ERROR_NOT_ABSOLUTE_PATH,
"Not an absolute filename");
}
@@ -578,7 +578,7 @@ u_filename_to_uri (const char *filename, const char *hostname, UError **error)
n = strlen (uriPrefix) + 1;
for (p = filename; *p; p++){
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
if (*p == '\\') {
n++;
continue;
@@ -589,10 +589,10 @@ u_filename_to_uri (const char *filename, const char *hostname, UError **error)
else
n++;
}
- ret = u_malloc (n);
+ ret = c_malloc (n);
strcpy (ret, uriPrefix);
for (p = filename, rp = ret + strlen (ret); *p; p++){
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
if (*p == '\\') {
*rp++ = '/';
continue;
@@ -618,26 +618,26 @@ decode (char p)
return p - 'A';
if (p >= 'a' && p <= 'f')
return p - 'a';
- u_assert_not_reached ();
+ c_assert_not_reached ();
return 0;
}
char *
-u_filename_from_uri (const char *uri, char **hostname, UError **error)
+c_filename_from_uri (const char *uri, char **hostname, UError **error)
{
const char *p;
char *r, *result;
int flen = 0;
- u_return_val_if_fail (uri != NULL, NULL);
+ c_return_val_if_fail (uri != NULL, NULL);
if (hostname != NULL)
- u_warning ("%s", "eglib: u_filename_from_uri: hostname not handled");
+ c_warning ("%s", "eglib: c_filename_from_uri: hostname not handled");
if (strncmp (uri, "file:///", 8) != 0){
if (error != NULL) {
- *error = u_error_new (U_CONVERT_ERROR,
- U_CONVERT_ERROR_BAD_URI,
+ *error = c_error_new (C_CONVERT_ERROR,
+ C_CONVERT_ERROR_BAD_URI,
"URI does not start with the file: scheme");
}
return NULL;
@@ -649,8 +649,8 @@ u_filename_from_uri (const char *uri, char **hostname, UError **error)
p += 2;
} else {
if (error != NULL) {
- *error = u_error_new (U_CONVERT_ERROR,
- U_CONVERT_ERROR_BAD_URI,
+ *error = c_error_new (C_CONVERT_ERROR,
+ C_CONVERT_ERROR_BAD_URI,
"URI contains an invalid escape sequence");
}
return NULL;
@@ -658,14 +658,14 @@ u_filename_from_uri (const char *uri, char **hostname, UError **error)
}
flen++;
}
-#ifndef U_OS_WIN32
+#ifndef C_OS_WIN32
flen++;
#endif
- result = u_malloc (flen + 1);
+ result = c_malloc (flen + 1);
result [flen] = 0;
-#ifndef U_OS_WIN32
+#ifndef C_OS_WIN32
*result = '/';
r = result + 1;
#else
@@ -684,9 +684,9 @@ u_filename_from_uri (const char *uri, char **hostname, UError **error)
}
void
-u_strdown (char *string)
+c_strdown (char *string)
{
- u_return_if_fail (string != NULL);
+ c_return_if_fail (string != NULL);
while (*string){
*string = (char)tolower (*string);
@@ -695,66 +695,66 @@ u_strdown (char *string)
}
char
-u_ascii_tolower (char c)
+c_ascii_tolower (char c)
{
return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
}
char *
-u_ascii_strdown (const char *str, ussize len)
+c_ascii_strdown (const char *str, ussize len)
{
char *ret;
int i;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len == -1)
len = strlen (str);
- ret = u_malloc (len + 1);
+ ret = c_malloc (len + 1);
for (i = 0; i < len; i++)
- ret [i] = (unsigned char) u_ascii_tolower (str [i]);
+ ret [i] = (unsigned char) c_ascii_tolower (str [i]);
ret [i] = 0;
return ret;
}
char
-u_ascii_toupper (char c)
+c_ascii_toupper (char c)
{
return c >= 'a' && c <= 'z' ? c + ('A' - 'a') : c;
}
char *
-u_ascii_strup (const char *str, ussize len)
+c_ascii_strup (const char *str, ussize len)
{
char *ret;
int i;
- u_return_val_if_fail (str != NULL, NULL);
+ c_return_val_if_fail (str != NULL, NULL);
if (len == -1)
len = strlen (str);
- ret = u_malloc (len + 1);
+ ret = c_malloc (len + 1);
for (i = 0; i < len; i++)
- ret [i] = (unsigned char) u_ascii_toupper (str [i]);
+ ret [i] = (unsigned char) c_ascii_toupper (str [i]);
ret [i] = 0;
return ret;
}
int
-u_ascii_strncasecmp (const char *s1, const char *s2, size_t n)
+c_ascii_strncasecmp (const char *s1, const char *s2, size_t n)
{
size_t i;
- u_return_val_if_fail (s1 != NULL, 0);
- u_return_val_if_fail (s2 != NULL, 0);
+ c_return_val_if_fail (s1 != NULL, 0);
+ c_return_val_if_fail (s2 != NULL, 0);
for (i = 0; i < n; i++) {
- char c1 = u_ascii_tolower (*s1++);
- char c2 = u_ascii_tolower (*s2++);
+ char c1 = c_ascii_tolower (*s1++);
+ char c2 = c_ascii_tolower (*s2++);
if (c1 != c2)
return c1 - c2;
@@ -764,17 +764,17 @@ u_ascii_strncasecmp (const char *s1, const char *s2, size_t n)
}
int
-u_ascii_strcasecmp (const char *s1, const char *s2)
+c_ascii_strcasecmp (const char *s1, const char *s2)
{
const char *sp1 = s1;
const char *sp2 = s2;
- u_return_val_if_fail (s1 != NULL, 0);
- u_return_val_if_fail (s2 != NULL, 0);
+ c_return_val_if_fail (s1 != NULL, 0);
+ c_return_val_if_fail (s2 != NULL, 0);
while (*sp1 != '\0') {
- char c1 = u_ascii_tolower (*sp1++);
- char c2 = u_ascii_tolower (*sp2++);
+ char c1 = c_ascii_tolower (*sp1++);
+ char c2 = c_ascii_tolower (*sp2++);
if (c1 != c2)
return c1 - c2;
@@ -784,14 +784,14 @@ u_ascii_strcasecmp (const char *s1, const char *s2)
}
char *
-u_strdelimit (char *string, const char *delimiters, char new_delimiter)
+c_strdelimit (char *string, const char *delimiters, char new_delimiter)
{
char *ptr;
- u_return_val_if_fail (string != NULL, NULL);
+ c_return_val_if_fail (string != NULL, NULL);
if (delimiters == NULL)
- delimiters = U_STR_DELIMITERS;
+ delimiters = C_STR_DELIMITERS;
for (ptr = string; *ptr; ptr++) {
if (strchr (delimiters, *ptr))
@@ -802,7 +802,7 @@ u_strdelimit (char *string, const char *delimiters, char new_delimiter)
}
size_t
-u_strlcpy (char *dest, const char *src, size_t dest_size)
+c_strlcpy (char *dest, const char *src, size_t dest_size)
{
#ifdef HAVE_STRLCPY
return strlcpy (dest, src, dest_size);
@@ -812,8 +812,8 @@ u_strlcpy (char *dest, const char *src, size_t dest_size)
char c;
size_t len;
- u_return_val_if_fail (src != NULL, 0);
- u_return_val_if_fail (dest != NULL, 0);
+ c_return_val_if_fail (src != NULL, 0);
+ c_return_val_if_fail (dest != NULL, 0);
len = dest_size;
if (len == 0)
@@ -837,10 +837,10 @@ u_strlcpy (char *dest, const char *src, size_t dest_size)
}
char *
-u_stpcpy (char *dest, const char *src)
+c_stpcpy (char *dest, const char *src)
{
- u_return_val_if_fail (dest != NULL, dest);
- u_return_val_if_fail (src != NULL, dest);
+ c_return_val_if_fail (dest != NULL, dest);
+ c_return_val_if_fail (src != NULL, dest);
#if HAVE_STPCPY
return stpcpy (dest, src);
@@ -874,7 +874,7 @@ static const char escaped_dflt [256] = {
};
char *
-u_strescape (const char *source, const char *exceptions)
+c_strescape (const char *source, const char *exceptions)
{
char escaped [256];
const char *ptr;
@@ -883,14 +883,14 @@ u_strescape (const char *source, const char *exceptions)
char *result;
char *res_ptr;
- u_return_val_if_fail (source != NULL, NULL);
+ c_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 = u_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
+ result = c_malloc (strlen (source) * 4 + 1); /* Worst case: everything octal. */
res_ptr = result;
for (ptr = source; *ptr; ptr++) {
c = *ptr;
@@ -913,7 +913,7 @@ u_strescape (const char *source, const char *exceptions)
}
int
-u_ascii_xdigit_value (char c)
+c_ascii_xdigit_value (char c)
{
return ((isxdigit (c) == 0) ? -1 :
((c >= '0' && c <= '9') ? (c - '0') :
@@ -922,11 +922,27 @@ u_ascii_xdigit_value (char c)
}
char *
-u_strnfill (size_t length, char fill_char)
+c_strnfill (size_t length, char fill_char)
{
- char *ret = u_new (char, length + 1);
+ char *ret = c_new (char, length + 1);
memset (ret, fill_char, length);
ret [length] = 0;
return ret;
}
+
+int
+c_strcmp0 (const char *str1, const char *str2)
+{
+ if (!str1)
+ {
+ if (!str2)
+ return 0;
+ return -1;
+ }
+
+ if (!str2)
+ return 1;
+
+ return strcmp (str1, str2);
+}
diff --git a/deps/ulib/src/ustring.c b/deps/clib/src/cstring.c
index c9184331..8c87c5ee 100644
--- a/deps/ulib/src/ustring.c
+++ b/deps/clib/src/cstring.c
@@ -30,26 +30,26 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
#define UROW_IF_NECESSARY(s,l) { \
if(s->len + l >= s->allocated_len) { \
s->allocated_len = (s->allocated_len + l + 16) * 2; \
- s->str = u_realloc(s->str, s->allocated_len); \
+ s->str = c_realloc(s->str, s->allocated_len); \
} \
}
-UString *
-u_string_new_len (const char *init, ussize len)
+CString *
+c_string_new_len (const char *init, ussize len)
{
- UString *ret = u_new (UString, 1);
+ CString *ret = c_new (CString, 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 = u_malloc(ret->allocated_len);
+ ret->str = c_malloc(ret->allocated_len);
if (init)
memcpy(ret->str, init, ret->len);
ret->str[ret->len] = 0;
@@ -57,18 +57,18 @@ u_string_new_len (const char *init, ussize len)
return ret;
}
-UString *
-u_string_new (const char *init)
+CString *
+c_string_new (const char *init)
{
- return u_string_new_len(init, -1);
+ return c_string_new_len(init, -1);
}
-UString *
-u_string_sized_new (size_t default_size)
+CString *
+c_string_sized_new (size_t default_size)
{
- UString *ret = u_new (UString, 1);
+ CString *ret = c_new (CString, 1);
- ret->str = u_malloc (default_size);
+ ret->str = c_malloc (default_size);
ret->str [0] = 0;
ret->len = 0;
ret->allocated_len = default_size;
@@ -77,42 +77,42 @@ u_string_sized_new (size_t default_size)
}
char *
-u_string_free (UString *string, uboolean free_segment)
+c_string_free (CString *string, cboolean free_segment)
{
char *data;
- u_return_val_if_fail (string != NULL, NULL);
+ c_return_val_if_fail (string != NULL, NULL);
data = string->str;
- u_free(string);
+ c_free(string);
if(!free_segment) {
return data;
}
- u_free(data);
+ c_free(data);
return NULL;
}
-UString *
-u_string_assign (UString *string, const char *val)
+CString *
+c_string_assign (CString *string, const char *val)
{
- u_return_val_if_fail(string != NULL, NULL);
- u_return_val_if_fail(val != NULL, string);
+ c_return_val_if_fail(string != NULL, NULL);
+ c_return_val_if_fail(val != NULL, string);
if (string->str == val)
return string;
- u_string_truncate (string, 0);
- u_string_append (string, val);
+ c_string_truncate (string, 0);
+ c_string_append (string, val);
return string;
}
-UString *
-u_string_append_len (UString *string, const char *val, ussize len)
+CString *
+c_string_append_len (CString *string, const char *val, ussize len)
{
- u_return_val_if_fail(string != NULL, NULL);
- u_return_val_if_fail(val != NULL, string);
+ c_return_val_if_fail(string != NULL, NULL);
+ c_return_val_if_fail(val != NULL, string);
if(len < 0) {
len = strlen(val);
@@ -126,19 +126,19 @@ u_string_append_len (UString *string, const char *val, ussize len)
return string;
}
-UString *
-u_string_append (UString *string, const char *val)
+CString *
+c_string_append (CString *string, const char *val)
{
- u_return_val_if_fail(string != NULL, NULL);
- u_return_val_if_fail(val != NULL, string);
+ c_return_val_if_fail(string != NULL, NULL);
+ c_return_val_if_fail(val != NULL, string);
- return u_string_append_len(string, val, -1);
+ return c_string_append_len(string, val, -1);
}
-UString *
-u_string_append_c (UString *string, char c)
+CString *
+c_string_append_c (CString *string, char c)
{
- u_return_val_if_fail(string != NULL, NULL);
+ c_return_val_if_fail(string != NULL, NULL);
UROW_IF_NECESSARY(string, 1);
@@ -149,27 +149,27 @@ u_string_append_c (UString *string, char c)
return string;
}
-UString *
-u_string_append_unichar (UString *string, uunichar c)
+CString *
+c_string_append_unichar (CString *string, cunichar c)
{
char utf8[6];
int len;
- u_return_val_if_fail (string != NULL, NULL);
+ c_return_val_if_fail (string != NULL, NULL);
- if ((len = u_unichar_to_utf8 (c, utf8)) <= 0)
+ if ((len = c_unichar_to_utf8 (c, utf8)) <= 0)
return string;
- return u_string_append_len (string, utf8, len);
+ return c_string_append_len (string, utf8, len);
}
-UString *
-u_string_prepend (UString *string, const char *val)
+CString *
+c_string_prepend (CString *string, const char *val)
{
ussize len;
- u_return_val_if_fail (string != NULL, string);
- u_return_val_if_fail (val != NULL, string);
+ c_return_val_if_fail (string != NULL, string);
+ c_return_val_if_fail (val != NULL, string);
len = strlen (val);
@@ -180,14 +180,14 @@ u_string_prepend (UString *string, const char *val)
return string;
}
-UString *
-u_string_insert (UString *string, ussize pos, const char *val)
+CString *
+c_string_insert (CString *string, ussize pos, const char *val)
{
ussize len;
- 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);
+ c_return_val_if_fail (string != NULL, string);
+ c_return_val_if_fail (val != NULL, string);
+ c_return_val_if_fail (pos <= string->len, string);
len = strlen (val);
@@ -199,57 +199,57 @@ u_string_insert (UString *string, ussize pos, const char *val)
}
void
-u_string_append_printf (UString *string, const char *format, ...)
+c_string_append_printf (CString *string, const char *format, ...)
{
char *ret;
va_list args;
- u_return_if_fail (string != NULL);
- u_return_if_fail (format != NULL);
+ c_return_if_fail (string != NULL);
+ c_return_if_fail (format != NULL);
va_start (args, format);
- ret = u_strdup_vprintf (format, args);
+ ret = c_strdup_vprintf (format, args);
va_end (args);
- u_string_append (string, ret);
+ c_string_append (string, ret);
- u_free (ret);
+ c_free (ret);
}
void
-u_string_append_vprintf (UString *string, const char *format, va_list args)
+c_string_append_vprintf (CString *string, const char *format, va_list args)
{
char *ret;
- u_return_if_fail (string != NULL);
- u_return_if_fail (format != NULL);
+ c_return_if_fail (string != NULL);
+ c_return_if_fail (format != NULL);
- ret = u_strdup_vprintf (format, args);
- u_string_append (string, ret);
- u_free (ret);
+ ret = c_strdup_vprintf (format, args);
+ c_string_append (string, ret);
+ c_free (ret);
}
void
-u_string_printf (UString *string, const char *format, ...)
+c_string_printf (CString *string, const char *format, ...)
{
va_list args;
- u_return_if_fail (string != NULL);
- u_return_if_fail (format != NULL);
+ c_return_if_fail (string != NULL);
+ c_return_if_fail (format != NULL);
- u_free (string->str);
+ c_free (string->str);
va_start (args, format);
- string->str = u_strdup_vprintf (format, args);
+ string->str = c_strdup_vprintf (format, args);
va_end (args);
string->len = strlen (string->str);
string->allocated_len = string->len+1;
}
-UString *
-u_string_truncate (UString *string, size_t len)
+CString *
+c_string_truncate (CString *string, size_t len)
{
- u_return_val_if_fail (string != NULL, string);
+ c_return_val_if_fail (string != NULL, string);
/* Silent return */
if (len >= string->len)
@@ -260,10 +260,10 @@ u_string_truncate (UString *string, size_t len)
return string;
}
-UString *
-u_string_set_size (UString *string, size_t len)
+CString *
+c_string_set_size (CString *string, size_t len)
{
- u_return_val_if_fail (string != NULL, string);
+ c_return_val_if_fail (string != NULL, string);
UROW_IF_NECESSARY(string, len);
@@ -272,10 +272,10 @@ u_string_set_size (UString *string, size_t len)
return string;
}
-UString *
-u_string_erase (UString *string, ussize pos, ussize len)
+CString *
+c_string_erase (CString *string, ussize pos, ussize len)
{
- u_return_val_if_fail (string != NULL, string);
+ c_return_val_if_fail (string != NULL, string);
/* Silent return */
if (pos >= string->len)
diff --git a/deps/ulib/src/utimer-unix.c b/deps/clib/src/ctimer-unix.c
index c895d201..50c34ec6 100644
--- a/deps/ulib/src/utimer-unix.c
+++ b/deps/clib/src/ctimer-unix.c
@@ -28,7 +28,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <sys/time.h>
struct _UTimer {
@@ -36,46 +36,46 @@ struct _UTimer {
struct timeval stop;
};
-UTimer *u_timer_new (void)
+UTimer *c_timer_new (void)
{
UTimer *timer;
- timer = u_new0 (UTimer, 1);
- u_timer_start (timer);
+ timer = c_new0 (UTimer, 1);
+ c_timer_start (timer);
return timer;
}
void
-u_timer_destroy (UTimer *timer)
+c_timer_destroy (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
- u_free (timer);
+ c_return_if_fail (timer != NULL);
+ c_free (timer);
}
void
-u_timer_start (UTimer *timer)
+c_timer_start (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
+ c_return_if_fail (timer != NULL);
gettimeofday (&timer->start, NULL);
memset (&timer->stop, 0, sizeof (struct timeval));
}
void
-u_timer_stop (UTimer *timer)
+c_timer_stop (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
+ c_return_if_fail (timer != NULL);
gettimeofday (&timer->stop, NULL);
}
double
-u_timer_elapsed (UTimer *timer, unsigned long *microseconds)
+c_timer_elapsed (UTimer *timer, unsigned long *microseconds)
{
struct timeval tv;
unsigned long seconds;
long usec;
double result;
- u_return_val_if_fail (timer != NULL, 0.0);
+ c_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/ulib/src/utimer-win32.c b/deps/clib/src/ctimer-win32.c
index b181ab86..8014c6a8 100644
--- a/deps/ulib/src/utimer-win32.c
+++ b/deps/clib/src/ctimer-win32.c
@@ -28,7 +28,7 @@
#include <config.h>
-#include <ulib.h>
+#include <clib.h>
#include <windows.h>
struct _UTimer {
@@ -36,40 +36,40 @@ struct _UTimer {
uint64_t stop;
};
-UTimer *u_timer_new (void)
+UTimer *c_timer_new (void)
{
UTimer *timer;
- timer = u_new0 (UTimer, 1);
- u_timer_start (timer);
+ timer = c_new0 (UTimer, 1);
+ c_timer_start (timer);
return timer;
}
void
-u_timer_destroy (UTimer *timer)
+c_timer_destroy (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
- u_free (timer);
+ c_return_if_fail (timer != NULL);
+ c_free (timer);
}
void
-u_timer_start (UTimer *timer)
+c_timer_start (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
+ c_return_if_fail (timer != NULL);
QueryPerformanceCounter ((LARGE_INTEGER*)&timer->start);
}
void
-u_timer_stop (UTimer *timer)
+c_timer_stop (UTimer *timer)
{
- u_return_if_fail (timer != NULL);
+ c_return_if_fail (timer != NULL);
QueryPerformanceCounter ((LARGE_INTEGER*)&timer->stop);
}
double
-u_timer_elapsed (UTimer *timer, unsigned long *microseconds)
+c_timer_elapsed (UTimer *timer, unsigned long *microseconds)
{
static uint64_t freq = 0;
uint64_t delta, stop;
diff --git a/deps/ulib/src/uunicode.c b/deps/clib/src/cunicode.c
index b6de1659..5280e084 100644
--- a/deps/ulib/src/uunicode.c
+++ b/deps/clib/src/cunicode.c
@@ -35,11 +35,11 @@
*/
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.h>
#include <unicode-data.h>
#include <errno.h>
-#if defined(_MSC_VER) || defined(U_OS_WIN32)
+#if defined(_MSC_VER) || defined(C_OS_WIN32)
/* FIXME */
# define CODESET 1
# include <windows.h>
@@ -53,14 +53,14 @@
#endif
static const char *my_charset;
-static uboolean is_utf8;
+static cboolean is_utf8;
/*
* Character set conversion
*/
UUnicodeType
-u_unichar_type (uunichar c)
+c_unichar_type (cunichar c)
{
int i;
@@ -84,15 +84,15 @@ u_unichar_type (uunichar c)
// 100000-10FFFD OtherPrivateUse
*/
if (0x3400 <= cp && cp < 0x4DB5)
- return U_UNICODE_OTHER_LETTER;
+ return C_UNICODE_OTHER_LETTER;
if (0x4E00 <= cp && cp < 0x9FC3)
- return U_UNICODE_OTHER_LETTER;
+ return C_UNICODE_OTHER_LETTER;
if (0xAC00<= cp && cp < 0xD7A3)
- return U_UNICODE_OTHER_LETTER;
+ return C_UNICODE_OTHER_LETTER;
if (0xD800 <= cp && cp < 0xDFFF)
- return U_UNICODE_SURROGATE;
+ return C_UNICODE_SURROGATE;
if (0xE000 <= cp && cp < 0xF8FF)
- return U_UNICODE_PRIVATE_USE;
+ return C_UNICODE_PRIVATE_USE;
/* since the argument is UTF-16, we cannot check beyond FFFF */
/* It should match any of above */
@@ -100,14 +100,14 @@ u_unichar_type (uunichar c)
}
UUnicodeBreakType
-u_unichar_break_type (uunichar c)
+c_unichar_break_type (cunichar c)
{
// MOONLIGHT_FIXME
- return U_UNICODE_BREAK_UNKNOWN;
+ return C_UNICODE_BREAK_UNKNOWN;
}
-uunichar
-u_unichar_case (uunichar c, uboolean upper)
+cunichar
+c_unichar_case (cunichar c, cboolean upper)
{
int8_t i, i2;
uint32_t cp = (uint32_t) c, v;
@@ -126,25 +126,25 @@ u_unichar_case (uunichar c, uboolean upper)
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 ? (uunichar) v : c;
+ return v != 0 ? (cunichar) v : c;
}
return c;
}
-uunichar
-u_unichar_toupper (uunichar c)
+cunichar
+c_unichar_toupper (cunichar c)
{
- return u_unichar_case (c, TRUE);
+ return c_unichar_case (c, TRUE);
}
-uunichar
-u_unichar_tolower (uunichar c)
+cunichar
+c_unichar_tolower (cunichar c)
{
- return u_unichar_case (c, FALSE);
+ return c_unichar_case (c, FALSE);
}
-uunichar
-u_unichar_totitle (uunichar c)
+cunichar
+c_unichar_totitle (cunichar c)
{
uint8_t i;
uint32_t cp;
@@ -157,18 +157,18 @@ u_unichar_totitle (uunichar c)
/* it is ordered, hence no more match */
break;
}
- return u_unichar_toupper (c);
+ return c_unichar_toupper (c);
}
-uboolean
-u_unichar_isxdigit (uunichar c)
+cboolean
+c_unichar_isxdigit (cunichar c)
{
- return (u_unichar_xdigit_value (c) != -1);
+ return (c_unichar_xdigit_value (c) != -1);
}
int
-u_unichar_xdigit_value (uunichar c)
+c_unichar_xdigit_value (cunichar c)
{
if (c >= 0x30 && c <= 0x39) /*0-9*/
return (c - 0x30);
@@ -179,13 +179,13 @@ u_unichar_xdigit_value (uunichar c)
return -1;
}
-uboolean
-u_unichar_isspace (uunichar c)
+cboolean
+c_unichar_isspace (cunichar c)
{
- UUnicodeType type = u_unichar_type (c);
- if (type == U_UNICODE_LINE_SEPARATOR ||
- type == U_UNICODE_PARAGRAPH_SEPARATOR ||
- type == U_UNICODE_SPACE_SEPARATOR)
+ UUnicodeType type = c_unichar_type (c);
+ if (type == C_UNICODE_LINE_SEPARATOR ||
+ type == C_UNICODE_PARAGRAPH_SEPARATOR ||
+ type == C_UNICODE_SPACE_SEPARATOR)
return TRUE;
return FALSE;
@@ -196,23 +196,23 @@ u_unichar_isspace (uunichar c)
* This is broken, and assumes an UTF8 system, but will do for eglib's first user
*/
char *
-u_filename_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read, size_t *bytes_written, UError **error)
+c_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 = u_malloc (len + 1);
- u_strlcpy (res, utf8string, len + 1);
+ res = c_malloc (len + 1);
+ c_strlcpy (res, utf8string, len + 1);
return res;
}
-uboolean
-u_get_charset (U_CONST_RETURN char **charset)
+cboolean
+c_get_charset (C_CONST_RETURN char **charset)
{
if (my_charset == NULL) {
-#ifdef U_OS_WIN32
+#ifdef C_OS_WIN32
static char buf [14];
sprintf (buf, "CP%u", UetACP ());
my_charset = buf;
@@ -237,17 +237,17 @@ 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)
+c_locale_to_utf8 (const char *opsysstring, ussize len, size_t *bytes_read, size_t *bytes_written, UError **error)
{
- u_get_charset (NULL);
+ c_get_charset (NULL);
- return u_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
+ return c_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error);
}
char *
-u_locale_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read, size_t *bytes_written, UError **error)
+c_locale_from_utf8 (const char *utf8string, ussize len, size_t *bytes_read, size_t *bytes_written, UError **error)
{
- u_get_charset (NULL);
+ c_get_charset (NULL);
- return u_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
+ return c_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error);
}
diff --git a/deps/ulib/src/uutf8.c b/deps/clib/src/cutf8.c
index 1b82380a..5eb92ced 100644
--- a/deps/ulib/src/uutf8.c
+++ b/deps/clib/src/cutf8.c
@@ -12,7 +12,7 @@
#include <config.h>
#include <stdio.h>
-#include <ulib.h>
+#include <clib.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 unsigned char u_utf8_jump_table[256] = {
+const unsigned char c_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,
@@ -34,34 +34,34 @@ const unsigned char u_utf8_jump_table[256] = {
};
static char *
-utf8_case_conv (const char *str, ussize len, uboolean upper)
+utf8_case_conv (const char *str, ussize len, cboolean upper)
{
- uunichar *ustr;
+ cunichar *ustr;
long i, ulen;
char *utf8;
- ustr = u_utf8_to_ucs4_fast (str, (long) len, &ulen);
+ ustr = c_utf8_to_ucs4_fast (str, (long) len, &ulen);
for (i = 0; i < ulen; i++)
- 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);
+ ustr[i] = upper ? c_unichar_toupper (ustr[i]) : c_unichar_tolower (ustr[i]);
+ utf8 = c_ucs4_to_utf8 (ustr, ulen, NULL, NULL, NULL);
+ c_free (ustr);
return utf8;
}
char *
-u_utf8_strup (const char *str, ussize len)
+c_utf8_strup (const char *str, ussize len)
{
return utf8_case_conv (str, len, TRUE);
}
char *
-u_utf8_strdown (const char *str, ussize len)
+c_utf8_strdown (const char *str, ussize len)
{
return utf8_case_conv (str, len, FALSE);
}
-static uboolean
+static cboolean
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)
}
/**
- * u_utf8_validate:
+ * c_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,11 +122,11 @@ utf8_validate (const unsigned char *inptr, size_t len)
*
* Return value: %TRUE if @str is valid or %FALSE otherwise.
**/
-uboolean
-u_utf8_validate (const char *str, ussize max_len, const char **end)
+cboolean
+c_utf8_validate (const char *str, ussize max_len, const char **end)
{
unsigned char *inptr = (unsigned char *) str;
- uboolean valid = TRUE;
+ cboolean valid = TRUE;
unsigned int length, min;
ussize n = 0;
@@ -135,7 +135,7 @@ u_utf8_validate (const char *str, ussize max_len, const char **end)
if (max_len < 0) {
while (*inptr != 0) {
- length = u_utf8_jump_table[*inptr];
+ length = c_utf8_jump_table[*inptr];
if (!utf8_validate (inptr, length)) {
valid = FALSE;
break;
@@ -152,7 +152,7 @@ u_utf8_validate (const char *str, ussize max_len, const char **end)
break;
}
- length = u_utf8_jump_table[*inptr];
+ length = c_utf8_jump_table[*inptr];
min = MIN (length, max_len - n);
if (!utf8_validate (inptr, min)) {
@@ -176,11 +176,11 @@ u_utf8_validate (const char *str, ussize max_len, const char **end)
return valid;
}
-uunichar
-u_utf8_get_char_validated (const char *str, ussize max_len)
+cunichar
+c_utf8_get_char_validated (const char *str, ussize max_len)
{
unsigned char *inptr = (unsigned char *) str;
- uunichar u = *inptr;
+ cunichar u = *inptr;
int n, i;
if (max_len == 0)
@@ -228,7 +228,7 @@ u_utf8_get_char_validated (const char *str, ussize max_len)
}
long
-u_utf8_strlen (const char *str, ussize max_len)
+c_utf8_strlen (const char *str, ussize max_len)
{
const unsigned char *inptr = (const unsigned char *) str;
long clen = 0, len = 0, n;
@@ -238,12 +238,12 @@ u_utf8_strlen (const char *str, ussize max_len)
if (max_len < 0) {
while (*inptr) {
- inptr += u_utf8_jump_table[*inptr];
+ inptr += c_utf8_jump_table[*inptr];
len++;
}
} else {
while (len < max_len && *inptr) {
- n = u_utf8_jump_table[*inptr];
+ n = c_utf8_jump_table[*inptr];
if ((clen + n) > max_len)
break;
@@ -256,11 +256,11 @@ u_utf8_strlen (const char *str, ussize max_len)
return len;
}
-uunichar
-u_utf8_get_char (const char *src)
+cunichar
+c_utf8_get_char (const char *src)
{
unsigned char *inptr = (unsigned char *) src;
- uunichar u = *inptr;
+ cunichar u = *inptr;
int n, i;
if (u < 0x80) {
@@ -290,7 +290,7 @@ u_utf8_get_char (const char *src)
}
char *
-u_utf8_find_prev_char (const char *str, const char *p)
+c_utf8_find_prev_char (const char *str, const char *p)
{
while (p > str) {
p--;
@@ -301,7 +301,7 @@ u_utf8_find_prev_char (const char *str, const char *p)
}
char *
-u_utf8_prev_char (const char *str)
+c_utf8_prev_char (const char *str)
{
const char *p = str;
do {
@@ -312,13 +312,13 @@ u_utf8_prev_char (const char *str)
}
char *
-u_utf8_offset_to_pointer (const char *str, long offset)
+c_utf8_offset_to_pointer (const char *str, long offset)
{
const char *p = str;
if (offset > 0) {
do {
- p = u_utf8_next_char (p);
+ p = c_utf8_next_char (p);
offset --;
} while (offset > 0);
}
@@ -338,7 +338,7 @@ u_utf8_offset_to_pointer (const char *str, long offset)
// by going forward
p = jump;
do {
- p = u_utf8_next_char (p);
+ p = c_utf8_next_char (p);
offset ++;
} while (p < jump);
@@ -349,7 +349,7 @@ u_utf8_offset_to_pointer (const char *str, long offset)
}
long
-u_utf8_pointer_to_offset (const char *str, const char *pos)
+c_utf8_pointer_to_offset (const char *str, const char *pos)
{
const char *inptr, *inend;
long offset = 0;
@@ -368,7 +368,7 @@ u_utf8_pointer_to_offset (const char *str, const char *pos)
}
do {
- inptr = u_utf8_next_char (inptr);
+ inptr = c_utf8_next_char (inptr);
offset++;
} while (inptr < inend);
diff --git a/deps/ulib/src/sort.frag.h b/deps/clib/src/sort.frag.h
index 644e2d7c..45ab3529 100644
--- a/deps/ulib/src/sort.frag.h
+++ b/deps/clib/src/sort.frag.h
@@ -50,14 +50,14 @@ typedef list_node *digit;
struct sort_info
{
int min_rank, n_ranks;
- UCompareFunc func;
+ CCompareFunc 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, UCompareFunc func)
+init_sort_info (struct sort_info *si, CCompareFunc func)
{
si->min_rank = si->n_ranks = 0;
si->func = func;
@@ -65,7 +65,7 @@ init_sort_info (struct sort_info *si, UCompareFunc func)
}
static inline list_node *
-merge_lists (list_node *first, list_node *second, UCompareFunc func)
+merge_lists (list_node *first, list_node *second, CCompareFunc 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) {
- u_warning ("Rank '%d' should not exceed " stringify (MAX_RANKS), rank);
+ c_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, UCompareFunc func)
+do_sort (list_node* list, CCompareFunc func)
{
struct sort_info si;
diff --git a/deps/ulib/src/ulib-config.hw b/deps/clib/src/ulib-config.hw
index e1881b20..e1881b20 100644
--- a/deps/ulib/src/ulib-config.hw
+++ b/deps/clib/src/ulib-config.hw
diff --git a/deps/ulib/src/unicode-data.h b/deps/clib/src/unicode-data.h
index 3ff43974..c7075f19 100644
--- a/deps/ulib/src/unicode-data.h
+++ b/deps/clib/src/unicode-data.h
@@ -7,7 +7,7 @@ The source for this generator should be in Mono repository
#ifndef __UNICODE_DATA_H
#define __UNICODE_DATA_H
-#include <ulib.h>
+#include <clib.h>
/* ======== Structures ======== */
diff --git a/deps/ulib/src/vasprintf.c b/deps/clib/src/vasprintf.c
index 297afbe0..297afbe0 100644
--- a/deps/ulib/src/vasprintf.c
+++ b/deps/clib/src/vasprintf.c
diff --git a/deps/ulib/test/.gitignore b/deps/clib/test/.gitignore
index 2d669e10..2d669e10 100644
--- a/deps/ulib/test/.gitignore
+++ b/deps/clib/test/.gitignore
diff --git a/deps/ulib/winconfig.h b/deps/clib/winconfig.h
index fdab3dda..fdab3dda 100755
--- a/deps/ulib/winconfig.h
+++ b/deps/clib/winconfig.h
diff --git a/deps/ulib/Makefile.am b/deps/ulib/Makefile.am
deleted file mode 100644
index b5ec1496..00000000
--- a/deps/ulib/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-if HOST_WIN32
-SUBDIRS = src
-else
-if PLATFORM_DARWIN
-SUBDIRS = src
-else
-if CROSS_COMPILING
-SUBDIRS = src
-else
-SUBDIRS = src test
-endif
-endif
-endif
-
-EXTRA_DIST = README winconfig.h
diff --git a/deps/ulib/src/Makefile.am b/deps/ulib/src/Makefile.am
deleted file mode 100644
index e14adf9d..00000000
--- a/deps/ulib/src/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-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 $(LTLIBICONV) -lpsapi
-else
-if PLATFORM_ANDROID
-libulib_la_LIBADD = -llog
-endif
-endif
-
-libulib_static_la_LIBADD = $(libulib_la_LIBADD) $(LTLIBICONV)
-libulib_static_la_LDFLAGS = -static
-
-MAINTAINERCLEANFILES = Makefile.in
-
-EXTRA_DIST = ulib-config.h.in $(win_files) $(unix_files)
diff --git a/deps/ulib/src/ulib-config.h.in b/deps/ulib/src/ulib-config.h.in
deleted file mode 100644
index b7cfeb13..00000000
--- a/deps/ulib/src/ulib-config.h.in
+++ /dev/null
@@ -1,19 +0,0 @@
-#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.h b/deps/ulib/src/ulib.h
deleted file mode 100644
index 9890f7e4..00000000
--- a/deps/ulib/src/ulib.h
+++ /dev/null
@@ -1,1285 +0,0 @@
-#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/ulib/src/umodule.h b/deps/ulib/src/umodule.h
deleted file mode 100644
index 0c78fab0..00000000
--- a/deps/ulib/src/umodule.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#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/ulib/test/Makefile.am b/deps/ulib/test/Makefile.am
deleted file mode 100644
index 99cc02aa..00000000
--- a/deps/ulib/test/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-EXTRA_DIST = UTF-8.txt UTF-16BE.txt UTF-16LE.txt UTF-32BE.txt UTF-32LE.txt
-
-SOURCES = \
- test.c \
- test.h \
- tests.h \
- driver.c \
- hashtable.c \
- string-util.c \
- string.c \
- slist.c \
- sizes.c \
- ptrarray.c \
- list.c \
- array.c \
- fake.c \
- path.c \
- queue.c \
- shell.c \
- spawn.c \
- timer.c \
- file.c \
- dir.c \
- unicode.c \
- utf8.c \
- endian.c \
- module.c \
- memory.c
-
-AM_CPPFLAGS = \
- -I$(top_builddir) \
- -I$(top_srcdir) \
- -I$(srcdir) \
- -Wall \
- $(NULL)
-
-test_ulib_SOURCES = $(SOURCES)
-
-test_ulib_CFLAGS = -DULIB_TESTS=1 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
-test_ulib_LDADD = ../src/libulib.la $(LTLIBICONV)
-
-run-ulib: all
- srcdir=`readlink -f $(srcdir)` ./test-ulib
-
-noinst_PROGRAMS = test-ulib
-
-run-both: run-ulib
-
-MAINTAINERCLEANFILES = Makefile.in
diff --git a/deps/ulib/test/README b/deps/ulib/test/README
deleted file mode 100644
index 268010a2..00000000
--- a/deps/ulib/test/README
+++ /dev/null
@@ -1,113 +0,0 @@
-EGlib Unit Testing
-===============================================================================
-
- 1. Writing new tests
- 2. Using the test driver
-
-===============================================================================
-1. Writing new tests
-===============================================================================
-
-Tests are easy to write, but must be grouped in to logical cases. For instance,
-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
-three elements:
-
- #include <glib.h>
- #include "test.h"
-
- ...
- <define test implementations>
- ...
-
- static Test groupname_tests [] = {
- {"groupname_test1", groupname_test1},
- {"groupname_test1", groupname_test2},
- {NULL, NULL}
- };
-
- DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)
-
-A test implementation should look like:
-
- RESULT groupname_test1()
- {
- <perform the test>
-
- if(test_failed) {
- return FAILED("reason: %s", "this works like printf");
- }
-
- return OK; /* just NULL, but OK is cute */
- }
-
-Once a test group is written, it needs to be added to the groups table
-in tests.h:
-
- DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl
-
- static Group test_groups [] = {
- ...
- {"groupname", groupname_tests_init}
- ...
- };
-
-===============================================================================
-2. Using the test driver
-===============================================================================
-
-When tests are written, they are rebuilt with make. Two programs will be
-built:
-
- test-eglib: the test driver and tests linked against eglib
- test-glib: the test driver and tests linked against system glib-2.0
-
-Each driver program works exactly the same. Running test-eglib will run
-the tests against eglib, and test-glib against glib-2.0.
-
-The test driver supports a few options to allow for performance measuring:
-
- --help show all options and available test groups
- --time time the overall run and report it, even if --quiet is set
- --quiet do not print test results, useful for timing
- --iterations N run all or specified test groups N times
-
-Run "test-eglib --help" for more details.
-
-Example: run the ptrarray test group 100000 times and only print the time
- it took to perform all iterations
-
- ./test-eglib -tqi 100000 ptrarray
-
-Example: show single iteration of test output for two groups
-
- ./test-eglib ptrarray hashtable
-
-Example: show test output of all available groups
-
- ./test-eglib
-
-The 'test-both' script can be used to run both test-eglib and test-glib
-with the same options back to back:
-
- $ ./test-both -tqi 100000 ptrarray
- EGlib Total Time: 1.1961s
- GLib Total Time: 0.955957s
-
-test-both also has a nice --speed-compare mode that shows comparison
-information about EGlib vs GLib. It can run all tests or specific tests
-with a configurable number of iterations. --speed-compare mode always runs
-the drivers with -qtni
-
-The syntax for --speed-compare is:
-
- ./test-both --speed-compare [ITERATIONS] [GROUPS...]
-
- $ ./test-both --speed-compare Runs all tests with default iterations
- $ ./test-both --speed-compare 500 Runs all tests with 500 iterations
- $ ./test-both --speed-compare ptrarray Runs ptrarray test with default
- iterations
-
-
diff --git a/deps/ulib/test/UTF-16BE.txt b/deps/ulib/test/UTF-16BE.txt
deleted file mode 100644
index b7e494cb..00000000
--- a/deps/ulib/test/UTF-16BE.txt
+++ /dev/null
Binary files differ
diff --git a/deps/ulib/test/UTF-16LE.txt b/deps/ulib/test/UTF-16LE.txt
deleted file mode 100644
index 30fe7b06..00000000
--- a/deps/ulib/test/UTF-16LE.txt
+++ /dev/null
Binary files differ
diff --git a/deps/ulib/test/UTF-32BE.txt b/deps/ulib/test/UTF-32BE.txt
deleted file mode 100644
index a1fd5437..00000000
--- a/deps/ulib/test/UTF-32BE.txt
+++ /dev/null
Binary files differ
diff --git a/deps/ulib/test/UTF-32LE.txt b/deps/ulib/test/UTF-32LE.txt
deleted file mode 100644
index 043afc99..00000000
--- a/deps/ulib/test/UTF-32LE.txt
+++ /dev/null
Binary files differ
diff --git a/deps/ulib/test/UTF-8.txt b/deps/ulib/test/UTF-8.txt
deleted file mode 100644
index 4363f27b..00000000
--- a/deps/ulib/test/UTF-8.txt
+++ /dev/null
@@ -1,212 +0,0 @@
-
-UTF-8 encoded sample plain-text file
-‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-Markus Kuhn [ˈmaʳkʊs kuːn] <http://www.cl.cam.ac.uk/~mgk25/> — 2002-07-25
-
-
-The ASCII compatible UTF-8 encoding used in this plain-text file
-is defined in Unicode, ISO 10646-1, and RFC 2279.
-
-
-Using Unicode/UTF-8, you can write in emails and source code things such as
-
-Mathematics and sciences:
-
- ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ⎧⎡⎛┌─────┐⎞⎤⎫
- ⎪⎢⎜│a²+b³ ⎟⎥⎪
- ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), ⎪⎢⎜│───── ⎟⎥⎪
- ⎪⎢⎜⎷ c₈ ⎟⎥⎪
- ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⎨⎢⎜ ⎟⎥⎬
- ⎪⎢⎜ ∞ ⎟⎥⎪
- ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (⟦A⟧ ⇔ ⟪B⟫), ⎪⎢⎜ ⎲ ⎟⎥⎪
- ⎪⎢⎜ ⎳aⁱ-bⁱ⎟⎥⎪
- 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm ⎩⎣⎝i=1 ⎠⎦⎭
-
-Linguistics and dictionaries:
-
- ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn
- Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ]
-
-APL:
-
- ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈
-
-Nicer typography in plain text files:
-
- ╔══════════════════════════════════════════╗
- ║ ║
- ║ • ‘single’ and “double” quotes ║
- ║ ║
- ║ • Curly apostrophes: “We’ve been here” ║
- ║ ║
- ║ • Latin-1 apostrophe and accents: '´` ║
- ║ ║
- ║ • ‚deutsche‘ „Anführungszeichen“ ║
- ║ ║
- ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║
- ║ ║
- ║ • ASCII safety test: 1lI|, 0OD, 8B ║
- ║ ╭─────────╮ ║
- ║ • the euro symbol: │ 14.95 € │ ║
- ║ ╰─────────╯ ║
- ╚══════════════════════════════════════════╝
-
-Combining characters:
-
- STARGΛ̊TE SG-1, a = v̇ = r̈, a⃑ ⊥ b⃑
-
-Greek (in Polytonic):
-
- The Greek anthem:
-
- Σὲ γνωρίζω ἀπὸ τὴν κόψη
- τοῦ σπαθιοῦ τὴν τρομερή,
- σὲ γνωρίζω ἀπὸ τὴν ὄψη
- ποὺ μὲ βία μετράει τὴ γῆ.
-
- ᾿Απ᾿ τὰ κόκκαλα βγαλμένη
- τῶν ῾Ελλήνων τὰ ἱερά
- καὶ σὰν πρῶτα ἀνδρειωμένη
- χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά!
-
- From a speech of Demosthenes in the 4th century BC:
-
- Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι,
- ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς
- λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ
- τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿
- εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ
- πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν
- οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι,
- οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν
- ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον
- τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι
- γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν
- προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους
- σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ
- τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ
- τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς
- τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον.
-
- Δημοσθένους, Γ´ ᾿Ολυνθιακὸς
-
-Georgian:
-
- From a Unicode conference invitation:
-
- გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო
- კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს,
- ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს
- ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი,
- ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება
- ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში,
- ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში.
-
-Russian:
-
- From a Unicode conference invitation:
-
- Зарегистрируйтесь сейчас на Десятую Международную Конференцию по
- Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии.
- Конференция соберет широкий круг экспертов по вопросам глобального
- Интернета и Unicode, локализации и интернационализации, воплощению и
- применению Unicode в различных операционных системах и программных
- приложениях, шрифтах, верстке и многоязычных компьютерных системах.
-
-Thai (UCS Level 2):
-
- Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese
- classic 'San Gua'):
-
- [----------------------------|------------------------]
- ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่
- สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา
- ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา
- โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ
- เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ
- ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ
- พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้
- ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ
-
- (The above is a two-column text. If combining characters are handled
- correctly, the lines of the second column should be aligned with the
- | character above.)
-
-Ethiopian:
-
- Proverbs in the Amharic language:
-
- ሰማይ አይታረስ ንጉሥ አይከሰስ።
- ብላ ካለኝ እንደአባቴ በቆመጠኝ።
- ጌጥ ያለቤቱ ቁምጥና ነው።
- ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው።
- የአፍ ወለምታ በቅቤ አይታሽም።
- አይጥ በበላ ዳዋ ተመታ።
- ሲተረጉሙ ይደረግሙ።
- ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል።
- ድር ቢያብር አንበሳ ያስር።
- ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም።
- እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም።
- የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ።
- ሥራ ከመፍታት ልጄን ላፋታት።
- ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል።
- የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ።
- ተንጋሎ ቢተፉ ተመልሶ ባፉ።
- ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው።
- እግርህን በፍራሽህ ልክ ዘርጋ።
-
-Runes:
-
- ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ
-
- (Old English, which transcribed into Latin reads 'He cwaeth that he
- bude thaem lande northweardum with tha Westsae.' and means 'He said
- that he lived in the northern land near the Western Sea.')
-
-Braille:
-
- ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌
-
- ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞
- ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎
- ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂
- ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙
- ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑
- ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲
-
- ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
-
- ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹
- ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞
- ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕
- ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹
- ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎
- ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎
- ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳
- ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞
- ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲
-
- (The first couple of paragraphs of "A Christmas Carol" by Dickens)
-
-Compact font selection example text:
-
- ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789
- abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ
- –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд
- ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა
-
-Greetings in various languages:
-
- Hello world, Καλημέρα κόσμε, コンニチハ
-
-Box drawing alignment tests: █
- ▉
- ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
- ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
- ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
- ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
- ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
- ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
- ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
- ▝▀▘▙▄▟
diff --git a/deps/ulib/test/array.c b/deps/ulib/test/array.c
deleted file mode 100644
index fd0a683e..00000000
--- a/deps/ulib/test/array.c
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ulib.h>
-#include "test.h"
-
-/* example from glib documentation */
-RESULT
-test_array_big ()
-{
- UArray *garray;
- int i;
-
- /* We create a new array to store int values.
- We don't want it zero-terminated or cleared to 0's. */
- garray = u_array_new (FALSE, FALSE, sizeof (int));
- for (i = 0; i < 10000; i++)
- u_array_append_val (garray, i);
-
- for (i = 0; i < 10000; i++)
- if (u_array_index (garray, int, i) != i)
- return FAILED ("array value didn't match");
-
- u_array_free (garray, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_index ()
-{
- UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
- int v;
-
- v = 27;
- u_array_append_val (array, v);
-
- if (27 != u_array_index (array, int, 0))
- return FAILED ("");
-
- u_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_append_zero_terminated ()
-{
- UArray *array = u_array_new (TRUE, FALSE, sizeof (int));
- int v;
-
- v = 27;
- u_array_append_val (array, v);
-
- if (27 != u_array_index (array, int, 0))
- return FAILED ("u_array_append_val failed");
-
- if (0 != u_array_index (array, int, 1))
- return FAILED ("zero_terminated didn't append a zero element");
-
- u_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_append ()
-{
- UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
- int v;
-
- if (0 != array->len)
- return FAILED ("initial array length not zero");
-
- v = 27;
-
- u_array_append_val (array, v);
-
- if (1 != array->len)
- return FAILED ("array append failed");
-
- u_array_free (array, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_array_insert_val ()
-{
- UArray *array = u_array_new (FALSE, FALSE, sizeof (void *));
- void *ptr0, *ptr1, *ptr2, *ptr3;
-
- u_array_insert_val (array, 0, array);
-
- if (array != u_array_index (array, void *, 0))
- return FAILED ("1 The value in the array is incorrect");
-
- 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");
-
- 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");
-
- u_array_free (array, TRUE);
- array = u_array_new (FALSE, FALSE, sizeof (void *));
- ptr0 = array;
- ptr1 = array + 1;
- ptr2 = array + 2;
- ptr3 = array + 3;
-
- 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 != u_array_index (array, void *, 1))
- return FAILED ("5 The value in the array is incorrect");
- if (ptr1 != u_array_index (array, void *, 2))
- return FAILED ("6 The value in the array is incorrect");
- if (ptr2 != u_array_index (array, void *, 3))
- return FAILED ("7 The value in the array is incorrect");
-
- u_array_free (array, TRUE);
- return NULL;
-}
-
-RESULT
-test_array_remove ()
-{
- UArray *array = u_array_new (FALSE, FALSE, sizeof (int));
- int v[] = {30, 29, 28, 27, 26, 25};
-
- u_array_append_vals (array, v, 6);
-
- if (6 != array->len)
- return FAILED ("append_vals fail");
-
- u_array_remove_index (array, 3);
-
- if (5 != array->len)
- return FAILED ("remove_index failed to update length");
-
- if (26 != u_array_index (array, int, 3))
- return FAILED ("remove_index failed to update the array");
-
- u_array_free (array, TRUE);
-
- return NULL;
-}
-
-static Test array_tests [] = {
- {"big", test_array_big},
- {"append", test_array_append},
- {"insert_val", test_array_insert_val},
- {"index", test_array_index},
- {"remove", test_array_remove},
- {"append_zero_term", test_array_append_zero_terminated},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(array_tests_init, array_tests)
diff --git a/deps/ulib/test/dir.c b/deps/ulib/test/dir.c
deleted file mode 100644
index 592cd9f6..00000000
--- a/deps/ulib/test/dir.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef U_OS_UNIX
-#include <pthread.h>
-#endif
-#include "test.h"
-
-/* This test is just to be used with valgrind */
-RESULT
-test_dir ()
-{
- UDir *dir;
- UError *error;
- const char *name;
-
- /*
- dir = u_dir_open (NULL, 0, NULL);
- */
- dir = u_dir_open ("", 0, NULL);
- if (dir != NULL)
- return FAILED ("1 Should be an error");
-
- dir = u_dir_open ("", 9, NULL);
- if (dir != NULL)
- return FAILED ("2 Should be an error");
-
- error = NULL;
- 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");
- u_error_free (error);
- error = NULL;
- 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 = u_dir_read_name (dir);
- if (name == NULL)
- return FAILED ("7 didn't read a file name");
- while ((name = u_dir_read_name (dir)) != NULL) {
- if (strcmp (name, ".") == 0)
- return FAILED (". directory found");
- if (strcmp (name, "..") == 0)
- return FAILED (".. directory found");
- }
- u_dir_close (dir);
- return OK;
-}
-
-static Test dir_tests [] = {
- {"u_dir_*", test_dir},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(dir_tests_init, dir_tests)
-
-
diff --git a/deps/ulib/test/driver.c b/deps/ulib/test/driver.c
deleted file mode 100644
index 5b70ca3c..00000000
--- a/deps/ulib/test/driver.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * ULib Unit Test Driver
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <config.h>
-#include "test.h"
-#include "tests.h"
-
-#include <stdio.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-#ifndef DRIVER_NAME
-#define DRIVER_NAME "EGlib"
-#endif
-
-typedef struct _StringArray {
- char **strings;
- int length;
-} StringArray;
-
-static StringArray *
-string_array_append(StringArray *array, char *string)
-{
- if(array == NULL) {
- array = u_new0(StringArray, 1);
- array->length = 1;
- array->strings = u_malloc(sizeof(char *) * 2);
- } else {
- array->length++;
- array->strings = u_realloc(array->strings, sizeof(char *)
- * (array->length + 1));
- }
-
- array->strings[array->length - 1] = string;
- array->strings[array->length] = NULL;
-
- return array;
-}
-
-int global_passed = 0, global_tests = 0;
-
-static void
-string_array_free(StringArray *array)
-{
- u_free(array->strings);
- u_free(array);
-}
-
-static void print_help(char *s)
-{
- int i;
-
- printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
- printf("OPTIONS are:\n");
- printf(" -h, --help show this help\n");
- printf(" -t, --time time the tests\n");
- printf(" -i, --iterations number of times to run tests\n");
- printf(" -q, --quiet do not print test results; "
- "final time always prints\n");
- printf(" -n, --no-labels print final time without labels, "
- "nice for scripts\n");
- printf(" -d, --debug do not run tests, "
- "debug the driver itself for valgrind\n\n");
- printf("TESTGROUPS available:\n");
-
- for(i = 0; test_groups[i].name != NULL; i++) {
- if(test_groups[i].handler != fake_tests_init) {
- printf(" %s\n", test_groups[i].name);
- }
- }
-
- printf("\n");
-}
-
-int main(int argc, char **argv)
-{
- int i, j, c, iterations = 1;
- StringArray *tests_to_run = NULL;
- 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 [] = {
- {"help", no_argument, 0, 'h'},
- {"time", no_argument, 0, 't'},
- {"quiet", no_argument, 0, 'q'},
- {"iterations", required_argument, 0, 'i'},
- {"debug", no_argument, 0, 'd'},
- {"no-labels", no_argument, 0, 'n'},
- {0, 0, 0, 0}
- };
-
- while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) { switch(c) {
- case 'h':
- print_help(argv[0]);
- return 1;
- case 't':
- report_time = TRUE;
- break;
- case 'i':
- iterations = atoi(optarg);
- break;
- case 'q':
- quiet = TRUE;
- break;
- case 'n':
- no_final_time_labels = TRUE;
- break;
- case 'd':
- debug = TRUE;
- break;
- }
- }
-
- for(i = optind; i < argc; i++) {
- if(argv[i][0] == '-') {
- continue;
- }
-
- tests_to_run = string_array_append(tests_to_run, argv[i]);
- }
-#endif
-
- time_start = get_timestamp();
-
- for(j = 0; test_groups[j].name != NULL; j++) {
- uboolean run = TRUE;
- char *tests = NULL;
- char *group = NULL;
-
- if(tests_to_run != NULL) {
- int k;
- run = FALSE;
-
- for(k = 0; k < tests_to_run->length; k++) {
- 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);
-
- if(strncmp(user, table, table_len) == 0) {
- if(user_len > table_len && user[table_len] != ':') {
- break;
- }
-
- run = TRUE;
- group = tests_to_run->strings[k];
- break;
- }
- }
- }
-
- if(run) {
- uboolean passed;
- char **split = NULL;
-
- if(debug && test_groups[j].handler != fake_tests_init) {
- printf("Skipping %s, in driver debug mode\n",
- test_groups[j].name);
- continue;
- } else if(!debug && test_groups[j].handler == fake_tests_init) {
- continue;
- }
-
- if(group != NULL) {
- split = eg_strsplit(group, ":", -1);
- if(split != NULL) {
- int m;
- for(m = 0; split[m] != NULL; m++) {
- if(m == 1) {
- tests = strdup(split[m]);
- break;
- }
- }
- eg_strfreev(split);
- }
- }
-
- passed = run_group(&(test_groups[j]),
- iterations, quiet, report_time, tests);
-
- if(tests != NULL) {
- u_free(tests);
- }
-
- if(!passed && !global_failure) {
- global_failure = TRUE;
- }
- }
- }
-
- if(!quiet) {
- 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) {
- double duration = get_timestamp() - time_start;
- if(no_final_time_labels) {
- printf("%g\n", duration);
- } else {
- printf("%s Total Time: %g\n", DRIVER_NAME, duration);
- }
- }
-
- if(tests_to_run != NULL) {
- string_array_free(tests_to_run);
- }
-
- return global_tests - global_passed;
-}
-
-
diff --git a/deps/ulib/test/endian.c b/deps/ulib/test/endian.c
deleted file mode 100644
index 820e3310..00000000
--- a/deps/ulib/test/endian.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#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/ulib/test/fake.c b/deps/ulib/test/fake.c
deleted file mode 100644
index c8d9af61..00000000
--- a/deps/ulib/test/fake.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Fake test allows debugging of the driver itself
- */
-
-#include "test.h"
-
-RESULT
-test_fake()
-{
- return OK;
-}
-
-static Test fake_tests [] = {
- {"fake", test_fake},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(fake_tests_init, fake_tests)
-
diff --git a/deps/ulib/test/file.c b/deps/ulib/test/file.c
deleted file mode 100644
index e19bb86c..00000000
--- a/deps/ulib/test/file.c
+++ /dev/null
@@ -1,228 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <string.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include "test.h"
-
-#ifdef U_OS_WIN32
-#include <io.h>
-#define close _close
-#endif
-
-RESULT
-test_file_get_contents ()
-{
- UError *error;
- char *content;
- uboolean ret;
- size_t length;
-#ifdef U_OS_WIN32
- const char *filename = "c:\\Windows\\system.ini";
-#else
- const char *filename = "/etc/hosts";
-#endif
-
- /*
- filename != NULL
- ret = u_file_get_contents (NULL, NULL, NULL, NULL);
- contents != NULL
- ret = u_file_get_contents ("", NULL, NULL, NULL);
- error no such file and fails for 'error' not being null too
- ret = u_file_get_contents ("", &content, NULL, &error);
- */
-
- error = NULL;
- ret = u_file_get_contents ("", &content, NULL, &error);
- if (ret)
- return FAILED ("HAH!");
- if (error == NULL)
- return FAILED ("Got nothing as error.");
- if (content != NULL)
- return FAILED ("Content is uninitialized");
-
- u_error_free (error);
- error = NULL;
- 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)
- return FAILED ("Got an error returning TRUE");
- if (content == NULL)
- return FAILED ("Content is NULL");
- if (strlen (content) != length)
- return FAILED ("length is %d but the string is %d", length, strlen (content));
- u_free (content);
-
- return OK;
-}
-
-RESULT
-test_open_tmp ()
-{
- 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 = u_file_open_tmp (NULL, NULL, NULL);
- * if (fd < 0)
- * return FAILED ("Default failed.");
- * close (fd);
- */
- error = NULL;
- 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.");
- u_error_free (error);
-
- error = NULL;
- 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");
- u_error_free (error);
-
- error = NULL;
- fd = u_file_open_tmp ("valid-XXXXXX", &name, &error);
- if (fd == -1)
- return FAILED ("This should be valid");
- if (error != NULL)
- return FAILED ("No error returned.");
- if (name == NULL)
- return FAILED ("No name returned.");
- close (fd);
- unlink (name);
- u_free (name);
- return OK;
-}
-
-RESULT
-test_file ()
-{
- uboolean res;
- const char *tmp;
- char *path;
-
-#ifndef U_OS_WIN32 /* FIXME */
- char *sympath;
- int ignored;
-#endif
-
- res = u_file_test (NULL, 0);
- if (res)
- return FAILED ("Should return FALSE HERE");
-
- res = u_file_test ("file.c", 0);
- if (res)
- return FAILED ("Should return FALSE HERE");
-
- tmp = u_get_tmp_dir ();
- res = u_file_test (tmp, U_FILE_TEST_EXISTS);
- if (!res)
- return FAILED ("tmp does not exist.");
- res = u_file_test (tmp, U_FILE_TEST_IS_REGULAR);
- if (res)
- return FAILED ("tmp is regular");
-
- res = u_file_test (tmp, U_FILE_TEST_IS_DIR);
- if (!res)
- return FAILED ("tmp is not a directory");
- res = u_file_test (tmp, U_FILE_TEST_IS_EXECUTABLE);
- if (!res)
- return FAILED ("tmp is not a executable");
-
- res = u_file_test (tmp, U_FILE_TEST_EXISTS | U_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("2 tmp does not exist.");
- res = u_file_test (tmp, U_FILE_TEST_IS_REGULAR | U_FILE_TEST_IS_SYMLINK);
- if (res)
- return FAILED ("2 tmp is regular");
-
- 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 = 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 (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 = 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 = u_file_test (path, U_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("3 %s should not be a directory", path);
- res = u_file_test (path, U_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("3 %s should not be executable", path);
- res = u_file_test (path, U_FILE_TEST_IS_SYMLINK);
- if (res)
- return FAILED ("3 %s should not be a symlink", path);
-
-#ifndef U_OS_WIN32 /* FIXME */
- sympath = u_strconcat (path, "-link", NULL);
- ignored = symlink (path, sympath);
- res = u_file_test (sympath, U_FILE_TEST_EXISTS);
- if (!res)
- return FAILED ("4 %s should not exist", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_REGULAR);
- if (!res)
- return FAILED ("4 %s should not be a regular file", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("4 %s should not be a directory", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("4 %s should not be executable", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("4 %s should be a symlink", sympath);
-
- unlink (path);
-
- res = u_file_test (sympath, U_FILE_TEST_EXISTS);
- if (res)
- return FAILED ("5 %s should exist", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_REGULAR);
- if (res)
- return FAILED ("5 %s should be a regular file", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_DIR);
- if (res)
- return FAILED ("5 %s should not be a directory", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_EXECUTABLE);
- if (res)
- return FAILED ("5 %s should not be executable", sympath);
- res = u_file_test (sympath, U_FILE_TEST_IS_SYMLINK);
- if (!res)
- return FAILED ("5 %s should be a symlink", sympath);
- unlink (sympath);
- u_free (sympath);
-#endif
- u_free (path);
- return OK;
-}
-
-static Test file_tests [] = {
- {"u_file_get_contents", test_file_get_contents},
- {"u_file_open_tmp", test_open_tmp},
- {"u_file_test", test_file},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(file_tests_init, file_tests)
-
-
diff --git a/deps/ulib/test/hashtable.c b/deps/ulib/test/hashtable.c
deleted file mode 100644
index ea395b34..00000000
--- a/deps/ulib/test/hashtable.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ulib.h>
-#include "test.h"
-
-int foreach_count = 0;
-int foreach_fail = 0;
-
-void foreach (void * key, void * value, void * user_data)
-{
- foreach_count++;
- if (U_POINTER_TO_INT (user_data) != 'a')
- foreach_fail = 1;
-}
-
-RESULT hash_t1 (void)
-{
- UHashTable *t = u_hash_table_new (u_str_hash, u_str_equal);
-
- foreach_count = 0;
- foreach_fail = 0;
- u_hash_table_insert (t, "hello", "world");
- u_hash_table_insert (t, "my", "god");
-
- 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 (!u_hash_table_remove (t, "my"))
- return FAILED ("did not find known key");
- if (u_hash_table_size (t) != 1)
- return FAILED ("unexpected size");
- 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 (!u_hash_table_remove (t, "hello"))
- return FAILED ("did not find known key");
- if (u_hash_table_size (t) != 0)
- return FAILED ("unexpected size");
- u_hash_table_destroy (t);
-
- return OK;
-}
-
-RESULT hash_t2 (void)
-{
- return OK;
-}
-
-RESULT hash_default (void)
-{
- UHashTable *hash = u_hash_table_new (NULL, NULL);
-
- if (hash == NULL)
- return FAILED ("u_hash_table_new should return a valid hash");
-
- u_hash_table_destroy (hash);
- return NULL;
-}
-
-RESULT
-hash_null_lookup (void)
-{
- 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 (!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 != U_INT_TO_POINTER (1))
- return FAILED ("Got wrong value %p\n", ov);
-
- if (!u_hash_table_lookup_extended (hash, U_INT_TO_POINTER(1), &ok, &ov))
- return FAILED ("Did not find the 1");
- if (ok != U_INT_TO_POINTER(1))
- return FAILED ("Incorrect key found");
- if (ov != U_INT_TO_POINTER (2))
- return FAILED ("Got wrong value %p\n", ov);
-
- u_hash_table_destroy (hash);
-
- return NULL;
-}
-
-static void
-counter (void * key, void * value, void * user_data)
-{
- int *counter = (int *) user_data;
-
- (*counter)++;
-}
-
-RESULT hash_grow (void)
-{
- 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++)
- 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];
- void * value;
-
- sprintf (buffer, "%d", i);
-
- 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 (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 */
- u_hash_table_foreach (hash, counter, &count);
- if (count != 1000){
- return FAILED ("Foreach count is not 1000");
- }
-
- u_hash_table_destroy (hash);
- return NULL;
-}
-
-RESULT hash_iter (void)
-{
-#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;
- void *key, *value;
-
- sum = 0;
- for (i = 0; i < 1000; i++) {
- sum += i;
- u_hash_table_insert (hash, U_UINT_TO_POINTER (i), U_UINT_TO_POINTER (i));
- }
-
- keys_sum = values_sum = 0;
- 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 += 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");
- u_hash_table_destroy (hash);
- return NULL;
-#else
- /* UHashTableIter was added in glib 2.16 */
- return NULL;
-#endif
-}
-
-static Test hashtable_tests [] = {
- {"t1", hash_t1},
- {"t2", hash_t2},
- {"grow", hash_grow},
- {"default", hash_default},
- {"null_lookup", hash_null_lookup},
- {"iter", hash_iter},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(hashtable_tests_init, hashtable_tests)
-
diff --git a/deps/ulib/test/list.c b/deps/ulib/test/list.c
deleted file mode 100644
index ab52f653..00000000
--- a/deps/ulib/test/list.c
+++ /dev/null
@@ -1,438 +0,0 @@
-#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/ulib/test/memory.c b/deps/ulib/test/memory.c
deleted file mode 100644
index 7be283f0..00000000
--- a/deps/ulib/test/memory.c
+++ /dev/null
@@ -1,40 +0,0 @@
-
-#include <ulib.h>
-#include "test.h"
-
-RESULT
-test_memory_zero_size_allocations ()
-{
- void * p;
-
- p = u_malloc (0);
- if (p)
- return FAILED ("Calling u_malloc with size zero should return NULL.");
-
- p = u_malloc0 (0);
- if (p)
- return FAILED ("Calling u_malloc0 with size zero should return NULL.");
-
- p = u_realloc (NULL, 0);
- if (p)
- return FAILED ("Calling u_realloc with size zero should return NULL.");
-
- p = u_new (int, 0);
- if (p)
- return FAILED ("Calling u_new with size zero should return NULL.");
-
- p = u_new0 (int, 0);
- if (p)
- return FAILED ("Calling u_new0 with size zero should return NULL.");
-
- return OK;
-}
-
-
-static Test memory_tests [] = {
- { "zero_size_allocations", test_memory_zero_size_allocations},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(memory_tests_init, memory_tests)
-
diff --git a/deps/ulib/test/module.c b/deps/ulib/test/module.c
deleted file mode 100644
index 1f796d38..00000000
--- a/deps/ulib/test/module.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <umodule.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "test.h"
-
-#if defined (U_OS_WIN32)
-#define EXTERNAL_SYMBOL "UetProcAddress"
-#else
-#define EXTERNAL_SYMBOL "system"
-#endif
-
-void U_MODULE_EXPORT
-dummy_test_export ()
-{
-}
-
-/* test for u_module_open (NULL, ...) */
-RESULT
-test_module_symbol_null ()
-{
- void * proc = U_INT_TO_POINTER (42);
-
- UModule *m = u_module_open (NULL, U_MODULE_BIND_LAZY);
-
- if (m == NULL)
- return FAILED ("bind to main module failed. #0");
-
- 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 (!u_module_symbol (m, EXTERNAL_SYMBOL, &proc))
- return FAILED ("external lookup failed. #3");
-
- if (!proc)
- return FAILED ("external lookup failed. #4");
-
- 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 (!u_module_close (m))
- return FAILED ("close failed. #7");
-
- return OK;
-}
-
-static Test module_tests [] = {
- {"u_module_symbol_null", test_module_symbol_null},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)
-
-
diff --git a/deps/ulib/test/path.c b/deps/ulib/test/path.c
deleted file mode 100644
index 717d0cfe..00000000
--- a/deps/ulib/test/path.c
+++ /dev/null
@@ -1,357 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef U_OS_UNIX
-#include <pthread.h>
-#endif
-#include "test.h"
-
-#ifdef U_OS_WIN32
-#include <direct.h>
-#define chdir _chdir
-#endif
-
-/* This test is just to be used with valgrind */
-RESULT
-test_buildpath ()
-{
- char *s;
- char *buffer = "var/private";
- char *dir = "/";
-
- s = u_build_path ("/", "hola///", "//mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("1 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("/", "hola/", "/mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("2 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("/", "hola/", "mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("3 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("/", "hola", "/mundo", NULL);
- if (strcmp (s, "hola/mundo") != 0)
- return FAILED ("4 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("/", "/hello", "world/", NULL);
- if (strcmp (s, "/hello/world/") != 0)
- return FAILED ("5 Got wrong result, got: %s", s);
- u_free (s);
-
- /* Now test multi-char-separators */
- s = u_build_path ("**", "hello", "world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("6 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("**", "hello**", "world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("7 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("**", "hello**", "**world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("8 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("**", "hello**", "**world", NULL);
- if (strcmp (s, "hello**world") != 0)
- return FAILED ("9 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("1234567890", "hello", "world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("10 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("1234567890", "hello1234567890", "1234567890world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("11 Got wrong result, got: %s", s);
- u_free (s);
-
- s = u_build_path ("1234567890", "hello12345678901234567890", "1234567890world", NULL);
- if (strcmp (s, "hello1234567890world") != 0)
- return FAILED ("12 Got wrong result, got: %s", s);
- u_free (s);
-
- /* Multiple */
- 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);
- u_free (s);
-
- s = u_build_path ("/", "/a", "", "/c/", NULL);
- if (strcmp (s, "/a/c/") != 0)
- return FAILED ("14 Got wrong result, got: %s", s);
- u_free (s);
-
- /* Null */
- s = u_build_path ("/", NULL, NULL);
- if (s == NULL)
- return FAILED ("must get a non-NULL return");
- if (s [0] != 0)
- return FAILED ("must get an empty string");
-
- // This is to test the regression introduced by Levi for the Windows support
- // that code errouneously read below the allowed area (in this case dir [-1]).
- // and caused all kinds of random errors.
- dir = "//";
- dir++;
- s = u_build_filename (dir, buffer, NULL);
- if (s [0] != '/')
- return FAILED ("Must have a '/' at the start");
-
- u_free (s);
- return OK;
-}
-
-RESULT
-test_buildfname ()
-{
- char *s;
-
- 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);
- u_free (s);
-
-#ifdef U_OS_WIN32
- s = u_build_filename ("C:\\", "a", NULL);
- if (strcmp (s, "C:\\a") != 0)
-#else
- s = u_build_filename ("/", "a", NULL);
- if (strcmp (s, "/a") != 0)
-#endif
- return FAILED ("1 Got wrong result, got: %s", s);
-
-#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
-
- return OK;
-}
-
-char *
-test_dirname ()
-{
- char *s;
-
-#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);
- u_free (s);
-
- s = u_path_get_dirname ("c:/home/miguel");
- if (strcmp (s, "c:/home") != 0)
- return FAILED ("Expected c:/home, got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("c:\\home\\dingus\\");
- if (strcmp (s, "c:\\home\\dingus") != 0)
- return FAILED ("Expected c:\\home\\dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("dir.c");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("c:\\index.html");
- if (strcmp (s, "c:") != 0)
- return FAILED ("Expected [c:], got [%s]", s);
-#else
- s = u_path_get_dirname ("/home/miguel");
- if (strcmp (s, "/home") != 0)
- return FAILED ("Expected /home, got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("/home/dingus/");
- if (strcmp (s, "/home/dingus") != 0)
- return FAILED ("Expected /home/dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("dir.c");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- u_free (s);
-
- s = u_path_get_dirname ("/index.html");
- if (strcmp (s, "/") != 0)
- return FAILED ("Expected [/], got [%s]", s);
-#endif
- return OK;
-}
-
-char *
-test_basename ()
-{
- char *s;
-
-#ifdef U_OS_WIN32
- s = u_path_get_basename ("");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("c:\\home\\dingus\\");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("c:/home/dingus/");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("c:\\home\\dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("c:/home/dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- u_free (s);
-#else
- s = u_path_get_basename ("");
- if (strcmp (s, ".") != 0)
- return FAILED ("Expected `.', got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("/home/dingus/");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("1 Expected dingus, got %s", s);
- u_free (s);
-
- s = u_path_get_basename ("/home/dingus");
- if (strcmp (s, "dingus") != 0)
- return FAILED ("2 Expected dingus, got %s", s);
- u_free (s);
-#endif
- return OK;
-}
-
-char *
-test_ppath ()
-{
- char *s;
-#ifdef U_OS_WIN32
- const char *searchfor = "explorer.exe";
-#else
- const char *searchfor = "ls";
-#endif
- s = u_find_program_in_path (searchfor);
- if (s == NULL)
- return FAILED ("No %s on this system?", searchfor);
- u_free (s);
- return OK;
-}
-
-char *
-test_ppath2 ()
-{
- char *s;
- const char *path = u_getenv ("PATH");
-#ifdef U_OS_WIN32
- const char *searchfor = "test_eglib.exe";
-#else
- const char *searchfor = "test-glib";
-#endif
-
- u_setenv ("PATH", "", TRUE);
- s = u_find_program_in_path ("ls");
- if (s != NULL) {
- u_setenv ("PATH", path, TRUE);
- return FAILED ("Found something interesting here: %s", s);
- }
- u_free (s);
- s = u_find_program_in_path (searchfor);
- if (s == NULL) {
- u_setenv ("PATH", path, TRUE);
- return FAILED ("It should find '%s' in the current directory.", searchfor);
- }
- u_free (s);
- u_setenv ("PATH", path, TRUE);
- return OK;
-}
-
-#ifndef DISABLE_FILESYSTEM_TESTS
-char *
-test_cwd ()
-{
- char *dir = u_get_current_dir ();
-#ifdef U_OS_WIN32
- const char *newdir = "C:\\Windows";
-#else
- const char *newdir = "/bin";
-#endif
-
- if (dir == NULL)
- return FAILED ("No current directory?");
- u_free (dir);
-
- if (chdir (newdir) == -1)
- return FAILED ("No %s?", newdir);
-
- dir = u_get_current_dir ();
- if (strcmp (dir, newdir) != 0)
- return FAILED("Did not go to %s?", newdir);
- u_free (dir);
-
- return OK;
-}
-#else
-char *
-test_cwd ()
-{
- return OK;
-}
-#endif
-
-char *
-test_misc ()
-{
- const char *home = u_get_home_dir ();
- const char *tmp = u_get_tmp_dir ();
-
- if (home == NULL)
- return FAILED ("Where did my home go?");
-
- if (tmp == NULL)
- return FAILED ("Where did my /tmp go?");
-
- return OK;
-}
-
-static Test path_tests [] = {
- {"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}
-};
-
-DEFINE_TEST_GROUP_INIT(path_tests_init, path_tests)
-
-
diff --git a/deps/ulib/test/ptrarray.c b/deps/ulib/test/ptrarray.c
deleted file mode 100644
index 74720a09..00000000
--- a/deps/ulib/test/ptrarray.c
+++ /dev/null
@@ -1,349 +0,0 @@
-#include <stdio.h>
-#include <ulib.h>
-#include "test.h"
-
-/* Redefine the private structure only to verify proper allocations */
-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 [] = {
- "Apples", "Oranges", "Plumbs", "Goats", "Snorps", "Grapes",
- "Tickle", "Place", "Coffee", "Cookies", "Cake", "Cheese",
- "Tseng", "Holiday", "Avenue", "Smashing", "Water", "Toilet",
- NULL
-};
-
-static UPtrArray *ptrarray_alloc_and_fill(unsigned int *item_count)
-{
- UPtrArray *array = u_ptr_array_new();
- int i;
-
- for(i = 0; items[i] != NULL; i++) {
- u_ptr_array_add(array, (void *)items[i]);
- }
-
- if(item_count != NULL) {
- *item_count = i;
- }
-
- return array;
-}
-
-static unsigned int guess_size(unsigned int length)
-{
- unsigned int size = 1;
-
- while(size < length) {
- size <<= 1;
- }
-
- return size;
-}
-
-RESULT ptrarray_alloc()
-{
- UPtrArrayPriv *array;
- unsigned int 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",
- guess_size(array->len), array->size);
- }
-
- if(array->len != i) {
- return FAILED("Expected %d node(s) in the array", i);
- }
-
- u_ptr_array_free((UPtrArray *)array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_for_iterate()
-{
- UPtrArray *array = ptrarray_alloc_and_fill(NULL);
- unsigned int i;
-
- for(i = 0; i < array->len; 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",
- i, items[i], item);
- }
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static int foreach_iterate_index = 0;
-static char *foreach_iterate_error = NULL;
-
-void foreach_callback(void * data, void * user_data)
-{
- char *item = (char *)data;
- const char *item_cmp = items[foreach_iterate_index++];
-
- if(foreach_iterate_error != NULL) {
- return;
- }
-
- if(item != item_cmp) {
- foreach_iterate_error = FAILED(
- "Expected item at %d to be %s, but it was %s",
- foreach_iterate_index - 1, item_cmp, item);
- }
-}
-
-RESULT ptrarray_foreach_iterate()
-{
- UPtrArray *array = ptrarray_alloc_and_fill(NULL);
-
- foreach_iterate_index = 0;
- foreach_iterate_error = NULL;
-
- u_ptr_array_foreach(array, foreach_callback, array);
-
- u_ptr_array_free(array, TRUE);
-
- return foreach_iterate_error;
-}
-
-RESULT ptrarray_set_size()
-{
- UPtrArray *array = u_ptr_array_new();
- unsigned int i, grow_length = 50;
-
- 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);
- } else if(array->pdata[0] != items[0]) {
- return FAILED("Item 0 was overwritten, should be %s", items[0]);
- } else if(array->pdata[1] != items[1]) {
- return FAILED("Item 1 was overwritten, should be %s", items[1]);
- }
-
- for(i = 2; i < array->len; i++) {
- if(array->pdata[i] != NULL) {
- return FAILED("Item %d is not NULL, it is %p", i, array->pdata[i]);
- }
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_index()
-{
- UPtrArray *array;
- unsigned int i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- 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]);
- }
-
- 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]);
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_index_fast()
-{
- UPtrArray *array;
- unsigned int i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- 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]);
- }
-
- 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]);
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove()
-{
- UPtrArray *array;
- unsigned int i;
-
- array = ptrarray_alloc_and_fill(&i);
-
- u_ptr_array_remove(array, (void *)items[7]);
-
- if(!u_ptr_array_remove(array, (void *)items[4])) {
- return FAILED("Item %s not removed", 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 UPtrArray not correct");
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static int ptrarray_sort_compare(const void * a, const void * b)
-{
- char *stra = *(char **) a;
- char *strb = *(char **) b;
- return strcmp(stra, strb);
-}
-
-RESULT ptrarray_sort()
-{
- UPtrArray *array = u_ptr_array_new();
- unsigned int i;
- char *letters [] = { "A", "B", "C", "D", "E" };
-
- 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]);
-
- 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], (char *) array->pdata [i], i);
- }
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static int ptrarray_sort_compare_with_data (const void * a, const void * b, void * user_data)
-{
- 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");
-
- return strcmp(stra, strb);
-}
-
-RESULT ptrarray_sort_with_data ()
-{
- UPtrArray *array = u_ptr_array_new();
- unsigned int i;
- char *letters [] = { "A", "B", "C", "D", "E" };
-
- 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]);
-
- 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], (char *) array->pdata [i], i);
- }
- }
-
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-RESULT ptrarray_remove_fast()
-{
- UPtrArray *array = u_ptr_array_new();
- char *letters [] = { "A", "B", "C", "D", "E" };
-
- if (u_ptr_array_remove_fast (array, NULL))
- return FAILED ("Removing NULL succeeded");
-
- 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");
-
- 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 (!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 (u_ptr_array_remove_fast (array, letters[0]))
- return FAILED ("Succedeed removing a non-existing element");
-
- if (!u_ptr_array_remove_fast (array, letters[3]) || array->len != 3)
- return FAILED ("Failed removing \"D\"");
-
- 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");
- u_ptr_array_free(array, TRUE);
-
- return OK;
-}
-
-static Test ptrarray_tests [] = {
- {"alloc", ptrarray_alloc},
- {"for_iterate", ptrarray_for_iterate},
- {"foreach_iterate", ptrarray_foreach_iterate},
- {"set_size", ptrarray_set_size},
- {"remove_index", ptrarray_remove_index},
- {"remove_index_fast", ptrarray_remove_index_fast},
- {"remove", ptrarray_remove},
- {"sort", ptrarray_sort},
- {"remove_fast", ptrarray_remove_fast},
- {"sort_with_data", ptrarray_sort_with_data},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(ptrarray_tests_init, ptrarray_tests)
-
-
diff --git a/deps/ulib/test/queue.c b/deps/ulib/test/queue.c
deleted file mode 100644
index b1c69226..00000000
--- a/deps/ulib/test/queue.c
+++ /dev/null
@@ -1,184 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ulib.h>
-#include "test.h"
-
-RESULT
-test_queue_push ()
-{
- UQueue *queue = u_queue_new ();
-
- 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");
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("baz", queue->head->data))
- return FAILED ("HEAD: First element is wrong");
- if (strcmp ("bar", queue->head->next->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Third element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("baz", queue->tail->prev->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- u_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_push_tail ()
-{
- UQueue *queue = u_queue_new ();
-
- 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");
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("baz", queue->head->data))
- return FAILED ("HEAD: First element is wrong");
- if (strcmp ("bar", queue->head->next->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Third element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("baz", queue->tail->prev->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- u_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_pop ()
-{
- UQueue *queue = u_queue_new ();
- void * data;
-
- u_queue_push_head (queue, "foo");
- u_queue_push_head (queue, "bar");
- u_queue_push_head (queue, "baz");
-
- data = u_queue_pop_head (queue);
- if (strcmp ("baz", data))
- return FAILED ("expect baz.");
-
- data = u_queue_pop_head (queue);
- if (strcmp ("bar", data))
- return FAILED ("expect bar.");
-
- data = u_queue_pop_head (queue);
- if (strcmp ("foo", data))
- return FAILED ("expect foo.");
-
- if (u_queue_is_empty (queue) == FALSE)
- return FAILED ("expect is_empty.");
-
- if (queue->length != 0)
- return FAILED ("expect 0 length .");
-
- u_queue_push_head (queue, "foo");
- u_queue_push_head (queue, "bar");
- u_queue_push_head (queue, "baz");
-
- u_queue_pop_head (queue);
-
- if (NULL != queue->head->prev)
- return FAILED ("HEAD: prev is wrong");
- if (strcmp ("bar", queue->head->data))
- return FAILED ("HEAD: Second element is wrong");
- if (strcmp ("foo", queue->head->next->data))
- return FAILED ("HEAD: Third element is wrong");
- if (NULL != queue->head->next->next)
- return FAILED ("HEAD: End is wrong");
-
- if (NULL != queue->tail->next)
- return FAILED ("TAIL: next is wrong");
- if (strcmp ("foo", queue->tail->data))
- return FAILED ("TAIL: Second element is wrong");
- if (strcmp ("bar", queue->tail->prev->data))
- return FAILED ("TAIL: First element is wrong");
- if (NULL != queue->tail->prev->prev)
- return FAILED ("TAIL: End is wrong");
-
- u_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_new ()
-{
- UQueue *queue = u_queue_new ();
-
- if (queue->length != 0)
- return FAILED ("expect length == 0");
-
- if (queue->head != NULL)
- return FAILED ("expect head == NULL");
-
- if (queue->tail != NULL)
- return FAILED ("expect tail == NULL");
-
- u_queue_free (queue);
- return OK;
-}
-
-RESULT
-test_queue_is_empty ()
-{
- UQueue *queue = u_queue_new ();
-
- if (u_queue_is_empty (queue) == FALSE)
- return FAILED ("new queue should be empty");
-
- u_queue_push_head (queue, "foo");
-
- if (u_queue_is_empty (queue) == TRUE)
- return FAILED ("expected TRUE");
-
- u_queue_free (queue);
-
- return OK;
-}
-
-static Test queue_tests [] = {
- { "push", test_queue_push},
- {"push_tail", test_queue_push_tail},
- { "pop", test_queue_pop},
- { "new", test_queue_new},
- {"is_empty", test_queue_is_empty},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(queue_tests_init, queue_tests)
-
diff --git a/deps/ulib/test/shell.c b/deps/ulib/test/shell.c
deleted file mode 100644
index f00e42e0..00000000
--- a/deps/ulib/test/shell.c
+++ /dev/null
@@ -1,331 +0,0 @@
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-RESULT
-test_shell_argv1 ()
-{
- UError *error;
- int argc;
- char **argv;
- uboolean ret;
-
- /* The next line prints a critical error and returns FALSE
- ret = u_shell_parse_argv (NULL, NULL, NULL, NULL);
- */
- ret = u_shell_parse_argv ("", NULL, NULL, NULL);
- if (ret)
- return FAILED ("1. It should return FALSE");
-
- ret = u_shell_parse_argv ("hola", NULL, NULL, NULL);
- if (!ret)
- return FAILED ("2. It should return TRUE");
-
- argc = 0;
- 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 = 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 = u_shell_parse_argv ("hola bola", &argc, &argv, NULL);
- if (!ret)
- return FAILED ("7. It should return TRUE");
- if (argc != 2)
- return FAILED ("8. argc was %d", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("9. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("10. argv[1] was %s", argv [1]);
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola 'bola'", &argc, &argv, &error);
- if (!ret)
- return FAILED ("11. It should return TRUE");
- if (argc != 2)
- return FAILED ("12. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("13. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("14. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("15. error is not null");
-
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola '' 'bola'", &argc, &argv, &error);
- if (!ret)
- return FAILED ("16. It should return TRUE");
- if (argc != 3)
- return FAILED ("17. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], ""))
- return FAILED ("19. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola"))
- return FAILED ("19. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("20. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola'' bola", &argc, &argv, &error);
- if (!ret)
- return FAILED ("21. It should return TRUE");
- if (argc != 2)
- return FAILED ("22. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("23. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("24. argv[2] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("25. error is not null");
-
- return OK;
-}
-
-RESULT
-test_shell_argv2 ()
-{
- UError *error;
- int argc;
- char **argv;
- uboolean ret;
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola \"bola\"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 2)
- return FAILED ("2. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("3. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "bola"))
- return FAILED ("4. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("5. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola \"\" \"bola \"", &argc, &argv, &error);
- if (!ret)
- return FAILED ("6. It should return TRUE");
- if (argc != 3)
- return FAILED ("7. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("8. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], ""))
- return FAILED ("9. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("10. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("11. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- 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)
- return FAILED ("11. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("12. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\t"))
- return FAILED ("13. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("14. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("15. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- error = NULL;
- 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)
- return FAILED ("17. argc was %d expected 3", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\t"))
- return FAILED ("19. argv[2] was %s", argv [1]);
- if (strcmp (argv [2], "bola "))
- return FAILED ("20. argv[2] was %s", argv [2]);
- if (error != NULL)
- return FAILED ("21. error is not null");
-
- u_strfreev (argv);
- return OK;
-}
-
-RESULT
-test_shell_argv3 ()
-{
- UError *error;
- int argc;
- char **argv;
- uboolean ret;
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv ("hola \"bola", &argc, &argv, &error);
- if (ret)
- return FAILED ("1. It should return FALSE");
- if (argc != 0)
- return FAILED ("2. argc was %d expected 0", argc);
- if (argv != NULL)
- return FAILED ("3. argv[0] was %s", argv [0]);
- if (error == NULL)
- return FAILED ("4. error is null");
-
- /* Text ended before matching quote was found for ". (The text was 'hola "bola') */
- u_error_free (error);
- error = NULL;
- ret = u_shell_parse_argv ("hola \\\"bola", &argc, &argv, &error);
- if (!ret)
- return FAILED ("5. It should return TRUE");
- if (argc != 2)
- return FAILED ("6. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("18. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\"bola"))
- return FAILED ("18. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("8. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- 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)
- return FAILED ("10. argc was %d expected 2", argc);
- if (strcmp (argv [0], "hola"))
- return FAILED ("11. argv[0] was %s", argv [0]);
- if (strcmp (argv [1], "\n\\'bola"))
- return FAILED ("12. argv[1] was %s", argv [1]);
- if (error != NULL)
- return FAILED ("13. error is not null");
-
- u_strfreev (argv);
- argv = NULL;
- argc = 0;
- return OK;
-}
-
-// This was the 2.8 showstopper error
-RESULT
-test_shell_argv4 ()
-{
- 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 = u_shell_parse_argv (str, &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 3)
- return FAILED ("2. argc was %d expected 3", argc);
- if (argv == NULL)
- return FAILED ("3. argv[0] was NULL");
- if (error != NULL)
- return FAILED ("4. error was set");
-
- if (strcmp (argv [0], "/usr/bin/gnome-terminal"))
- return FAILED ("5. Expected /usr/bin/gnome-terminal got %s", argv [0]);
- if (strcmp (argv [1], "-e"))
- return FAILED ("6. Expected -e, got: %s", argv [1]);
- if (strcmp (argv [2], "bash -c 'read -p \"Press any key to continue...\" -n1;'"))
- return FAILED ("7. Got unexpected result: %s\n", argv [2]);
-
- return OK;
-}
-
-// This is https://bugzilla.novell.com/show_bug.cgi?id=655896
-RESULT
-test_shell_argv5 ()
-{
- UError *error;
- int argc;
- char **argv;
- uboolean ret;
- char *str = "echo \"foo\",\"bar\"";
-
- argv = NULL;
- argc = 0;
- error = NULL;
- ret = u_shell_parse_argv (str, &argc, &argv, &error);
- if (!ret)
- return FAILED ("1. It should return TRUE");
- if (argc != 2)
- return FAILED ("2. argc was %d expected 2", argc);
- if (argv == NULL)
- return FAILED ("3. argv[0] was NULL");
- if (error != NULL)
- return FAILED ("4. error was set");
-
- if (strcmp (argv [0], "echo"))
- return FAILED ("5. Expected echo got %s", argv [0]);
- if (strcmp (argv [1], "foo,bar"))
- return FAILED ("6. Expected foo,bar, got: %s", argv [1]);
-
- return OK;
-}
-
-RESULT
-test_quote ()
-{
- if (strcmp (u_shell_quote ("foo"), "'foo'"))
- return FAILED ("Should return 'foo'");
-
- if (strcmp (u_shell_quote ("foo'bar"), "'foo'\\''bar'"))
- return FAILED ("Should return 'foo'\\''bar'");
-
- if (strcmp (u_shell_quote ("foo bar"), "'foo bar'"))
- return FAILED ("Should return 'foo bar'");
- return OK;
-}
-
-static Test shell_tests [] = {
- {"test_shell_argv1", test_shell_argv1},
- {"test_shell_argv2", test_shell_argv2},
- {"test_shell_argv3", test_shell_argv3},
- {"test_shell_argv4", test_shell_argv4},
- {"test_shell_argv5", test_shell_argv5},
- {"u_shell_quote", test_quote},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(shell_tests_init, shell_tests)
-
diff --git a/deps/ulib/test/sizes.c b/deps/ulib/test/sizes.c
deleted file mode 100644
index 595e5106..00000000
--- a/deps/ulib/test/sizes.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Tests to ensure that our type definitions are correct
- *
- * These depend on -Werror, -Wall being set to catch the build error.
- */
-#include <stdio.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include <string.h>
-#include <ulib.h>
-#include "test.h"
-
-RESULT
-test_ptrconv ()
-{
- int iv, iv2;
- unsigned int uv, uv2;
- void * 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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);
-
- return NULL;
-
-}
-
-typedef struct {
- int a;
- int b;
-} my_struct;
-
-RESULT
-test_offset ()
-{
- if (U_STRUCT_OFFSET (my_struct, a) != 0)
- return FAILED ("offset of a is not zero");
-
- 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;
-}
-
-static Test size_tests [] = {
- {"ptrconv", test_ptrconv},
- {"u_struct_offset", test_offset},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(size_tests_init, size_tests)
diff --git a/deps/ulib/test/slist.c b/deps/ulib/test/slist.c
deleted file mode 100644
index 182d2687..00000000
--- a/deps/ulib/test/slist.c
+++ /dev/null
@@ -1,345 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ulib.h>
-#include "test.h"
-
-
-RESULT
-test_slist_nth ()
-{
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- USList *nth, *list;
- list = u_slist_prepend (NULL, baz);
- list = u_slist_prepend (list, bar);
- list = u_slist_prepend (list, foo);
-
- nth = u_slist_nth (list, 0);
- if (nth->data != foo)
- return FAILED ("nth failed. #0");
-
- nth = u_slist_nth (list, 1);
- if (nth->data != bar)
- return FAILED ("nth failed. #1");
-
- nth = u_slist_nth (list, 2);
- if (nth->data != baz)
- return FAILED ("nth failed. #2");
-
- nth = u_slist_nth (list, 3);
- if (nth)
- return FAILED ("nth failed. #3: %s", nth->data);
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_index ()
-{
- int i;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
- USList *list;
- list = u_slist_prepend (NULL, baz);
- list = u_slist_prepend (list, bar);
- list = u_slist_prepend (list, foo);
-
- i = u_slist_index (list, foo);
- if (i != 0)
- return FAILED ("index failed. #0: %d", i);
-
- i = u_slist_index (list, bar);
- if (i != 1)
- return FAILED ("index failed. #1: %d", i);
-
- i = u_slist_index (list, baz);
- if (i != 2)
- return FAILED ("index failed. #2: %d", i);
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_append ()
-{
- USList *foo;
- USList *list = u_slist_append (NULL, "first");
- if (u_slist_length (list) != 1)
- return FAILED ("append(null,...) failed");
-
- foo = u_slist_append (list, "second");
- if (foo != list)
- return FAILED ("changed list head on non-empty");
-
- if (u_slist_length (list) != 2)
- return FAILED ("Append failed");
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_concat ()
-{
- USList *foo = u_slist_prepend (NULL, "foo");
- USList *bar = u_slist_prepend (NULL, "bar");
-
- USList *list = u_slist_concat (foo, bar);
-
- if (u_slist_length (list) != 2)
- return FAILED ("Concat failed.");
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_find ()
-{
- USList *list = u_slist_prepend (NULL, "three");
- USList *found;
- char *data;
-
- list = u_slist_prepend (list, "two");
- list = u_slist_prepend (list, "one");
-
- data = "four";
- list = u_slist_append (list, data);
-
- found = u_slist_find (list, data);
-
- if (found->data != data)
- return FAILED ("Find failed");
-
- u_slist_free (list);
- return OK;
-}
-
-static int
-find_custom (const void * a, const void * b)
-{
- return(strcmp (a, b));
-}
-
-RESULT
-test_slist_find_custom ()
-{
- USList *list = NULL, *found;
- char *foo = "foo";
- char *bar = "bar";
- char *baz = "baz";
-
- list = u_slist_prepend (list, baz);
- list = u_slist_prepend (list, bar);
- list = u_slist_prepend (list, foo);
-
- found = u_slist_find_custom (list, baz, find_custom);
-
- if (found == NULL)
- return FAILED ("Find failed");
-
- u_slist_free (list);
-
- return OK;
-}
-
-RESULT
-test_slist_remove ()
-{
- USList *list = u_slist_prepend (NULL, "three");
- char *one = "one";
- list = u_slist_prepend (list, "two");
- list = u_slist_prepend (list, one);
-
- list = u_slist_remove (list, one);
-
- if (u_slist_length (list) != 2)
- return FAILED ("Remove failed");
-
- if (strcmp ("two", list->data) != 0)
- return FAILED ("Remove failed");
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_remove_link ()
-{
- 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 = u_slist_concat (foo, bar);
- foo = u_slist_concat (foo, baz);
-
- list = u_slist_remove_link (list, bar);
-
- if (u_slist_length (list) != 2)
- return FAILED ("remove_link failed #1");
-
- if (bar->next != NULL)
- return FAILED ("remove_link failed #2");
-
- u_slist_free (list);
- u_slist_free (bar);
-
- 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_slist_insert_sorted ()
-{
- USList *list = u_slist_prepend (NULL, "a");
- list = u_slist_append (list, "aaa");
-
- /* insert at the middle */
- 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 = u_slist_insert_sorted (list, "", compare);
- if (strcmp ("", list->data))
- return FAILED ("insert_sorted failed #2");
-
- /* insert at the end */
- list = u_slist_insert_sorted (list, "aaaa", compare);
- if (strcmp ("aaaa", u_slist_last (list)->data))
- return FAILED ("insert_sorted failed #3");
-
- u_slist_free (list);
- return OK;
-}
-
-RESULT
-test_slist_insert_before ()
-{
- USList *foo, *bar, *baz;
-
- 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 = 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);
-
- u_slist_free (foo);
- return OK;
-}
-
-#define N_ELEMS 100
-
-static int intcompare (const void * p1, const void * p2)
-{
- return U_POINTER_TO_INT (p1) - U_POINTER_TO_INT (p2);
-}
-
-static uboolean verify_sort (USList *list, int len)
-{
- int 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 (len == 0)
- return FALSE;
- len--;
- }
- return len == 0;
-}
-
-RESULT
-test_slist_sort ()
-{
- int i, j, mul;
- USList *list = NULL;
-
- for (i = 0; i < N_ELEMS; ++i)
- 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");
-
- u_slist_free (list);
-
- list = NULL;
- for (i = 0; i < N_ELEMS; ++i)
- 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");
-
- u_slist_free (list);
-
- list = u_slist_prepend (NULL, U_INT_TO_POINTER (0));
- for (i = 1; i < N_ELEMS; ++i) {
- list = u_slist_prepend (list, U_INT_TO_POINTER (-i));
- list = u_slist_prepend (list, U_INT_TO_POINTER (i));
- }
- list = u_slist_sort (list, intcompare);
- if (!verify_sort (list, 2*N_ELEMS-1))
- return FAILED ("alternating 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 = u_slist_prepend (list, U_INT_TO_POINTER (mul * j));
- }
- list = u_slist_sort (list, intcompare);
- if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
- return FAILED ("wavering list");
-
- u_slist_free (list);
-
- return OK;
-}
-
-static Test slist_tests [] = {
- {"nth", test_slist_nth},
- {"index", test_slist_index},
- {"append", test_slist_append},
- {"concat", test_slist_concat},
- {"find", test_slist_find},
- {"find_custom", test_slist_find_custom},
- {"remove", test_slist_remove},
- {"remove_link", test_slist_remove_link},
- {"insert_sorted", test_slist_insert_sorted},
- {"insert_before", test_slist_insert_before},
- {"sort", test_slist_sort},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(slist_tests_init, slist_tests)
-
diff --git a/deps/ulib/test/spawn.c b/deps/ulib/test/spawn.c
deleted file mode 100644
index 3f809033..00000000
--- a/deps/ulib/test/spawn.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "test.h"
-
-#ifdef U_OS_WIN32
-#include <io.h>
-#define read _read
-#define close _close
-#endif
-
-RESULT
-test_spawn_sync ()
-{
- char *out;
- char *err;
- int status = -1;
- UError *error = NULL;
-
- if (!u_spawn_command_line_sync ("ls", &out, &err, &status, &error))
- return FAILED ("Error executing 'ls'");
-
- if (status != 0)
- return FAILED ("Status is %d", status);
-
- if (out == NULL || strlen (out) == 0)
- return FAILED ("Didn't get any output from ls!?");
-
- u_free (out);
- u_free (err);
- return OK;
-}
-
-RESULT
-test_spawn_async ()
-{
- /*
-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];
- pid_t child_pid = 0;
-
- memset (argv, 0, 15 * sizeof (char *));
- argv [0] = "ls";
- 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");
- if (stdout_fd == -1)
- return FAILED ("3 out fd is -1");
-
- while (read (stdout_fd, buffer, 512) > 0);
- close (stdout_fd);
-
- return OK;
-}
-
-static Test spawn_tests [] = {
- {"u_shell_spawn_sync", test_spawn_sync},
- {"u_shell_spawn_async_with_pipes", test_spawn_async},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(spawn_tests_init, spawn_tests)
-
-
diff --git a/deps/ulib/test/string-util.c b/deps/ulib/test/string-util.c
deleted file mode 100644
index af895ec0..00000000
--- a/deps/ulib/test/string-util.c
+++ /dev/null
@@ -1,698 +0,0 @@
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-/* This test is just to be used with valgrind */
-RESULT
-test_strfreev ()
-{
- char **array = u_new (char *, 4);
- array [0] = u_strdup ("one");
- array [1] = u_strdup ("two");
- array [2] = u_strdup ("three");
- array [3] = NULL;
-
- u_strfreev (array);
- u_strfreev (NULL);
-
- return OK;
-}
-
-RESULT
-test_concat ()
-{
- char *x = u_strconcat ("Hello", ", ", "world", NULL);
- if (strcmp (x, "Hello, world") != 0)
- return FAILED("concat failed, got: %s", x);
- u_free (x);
- return OK;
-}
-
-RESULT
-test_split ()
-{
- const char *to_split = "Hello world, how are we doing today?";
- int i;
- char **v;
-
- v= u_strsplit(to_split, " ", 0);
-
- if(v == NULL) {
- return FAILED("split failed, got NULL vector (1)");
- }
-
- for(i = 0; v[i] != NULL; i++);
- if(i != 7) {
- return FAILED("split failed, expected 7 tokens, got %d", i);
- }
-
- u_strfreev(v);
-
- v = u_strsplit(to_split, ":", -1);
- if(v == NULL) {
- return FAILED("split failed, got NULL vector (2)");
- }
-
- for(i = 0; v[i] != NULL; i++);
- if(i != 1) {
- return FAILED("split failed, expected 1 token, got %d", i);
- }
-
- if(strcmp(v[0], to_split) != 0) {
- return FAILED("expected vector[0] to be '%s' but it was '%s'",
- to_split, v[0]);
- }
- u_strfreev(v);
-
- v = u_strsplit ("", ":", 0);
- if (v == NULL)
- return FAILED ("u_strsplit returned NULL");
- u_strfreev (v);
-
- v = u_strsplit ("/home/miguel/dingus", "/", 0);
- if (v [0][0] != 0)
- return FAILED ("Got a non-empty first element");
- u_strfreev (v);
-
- v = u_strsplit ("appdomain1, Version=0.0.0.0, Culture=neutral", ",", 4);
- if (strcmp (v [0], "appdomain1") != 0)
- return FAILED ("Invalid value");
-
- if (strcmp (v [1], " Version=0.0.0.0") != 0)
- return FAILED ("Invalid value");
-
- if (strcmp (v [2], " Culture=neutral") != 0)
- return FAILED ("Invalid value");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements");
-
- u_strfreev (v);
-
- v = u_strsplit ("abcXYdefXghiXYjklYmno", "XY", 4);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 0");
-
- if (strcmp (v [1], "defXghi") != 0)
- return FAILED ("Invalid value 1");
-
- if (strcmp (v [2], "jklYmno") != 0)
- return FAILED ("Invalid value 2");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (1)");
-
- u_strfreev (v);
-
- v = u_strsplit ("abcXYdefXghiXYjklYmno", "XY", 2);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 3");
-
- if (strcmp (v [1], "defXghiXYjklYmno") != 0)
- return FAILED ("Invalid value 4");
-
- if (v [2] != NULL)
- return FAILED ("Expected only 2 elements (2)");
-
- u_strfreev (v);
-
- v = u_strsplit ("abcXYdefXghiXYjklYmnoXY", "XY", 3);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 5");
-
- if (strcmp (v [1], "defXghi") != 0)
- return FAILED ("Invalid value 6");
-
- if (strcmp (v [2], "jklYmnoXY") != 0)
- return FAILED ("Invalid value 7");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (3)");
-
- u_strfreev (v);
-
- v = u_strsplit ("abcXYXYXYdefXY", "XY", -1);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 8");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 9");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 10");
-
- if (strcmp (v [3], "def") != 0)
- return FAILED ("Invalid value 11");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 12");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (4)");
-
- u_strfreev (v);
-
- v = u_strsplit ("XYXYXYabcXYdef", "XY", -1);
- if (strcmp (v [0], "") != 0)
- return FAILED ("Invalid value 13");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 14");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 15");
-
- if (strcmp (v [3], "abc") != 0)
- return FAILED ("Invalid value 16");
-
- if (strcmp (v [4], "def") != 0)
- return FAILED ("Invalid value 17");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (5)");
-
- u_strfreev (v);
-
- 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)
- return FAILED ("Invalid value 19; expected '', got '%s'", v [1]);
- if (v [2] != NULL)
- return FAILED ("Expected only 2 elements (6)");
-
- u_strfreev (v);
-
- return OK;
-}
-
-RESULT
-test_split_set ()
-{
- char **v;
-
- v = u_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 6);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 0");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 1");
-
- if (strcmp (v [2], "def") != 0)
- return FAILED ("Invalid value 2");
-
- if (strcmp (v [3], "ghi") != 0)
- return FAILED ("Invalid value 3");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 4");
-
- if (strcmp (v [5], "jklYmno") != 0)
- return FAILED ("Invalid value 5");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (1)");
-
- u_strfreev (v);
-
- v = u_strsplit_set ("abcXYdefXghiXYjklYmno", "XY", 3);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 6");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 7");
-
- if (strcmp (v [2], "defXghiXYjklYmno") != 0)
- return FAILED ("Invalid value 8");
-
- if (v [3] != NULL)
- return FAILED ("Expected only 3 elements (2)");
-
- u_strfreev (v);
-
- v = u_strsplit_set ("abcXdefYghiXjklYmnoX", "XY", 5);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 9");
-
- if (strcmp (v [1], "def") != 0)
- return FAILED ("Invalid value 10");
-
- if (strcmp (v [2], "ghi") != 0)
- return FAILED ("Invalid value 11");
-
- if (strcmp (v [3], "jkl") != 0)
- return FAILED ("Invalid value 12");
-
- if (strcmp (v [4], "mnoX") != 0)
- return FAILED ("Invalid value 13");
-
- if (v [5] != NULL)
- return FAILED ("Expected only 5 elements (5)");
-
- u_strfreev (v);
-
- v = u_strsplit_set ("abcXYXdefXY", "XY", -1);
- if (strcmp (v [0], "abc") != 0)
- return FAILED ("Invalid value 14");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 15");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 16");
-
- if (strcmp (v [3], "def") != 0)
- return FAILED ("Invalid value 17");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 18");
-
- if (strcmp (v [5], "") != 0)
- return FAILED ("Invalid value 19");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (4)");
-
- u_strfreev (v);
-
- v = u_strsplit_set ("XYXabcXYdef", "XY", -1);
- if (strcmp (v [0], "") != 0)
- return FAILED ("Invalid value 20");
-
- if (strcmp (v [1], "") != 0)
- return FAILED ("Invalid value 21");
-
- if (strcmp (v [2], "") != 0)
- return FAILED ("Invalid value 22");
-
- if (strcmp (v [3], "abc") != 0)
- return FAILED ("Invalid value 23");
-
- if (strcmp (v [4], "") != 0)
- return FAILED ("Invalid value 24");
-
- if (strcmp (v [5], "def") != 0)
- return FAILED ("Invalid value 25");
-
- if (v [6] != NULL)
- return FAILED ("Expected only 6 elements (5)");
-
- u_strfreev (v);
-
- return OK;
-}
-
-RESULT
-test_strreverse ()
-{
- RESULT res = OK;
- 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;
- }
-
- u_strreverse (b);
- if (strcmp (b, b_target)) {
- res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
- goto cleanup;
- }
-
- u_strreverse (c);
- if (strcmp (c, c_target)) {
- res = FAILED("strreverse failed. Expecting: '%s' and got '%s'\n", b, b_target);
- goto cleanup;
- }
-
-cleanup:
- u_free (c);
- u_free (b);
- u_free (a);
- return res;
-}
-
-RESULT
-test_strjoin ()
-{
- char *s;
-
- s = u_strjoin (NULL, "a", "b", NULL);
- if (strcmp (s, "ab") != 0)
- return FAILED ("Join of two strings with no separator fails");
- u_free (s);
-
- s = u_strjoin ("", "a", "b", NULL);
- if (strcmp (s, "ab") != 0)
- return FAILED ("Join of two strings with empty separator fails");
- u_free (s);
-
- s = u_strjoin ("-", "a", "b", NULL);
- if (strcmp (s, "a-b") != 0)
- return FAILED ("Join of two strings with separator fails");
- u_free (s);
-
- s = u_strjoin ("-", "aaaa", "bbbb", "cccc", "dddd", NULL);
- if (strcmp (s, "aaaa-bbbb-cccc-dddd") != 0)
- return FAILED ("Join of multiple strings fails");
- u_free (s);
-
- s = u_strjoin ("-", NULL);
- if (s == NULL || (strcmp (s, "") != 0))
- return FAILED ("Failed to join empty arguments");
- u_free (s);
-
- return OK;
-}
-
-RESULT
-test_strchug ()
-{
- char *str = u_strdup (" \t\n hola");
-
- u_strchug (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- u_free (str);
- return FAILED ("Failed.");
- }
- u_free (str);
- return OK;
-}
-
-RESULT
-test_strchomp ()
-{
- char *str = u_strdup ("hola \t");
-
- u_strchomp (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- u_free (str);
- return FAILED ("Failed.");
- }
- u_free (str);
- return OK;
-}
-
-RESULT
-test_strstrip ()
-{
- char *str = u_strdup (" \t hola ");
-
- u_strstrip (str);
- if (strcmp ("hola", str)) {
- fprintf (stderr, "%s\n", str);
- u_free (str);
- return FAILED ("Failed.");
- }
- u_free (str);
- return OK;
-}
-
-#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 = 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 U_OS_WIN32
-#else
- char *s;
-
- urit ("/a", "file:///a");
- urit ("/home/miguel", "file:///home/miguel");
- urit ("/home/mig uel", "file:///home/mig%20uel");
- urit ("/\303\241", "file:///%C3%A1");
- urit ("/\303\241/octal", "file:///%C3%A1/octal");
- urit ("/%", "file:///%25");
- urit ("/\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040", "file:///%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20");
- urit ("/!$&'()*+,-./", "file:///!$&'()*+,-./");
- urit ("/\042\043\045", "file:///%22%23%25");
- urit ("/0123456789:=", "file:///0123456789:=");
- urit ("/\073\074\076\077", "file:///%3B%3C%3E%3F");
- urit ("/\133\134\135\136_\140\173\174\175", "file:///%5B%5C%5D%5E_%60%7B%7C%7D");
- urit ("/\173\174\175\176\177\200", "file:///%7B%7C%7D~%7F%80");
- urit ("/@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "file:///@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
- errit ("a");
- errit ("./hola");
-#endif
-
- return OK;
-}
-
-#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 = 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 U_OS_WIN32
-#else
- char *s;
-
- fileit ("file:///a", "/a");
- fileit ("file:///%41", "/A");
- fileit ("file:///home/miguel", "/home/miguel");
- fileit ("file:///home/mig%20uel", "/home/mig uel");
- ferrit ("/a");
- ferrit ("a");
- ferrit ("file://a");
- ferrit ("file:a");
- ferrit ("file:///%");
- ferrit ("file:///%0");
- ferrit ("file:///%jj");
-#endif
-
- return OK;
-}
-
-RESULT
-test_ascii_xdigit_value ()
-{
- int i;
- char j;
-
- i = u_ascii_xdigit_value ('9' + 1);
- if (i != -1)
- return FAILED ("'9' + 1");
- i = u_ascii_xdigit_value ('0' - 1);
- if (i != -1)
- return FAILED ("'0' - 1");
- i = u_ascii_xdigit_value ('a' - 1);
- if (i != -1)
- return FAILED ("'a' - 1");
- i = u_ascii_xdigit_value ('f' + 1);
- if (i != -1)
- return FAILED ("'f' + 1");
- i = u_ascii_xdigit_value ('A' - 1);
- if (i != -1)
- return FAILED ("'A' - 1");
- i = u_ascii_xdigit_value ('F' + 1);
- if (i != -1)
- return FAILED ("'F' + 1");
-
- for (j = '0'; j < '9'; 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 = 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 = u_ascii_xdigit_value (j);
- if (c != (j - 'A' + 10))
- return FAILED ("Upper %c -> %d", j, c);
- }
- return OK;
-}
-
-RESULT
-test_strdelimit ()
-{
- char *str;
-
- str = u_strdup (U_STR_DELIMITERS);
- str = u_strdelimit (str, NULL, 'a');
- if (0 != strcmp ("aaaaaaa", str))
- return FAILED ("All delimiters: '%s'", str);
- u_free (str);
- str = u_strdup ("hola");
- str = u_strdelimit (str, "ha", '+');
- if (0 != strcmp ("+ol+", str))
- return FAILED ("2 delimiters: '%s'", str);
- u_free (str);
- return OK;
-}
-
-#define NUMBERS "0123456789"
-
-RESULT
-test_strlcpy ()
-{
- const char *src = "onetwothree";
- char *dest;
- size_t i;
-
- dest = u_malloc (strlen (src) + 1);
- memset (dest, 0, strlen (src) + 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 = u_strlcpy (dest, src, 3);
- if (i != strlen (src))
- return FAILED ("Test1 got %d", i);
- if (0 != strcmp (dest, "on"))
- return FAILED ("Test2");
-
- i = u_strlcpy (dest, src, 1);
- if (i != strlen (src))
- return FAILED ("Test3 got %d", i);
- if (*dest != '\0')
- return FAILED ("Test4");
-
- 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");
- u_free (dest);
-
- /* 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);
- u_free (dest);
-
- return OK;
-}
-
-RESULT
-test_strescape ()
-{
- char *str;
-
- str = u_strescape ("abc", NULL);
- if (strcmp ("abc", str))
- return FAILED ("#1");
- 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 = u_strescape ("\001abc", NULL);
- if (strcmp ("\\001abc", str))
- return FAILED ("#3 %s", str);
- str = u_strescape ("\001abc", "\001");
- if (strcmp ("\001abc", str))
- return FAILED ("#3 %s", str);
- return OK;
-}
-
-RESULT
-test_ascii_strncasecmp ()
-{
- int n;
-
- n = u_ascii_strncasecmp ("123", "123", 1);
- if (n != 0)
- return FAILED ("Should have been 0");
-
- n = u_ascii_strncasecmp ("423", "123", 1);
- if (n != 3)
- return FAILED ("Should have been 3, got %d", n);
-
- n = u_ascii_strncasecmp ("123", "423", 1);
- if (n != -3)
- return FAILED ("Should have been -3, got %d", n);
-
- n = u_ascii_strncasecmp ("1", "1", 10);
- if (n != 0)
- return FAILED ("Should have been 0, got %d", n);
- return OK;
-}
-
-RESULT
-test_ascii_strdown ()
-{
- const char *a = "~09+AaBcDeFzZ$0909EmPAbCdEEEEEZZZZAAA";
- const char *b = "~09+aabcdefzz$0909empabcdeeeeezzzzaaa";
- char *c;
- int n, l;
-
- l = (int)strlen (b);
- c = u_ascii_strdown (a, l);
- n = u_ascii_strncasecmp (b, c, l);
-
- if (n != 0) {
- u_free (c);
- return FAILED ("Should have been 0, got %d", n);
- }
-
- u_free (c);
- return OK;
-}
-
-RESULT
-test_strdupv ()
-{
- char **one;
- char **two;
- int len;
-
- one = u_strdupv (NULL);
- if (one)
- return FAILED ("Should have been NULL");
-
- one = u_malloc (sizeof (char *));
- *one = NULL;
- two = u_strdupv (one);
- if (!two)
- FAILED ("Should have been not NULL");
- len = u_strv_length (two);
- if (len)
- FAILED ("Should have been 0");
- u_strfreev (two);
- u_strfreev (one);
- return NULL;
-}
-
-static Test strutil_tests [] = {
- {"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}
-};
-
-DEFINE_TEST_GROUP_INIT(strutil_tests_init, strutil_tests)
-
-
diff --git a/deps/ulib/test/string.c b/deps/ulib/test/string.c
deleted file mode 100644
index 19af6f1b..00000000
--- a/deps/ulib/test/string.c
+++ /dev/null
@@ -1,237 +0,0 @@
-#include <ulib.h>
-#include <string.h>
-#include <stdio.h>
-#include "test.h"
-
-#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()
-{
- UString *s = u_string_new("");
- int i;
-
- for(i = 0; i < 1024; i++) {
- u_string_append(s, "x");
- }
-
- if(strlen (s->str) != 1024) {
- return FAILED("Incorrect string size, got: %s %d",
- s->str, strlen(s->str));
- }
-
- u_string_free (s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_append_c_speed()
-{
- UString *s = u_string_new("");
- int i;
-
- for(i = 0; i < 1024; i++) {
- u_string_append_c(s, 'x');
- }
-
- if(strlen(s->str) != 1024) {
- return FAILED("Incorrect string size, got: %s %d", s->str,
- strlen(s->str));
- }
-
- u_string_free(s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_gstring ()
-{
- 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";
- u_string_free (s, TRUE);
-
- 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";
- }
-
- 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);
- }
-
- u_string_free (s, TRUE);
-
- s = u_string_new ("");
- for (i = 0; i < 1024; i++){
- 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));
- }
- u_string_free (s, TRUE);
-
- 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);
- }
- u_string_free (s, TRUE);
-
- s = u_string_new ("Hola");
- u_string_printf (s, "Dingus");
-
- /* Test that it does not release it */
- ret = u_string_free (s, FALSE);
- u_free (ret);
-
- 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);
- u_string_free (s, TRUE);
-
- return OK;
-}
-
-RESULT
-test_sized ()
-{
- 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");
-
- u_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_truncate ()
-{
- 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);
- u_string_free (s, TRUE);
-
- s = u_string_new ("a");
- s = u_string_truncate (s, 10);
- if (strlen (s->str) != 1)
- return FAILED ("The size is not 1");
- u_string_truncate (s, (size_t)-1);
- if (strlen (s->str) != 1)
- return FAILED ("The size is not 1");
- u_string_truncate (s, 0);
- if (strlen (s->str) != 0)
- return FAILED ("The size is not 0");
-
- u_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_prepend ()
-{
- 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);
-
- u_string_free (s, TRUE);
-
- /* This is to force the code that where stuff does not fit in the allocated block */
- 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);
- u_string_free (s, TRUE);
-
- /* This is to force the path where things fit */
- 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);
-
- u_string_prepend (s, "pre");
- if (strcmp (s->str, "pre1") != 0)
- return FAILED ("Expected [pre1], got [%s]", s->str);
- u_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_appendlen ()
-{
- UString *s = u_string_new ("");
-
- u_string_append_len (s, "boo\000x", 0);
- if (s->len != 0)
- return FAILED ("The length is not zero %d", s->len);
- u_string_append_len (s, "boo\000x", 5);
- if (s->len != 5)
- return FAILED ("The length is not five %d", s->len);
- u_string_append_len (s, "ha", -1);
- if (s->len != 7)
- return FAILED ("The length is not seven %d", s->len);
-
- u_string_free (s, TRUE);
-
- return NULL;
-}
-
-RESULT
-test_macros ()
-{
- char *s = u_strdup (U_STRLOC);
- char *p = strchr (s + 2, ':');
- int n;
-
- if (p == NULL)
- return FAILED ("Did not find a separator");
- n = atoi (p+1);
- if (n <= 0)
- return FAILED ("did not find a valid line number");
-
- *p = 0;
- if (strcmp (s + strlen(s) - 8 , "string.c") != 0)
- return FAILED ("This did not store the filename on U_STRLOC");
-
- u_free (s);
- return NULL;
-}
-
-static Test string_tests [] = {
- {"append-speed", test_append_speed},
- {"append_c-speed", test_append_c_speed},
- {"ctor+append", test_gstring },
- {"ctor+sized", test_sized },
- {"truncate", test_truncate },
- {"prepend", test_prepend },
- {"append_len", test_appendlen },
- {"macros", test_macros },
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(string_tests_init, string_tests)
diff --git a/deps/ulib/test/test-both b/deps/ulib/test/test-both
deleted file mode 100755
index ff41e2af..00000000
--- a/deps/ulib/test/test-both
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-for arg in $@; do
- if [ "x$arg" = "x--help" ]; then
- echo "Usage: $0 [OPTION]... [ITERATIONS] [TESTGROUP]..."
- echo ""
- echo "Works the same as test-eglib or test-glib with the following"
- echo "exception. Run test-eglib --help for details on normal testing"
- echo ""
- echo "If the first OPTION is --speed-compare, the following is"
- echo "applicable to this program:"
- echo ""
- echo " --speed-compare run drivers in -qtni mode and report"
- echo " speed comparison information"
- echo ""
- echo "After --speed-compare, the number of iterations "
- echo "(optional, default is 100000) can be specified, followed "
- echo "by specific tests to run (or none to run all)"
- echo ""
- echo "If --speed-compare is not the first argument, all arguments are"
- echo "passed on directly to each driver"
- echo ""
- exit 1
- fi
-done
-
-if [ ! -x "./test-glib" -o ! -x "./test-eglib" ]; then
- make
-fi
-
-if [ "x$1" = "x--speed-compare" ]; then
- ITERATIONS=100000
- if [ ! -z "$2" ]; then
- case $2 in
- *[0-9]*) ITERATIONS=$2; break;
- esac
- fi
-
- OPTIONS="-qnti $ITERATIONS"
-
- for arg in $@; do
- if [ "x$arg" = "x--speed-compare" ]; then
- continue;
- elif [ "$arg" = "$ITERATIONS" ]; then
- continue;
- fi
-
- OPTIONS="$OPTIONS $arg"
- done
-
- echo "Running tests with $OPTIONS..."
-
- GLIB=`./test-glib $OPTIONS`
- ULIB=`./test-eglib $OPTIONS`
-
- # this blows
- 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 }'`
-
- echo "$FASTER_NAME $FASTER_SPEED"
- echo "$SLOWER_NAME $SLOWER_SPEED"
- echo "------------------------------------------------"
- echo "$FASTER_NAME is $FASTER_PERCENTAGE% faster than $SLOWER_NAME"
-
- exit 0;
-fi
-
-./test-eglib $@
-./test-glib $@
-
diff --git a/deps/ulib/test/test.c b/deps/ulib/test/test.c
deleted file mode 100644
index 8f051a48..00000000
--- a/deps/ulib/test/test.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * ULib Unit Group/Test Runners
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ulib.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef U_OS_WIN32
-#include <winsock2.h>
-#endif
-
-#include "test.h"
-
-extern int global_passed, global_tests;
-
-#ifndef HAVE_VASPRINTF
- /* systen does not provide a vasprintf function, use the one
- provided within eglib itself */
-extern int vasprintf(char **ret, const char *format, va_list ap);
-#endif
-
-static char *last_result = NULL;
-
-uboolean
-run_test(Test *test, char **result_out)
-{
- char *result;
-
- if((result = test->handler()) == NULL) {
- *result_out = NULL;
- return TRUE;
- } else {
- *result_out = result;
- return FALSE;
- }
-}
-
-uboolean
-run_group(Group *group, int iterations, uboolean quiet,
- uboolean time, char *tests_to_run_s)
-{
- Test *tests = group->handler();
- int i, j, passed = 0, total = 0;
- double start_time_group, start_time_test;
- char **tests_to_run = NULL;
-
- if(!quiet) {
- if(iterations > 1) {
- printf("[%s] (%dx)\n", group->name, iterations);
- } else {
- printf("[%s]\n", group->name);
- }
- }
-
- if(tests_to_run_s != NULL) {
- tests_to_run = eg_strsplit(tests_to_run_s, ",", -1);
- }
-
- start_time_group = get_timestamp();
-
- for(i = 0; tests[i].name != NULL; i++) {
- char *result = "";
- uboolean iter_pass, run;
-
- iter_pass = FALSE;
- if(tests_to_run != NULL) {
- int j;
- run = FALSE;
- for(j = 0; tests_to_run[j] != NULL; j++) {
- if(strcmp(tests_to_run[j], tests[i].name) == 0) {
- run = TRUE;
- break;
- }
- }
- } else {
- run = TRUE;
- }
-
- if(!run) {
- continue;
- }
-
- total++;
-
- if(!quiet) {
- printf(" %s: ", tests[i].name);
- }
-
- start_time_test = get_timestamp();
-
- for(j = 0; j < iterations; j++) {
- iter_pass = run_test(&(tests[i]), &result);
- if(!iter_pass) {
- break;
- }
- }
-
- if(iter_pass) {
- passed++;
- if(!quiet) {
- if(time) {
- printf("OK (%g)\n", get_timestamp() - start_time_test);
- } else {
- printf("OK\n");
- }
- }
- } else {
- if(!quiet) {
- printf("FAILED (%s)\n", result);
- }
-
- if(last_result == result) {
- last_result = NULL;
- u_free(result);
- }
- }
- }
-
- global_passed += passed;
- global_tests += total;
-
- if(!quiet) {
- 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);
- } else {
- printf(" %d / %d (%g%%)\n", passed, total, pass_percentage);
- }
- }
-
- if(tests_to_run != NULL) {
- eg_strfreev(tests_to_run);
- }
-
- return passed == total;
-}
-
-RESULT
-FAILED(const char *format, ...)
-{
- char *ret;
- va_list args;
- int n;
-
-#if !defined(HAVE_VASPRINTF) && !defined(_ULIB_MAJOR)
- /* We are linked against the real glib, no vasprintf */
- u_assert_not_reached ();
- return NULL;
-#else
- va_start(args, format);
- n = vasprintf(&ret, format, args);
- va_end(args);
-
- if(n == -1) {
- last_result = NULL;
- return NULL;
- }
-
- last_result = ret;
- return ret;
-#endif
-}
-
-double
-get_timestamp()
-{
- /* 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 u_strsplit skew between
- * ULib and ULib
- */
-
-char **
-eg_strsplit (const char *string, const char *delimiter, int max_tokens)
-{
- char *string_c;
- char *strtok_save, **vector;
- char *token, *token_c;
- int size = 1;
- size_t token_length;
-
- 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 = (char *)u_malloc(token_length + 1);
- memcpy(string_c, string, token_length);
- string_c[token_length] = 0;
-
- vector = NULL;
- token = (char *)strtok_r(string_c, delimiter, &strtok_save);
-
- while(token != NULL) {
- token_length = strlen(token);
- token_c = (char *)u_malloc(token_length + 1);
- memcpy(token_c, token, token_length);
- token_c[token_length] = 0;
-
- vector = vector == NULL ?
- (char **)u_malloc(2 * sizeof(vector)) :
- (char **)u_realloc(vector, (size + 1) * sizeof(vector));
-
- vector[size - 1] = token_c;
- size++;
-
- if(max_tokens > 0 && size >= max_tokens) {
- if(size > max_tokens) {
- break;
- }
-
- token = strtok_save;
- } else {
- token = (char *)strtok_r(NULL, delimiter, &strtok_save);
- }
- }
-
- if(vector != NULL && size > 0) {
- vector[size - 1] = NULL;
- }
-
- u_free(string_c);
- string_c = NULL;
-
- return vector;
-}
-
-void
-eg_strfreev (char **str_array)
-{
- char **orig = str_array;
- if (str_array == NULL)
- return;
- while (*str_array != NULL){
- u_free (*str_array);
- str_array++;
- }
- u_free (orig);
-}
-
-
-
diff --git a/deps/ulib/test/test.h b/deps/ulib/test/test.h
deleted file mode 100644
index 97ae8c0f..00000000
--- a/deps/ulib/test/test.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * ULib Unit Group/Test Runners
- *
- * Author:
- * Aaron Bockover (abockover@novell.com)
- *
- * (C) 2006 Novell, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _TEST_H
-#define _TEST_H
-
-#include <config.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <ulib.h>
-
-#ifdef _MSC_VER
-/* 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 (test macros produce a lot of these)
-*/
-#pragma warning(disable:4100 4127)
-#endif
-
-typedef char * RESULT;
-
-typedef struct _Test Test;
-typedef struct _Group Group;
-
-typedef char * (* RunTestHandler)();
-typedef Test * (* LoadGroupHandler)();
-
-struct _Test {
- const char *name;
- RunTestHandler handler;
-};
-
-struct _Group {
- const char *name;
- LoadGroupHandler handler;
-};
-
-uboolean run_group(Group *group, int iterations, uboolean quiet,
- uboolean time, char *tests);
-#undef FAILED
-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
-
-#define DEFINE_TEST_GROUP_INIT(name, table) \
- Test * (name)() { return table; }
-
-#define DEFINE_TEST_GROUP_INIT_H(name) \
- Test * (name)();
-
-#endif /* _TEST_H */
-
-
diff --git a/deps/ulib/test/tests.h b/deps/ulib/test/tests.h
deleted file mode 100644
index 6f00d8c3..00000000
--- a/deps/ulib/test/tests.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "test.h"
-
-DEFINE_TEST_GROUP_INIT_H(string_tests_init);
-DEFINE_TEST_GROUP_INIT_H(strutil_tests_init);
-DEFINE_TEST_GROUP_INIT_H(slist_tests_init);
-DEFINE_TEST_GROUP_INIT_H(list_tests_init);
-DEFINE_TEST_GROUP_INIT_H(hashtable_tests_init);
-DEFINE_TEST_GROUP_INIT_H(ptrarray_tests_init);
-DEFINE_TEST_GROUP_INIT_H(size_tests_init);
-DEFINE_TEST_GROUP_INIT_H(fake_tests_init);
-DEFINE_TEST_GROUP_INIT_H(array_tests_init);
-DEFINE_TEST_GROUP_INIT_H(queue_tests_init);
-DEFINE_TEST_GROUP_INIT_H(path_tests_init);
-DEFINE_TEST_GROUP_INIT_H(shell_tests_init);
-DEFINE_TEST_GROUP_INIT_H(spawn_tests_init);
-DEFINE_TEST_GROUP_INIT_H(timer_tests_init);
-DEFINE_TEST_GROUP_INIT_H(file_tests_init);
-DEFINE_TEST_GROUP_INIT_H(dir_tests_init);
-DEFINE_TEST_GROUP_INIT_H(unicode_tests_init);
-DEFINE_TEST_GROUP_INIT_H(utf8_tests_init);
-DEFINE_TEST_GROUP_INIT_H(endian_tests_init);
-DEFINE_TEST_GROUP_INIT_H(module_tests_init);
-DEFINE_TEST_GROUP_INIT_H(memory_tests_init);
-
-static Group test_groups [] = {
- {"string", string_tests_init},
- {"strutil", strutil_tests_init},
- {"ptrarray", ptrarray_tests_init},
- {"slist", slist_tests_init},
- {"list", list_tests_init},
- {"hashtable", hashtable_tests_init},
- {"sizes", size_tests_init},
- {"fake", fake_tests_init},
- {"array", array_tests_init},
- {"queue", queue_tests_init},
- {"path", path_tests_init},
- {"shell", shell_tests_init},
-#if !DISABLE_PROCESS_TESTS
- {"spawn", spawn_tests_init},
- {"module", module_tests_init},
-#endif
-#if !DISABLE_FILESYSTEM_TESTS
- {"file", file_tests_init},
-#endif
- {"timer", timer_tests_init},
- {"dir", dir_tests_init},
- {"unicode", unicode_tests_init},
- {"utf8", utf8_tests_init},
- {"endian", endian_tests_init},
- {"memory", memory_tests_init},
- {NULL, NULL}
-};
-
diff --git a/deps/ulib/test/timer.c b/deps/ulib/test/timer.c
deleted file mode 100644
index 206a6fcf..00000000
--- a/deps/ulib/test/timer.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <config.h>
-#include <ulib.h>
-#include <string.h>
-#include <math.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifdef U_OS_WIN32
-#include <windows.h>
-#define sleep(t) Sleep((t) * 1000)
-#endif
-
-#include "test.h"
-
-RESULT
-test_timer ()
-{
- UTimer *timer;
- double elapsed1, elapsed2;
- unsigned long usec = 0;
-
- timer = u_timer_new ();
- sleep (1);
- elapsed1 = u_timer_elapsed (timer, NULL);
- if ((elapsed1 + 0.1) < 1.0)
- return FAILED ("Elapsed time should be around 1s and was %f", elapsed1);
-
- 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);
-
- elapsed2 *= 1000000;
- while (elapsed2 > 1000000)
- elapsed2 -= 1000000;
-
- if (fabs (usec - elapsed2) > 100.0)
- return FAILED ("usecs are wrong.");
-
- u_timer_destroy (timer);
- return OK;
-}
-
-static Test timer_tests [] = {
- {"u_timer", test_timer},
- {NULL, NULL}
-};
-
-DEFINE_TEST_GROUP_INIT(timer_tests_init, timer_tests)
-
-
diff --git a/deps/ulib/test/unicode.c b/deps/ulib/test/unicode.c
deleted file mode 100644
index eaac5d96..00000000
--- a/deps/ulib/test/unicode.c
+++ /dev/null
@@ -1,99 +0,0 @@
-#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/ulib/test/utf8.c b/deps/ulib/test/utf8.c
deleted file mode 100644
index 89e879ef..00000000
--- a/deps/ulib/test/utf8.c
+++ /dev/null
@@ -1,935 +0,0 @@
-#include <stdlib.h>
-
-#include "test.h"
-
-/*
- * u_utf16_to_utf8
- */
-
-long
-compare_strings_utf8_pos (const char *expected, const char *actual, long size)
-{
- int i;
- for (i = 0; i < size; i++)
- if (expected [i] != actual [i])
- return i;
- return -1;
-}
-
-RESULT
-compare_strings_utf8_RESULT (const char *expected, const char *actual, long size)
-{
- long ret;
-
- ret = compare_strings_utf8_pos (expected, actual, size);
- if (ret < 0)
- return OK;
- return FAILED ("Incorrect output: expected '%s' but was '%s', differ at %d\n", expected, actual, ret);
-}
-
-void
-char_to_uunichar2 (uunichar2 ret[], const char *src)
-{
- int i;
-
- for (i = 0; src [i]; i++)
- ret [i] = src [i];
- ret [i] = 0;
-}
-
-RESULT
-compare_utf16_to_utf8_explicit (const char *expected, const uunichar2 *utf16, long len_in, long len_out, long size_spec)
-{
- UError *error;
- char* ret;
- RESULT result;
- long in_read, out_read;
-
- result = NULL;
-
- error = NULL;
- 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);
- u_error_free (error);
- if (ret)
- u_free (ret);
- return result;
- }
- if (in_read != len_in)
- result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
- else if (out_read != len_out)
- result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
- else
- result = compare_strings_utf8_RESULT (expected, ret, len_out);
-
- u_free (ret);
- if (result)
- return result;
-
- return OK;
-}
-
-RESULT
-compare_utf16_to_utf8 (const char *expected, const uunichar2 *utf16, long len_in, long len_out)
-{
- RESULT result;
-
- result = compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, -1);
- if (result != OK)
- return result;
- return compare_utf16_to_utf8_explicit (expected, utf16, len_in, len_out, len_in);
-}
-
-RESULT
-test_utf16_to_utf8 ()
-{
- 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;
-
- char_to_uunichar2 (str1, src1);
-
- /* empty string */
- result = compare_utf16_to_utf8 (src0, str0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf16_to_utf8 (src1, str1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src2, str2, 2, 4);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src3, str3, 1, 3);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src4, str4, 1, 3);
- if (result != OK)
- return result;
- result = compare_utf16_to_utf8 (src5, str5, 2, 4);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-/*
- * u_utf8_to_utf16
- */
-
-long
-compare_strings_utf16_pos (const uunichar2 *expected, const uunichar2 *actual, long size)
-{
- int i;
- for (i = 0; i < size; i++)
- if (expected [i] != actual [i])
- return i;
- return -1;
-}
-
-RESULT
-compare_strings_utf16_RESULT (const uunichar2 *expected, const uunichar2 *actual, long size)
-{
- long ret;
-
- ret = compare_strings_utf16_pos (expected, actual, size);
- if (ret < 0)
- return OK;
- 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(ULIB_TESTS)
-#define eg_utf8_to_utf16_with_nuls u_utf8_to_utf16
-#endif
-
-RESULT
-compare_utf8_to_utf16_explicit (const uunichar2 *expected, const char *utf8, long len_in, long len_out, long size_spec, uboolean include_nuls)
-{
- UError *error;
- uunichar2* ret;
- RESULT result;
- long in_read, out_read;
-
- result = NULL;
-
- error = NULL;
- if (include_nuls)
- ret = eg_utf8_to_utf16_with_nuls (utf8, size_spec, &in_read, &out_read, &error);
- else
- 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);
- u_error_free (error);
- if (ret)
- u_free (ret);
- return result;
- }
- if (in_read != len_in)
- result = FAILED ("Read size is incorrect: expected %d but was %d\n", len_in, in_read);
- else if (out_read != len_out)
- result = FAILED ("Converted size is incorrect: expected %d but was %d\n", len_out, out_read);
- else
- result = compare_strings_utf16_RESULT (expected, ret, len_out);
-
- u_free (ret);
- if (result)
- return result;
-
- return OK;
-}
-
-RESULT
-compare_utf8_to_utf16_general (const uunichar2 *expected, const char *utf8, long len_in, long len_out, uboolean include_nuls)
-{
- RESULT result;
-
- result = compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, -1, include_nuls);
- if (result != OK)
- return result;
- return compare_utf8_to_utf16_explicit (expected, utf8, len_in, len_out, len_in, include_nuls);
-}
-
-RESULT
-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 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);
-}
-
-
-RESULT
-test_utf8_seq ()
-{
- 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 = u_utf8_to_utf16 (src, (long)strlen (src), &in_read, &out_read, &error);
- if (error != NULL){
- return error->message;
- }
-
- if (in_read != 4) {
- return FAILED ("in_read is expected to be 4 but was %d\n", in_read);
- }
- if (out_read != 2) {
- return FAILED ("out_read is expected to be 2 but was %d\n", out_read);
- }
- u_free (dst);
-
- return OK;
-}
-
-RESULT
-test_utf8_to_utf16 ()
-{
- 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;
-
- char_to_uunichar2 (str1, src1);
-
- /* empty string */
- result = compare_utf8_to_utf16 (str0, src0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf8_to_utf16 (str1, src1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str2, src2, 4, 2);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str3, src3, 3, 1);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16 (str4, src4, 3, 1);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-RESULT
-test_utf8_to_utf16_with_nuls ()
-{
- 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(ULIB_TESTS)
- return OK;
-#endif
-
- /* implicit length is forbidden */
- if (eg_utf8_to_utf16_with_nuls (src1, -1, NULL, NULL, NULL) != NULL)
- return FAILED ("explicit nulls must fail with -1 length\n");
-
- /* empty string */
- result = compare_utf8_to_utf16_with_nuls (str0, src0, 0, 0);
- if (result != OK)
- return result;
-
- result = compare_utf8_to_utf16_with_nuls (str1, src1, 5, 5);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str2, src2, 4, 2);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str3, src3, 3, 1);
- if (result != OK)
- return result;
- result = compare_utf8_to_utf16_with_nuls (str4, src4, 3, 1);
- if (result != OK)
- return result;
-
- return OK;
-}
-
-typedef struct {
- char *content;
- size_t length;
-} convert_result_t;
-
-RESULT
-test_convert ()
-{
- static const char *charsets[] = { "UTF-8", "UTF-16LE", "UTF-16BE", "UTF-32LE", "UTF-32BE" };
- size_t length, converted_length, n;
- char *content, *converted, *path;
- convert_result_t **expected;
- UError *err = NULL;
- const char *srcdir;
- uboolean loaded;
- unsigned int i, j, k;
- char c;
-
- if (!(srcdir = getenv ("srcdir")) && !(srcdir = getenv ("PWD")))
- return FAILED ("srcdir not defined!");
-
- expected = u_malloc (sizeof (convert_result_t *) * U_N_ELEMENTS (charsets));
-
- /* first load all our test samples... */
- 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++) {
- u_free (expected[j]->content);
- u_free (expected[j]);
- }
-
- u_free (expected);
-
- return FAILED ("Failed to load content for %s: %s", charsets[i], err->message);
- }
-
- 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 < 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 < U_N_ELEMENTS (charsets); k++) {
- u_free (expected[k]->content);
- u_free (expected[k]);
- }
-
- 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 < U_N_ELEMENTS (charsets); k++) {
- u_free (expected[k]->content);
- u_free (expected[k]);
- }
-
- 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 < U_N_ELEMENTS (charsets); k++) {
- u_free (expected[k]->content);
- u_free (expected[k]);
- }
-
- 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]);
- }
- }
-
- u_free (converted);
- }
- }
-
- for (k = 0; k < U_N_ELEMENTS (charsets); k++) {
- u_free (expected[k]->content);
- u_free (expected[k]);
- }
-
- u_free (expected);
-
- return OK;
-}
-
-
-RESULT
-test_xdigit ()
-{
- static char test_chars[] = {
- '0', '1', '2', '3', '4',
- '5', '6', '7', '8', '9',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g',
- '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 (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 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)
-{
- 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)
- return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
- if (result_error && !expect_error)
- return FAILED("There should not be an error code.");
- if (!result_error && expect_error)
- return FAILED("Unexpected error object.");
- if (expect_error && result_str)
- return FAILED("NULL should be returned when an error occurs.");
- if (!expect_error && !result_str)
- return FAILED("When no error occurs NULL should not be returned.");
- for (i=0; i<expected_items_written;i++) {
- 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')
- return FAILED("Null termination not found at the end of the string.");
-
- return OK;
-}
-
-RESULT
-test_ucs4_to_utf16 ()
-{
- 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;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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);
- u_free (res);
- if (check_result) return check_result;
-
- items_read = items_written = 0;
- err = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- err = 0;
- 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;
- 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 = 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;
- u_free (res);
- current_write_index += items_written;
- }
-
- items_read = items_written = 0;
- err = 0;
- 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;
- u_free (res);
-
- return OK;
-}
-
-static RESULT
-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)
-{
- 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)
- return FAILED("Incorrect number of items written; expected %d, got %d", expected_items_written, result_items_written);
- if (result_error && !expect_error)
- return FAILED("There should not be an error code.");
- if (!result_error && expect_error)
- return FAILED("Unexpected error object.");
- if (expect_error && result_str)
- return FAILED("NULL should be returned when an error occurs.");
- if (!expect_error && !result_str)
- return FAILED("When no error occurs NULL should not be returned.");
- for (i=0; i<expected_items_written;i++) {
- 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')
- return FAILED("Null termination not found at the end of the string.");
-
- return OK;
-}
-
-RESULT
-test_utf16_to_ucs4 ()
-{
- 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 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;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- 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;
- u_free (res);
-
- items_read = items_written = 0;
- err = 0;
- 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;
- 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 = 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;
- u_free (res);
- current_read_index += read_write[i*3];
- current_write_index += items_written;
- }
-
- items_read = items_written = 0;
- err = 0;
- 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;
- u_free (res);
-
- return OK;
-}
-RESULT
-test_utf8_strlen ()
-{
- 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 = 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 = u_utf8_strlen (word1,1);
- if (len != 0)
- return FAILED ("Word1, max = 1, expected length of 0, but was %i", len);
- len = u_utf8_strlen (word1,2);
- if (len != 1)
- return FAILED ("Word1, max = 1, expected length of 1, but was %i", len);
- 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 = u_utf8_strlen (word2,-1);
- if (len != 5)
- return FAILED ("Word2 expected length of 5, but was %i", len);
-
- //Test word3
- len = u_utf8_strlen (word3,-1);
- if (len != 4)
- return FAILED ("Word3 expected length of 4, but was %i", len);
-
- //Test word4
- len = u_utf8_strlen (word4,-1);
- if (len != 5)
- return FAILED ("Word4 expected length of 5, but was %i", len);
-
- //Test null case
- len = u_utf8_strlen(NULL,0);
- if (len != 0)
- return FAILED ("Expected passing null to result in a length of 0");
- return OK;
-}
-
-RESULT
-test_utf8_get_char()
-{
- char word1 [] = {0xC2, 0x82,0x45,0xE1, 0x81, 0x83,0x58,0xF1, 0x82, 0x82, 0x82,'\0'}; //Valid, len = 5
-
- uunichar value = u_utf8_get_char (&word1 [0]);
- if (value != 0x82UL)
- return FAILED ("Expected value of 0x82, but was %x", value);
- value = u_utf8_get_char (&word1 [2]);
- if (value != 0x45UL)
- return FAILED ("Expected value of 0x45, but was %x", value);
- value = u_utf8_get_char (&word1 [3]);
- if (value != 0x1043UL)
- return FAILED ("Expected value of 0x1043, but was %x", value);
- value = u_utf8_get_char (&word1 [6]);
- if (value != 0x58UL)
- return FAILED ("Expected value of 0x58, but was %x", value);
- value = u_utf8_get_char (&word1 [7]);
- if (value != 0x42082UL)
- return FAILED ("Expected value of 0x42082, but was %x", value);
-
- return OK;
-}
-
-RESULT
-test_utf8_next_char()
-{
- 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 = u_utf8_next_char (ptr);
- count++;
- }
-
- //Test word2
- count = 0;
- ptr = word2;
- while (*ptr != 0) {
- if (count > 4)
- 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 = u_utf8_next_char (ptr);
- count++;
- }
-
- return OK;
-}
-
-RESULT
-test_utf8_validate()
-{
- 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 = 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 = 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 = 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 = u_utf8_validate (validWord2, -1, &end);
- if (retVal != TRUE)
- return FAILED ("Expected validWord2 to be valid");
- if (end != &validWord2 [11])
- return FAILED ("Expected end parameter to be pointing to validWord2[11]");
- return OK;
-}
-
-long
-utf8_byteslen (const char *src)
-{
- int i = 0;
- do {
- if (src [i] == '\0')
- return i;
- i++;
- } while (TRUE);
-}
-
-RESULT
-test_utf8_strcase_each (const char *src, const char *expected, uboolean strup)
-{
- char *tmp;
- long len, len2;
- RESULT r;
-
- len = utf8_byteslen (src);
- 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);
- u_free (tmp);
- return r;
-}
-
-RESULT
-test_utf8_strup_each (const char *src, const char *expected)
-{
- return test_utf8_strcase_each (src, expected, TRUE);
-}
-
-RESULT
-test_utf8_strdown_each (const char *src, const char *expected)
-{
- return test_utf8_strcase_each (src, expected, FALSE);
-}
-
-/*
- * u_utf8_strup
- */
-RESULT
-test_utf8_strup ()
-{
- RESULT r;
-
- if ((r = test_utf8_strup_each ("aBc", "ABC")) != OK)
- return r;
- if ((r = test_utf8_strup_each ("x86-64", "X86-64")) != OK)
- return r;
- // U+3B1 U+392 -> U+391 U+392
- if ((r = test_utf8_strup_each ("\xCE\xB1\xCE\x92", "\xCE\x91\xCE\x92")) != OK)
- return r;
- // U+FF21 -> U+FF21
- if ((r = test_utf8_strup_each ("\xEF\xBC\xA1", "\xEF\xBC\xA1")) != OK)
- return r;
- // U+FF41 -> U+FF21
- if ((r = test_utf8_strup_each ("\xEF\xBD\x81", "\xEF\xBC\xA1")) != OK)
- return r;
- // U+10428 -> U+10400
- if ((r = test_utf8_strup_each ("\xF0\x90\x90\xA8", "\xF0\x90\x90\x80")) != OK)
- return r;
-
- return OK;
-}
-
-/*
- * u_utf8_strdown
- */
-RESULT
-test_utf8_strdown ()
-{
- RESULT r;
-
- if ((r = test_utf8_strdown_each ("aBc", "abc")) != OK)
- return r;
- if ((r = test_utf8_strdown_each ("X86-64", "x86-64")) != OK)
- return r;
- // U+391 U+3B2 -> U+3B1 U+3B2
- if ((r = test_utf8_strdown_each ("\xCE\x91\xCE\xB2", "\xCE\xB1\xCE\xB2")) != OK)
- return r;
-/*
- // U+FF41 -> U+FF41
- if ((r = test_utf8_strdown_each ("\xEF\xBC\x81", "\xEF\xBC\x81")) != OK)
- return r;
- // U+FF21 -> U+FF41
- if ((r = test_utf8_strdown_each ("\xEF\xBC\xA1", "\xEF\xBD\x81")) != OK)
- return r;
- // U+10400 -> U+10428
- if ((r = test_utf8_strdown_each ("\xF0\x90\x90\x80", "\xF0\x90\x90\xA8")) != OK)
- return r;
-*/
- return OK;
-}
-
-/*
- * test initialization
- */
-
-static Test utf8_tests [] = {
- {"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}
-};
-
-DEFINE_TEST_GROUP_INIT(utf8_tests_init, utf8_tests)
-
-
diff --git a/deps/ulib/test/whats-implemented b/deps/ulib/test/whats-implemented
deleted file mode 100755
index 8a113578..00000000
--- a/deps/ulib/test/whats-implemented
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-# Author: Aaron Bockover
-# Licensed under MIT/X11
-# (C) 2006 Novell
-
-if [ "x$1" = "x--help" ]; then
- echo "Usage: $0 [--show-only-mono]"
- echo ""
- echo "This script prints a sorted list of GLib functions used in Mono"
- echo "that have not yet been implemented in EGlib."
- echo ""
- echo "If --show-only-mono is passed, then the script will print all"
- echo "GLib functions used in Mono, whether or not they have been"
- echo "implemented in EGlib yet."
- echo ""
- echo "This script relies on the MONO_CHECKOUT environment variable."
- echo "MONO_CHECKOUT should be set to the location of a mono checkout."
- echo ""
- exit 1
-fi
-
-IGNORE_FUNCTIONS="g_hash_table_lookup_node g_hash_table_foreach_remove_or_steal g_hash_table_resize"
-
-if [ -z $MONO_CHECKOUT ]; then
- if [ -e ../../mono.pc.in ]; then
- MONO_CHECKOUT=../..
- else
- MONO_CHECKOUT=~/cvs/mono/mono
- fi
-fi
-
-if [ ! -d $MONO_CHECKOUT ]; then
- echo "Cannot find mono checkout; set MONO_CHECKOUT"
- exit 1
-fi
-
-MONO_CHECKOUT="$MONO_CHECKOUT/mono"
-RESULTS_FILE=.results
-
-(for i in `find $MONO_CHECKOUT -iregex \.*.c$`; do
- grep -oP "[ \t\(\)]+g_[a-z_]+[ ]{0,1}\([A-Za-z_\&\*\,\(\) ]+\)" $i |
- awk 'BEGIN { FS="(" } { print $1 }' |
- sed -e 's/[^A-Za-z_]//g'
- done
-) > $RESULTS_FILE
-
-if [ ! "x$1" = "x--show-only-mono" ]; then
- IMPLEMENTED_FUNCTIONS=`grep -oP "g_[a-z_]+[ ]{0,1}" ../src/glib.h | awk 'BEGIN { FS="(" } { print $1 }'`
-
- rm -f $RESULTS_FILE.tmp
-
- for mono_function in `cat $RESULTS_FILE`; do
- matched="no"
- for implemented_function in $IMPLEMENTED_FUNCTIONS; do
- if [ "x$mono_function" = "x$implemented_function" ]; then
- matched="yes"
- break
- fi
- done
-
- for ignore_function in $IGNORE_FUNCTIONS; do
- if [ "x$ignore_function" = "x$mono_function" ]; then
- matched="yes"
- break
- fi
- done
-
- if [ "x$matched" = "xno" ]; then
- echo $mono_function >> $RESULTS_FILE.tmp
- fi
- done
-
- mv $RESULTS_FILE.tmp $RESULTS_FILE
-fi
-
-(for i in `cat $RESULTS_FILE | sort -u`; do
- echo "`grep -c $i $RESULTS_FILE` $i";
- done;
-) | sort -nr
-
-rm $RESULTS_FILE
-
diff --git a/examples/Makefile.am b/examples/Makefile.am
index ae4dd780..8c03d6cd 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -2,8 +2,8 @@ include $(top_srcdir)/build/autotools/Makefile.am.silent
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/deps/ulib/src \
- -I$(top_builddir)/deps/ulib/src
+ -I$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src
AM_CFLAGS = \
$(COGL_DEP_CFLAGS) \
@@ -18,7 +18,7 @@ endif
common_ldadd = \
$(COGL_DEP_LIBS) \
$(top_builddir)/cogl/libcogl2.la \
- $(top_builddir)/deps/ulib/src/libulib.la \
+ $(top_builddir)/deps/clib/src/libclib.la \
$(LIBM)
programs = cogl-info
@@ -106,7 +106,7 @@ cogl_sdl2_hello_LDADD = $(common_ldadd)
endif
if USING_EMSCRIPTEN
-%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/ulib/src/.libs/libulib.a
+%.html: %.o $(top_builddir)/cogl/.libs/libcogl2.so $(top_builddir)/deps/clib/src/.libs/libclib.a
$(CC) $(AM_CFLAGS) $(CFLAGS) --js-library $(top_srcdir)/examples/emscripten-example-js-library.js -o $@ $^
all-local: $(addsuffix .html, $(programs))
diff --git a/test-fixtures/Makefile.am b/test-fixtures/Makefile.am
index 87c10654..7f3cd4a8 100644
--- a/test-fixtures/Makefile.am
+++ b/test-fixtures/Makefile.am
@@ -4,8 +4,8 @@ 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 \
+ -I$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src \
-Wall \
$(NULL)
diff --git a/test-fixtures/test-utils.h b/test-fixtures/test-utils.h
index bc106c23..9a301ca4 100644
--- a/test-fixtures/test-utils.h
+++ b/test-fixtures/test-utils.h
@@ -20,7 +20,7 @@
#include <cogl/cogl.h>
#endif
-#include <ulib.h>
+#include <clib.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 d198ba34..c0fc977b 100644
--- a/tests/conform/Makefile.am
+++ b/tests/conform/Makefile.am
@@ -129,8 +129,8 @@ BUILT_SOURCES = wrappers
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/deps/ulib/src \
- -I$(top_builddir)/deps/ulib/src \
+ -I$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src \
-I$(top_builddir)/cogl \
-I$(top_srcdir)/test-fixtures
@@ -146,7 +146,7 @@ test_conformance_LDADD = \
if BUILD_COGL_PATH
test_conformance_LDADD += $(top_builddir)/cogl-path/libcogl-path.la
endif
-test_conformance_LDADD += $(top_builddir)/deps/ulib/src/libulib.la
+test_conformance_LDADD += $(top_builddir)/deps/clib/src/libclib.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 cf9b7b0d..628db61e 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-alpha-textures.c b/tests/conform/test-alpha-textures.c
index c4053a78..2fe8463b 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-atlas-migration.c b/tests/conform/test-atlas-migration.c
index d5fa47b9..c848f32e 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 = u_malloc (size * size * 4);
+ p = data = c_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 = u_malloc (size * size * 4);
+ p = data = c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-backface-culling.c b/tests/conform/test-backface-culling.c
index 7573bcfb..15457d87 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 = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+ tex_data = c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-blend-strings.c b/tests/conform/test-blend-strings.c
index cfb3bb0c..c07a6ef7 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);
- u_print ("Skipping\n");
+ c_print ("Skipping\n");
}
return;
}
@@ -109,14 +109,14 @@ test_blend (TestState *state,
if (cogl_test_verbose ())
{
- 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);
+ c_print ("test_blend (%d, %d):\n%s\n", x, y, blend_string);
+ c_print (" src color = %02x, %02x, %02x, %02x\n", Sr, Sg, Sb, Sa);
+ c_print (" dst color = %02x, %02x, %02x, %02x\n", Dr, Dg, Db, Da);
if (blend_constant != BLEND_CONSTANT_UNUSED)
- u_print (" blend constant = %02x, %02x, %02x, %02x\n",
+ c_print (" blend constant = %02x, %02x, %02x, %02x\n",
Br, Bg, Bb, Ba);
else
- u_print (" blend constant = UNUSED\n");
+ c_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 = u_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
+ tex_data = c_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 ())
{
- 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);
+ c_print ("test_tex_combine (%d, %d):\n%s\n", x, y, combine_string);
+ c_print (" texture 0 color = 0x%08lX\n", (unsigned long)tex0_color);
+ c_print (" texture 1 color = 0x%08lX\n", (unsigned long)tex1_color);
if (combine_constant != TEX_CONSTANT_UNUSED)
- u_print (" combine constant = %02x, %02x, %02x, %02x\n",
+ c_print (" combine constant = %02x, %02x, %02x, %02x\n",
Cr, Cg, Cb, Ca);
else
- u_print (" combine constant = UNUSED\n");
+ c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-color-hsl.c b/tests/conform/test-color-hsl.c
index 2c03c7ad..78812d27 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-color-mask.c b/tests/conform/test-color-mask.c
index a56ddf92..877f523e 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 56d651e4..02ea4e26 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -2,7 +2,7 @@
#include <cogl/cogl.h>
-#include <ulib.h>
+#include <clib.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) \
- U_STMT_START { \
+ C_STMT_START { \
extern void FUNC (void); \
if (strcmp (#FUNC, argv[1]) == 0) \
{ \
@@ -20,7 +20,7 @@
test_utils_fini (); \
exit (0); \
} \
- } U_STMT_END
+ } C_STMT_END
#define UNPORTED_TEST(FUNC)
@@ -31,7 +31,7 @@ main (int argc, char **argv)
if (argc != 2)
{
- u_printerr ("usage %s UNIT_TEST\n", argv[0]);
+ c_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);
- u_printerr ("Unknown test name \"%s\"\n", argv[1]);
+ c_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 0ed07d61..d16b4174 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;
- u_print ("Alive textures:");
+ c_print ("Alive textures:");
for (i = 0; i < N_PIPELINES * N_LAYERS; i++)
if ((alive_texture_mask & (1 << (i + 1))))
- u_print (" %i", i);
+ c_print (" %i", i);
- u_print ("\n");
+ c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-custom-attributes.c b/tests/conform/test-custom-attributes.c
index 72f6721f..07e7d146 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),
- U_STRUCT_OFFSET (FloatVert, x),
+ C_STRUCT_OFFSET (FloatVert, x),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_SHORT);
attributes[1] = cogl_attribute_new (buffer,
"color",
sizeof (FloatVert),
- U_STRUCT_OFFSET (FloatVert, r),
+ C_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),
- U_STRUCT_OFFSET (ByteVert, x),
+ C_STRUCT_OFFSET (ByteVert, x),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_SHORT);
attributes[1] = cogl_attribute_new (buffer,
"color",
sizeof (ByteVert),
- U_STRUCT_OFFSET (ByteVert, r),
+ C_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),
- U_STRUCT_OFFSET (ByteVert, r),
+ C_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),
- U_STRUCT_OFFSET (ShortVert, x),
+ C_STRUCT_OFFSET (ShortVert, x),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_SHORT);
attributes[1] = cogl_attribute_new (buffer,
"color",
sizeof (ShortVert),
- U_STRUCT_OFFSET (ShortVert, r),
+ C_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),
- U_STRUCT_OFFSET (ShortVert, x),
+ C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-depth-test.c b/tests/conform/test-depth-test.c
index b354876d..0a83b8a8 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-euler-quaternion.c b/tests/conform/test-euler-quaternion.c
index 920e588f..5060851b 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-fence.c b/tests/conform/test-fence.c
index 87beb46a..8a3e4579 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-gles2-context.c b/tests/conform/test-gles2-context.c
index 1eadec92..bdec26b2 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 ())
- u_print ("status for gles2 framebuffer = 0x%x %s\n",
+ c_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 ())
- u_print ("OK\n");
+ c_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 = u_malloc (data->fb_height * stride);
+ uint8_t *buf = c_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 < U_N_ELEMENTS (paint_methods); i++)
+ for (i = 0; i < C_N_ELEMENTS (paint_methods); i++)
{
CoglTexture *offscreen_texture;
CoglOffscreen *offscreen;
@@ -752,7 +752,7 @@ verify_region (const CoglGLES2Vtable *gles2,
{
uint8_t *buf, *p;
- buf = u_malloc (width * height * 4);
+ buf = c_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 9e5138b9..6a903f01 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-layer-remove.c b/tests/conform/test-layer-remove.c
index 4476491f..ccef9156 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-map-buffer-range.c b/tests/conform/test-map-buffer-range.c
index 7a0598e2..c0be7d43 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-npot-texture.c b/tests/conform/test-npot-texture.c
index d3757875..8ed459ce 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 = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+ p = tex_data = c_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))
- u_print ("Texture is sliced\n");
+ c_print ("Texture is sliced\n");
else
- u_print ("Texture is not sliced\n");
+ c_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))
- u_print ("NPOT textures are supported\n");
+ c_print ("NPOT textures are supported\n");
else
- u_print ("NPOT textures are not supported\n");
+ c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-offscreen.c b/tests/conform/test-offscreen.c
index 0797495e..ae3df423 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-path-clip.c b/tests/conform/test-path-clip.c
index efdf706b..73d1ca54 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-path.c b/tests/conform/test-path.c
index 7b4b6334..d2cb261e 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-pipeline-cache-unrefs-texture.c b/tests/conform/test-pipeline-cache-unrefs-texture.c
index 5cd243ed..4562ae49 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-pipeline-uniforms.c b/tests/conform/test-pipeline-uniforms.c
index 436528d3..ac67b463 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-pixel-buffer.c b/tests/conform/test-pixel-buffer.c
index ef62cfa4..0d9f16ff 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
void
@@ -175,7 +175,7 @@ test_pixel_buffer_set_data (void)
stride = cogl_bitmap_get_rowstride (bitmap);
- data = u_malloc (stride * BITMAP_SIZE);
+ data = c_malloc (stride * BITMAP_SIZE);
generate_bitmap_data (data, stride);
@@ -206,14 +206,14 @@ test_pixel_buffer_set_data (void)
0xff0000ff);
if (cogl_test_verbose ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
static CoglTexture *
create_white_texture (void)
{
CoglTexture2D *texture;
- uint8_t *data = u_malloc (BITMAP_SIZE * BITMAP_SIZE * 4);
+ uint8_t *data = c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-point-size-attribute.c b/tests/conform/test-point-size-attribute.c
index 76e73338..8abfff38 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),
- U_STRUCT_OFFSET (PointVertex, x),
+ C_STRUCT_OFFSET (PointVertex, x),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = cogl_attribute_new (buffer,
attribute_name,
sizeof (PointVertex),
- U_STRUCT_OFFSET (PointVertex, point_size),
+ C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
void
diff --git a/tests/conform/test-point-size.c b/tests/conform/test-point-size.c
index 27e15c30..b1155991 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-point-sprite.c b/tests/conform/test-point-sprite.c
index b0dcf211..be121b20 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
void
diff --git a/tests/conform/test-premult.c b/tests/conform/test-premult.c
index fd8953fb..16720079 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 = u_malloc (QUAD_WIDTH * QUAD_WIDTH * 4);
+ tex_data = c_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 ())
- u_print ("make_texture (0xff00ff80, "
+ c_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 ())
- u_print ("make_texture (0xff00ff80, "
+ c_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 ())
- u_print ("make_texture (0xff00ff80, "
+ c_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 ())
- u_print ("make_texture (0x80008080, "
+ c_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 ())
- u_print ("make_texture (0x80008080, "
+ c_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 ())
- u_print ("make_texture (0x80008080, "
+ c_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 ())
- u_print ("make_texture (0xDEADBEEF, "
+ c_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 ())
- u_print ("set_region (0xff00ff80, RGBA_8888)\n");
+ c_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 ())
- u_print ("make_texture (0xDEADBEEF, "
+ c_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 ())
- u_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
+ c_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 ())
- u_print ("make_texture (0xDEADBEEF, "
+ c_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 ())
- u_print ("set_region (0x80008080, RGBA_8888_PRE)\n");
+ c_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 ())
- u_print ("make_texture (0xDEADBEEF, "
+ c_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 ())
- u_print ("set_region (0xff00ff80, RGBA_8888)\n");
+ c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-primitive-and-journal.c b/tests/conform/test-primitive-and-journal.c
index c728b150..60653e5d 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,
- U_N_ELEMENTS (vertex_data),
+ C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-primitive.c b/tests/conform/test-primitive.c
index 738d659d..146b9a0a 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 < U_N_ELEMENTS (test_prim_funcs); i++)
+ for (i = 0; i < C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-read-texture-formats.c b/tests/conform/test-read-texture-formats.c
index 26531365..8e07f47d 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-snippets.c b/tests/conform/test-snippets.c
index d894c1aa..5c0dfa2d 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 < U_N_ELEMENTS (tests); i++)
+ for (i = 0; i < C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-sparse-pipeline.c b/tests/conform/test-sparse-pipeline.c
index ef0fda2e..69f6fddc 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-sub-texture.c b/tests/conform/test-sub-texture.c
index 812f950a..cc9eaa9e 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 = u_malloc (SOURCE_SIZE * SOURCE_SIZE * 4);
+ uint8_t *data = c_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 = u_malloc (256 * 256 * 4), *p = data;
+ uint8_t *data = c_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 = u_malloc (256 * 256 * 4), *p = data;
+ uint8_t *data = c_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 = u_malloc (10 * 10 * 4);
+ p = texture_data = c_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 = u_malloc (tex_width * tex_height * 4);
+ p = texture_data = c_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 = u_malloc (256 * 256 * 4);
+ p = texture_data = c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-texture-3d.c b/tests/conform/test-texture-3d.c
index 311f8577..836df995 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 = u_malloc (TEX_IMAGE_STRIDE * TEX_DEPTH);
+ uint8_t *data = c_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),
- U_STRUCT_OFFSET (Vert, x),
+ C_STRUCT_OFFSET (Vert, x),
2, /* n_components */
COGL_ATTRIBUTE_TYPE_FLOAT);
attributes[1] = cogl_attribute_new (attribute_buffer,
"cogl_tex_coord_in",
sizeof (Vert),
- U_STRUCT_OFFSET (Vert, s),
+ C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-texture-get-set-data.c b/tests/conform/test-texture-get-set-data.c
index 858b6d7e..f29112af 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 = u_malloc (width * height * 4);
+ p = data = c_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 674f1ec4..d96fa03c 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 = u_malloc (TEXTURE_SIZE * TEXTURE_SIZE * 4);
+ p = tex_data = c_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 = u_malloc ((TEXTURE_SIZE / 2) * (TEXTURE_SIZE / 2) * 4);
+ p = tex_data = c_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-texture-no-allocate.c b/tests/conform/test-texture-no-allocate.c
index ef61a3b1..af1a54c0 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 = u_malloc (BIG_TEX_WIDTH * BIG_TEX_HEIGHT * 4);
+ tex_data = c_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-version.c b/tests/conform/test-version.c
index 0e484d74..6181bf0a 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-wrap-modes.c b/tests/conform/test-wrap-modes.c
index cd99dcb8..a5ca0232 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 = u_malloc (TEX_SIZE * TEX_SIZE * 4), *p = data;
+ uint8_t *data = c_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 < U_N_ELEMENTS (wrap_modes); i += 2)
+ for (i = 0; i < C_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 < U_N_ELEMENTS (wrap_modes); i += 2)
+ for (i = 0; i < C_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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/conform/test-write-texture-formats.c b/tests/conform/test-write-texture-formats.c
index d7e6d56b..dfd827b5 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 ())
- u_print ("OK\n");
+ c_print ("OK\n");
}
diff --git a/tests/micro-perf/Makefile.am b/tests/micro-perf/Makefile.am
index 3812b7cc..15f66b08 100644
--- a/tests/micro-perf/Makefile.am
+++ b/tests/micro-perf/Makefile.am
@@ -4,8 +4,8 @@ NULL =
AM_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_srcdir)/deps/ulib/src \
- -I$(top_builddir)/deps/ulib/src
+ -I$(top_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src
test_conformance_CPPFLAGS = \
-DCOGL_ENABLE_EXPERIMENTAL_API \
@@ -23,7 +23,7 @@ AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS)
common_ldadd = \
$(COGL_DEP_LIBS) \
- $(top_builddir)/deps/ulib/src/libulib.la \
+ $(top_builddir)/deps/clib/src/libclib.la \
$(top_builddir)/cogl/libcogl2.la \
$(LIBM)
diff --git a/tests/micro-perf/test-journal.c b/tests/micro-perf/test-journal.c
index 5e478020..a4774f34 100644
--- a/tests/micro-perf/test-journal.c
+++ b/tests/micro-perf/test-journal.c
@@ -2,7 +2,7 @@
#include <cogl/cogl.h>
#include <math.h>
-#include <ulib.h>
+#include <clib.h>
#include "cogl/cogl-profile.h"
@@ -117,7 +117,7 @@ paint_cb (void *user_data)
elapsed = g_timer_elapsed (data->timer, NULL);
if (elapsed > 1.0)
{
- u_print ("fps = %f\n", data->frame / elapsed);
+ c_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 53c03d0a..21b9d36b 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -58,8 +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_srcdir)/deps/clib/src \
+ -I$(top_builddir)/deps/clib/src \
-I$(top_builddir)/cogl
AM_CPPFLAGS += \
@@ -72,7 +72,7 @@ test_unit_LDADD = \
$(COGL_DEP_LIBS) \
$(top_builddir)/cogl/libcogl2.la \
$(LIBM)
-test_unit_LDADD += $(top_builddir)/deps/ulib/src/libulib.la
+test_unit_LDADD += $(top_builddir)/deps/clib/src/libclib.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 88ecc714..fcf61476 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)
{
- u_printerr ("usage %s UNIT_TEST\n", argv[0]);
+ c_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))
{
- u_printerr ("Unknown test name \"%s\"\n", argv[1]);
+ c_printerr ("Unknown test name \"%s\"\n", argv[1]);
return 1;
}