Makefile.am | 4 ----
backend.c | 1 -
configure.ac | 5 -----
iwhd.spec.in | 1 -
replica.c | 17 +++++++++++------
rest.c | 1 -
setup.h | 1 -
state_defs.h | 1 -
8 files changed, 11 insertions(+), 20 deletions(-)
New commits:
commit 2acf91ee633f14e39c9844e5769b23d34aa4d019
Author: Jim Meyering <meyering(a)redhat.com>
Date: Tue Feb 15 16:52:55 2011 +0100
remove final vestiges of glib
* Makefile.am (AM_CPPFLAGS): Remove definition with
hard-coded, version-dependent glib directory names.
(iwhd_LDADD): Remove GLIB2_LIB.
* configure.ac: Don't check for glib.
* iwhd.spec.in (BuildRequires): Remove glib2-devel.
* backend.c: Don't include <glib.h>.
* rest.c: Likewise.
* setup.h: Likewise.
* state_defs.h: Likewise.
* replica.c: (atomic_get, atomic_inc, atomic_get): Define.
Use these instead of glib's g_-prefixed names.
(rep_count): Change type from "gint" to "int".
diff --git a/Makefile.am b/Makefile.am
index fc767f0..334ad02 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,9 +15,6 @@
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
-# FIXME: don't hard-code 2.0
-AM_CPPFLAGS = -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-
iwhd_YFLAGS = -d
SUBDIRS = lib . gnulib-tests t man
@@ -104,7 +101,6 @@ iwhd_LDADD = \
$(UHTTPD_LIB) \
$(PTHREAD_LIB) \
$(XML2_LIB) \
- $(GLIB2_LIB) \
$(HAIL_LIBS)
MOSTLYCLEANFILES += qlexer.c
diff --git a/backend.c b/backend.c
index 003406f..b44c8c0 100644
--- a/backend.c
+++ b/backend.c
@@ -33,7 +33,6 @@
#include <microhttpd.h>
#include <curl/curl.h>
#include <hstor.h>
-#include <glib.h>
#define GLOBALS_IMPL
#include "iwh.h"
diff --git a/configure.ac b/configure.ac
index e874281..e4a6014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,11 +66,6 @@ AC_CHECK_LIB([pthread], [pthread_create],
[AC_MSG_ERROR([Missing required pthread lib])])
AC_SUBST([PTHREAD_LIB])
-AC_CHECK_LIB([glib-2.0], [g_hash_table_new_full],
- [GLIB2_LIB=-lglib-2.0],
- [AC_MSG_ERROR([Missing required glib2 lib])])
-AC_SUBST([GLIB2_LIB])
-
PKG_CHECK_MODULES([HAIL],[libhail >= 0.8])
AC_SUBST([HAIL_LIBS])
AC_SUBST([HAIL_CFLAGS])
diff --git a/iwhd.spec.in b/iwhd.spec.in
index 4b26dce..629dd50 100644
--- a/iwhd.spec.in
+++ b/iwhd.spec.in
@@ -18,7 +18,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u}
-n)
BuildRequires: boost-devel
BuildRequires: boost-filesystem
BuildRequires: gc-devel
-BuildRequires: glib2-devel
BuildRequires: hail-devel
BuildRequires: jansson-devel
BuildRequires: libcurl-devel
diff --git a/replica.c b/replica.c
index ee1034a..c7bcff6 100644
--- a/replica.c
+++ b/replica.c
@@ -36,6 +36,11 @@
#include "meta.h"
#include "replica.h"
+// FIXME-maybe: These are gcc-specific.
+#define atomic_get(p) __sync_fetch_and_add (p, 0)
+#define atomic_inc(p) __sync_fetch_and_add (p, 1)
+#define atomic_dec(p) __sync_fetch_and_sub (p, 1)
+
typedef enum {
REPL_PUT, /* store an object */
REPL_ODELETE, /* delete an object */
@@ -62,7 +67,7 @@ static repl_item *queue_head = NULL;
static repl_item *queue_tail = NULL;
static pthread_mutex_t queue_lock;
static sem_t queue_sema;
-static volatile gint rep_count = 0;
+static volatile int rep_count = 0;
static void *
proxy_repl_prod (void *ctx)
@@ -197,8 +202,8 @@ repl_worker (void *notused ATTRIBUTE_UNUSED)
error(0,0,"bad repl type %d (url=%s) skipped",
item->type, item->path);
}
- /* No atomic dec without test? Lame. */
- (void)g_atomic_int_dec_and_test(&rep_count);
+
+ atomic_dec(&rep_count);
}
}
@@ -345,7 +350,7 @@ replicate (const char *url, size_t size, const char *policy, my_state
*ms)
}
queue_tail = item;
pthread_mutex_unlock(&queue_lock);
- g_atomic_int_inc(&rep_count);
+ atomic_inc(&rep_count);
sem_post(&queue_sema);
}
}
@@ -393,7 +398,7 @@ replicate_namespace_action (const char *name, repl_t action, my_state
*ms)
}
queue_tail = item;
pthread_mutex_unlock(&queue_lock);
- g_atomic_int_inc(&rep_count);
+ atomic_inc(&rep_count);
sem_post(&queue_sema);
}
}
@@ -433,5 +438,5 @@ follow_link (char *object, const char *key)
int
get_rep_count (void)
{
- return g_atomic_int_get(&rep_count);
+ return atomic_get (&rep_count);
}
diff --git a/rest.c b/rest.c
index 1fb1aa8..3192915 100644
--- a/rest.c
+++ b/rest.c
@@ -33,7 +33,6 @@
#include <microhttpd.h>
#include <hstor.h> /* only for ARRAY_SIZE at this point */
#include <curl/curl.h>
-#include <glib.h>
#include "dirname.h"
#include "iwh.h"
diff --git a/setup.h b/setup.h
index b0b6882..ca04931 100644
--- a/setup.h
+++ b/setup.h
@@ -16,7 +16,6 @@
#if !defined(_SETUP_H)
#define _SETUP_H
-#include <glib.h>
#include <curl/curl.h> /* needed by stuff in state_defs.h (from backend.h) */
#include <microhttpd.h> /* ditto */
#include <assert.h>
diff --git a/state_defs.h b/state_defs.h
index 21ecbcd..70c62a9 100644
--- a/state_defs.h
+++ b/state_defs.h
@@ -16,7 +16,6 @@
#if !defined(_STATE_DEFS_H)
#define _STATE_DEFS_H
-#include <glib.h>
#include <microhttpd.h>
#include "hash.h"
#include "mpipe.h"