summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-07-18 19:53:29 +0000
committerLennart Poettering <lennart@poettering.net>2006-07-18 19:53:29 +0000
commit9db70682d68cc4fef9314677b6427582e5d5c8f2 (patch)
treef9048549466405d26876dbc849ac3b34c82de781
parentd7cdaf22a199e4b6710e6912b0378f0c919ff4d1 (diff)
remove glib 1.2 adapter. It started to bitrot and wasn't used by anything anyway.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1104 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac56
-rw-r--r--libpulse-mainloop-glib12.pc.in11
-rw-r--r--src/Makefile.am25
-rw-r--r--src/pulse/glib-mainloop.h6
-rw-r--r--src/pulse/glib12-mainloop.c503
-rw-r--r--src/tests/mainloop-test.c26
7 files changed, 12 insertions, 620 deletions
diff --git a/Makefile.am b/Makefile.am
index 8aa609f6..1b77187d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,11 +36,6 @@ pkgconfig_DATA += \
libpulse-mainloop-glib.pc
endif
-if HAVE_GLIB12
-pkgconfig_DATA += \
- libpulse-mainloop-glib12.pc
-endif
-
homepage: all dist doxygen
test -d $$HOME/homepage/private
mkdir -p $$HOME/homepage/private/projects/pulseaudio $$HOME/homepage/private/projects/pulseaudio/doxygen
diff --git a/configure.ac b/configure.ac
index 80473415..cf7b5534 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,37 +449,6 @@ AC_SUBST(GLIB20_LIBS)
AC_SUBST(HAVE_GLIB20)
AM_CONDITIONAL([HAVE_GLIB20], [test "x$HAVE_GLIB20" = x1])
-#### GLib 1 support (optional) ####
-
-AC_ARG_ENABLE([glib1],
- AC_HELP_STRING([--disable-glib1], [Disable optional GLib 1 support]),
- [
- case "${enableval}" in
- yes) glib1=yes ;;
- no) glib1=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-glib1) ;;
- esac
- ],
- [glib1=auto])
-
-if test "x${glib1}" != xno ; then
- PKG_CHECK_MODULES(GLIB12, [ glib >= 1.2.0 ],
- HAVE_GLIB12=1,
- [
- HAVE_GLIB12=0
- if test "x$glib1" = xyes ; then
- AC_MSG_ERROR([*** GLib 1 support not found])
- fi
- ])
-else
- HAVE_GLIB12=0
-fi
-
-AC_SUBST(GLIB12_CFLAGS)
-AC_SUBST(GLIB12_LIBS)
-AC_SUBST(HAVE_GLIB12)
-AM_CONDITIONAL([HAVE_GLIB12], [test "x$HAVE_GLIB12" = x1])
-
#### Avahi support (optional) ####
AC_ARG_ENABLE([avahi],
@@ -677,7 +646,6 @@ libpulse.pc
libpulse-simple.pc
libpulse-browse.pc
libpulse-mainloop-glib.pc
-libpulse-mainloop-glib12.pc
doxygen/Makefile
doxygen/doxygen.conf
src/pulse/version.h
@@ -710,11 +678,6 @@ if test "x$HAVE_GLIB20" = "x1" ; then
ENABLE_GLIB20=yes
fi
-ENABLE_GLIB12=no
-if test "x$HAVE_GLIB12" = "x1" ; then
- ENABLE_GLIB12=yes
-fi
-
ENABLE_AVAHI=no
if test "x$HAVE_AVAHI" = "x1" ; then
ENABLE_AVAHI=yes
@@ -748,15 +711,14 @@ echo "
localstatedir: ${localstatedir}
compiler: ${CC}
cflags: ${CFLAGS}
- Have X11: ${ENABLE_X11}
- Enable OSS: ${ENABLE_OSS}
- Enable Alsa: ${ENABLE_ALSA}
- Enable Solaris: ${ENABLE_SOLARIS}
- Enable Glib 2.0: ${ENABLE_GLIB20}
- Enable Glib 1.2: ${ENABLE_GLIB12}
- Enable Avahi: ${ENABLE_AVAHI}
- Enable Jack: ${ENABLE_JACK}
- Enable Async DNS: ${ENABLE_LIBASYNCNS}
- Enable LIRC: ${ENABLE_LIRC}
+ Have X11: ${ENABLE_X11}
+ Enable OSS: ${ENABLE_OSS}
+ Enable Alsa: ${ENABLE_ALSA}
+ Enable Solaris: ${ENABLE_SOLARIS}
+ Enable Glib 2.0: ${ENABLE_GLIB20}
+ Enable Avahi: ${ENABLE_AVAHI}
+ Enable Jack: ${ENABLE_JACK}
+ Enable Async DNS: ${ENABLE_LIBASYNCNS}
+ Enable LIRC: ${ENABLE_LIRC}
Enable TCP Wrappers: ${ENABLE_TCPWRAP}
"
diff --git a/libpulse-mainloop-glib12.pc.in b/libpulse-mainloop-glib12.pc.in
deleted file mode 100644
index 7a038826..00000000
--- a/libpulse-mainloop-glib12.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: libpulse-mainloop-glib12
-Description: GLIB 1.2 Main Loop Wrapper for PulseAudio
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lpulse-mainloop-glib12
-Cflags: -D_REENTRANT -I${includedir}
-Requires: libpulse glib
diff --git a/src/Makefile.am b/src/Makefile.am
index 8da51aac..0235741b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -207,11 +207,6 @@ noinst_PROGRAMS += \
mainloop-test-glib
endif
-if HAVE_GLIB12
-noinst_PROGRAMS += \
- mainloop-test-glib12
-endif
-
mainloop_test_SOURCES = tests/mainloop-test.c
mainloop_test_CFLAGS = $(AM_CFLAGS)
mainloop_test_LDADD = $(AM_LDADD) libpulse.la
@@ -277,11 +272,6 @@ mainloop_test_glib_CFLAGS = $(mainloop_test_CFLAGS) $(GLIB20_CFLAGS) -DGLIB_MAIN
mainloop_test_glib_LDADD = $(mainloop_test_LDADD) $(GLIB20_LIBS) libpulse-mainloop-glib.la
mainloop_test_glib_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
-mainloop_test_glib12_SOURCES = $(mainloop_test_SOURCES)
-mainloop_test_glib12_CFLAGS = $(mainloop_test_CFLAGS) $(GLIB12_CFLAGS) -DGLIB_MAIN_LOOP
-mainloop_test_glib12_LDADD = $(mainloop_test_LDADD) $(GLIB12_LIBS) libpulse-mainloop-glib12.la
-mainloop_test_glib12_LDFLAGS = $(AM_LDFLAGS) $(BINLDFLAGS)
-
memblockq_test_SOURCES = tests/memblockq-test.c
memblockq_test_CFLAGS = $(AM_CFLAGS)
memblockq_test_LDADD = $(AM_LDADD) $(WINSOCK_LIBS) libpulsecore.la
@@ -334,11 +324,6 @@ endif
if HAVE_GLIB20
pulseinclude_HEADERS += \
pulse/glib-mainloop.h
-else
-if HAVE_GLIB12
-pulseinclude_HEADERS += \
- pulse/glib-mainloop.h
-endif
endif
lib_LTLIBRARIES = \
@@ -355,11 +340,6 @@ lib_LTLIBRARIES += \
libpulse-mainloop-glib.la
endif
-if HAVE_GLIB12
-lib_LTLIBRARIES += \
- libpulse-mainloop-glib12.la
-endif
-
# Public interface
libpulse_la_SOURCES = \
pulse/cdecl.h \
@@ -461,11 +441,6 @@ libpulse_mainloop_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
libpulse_mainloop_glib_la_LIBADD = $(AM_LIBADD) libpulse.la $(GLIB20_LIBS)
libpulse_mainloop_glib_la_LDFLAGS = -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO)
-libpulse_mainloop_glib12_la_SOURCES = pulse/glib-mainloop.h pulse/glib12-mainloop.c
-libpulse_mainloop_glib12_la_CFLAGS = $(AM_CFLAGS) $(GLIB12_CFLAGS)
-libpulse_mainloop_glib12_la_LIBADD = $(AM_LIBADD) libpulse.la $(GLIB12_LIBS)
-libpulse_mainloop_glib12_la_LDFLAGS = -version-info $(LIBPULSE_MAINLOOP_GLIB_VERSION_INFO)
-
###################################
# OSS emulation #
###################################
diff --git a/src/pulse/glib-mainloop.h b/src/pulse/glib-mainloop.h
index 75de1cc7..af7cc0e9 100644
--- a/src/pulse/glib-mainloop.h
+++ b/src/pulse/glib-mainloop.h
@@ -47,13 +47,9 @@ PA_C_DECL_BEGIN
typedef struct pa_glib_mainloop pa_glib_mainloop;
/** Create a new GLIB main loop object for the specified GLIB main
- * loop context. The GLIB 2.0 version takes an argument c for the
+ * loop context. Takes an argument c for the
* GMainContext to use. If c is NULL the default context is used. */
-#if GLIB_MAJOR_VERSION >= 2
pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c);
-#else
-pa_glib_mainloop *pa_glib_mainloop_new(void);
-#endif
/** Free the GLIB main loop object */
void pa_glib_mainloop_free(pa_glib_mainloop* g);
diff --git a/src/pulse/glib12-mainloop.c b/src/pulse/glib12-mainloop.c
deleted file mode 100644
index ebaf87fc..00000000
--- a/src/pulse/glib12-mainloop.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of PulseAudio.
-
- PulseAudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- PulseAudio is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with PulseAudio; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <pulse/timeval.h>
-#include <pulse/xmalloc.h>
-
-#include <pulsecore/idxset.h>
-#include <pulsecore/core-util.h>
-
-#include "glib-mainloop.h"
-
-/* A mainloop implementation based on GLIB 1.2 */
-
-struct pa_io_event {
- pa_glib_mainloop *mainloop;
- int dead;
- GIOChannel *io_channel;
- guint source;
- GIOCondition io_condition;
- int fd;
- void (*callback) (pa_mainloop_api*m, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata);
- void *userdata;
- void (*destroy_callback) (pa_mainloop_api *m, pa_io_event*e, void *userdata);
- pa_io_event *next, *prev;
-};
-
-struct pa_time_event {
- pa_glib_mainloop *mainloop;
- int dead;
- guint source;
- struct timeval timeval;
- void (*callback) (pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata);
- void *userdata;
- void (*destroy_callback) (pa_mainloop_api *m, pa_time_event*e, void *userdata);
- pa_time_event *next, *prev;
-};
-
-struct pa_defer_event {
- pa_glib_mainloop *mainloop;
- int dead;
- guint source;
- void (*callback) (pa_mainloop_api*m, pa_defer_event *e, void *userdata);
- void *userdata;
- void (*destroy_callback) (pa_mainloop_api *m, pa_defer_event*e, void *userdata);
- pa_defer_event *next, *prev;
-};
-
-struct pa_glib_mainloop {
- pa_mainloop_api api;
- guint cleanup_source;
- pa_io_event *io_events, *dead_io_events;
- pa_time_event *time_events, *dead_time_events;
- pa_defer_event *defer_events, *dead_defer_events;
-};
-
-static void schedule_free_dead_events(pa_glib_mainloop *g);
-
-static void glib_io_enable(pa_io_event*e, pa_io_event_flags_t f);
-
-static pa_io_event* glib_io_new(pa_mainloop_api*m, int fd, pa_io_event_flags_t f, void (*callback) (pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags_t f, void *userdata), void *userdata) {
- pa_io_event *e;
- pa_glib_mainloop *g;
-
- assert(m && m->userdata && fd >= 0 && callback);
- g = m->userdata;
-
- e = pa_xmalloc(sizeof(pa_io_event));
- e->mainloop = m->userdata;
- e->dead = 0;
- e->fd = fd;
- e->callback = callback;
- e->userdata = userdata;
- e->destroy_callback = NULL;
-
- e->io_channel = g_io_channel_unix_new(e->fd);
- assert(e->io_channel);
- e->source = (guint) -1;
- e->io_condition = 0;
-
- glib_io_enable(e, f);
-
- e->next = g->io_events;
- if (e->next) e->next->prev = e;
- g->io_events = e;
- e->prev = NULL;
-
- return e;
-}
-
-static gboolean io_cb(GIOChannel *source, GIOCondition condition, gpointer data) {
- pa_io_event *e = data;
- pa_io_event_flags_t f;
- assert(source && e && e->io_channel == source);
-
- f = (condition & G_IO_IN ? PA_IO_EVENT_INPUT : 0) |
- (condition & G_IO_OUT ? PA_IO_EVENT_OUTPUT : 0) |
- (condition & G_IO_ERR ? PA_IO_EVENT_ERROR : 0) |
- (condition & G_IO_HUP ? PA_IO_EVENT_HANGUP : 0);
-
- e->callback(&e->mainloop->api, e, e->fd, f, e->userdata);
- return TRUE;
-}
-
-static void glib_io_enable(pa_io_event*e, pa_io_event_flags_t f) {
- GIOCondition c;
- assert(e && !e->dead);
-
- c = (f & PA_IO_EVENT_INPUT ? G_IO_IN : 0) | (f & PA_IO_EVENT_OUTPUT ? G_IO_OUT : 0);
-
- if (c == e->io_condition)
- return;
-
- if (e->source != (guint) -1)
- g_source_remove(e->source);
-
- e->source = g_io_add_watch_full(e->io_channel, G_PRIORITY_DEFAULT, c | G_IO_ERR | G_IO_HUP, io_cb, e, NULL);
- assert(e->source != (guint) -1);
- e->io_condition = c;
-}
-
-static void glib_io_free(pa_io_event*e) {
- assert(e && !e->dead);
-
- if (e->source != (guint) -1) {
- g_source_remove(e->source);
- e->source = (guint) -1;
- }
-
- if (e->prev)
- e->prev->next = e->next;
- else
- e->mainloop->io_events = e->next;
-
- if (e->next)
- e->next->prev = e->prev;
-
- if ((e->next = e->mainloop->dead_io_events))
- e->next->prev = e;
-
- e->mainloop->dead_io_events = e;
- e->prev = NULL;
-
- e->dead = 1;
- schedule_free_dead_events(e->mainloop);
-}
-
-static void glib_io_set_destroy(pa_io_event*e, void (*callback)(pa_mainloop_api*m, pa_io_event *e, void *userdata)) {
- assert(e);
- e->destroy_callback = callback;
-}
-
-/* Time sources */
-
-static void glib_time_restart(pa_time_event*e, const struct timeval *tv);
-
-static pa_time_event* glib_time_new(pa_mainloop_api*m, const struct timeval *tv, void (*callback) (pa_mainloop_api*m, pa_time_event*e, const struct timeval *tv, void *userdata), void *userdata) {
- pa_glib_mainloop *g;
- pa_time_event *e;
-
- assert(m && m->userdata && tv && callback);
- g = m->userdata;
-
- e = pa_xmalloc(sizeof(pa_time_event));
- e->mainloop = g;
- e->dead = 0;
- e->callback = callback;
- e->userdata = userdata;
- e->destroy_callback = NULL;
- e->source = (guint) -1;
-
- glib_time_restart(e, tv);
-
- e->next = g->time_events;
- if (e->next) e->next->prev = e;
- g->time_events = e;
- e->prev = NULL;
-
- return e;
-}
-
-static guint msec_diff(const struct timeval *a, const struct timeval *b) {
- guint r;
- assert(a && b);
-
- if (a->tv_sec < b->tv_sec)
- return 0;
-
- if (a->tv_sec == b->tv_sec && a->tv_sec <= b->tv_sec)
- return 0;
-
- r = (a->tv_sec-b->tv_sec)*1000;
-
- if (a->tv_usec >= b->tv_usec)
- r += (a->tv_usec - b->tv_usec) / 1000;
- else
- r -= (b->tv_usec - a->tv_usec) / 1000;
-
- return r;
-}
-
-static gboolean time_cb(gpointer data) {
- pa_time_event* e = data;
- assert(e && e->mainloop && e->source != (guint) -1);
-
- g_source_remove(e->source);
- e->source = (guint) -1;
-
- e->callback(&e->mainloop->api, e, &e->timeval, e->userdata);
- return FALSE;
-}
-
-static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
- struct timeval now;
- assert(e && e->mainloop && !e->dead);
-
- pa_gettimeofday(&now);
- if (e->source != (guint) -1)
- g_source_remove(e->source);
-
- if (tv) {
- e->timeval = *tv;
- e->source = g_timeout_add_full(G_PRIORITY_DEFAULT, msec_diff(tv, &now), time_cb, e, NULL);
- assert(e->source != (guint) -1);
- } else
- e->source = (guint) -1;
- }
-
-static void glib_time_free(pa_time_event *e) {
- assert(e && e->mainloop && !e->dead);
-
- if (e->source != (guint) -1) {
- g_source_remove(e->source);
- e->source = (guint) -1;
- }
-
- if (e->prev)
- e->prev->next = e->next;
- else
- e->mainloop->time_events = e->next;
-
- if (e->next)
- e->next->prev = e->prev;
-
- if ((e->next = e->mainloop->dead_time_events))
- e->next->prev = e;
-
- e->mainloop->dead_time_events = e;
- e->prev = NULL;
-
- e->dead = 1;
- schedule_free_dead_events(e->mainloop);
-}
-
-static void glib_time_set_destroy(pa_time_event *e, void (*callback)(pa_mainloop_api*m, pa_time_event*e, void *userdata)) {
- assert(e);
- e->destroy_callback = callback;
-}
-
-/* Deferred sources */
-
-static void glib_defer_enable(pa_defer_event *e, int b);
-
-static pa_defer_event* glib_defer_new(pa_mainloop_api*m, void (*callback) (pa_mainloop_api*m, pa_defer_event *e, void *userdata), void *userdata) {
- pa_defer_event *e;
- pa_glib_mainloop *g;
-
- assert(m && m->userdata && callback);
- g = m->userdata;
-
- e = pa_xmalloc(sizeof(pa_defer_event));
- e->mainloop = g;
- e->dead = 0;
- e->callback = callback;
- e->userdata = userdata;
- e->destroy_callback = NULL;
- e->source = (guint) -1;
-
- glib_defer_enable(e, 1);
-
- e->next = g->defer_events;
- if (e->next) e->next->prev = e;
- g->defer_events = e;
- e->prev = NULL;
- return e;
-}
-
-static gboolean idle_cb(gpointer data) {
- pa_defer_event* e = data;
- assert(e && e->mainloop && e->source != (guint) -1);
-
- e->callback(&e->mainloop->api, e, e->userdata);
- return TRUE;
-}
-
-static void glib_defer_enable(pa_defer_event *e, int b) {
- assert(e && e->mainloop);
-
- if (e->source != (guint) -1 && !b) {
- g_source_remove(e->source);
- e->source = (guint) -1;
- } else if (e->source == (guint) -1 && b) {
- e->source = g_idle_add_full(G_PRIORITY_HIGH, idle_cb, e, NULL);
- assert(e->source != (guint) -1);
- }
-}
-
-static void glib_defer_free(pa_defer_event *e) {
- assert(e && e->mainloop && !e->dead);
-
- if (e->source != (guint) -1) {
- g_source_remove(e->source);
- e->source = (guint) -1;
- }
-
- if (e->prev)
- e->prev->next = e->next;
- else
- e->mainloop->defer_events = e->next;
-
- if (e->next)
- e->next->prev = e->prev;
-
- if ((e->next = e->mainloop->dead_defer_events))
- e->next->prev = e;
-
- e->mainloop->dead_defer_events = e;
- e->prev = NULL;
-
- e->dead = 1;
- schedule_free_dead_events(e->mainloop);
-}
-
-static void glib_defer_set_destroy(pa_defer_event *e, void (*callback)(pa_mainloop_api *m, pa_defer_event *e, void *userdata)) {
- assert(e);
- e->destroy_callback = callback;
-}
-
-/* quit() */
-
-static void glib_quit(pa_mainloop_api*a, PA_GCC_UNUSED int retval) {
- pa_glib_mainloop *g;
- assert(a && a->userdata);
- g = a->userdata;
-
- /* NOOP */
-}
-
-static const pa_mainloop_api vtable = {
- .userdata = NULL,
-
- .io_new = glib_io_new,
- .io_enable = glib_io_enable,
- .io_free = glib_io_free,
- .io_set_destroy= glib_io_set_destroy,
-
- .time_new = glib_time_new,
- .time_restart = glib_time_restart,
- .time_free = glib_time_free,
- .time_set_destroy = glib_time_set_destroy,
-
- .defer_new = glib_defer_new,
- .defer_enable = glib_defer_enable,
- .defer_free = glib_defer_free,
- .defer_set_destroy = glib_defer_set_destroy,
-
- .quit = glib_quit,
-};
-
-pa_glib_mainloop *pa_glib_mainloop_new(void) {
- pa_glib_mainloop *g;
-
- g = pa_xmalloc(sizeof(pa_glib_mainloop));
-
- g->api = vtable;
- g->api.userdata = g;
-
- g->io_events = g->dead_io_events = NULL;
- g->time_events = g->dead_time_events = NULL;
- g->defer_events = g->dead_defer_events = NULL;
-
- g->cleanup_source = (guint) -1;
- return g;
-}
-
-static void free_io_events(pa_io_event *e) {
- while (e) {
- pa_io_event *r = e;
- e = r->next;
-
- if (r->source != (guint) -1)
- g_source_remove(r->source);
-
- if (r->io_channel)
- g_io_channel_unref(r->io_channel);
-
- if (r->destroy_callback)
- r->destroy_callback(&r->mainloop->api, r, r->userdata);
-
- pa_xfree(r);
- }
-}
-
-static void free_time_events(pa_time_event *e) {
- while (e) {
- pa_time_event *r = e;
- e = r->next;
-
- if (r->source != (guint) -1)
- g_source_remove(r->source);
-
- if (r->destroy_callback)
- r->destroy_callback(&r->mainloop->api, r, r->userdata);
-
- pa_xfree(r);
- }
-}
-
-static void free_defer_events(pa_defer_event *e) {
- while (e) {
- pa_defer_event *r = e;
- e = r->next;
-
- if (r->source != (guint) -1)
- g_source_remove(r->source);
-
- if (r->destroy_callback)
- r->destroy_callback(&r->mainloop->api, r, r->userdata);
-
- pa_xfree(r);
- }
-}
-
-void pa_glib_mainloop_free(pa_glib_mainloop* g) {
- assert(g);
-
- free_io_events(g->io_events);
- free_io_events(g->dead_io_events);
- free_defer_events(g->defer_events);
- free_defer_events(g->dead_defer_events);
- free_time_events(g->time_events);
- free_time_events(g->dead_time_events);
-
- if (g->cleanup_source != (guint) -1)
- g_source_remove(g->cleanup_source);
-
- pa_xfree(g);
-}
-
-pa_mainloop_api* pa_glib_mainloop_get_api(pa_glib_mainloop *g) {
- assert(g);
- return &g->api;
-}
-
-static gboolean free_dead_events(gpointer p) {
- pa_glib_mainloop *g = p;
- assert(g);
-
- free_io_events(g->dead_io_events);
- free_defer_events(g->dead_defer_events);
- free_time_events(g->dead_time_events);
-
- g->dead_io_events = NULL;
- g->dead_defer_events = NULL;
- g->dead_time_events = NULL;
-
- g_source_remove(g->cleanup_source);
- g->cleanup_source = (guint) -1;
-
- return FALSE;
-}
-
-static void schedule_free_dead_events(pa_glib_mainloop *g) {
- assert(g);
-
- if (g->cleanup_source != (guint) -1)
- return;
-
- g->cleanup_source = g_idle_add_full(G_PRIORITY_HIGH, free_dead_events, g, NULL);
-}
diff --git a/src/tests/mainloop-test.c b/src/tests/mainloop-test.c
index 671adeff..b06d0ed1 100644
--- a/src/tests/mainloop-test.c
+++ b/src/tests/mainloop-test.c
@@ -40,13 +40,6 @@
static GMainLoop* glib_main_loop = NULL;
-#if GLIB_MAJOR_VERSION >= 2
-#define GLIB20
-#else
-#undef GLIB20
-#endif
-
-
#else /* GLIB_MAIN_LOOP */
#include <pulse/mainloop.h>
#endif /* GLIB_MAIN_LOOP */
@@ -68,10 +61,8 @@ static void dcb(pa_mainloop_api*a, pa_defer_event *e, void *userdata) {
static void tcb(pa_mainloop_api*a, pa_time_event *e, const struct timeval *tv, void *userdata) {
fprintf(stderr, "TIME EVENT\n");
-#if defined(GLIB_MAIN_LOOP) && defined(GLIB20)
+#if defined(GLIB_MAIN_LOOP)
g_main_loop_quit(glib_main_loop);
-#elif defined(GLIB_MAIN_LOOP)
- g_main_quit(glib_main_loop);
#else
a->quit(a, 0);
#endif
@@ -86,17 +77,10 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
#ifdef GLIB_MAIN_LOOP
pa_glib_mainloop *g;
-#ifdef GLIB20
glib_main_loop = g_main_loop_new(NULL, FALSE);
assert(glib_main_loop);
g = pa_glib_mainloop_new(NULL);
-#else /* GLIB20 */
- glib_main_loop = g_main_new(FALSE);
- assert(glib_main_loop);
-
- g = pa_glib_mainloop_new();
-#endif /* GLIB20 */
assert(g);
a = pa_glib_mainloop_get_api(g);
@@ -121,10 +105,8 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
tv.tv_sec += 10;
te = a->time_new(a, &tv, tcb, NULL);
-#if defined(GLIB_MAIN_LOOP) && defined(GLIB20)
+#if defined(GLIB_MAIN_LOOP)
g_main_loop_run(glib_main_loop);
-#elif defined(GLIB_MAIN_LOOP)
- g_main_run(glib_main_loop);
#else
pa_mainloop_run(m, NULL);
#endif
@@ -135,12 +117,8 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) {
#ifdef GLIB_MAIN_LOOP
pa_glib_mainloop_free(g);
-#ifdef GLIB20
g_main_loop_unref(glib_main_loop);
#else
- g_main_destroy(glib_main_loop);
-#endif
-#else
pa_mainloop_free(m);
#endif