summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-19 21:35:33 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-10-19 21:35:33 +0200
commitebc11253078db014895a8321d8d0d23375a878c9 (patch)
tree7e40dcff8a0bf66cad15bd92fdf6e8077523fac8 /src
parenta97cfd759d060b87aaf352f9b56884af61dbfb69 (diff)
downloadpa-sink-ctl-ebc11253078db014895a8321d8d0d23375a878c9.tar.gz
pa-sink-ctl-ebc11253078db014895a8321d8d0d23375a878c9.tar.bz2
pa-sink-ctl-ebc11253078db014895a8321d8d0d23375a878c9.zip
Coding style: Seperate line for function return type
Diffstat (limited to 'src')
-rw-r--r--src/g_curses_input.c18
-rw-r--r--src/g_unix_signal.c28
-rw-r--r--src/interface.c27
-rw-r--r--src/pa-sink-ctl.c24
-rw-r--r--src/sink.c15
-rw-r--r--src/sink_input.c9
6 files changed, 81 insertions, 40 deletions
diff --git a/src/g_curses_input.c b/src/g_curses_input.c
index d84ddee..987ef49 100644
--- a/src/g_curses_input.c
+++ b/src/g_curses_input.c
@@ -7,7 +7,8 @@ typedef struct _GCursesInput {
WINDOW *win;
} GCursesInput;
-static gboolean check(GSource *source)
+static gboolean
+check(GSource *source)
{
GCursesInput *curses_input = (GCursesInput*) source;
static int i = 0;
@@ -18,13 +19,15 @@ static gboolean check(GSource *source)
return ch != ERR;
}
-static gboolean prepare(GSource *source, gint *timeout_)
+static gboolean
+prepare(GSource *source, gint *timeout_)
{
*timeout_ = 2;
return check(source);
}
-static gboolean dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
+static gboolean
+dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
{
GCursesInput *curses_input = (GCursesInput*) source;
return callback((gpointer)curses_input->win) ? TRUE : FALSE;
@@ -39,7 +42,8 @@ static GSourceFuncs SourceFuncs =
.closure_callback = NULL, .closure_marshal = NULL
};
-GSource *g_curses_input_source_new(WINDOW *win) {
+GSource *
+g_curses_input_source_new(WINDOW *win) {
GSource *source = g_source_new(&SourceFuncs, sizeof(GCursesInput));
GCursesInput *curses_input = (GCursesInput*) source;
curses_input->win = win;
@@ -47,7 +51,8 @@ GSource *g_curses_input_source_new(WINDOW *win) {
return source;
}
-guint g_curses_input_add_full(gint priority, WINDOW *win, GSourceFunc function, gpointer data, GDestroyNotify notify)
+guint
+g_curses_input_add_full(gint priority, WINDOW *win, GSourceFunc function, gpointer data, GDestroyNotify notify)
{
g_return_val_if_fail(function != NULL, 0);
GSource *source = g_curses_input_source_new(win);
@@ -59,7 +64,8 @@ guint g_curses_input_add_full(gint priority, WINDOW *win, GSourceFunc function,
return id;
}
-guint g_curses_input_add(WINDOW *win, GSourceFunc function, gpointer data)
+guint
+g_curses_input_add(WINDOW *win, GSourceFunc function, gpointer data)
{
return g_curses_input_add_full(G_PRIORITY_DEFAULT, win, function, data, NULL);
}
diff --git a/src/g_unix_signal.c b/src/g_unix_signal.c
index 7f703f5..889f459 100644
--- a/src/g_unix_signal.c
+++ b/src/g_unix_signal.c
@@ -16,12 +16,14 @@ typedef struct _GUnixSignalSource {
GUnixSignalData *data;
} GUnixSignalSource;
-static inline GUnixSignalData* get_signal_data(guint index)
+static inline GUnixSignalData *
+get_signal_data(guint index)
{
return (GUnixSignalData*)g_ptr_array_index(signal_data, index);
}
-static void handler(gint signum) {
+static void
+handler(gint signum) {
g_assert(signal_data != NULL);
for (guint i = 0; i < signal_data->len; ++i)
if (get_signal_data(i)->signum == signum)
@@ -29,13 +31,15 @@ static void handler(gint signum) {
sigaction(signum, &(struct sigaction){handler}, NULL);
}
-static gboolean check(GSource *source)
+static gboolean
+check(GSource *source)
{
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
return signal_source->data->triggered;
}
-static gboolean prepare(GSource *source, gint *timeout_)
+static gboolean
+prepare(GSource *source, gint *timeout_)
{
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
if (signal_source->data->context == NULL) {
@@ -47,13 +51,16 @@ static gboolean prepare(GSource *source, gint *timeout_)
return signal_source->data->triggered;
}
-static gboolean dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
+static gboolean
+dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
{
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
signal_source->data->triggered = FALSE;
return callback(user_data) ? TRUE : FALSE;
}
-static void finalize(GSource *source)
+
+static void
+finalize(GSource *source)
{
GUnixSignalSource *signal_source = (GUnixSignalSource*) source;
sigaction(signal_source->data->signum, &(struct sigaction){NULL}, NULL);
@@ -73,7 +80,8 @@ static GSourceFuncs SourceFuncs =
.closure_callback = NULL, .closure_marshal = NULL
};
-static void g_unix_signal_source_init(GSource *source, gint signum)
+static void
+g_unix_signal_source_init(GSource *source, gint signum)
{
GUnixSignalSource *signal_source = (GUnixSignalSource *) source;
signal_source->data = g_new(GUnixSignalData, 1);
@@ -86,7 +94,8 @@ static void g_unix_signal_source_init(GSource *source, gint signum)
g_ptr_array_add(signal_data, signal_source->data);
}
-GSource *g_unix_signal_source_new(gint signum)
+GSource *
+g_unix_signal_source_new(gint signum)
{
GSource *source = g_source_new(&SourceFuncs, sizeof(GUnixSignalSource));
g_unix_signal_source_init(source, signum);
@@ -94,7 +103,8 @@ GSource *g_unix_signal_source_new(gint signum)
return source;
}
-guint g_unix_signal_add_full(gint priority, gint signum, GSourceFunc function, gpointer data, GDestroyNotify notify)
+guint
+g_unix_signal_add_full(gint priority, gint signum, GSourceFunc function, gpointer data, GDestroyNotify notify)
{
g_return_val_if_fail(function != NULL, 0);
GSource *source = g_unix_signal_source_new(signum);
diff --git a/src/interface.c b/src/interface.c
index 4665c55..0229204 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -30,7 +30,8 @@ static guint32 selected_index;
guint max_name_len = 0;
-void interface_init(void)
+void
+interface_init(void)
{
chooser_sink = 0; /* Selected sink-device. 0 is the first device */
chooser_input = -1; /* Selected input of the current sink-device. */
@@ -62,7 +63,8 @@ void interface_init(void)
refresh();
}
-gboolean interface_resize(gpointer data)
+gboolean
+interface_resize(gpointer data)
{
struct winsize wsize;
gint height = 80;
@@ -87,7 +89,8 @@ gboolean interface_resize(gpointer data)
return TRUE;
}
-void print_sink_list(void)
+void
+print_sink_list(void)
{
gint i = 0;
gint x = 2;
@@ -134,7 +137,8 @@ void print_sink_list(void)
}
-void print_input_list(gint sink_num)
+void
+print_input_list(gint sink_num)
{
gint offset = sink_num + 3 /* win border + empty line + 1th sink */;
@@ -158,7 +162,8 @@ void print_input_list(gint sink_num)
}
}
-void print_volume(pa_volume_t volume, int mute, int y)
+void
+print_volume(pa_volume_t volume, int mute, int y)
{
gint x = 2 /* left */ + 2 /* index num width */ + 1 /* space */ +
1 /* space */ + max_name_len + 1 /* space */;
@@ -179,7 +184,8 @@ void print_volume(pa_volume_t volume, int mute, int y)
}
/* looking for the longest name length of all SINK's and INPUT's */
-void set_max_name_len(void)
+void
+set_max_name_len(void)
{
guint len = 0;
max_name_len = len;
@@ -206,7 +212,8 @@ void set_max_name_len(void)
}
}
-gboolean interface_get_input(gpointer data)
+gboolean
+interface_get_input(gpointer data)
{
gint c;
gboolean volume_increment = TRUE;
@@ -348,7 +355,8 @@ gboolean interface_get_input(gpointer data)
return TRUE;
}
-void interface_clear(void)
+void
+interface_clear(void)
{
g_source_remove(resize_source_id);
g_source_remove(input_source_id);
@@ -357,7 +365,8 @@ void interface_clear(void)
endwin();
}
-void status(const gchar *msg)
+void
+status(const gchar *msg)
{
static gchar *save = NULL;
if (msg != NULL) {
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c
index 102a78c..7a3f21c 100644
--- a/src/pa-sink-ctl.c
+++ b/src/pa-sink-ctl.c
@@ -13,7 +13,8 @@ gboolean context_ready = FALSE;
static gboolean info_callbacks_finished = TRUE;
static gboolean info_callbacks_blocked = FALSE;
-int main(int argc, char** argv)
+int
+main(int argc, char** argv)
{
pa_mainloop_api *mainloop_api = NULL;
pa_glib_mainloop *m = NULL;
@@ -56,7 +57,8 @@ int main(int argc, char** argv)
return 0;
}
-static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, guint32 idx, gpointer userdata)
+static void
+subscribe_cb(pa_context *c, pa_subscription_event_type_t t, guint32 idx, gpointer userdata)
{
if (!info_callbacks_finished)
info_callbacks_blocked = TRUE;
@@ -67,7 +69,8 @@ static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, guint32
/*
* is called after connection
*/
-void context_state_callback(pa_context *c, gpointer userdata)
+void
+context_state_callback(pa_context *c, gpointer userdata)
{
static pa_operation *o = NULL;
context_ready = FALSE;
@@ -112,7 +115,8 @@ void context_state_callback(pa_context *c, gpointer userdata)
/*
* the begin of the callback loops
*/
-void get_sink_info_callback(pa_context *c, const pa_sink_info *i, gint is_last, gpointer userdata)
+void
+get_sink_info_callback(pa_context *c, const pa_sink_info *i, gint is_last, gpointer userdata)
{
g_assert(userdata != NULL);
GArray *sink_list_tmp = userdata;
@@ -142,7 +146,8 @@ void get_sink_info_callback(pa_context *c, const pa_sink_info *i, gint is_last,
/*
* is called after sink-input
*/
-void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, gint is_last, gpointer userdata)
+void
+get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, gint is_last, gpointer userdata)
{
g_assert(userdata != NULL);
GArray *sink_list_tmp = userdata;
@@ -181,7 +186,8 @@ void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info *i, gi
}));
}
-void quit(void)
+void
+quit(void)
{
pa_context_disconnect(context);
}
@@ -189,12 +195,14 @@ void quit(void)
/*
* is called, after user input
*/
-void change_callback(pa_context* c, gint success, gpointer userdata)
+void
+change_callback(pa_context* c, gint success, gpointer userdata)
{
return;
}
-void collect_all_info(void)
+void
+collect_all_info(void)
{
if (!info_callbacks_finished)
return;
diff --git a/src/sink.c b/src/sink.c
index 9f36f3e..090659f 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -7,7 +7,8 @@
/*
* init a sink list
*/
-GArray *sink_list_alloc(void)
+GArray *
+sink_list_alloc(void)
{
return g_array_sized_new(FALSE, FALSE, sizeof(sink_info), 16);
}
@@ -15,7 +16,8 @@ GArray *sink_list_alloc(void)
/*
* frees all dynamic allocated components of a sink
*/
-static void sink_clear(sink_info* sink)
+static void
+sink_clear(sink_info* sink)
{
g_free(sink->name);
g_free(sink->device);
@@ -25,7 +27,8 @@ static void sink_clear(sink_info* sink)
/*
* frees a complete sink array
*/
-void sink_list_free(GArray *sink_list)
+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));
@@ -35,7 +38,8 @@ void sink_list_free(GArray *sink_list)
/*
* get sink at index from sink_list
*/
-sink_info *sink_list_get(gint index)
+sink_info *
+sink_list_get(gint index)
{
return &g_array_index(sink_list, sink_info, index);
}
@@ -43,7 +47,8 @@ sink_info *sink_list_get(gint index)
/*
* get an input association to an sink by their indizes
*/
-sink_input_info *sink_input_get(gint sink_list_index, gint index)
+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);
}
diff --git a/src/sink_input.c b/src/sink_input.c
index d4341d4..6dd292a 100644
--- a/src/sink_input.c
+++ b/src/sink_input.c
@@ -1,18 +1,21 @@
#include <glib.h>
#include "sink_input.h"
-GArray *sink_input_list_alloc(void)
+GArray *
+sink_input_list_alloc(void)
{
return g_array_sized_new(FALSE, FALSE, sizeof(sink_input_info), 8);
}
-static void sink_input_clear(sink_input_info* sink_input)
+static void
+sink_input_clear(sink_input_info* sink_input)
{
g_free(sink_input->name);
g_free(sink_input->pid);
}
-void sink_input_list_free(GArray *sink_input_list)
+void
+sink_input_list_free(GArray *sink_input_list)
{
for (int i = 0; i < sink_input_list->len; ++i)
sink_input_clear(&g_array_index(sink_input_list, sink_input_info, i));