From 1465bfab82b8715c00ccfd18768c16a71a3f5a9e Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Sat, 12 Apr 2008 04:19:38 +0000
Subject: pass pc to player_task()

Another global variable cleanup patch.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7321 09075e82-0dd4-0310-85a5-a0d7c8717e4f
---
 src/main.c   | 2 +-
 src/player.c | 8 ++++----
 src/player.h | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

(limited to 'src')

diff --git a/src/main.c b/src/main.c
index 1c513b171..d20a187d4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -444,7 +444,7 @@ int main(int argc, char *argv[])
 
 	openVolumeDevice();
 	decoderInit();
-	playerInit();
+	playerInit(&getPlayerData()->playerControl);
 	read_state_file();
 
 	notifyEnter(&main_notify);
diff --git a/src/player.c b/src/player.c
index 046195763..9fc55ec02 100644
--- a/src/player.c
+++ b/src/player.c
@@ -51,9 +51,9 @@ void player_sleep(PlayerControl *pc)
 	notifyWait(&pc->notify);
 }
 
-static void * player_task(mpd_unused void *unused)
+static void * player_task(void *arg)
 {
-	PlayerControl *pc = &(getPlayerData()->playerControl);
+	PlayerControl *pc = arg;
 
 	notifyEnter(&pc->notify);
 
@@ -86,14 +86,14 @@ static void * player_task(mpd_unused void *unused)
 	return NULL;
 }
 
-void playerInit(void)
+void playerInit(PlayerControl * pc)
 {
 	pthread_attr_t attr;
 	pthread_t player_thread;
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-	if (pthread_create(&player_thread, &attr, player_task, NULL))
+	if (pthread_create(&player_thread, &attr, player_task, pc))
 		FATAL("Failed to spawn player task: %s\n", strerror(errno));
 }
 
diff --git a/src/player.h b/src/player.h
index 7eb0dd9cd..6e0bc83d7 100644
--- a/src/player.h
+++ b/src/player.h
@@ -138,6 +138,6 @@ int getPlayerChannels(void);
 
 Song *playerCurrentDecodeSong(void);
 
-void playerInit(void);
+void playerInit(PlayerControl * pc);
 
 #endif
-- 
cgit v1.2.3