From 2310d43d6410de464dbd5ffa7edc7fd2785f21d3 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Fri, 21 Oct 2011 11:53:39 +0200 Subject: Use a GList instead of GArray for sinks. This lets us drop our ugly GArray wrappers sink.c and sink_input.c. It will make gradual updates of sinks easier, since elements can be added and dropped everywhere in the list easily. --- src/sink.c | 54 ------------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 src/sink.c (limited to 'src/sink.c') diff --git a/src/sink.c b/src/sink.c deleted file mode 100644 index 090659f..0000000 --- a/src/sink.c +++ /dev/null @@ -1,54 +0,0 @@ -#include - -#define SINK_C -#include "sink.h" -#include "sink_input.h" - -/* - * init a sink list - */ -GArray * -sink_list_alloc(void) -{ - return g_array_sized_new(FALSE, FALSE, sizeof(sink_info), 16); -} - -/* - * frees all dynamic allocated components of a sink - */ -static void -sink_clear(sink_info* sink) -{ - g_free(sink->name); - g_free(sink->device); - sink_input_list_free(sink->input_list); -} - -/* - * frees a complete sink array - */ -void -sink_list_free(GArray *sink_list) -{ - for (int i = 0; i < sink_list->len; ++i) - sink_clear(&g_array_index(sink_list, sink_info, i)); - g_array_free(sink_list, TRUE); -} - -/* - * get sink at index from sink_list - */ -sink_info * -sink_list_get(gint index) -{ - return &g_array_index(sink_list, sink_info, index); -} - -/* - * get an input association to an sink by their indizes - */ -sink_input_info * -sink_input_get(gint sink_list_index, gint index) -{ - return &g_array_index(sink_list_get(sink_list_index)->input_list, sink_input_info, index); -} -- cgit