From 68a2c771e2b923461a552bf3673e9e8245e1bfea Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 2 Nov 2009 18:31:53 -0500 Subject: [PATCH] Build without glib Thready-safety disabled in that case, until we add support for pthread, etc. Fun... --- src/hb-private.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/hb-private.h b/src/hb-private.h index 933abea3..f040ae52 100644 --- a/src/hb-private.h +++ b/src/hb-private.h @@ -49,7 +49,7 @@ /* We need external help for these */ -#if HAVE_GLIB +#ifdef HAVE_GLIB #include @@ -66,10 +66,25 @@ typedef GStaticMutex hb_mutex_t; #define hb_mutex_unlock(M) g_static_mutex_unlock (&M) #else -#error "Could not find any system to define platform macros, see hb-private.h" +#warning "Could not find any system to define platform macros, library will NOT be thread-safe" + +typedef int hb_atomic_int_t; +#define hb_atomic_int_fetch_and_add(AI, V) ((AI) += (V), (AI) - (V)) +#define hb_atomic_int_get(AI) (AI) +#define hb_atomic_int_set(AI, V) do { (AI) = (V); } while (0) + +typedef int hb_mutex_t; +#define HB_MUTEX_INIT 0 +#define hb_mutex_init(M) do { (M) = 0; } while (0) +#define hb_mutex_lock(M) do { (M) = 1; } while (0) +#define hb_mutex_trylock(M) ((M) = 1, 1) +#define hb_mutex_unlock(M) do { (M) = 0; } while (0) + #endif +/* Big-endian handling */ + #define hb_be_uint16(v) ((uint16_t) ((((const uint8_t *)&(v))[0] >> 8) + (((const uint8_t *)&(v))[1] << 8))) #define hb_be_uint8_put_unaligned(v,V) (v[0] = (V), 0) -- GitLab