1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
--- a/src/audioscrobbler.c
+++ b/src/audioscrobbler.c
@@ -50,6 +50,9 @@
#define API_KEY "3ec5638071c41a864bf0c8d451566476"
#define API_SECRET "365e18391ccdee3bf820cb3d2ba466f6"
+static struct as_conn_t as_conn;
+gchar *buffer;
+
gboolean as_connection_init(void)
{
as_conn.handle = curl_easy_init();
--- a/src/audioscrobbler.h
+++ b/src/audioscrobbler.h
@@ -37,19 +37,19 @@
/**
* Last.fm connection data
*/
-struct {
+struct as_conn_t {
gchar *session_id;
gint64 last_auth;
gint64 last_fail;
connection_status status;
CURL *handle;
struct curl_slist *headers;
-} as_conn;
+};
/**
* cURL data buffer
*/
-gchar *buffer;
+extern gchar *buffer;
/**
* Initialize cURL
--- a/src/mpd.c
+++ b/src/mpd.c
@@ -37,6 +37,8 @@
static gboolean mpd_parse(GIOChannel *source, GIOCondition condition,
gpointer data);
+struct mpd_t mpd;
+
gboolean mpd_connect(void)
{
mpd.conn = mpd_connection_new(prefs.mpd_hostname, prefs.mpd_port,
--- a/src/mpd.h
+++ b/src/mpd.h
@@ -32,7 +32,7 @@
/**
* MPD connection data
*/
-struct {
+struct mpd_t {
struct mpd_connection *conn;
struct mpd_status *status;
struct mpd_song *song;
@@ -42,7 +42,9 @@
guint idle_source;
guint check_source;
guint reconnect_source;
-} mpd;
+};
+
+extern struct mpd_t mpd;
/**
* Connect to MPD
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -36,6 +36,8 @@
#include "scmpc.h"
#include "preferences.h"
+struct prefs_t prefs;
+
static gint cf_log_level(cfg_t *cfg, cfg_opt_t *opt, const gchar *value,
void *result);
static gint cf_validate_num(cfg_t *cfg, cfg_opt_t *opt);
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -32,7 +32,7 @@
/**
* scmpc settings
*/
-struct {
+struct prefs_t {
gchar *mpd_hostname;
gushort mpd_port;
gushort mpd_timeout;
@@ -48,7 +48,9 @@
gchar *cache_file;
guint queue_length;
guint cache_interval;
-} prefs;
+};
+
+extern struct prefs_t prefs;
/**
* Initialize preferences
|