From 2532bc36d25318724f5bf50cfe2b122160665386 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Aug 2006 04:18:48 +0000 Subject: playerData: move player_pid into the main playerData structure No point in doing all that extra work for one variable... git-svn-id: https://svn.musicpd.org/mpd/trunk@4511 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playerData.c | 22 ++-------------------- src/playerData.h | 1 + 2 files changed, 3 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/playerData.c b/src/playerData.c index a023d76e9..b5f8aadd4 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -34,7 +34,6 @@ int buffered_chunks; #define DEFAULT_BUFFER_BEFORE_PLAY 0 static PlayerData *playerData_pd; -int *player_pid; void initPlayerData(void) { @@ -104,22 +103,6 @@ void initPlayerData(void) ERROR("problems shmctl'ing\n"); exit(EXIT_FAILURE); } - /* maybe the following should be put in the same shm block as the previous - * or maybe even made a part of the playerData struct - */ - allocationSize = sizeof(int); - if ((shmid = shmget(IPC_PRIVATE, allocationSize, IPC_CREAT | 0600)) < 0) { - ERROR("problems shmget'ing\n"); - exit(EXIT_FAILURE); - } - if (!(player_pid = shmat(shmid, NULL, 0))) { - ERROR("problems shmat'ing\n"); - exit(EXIT_FAILURE); - } - if (shmctl(shmid, IPC_RMID, NULL) < 0) { - ERROR("problems shmctl'ing\n"); - exit(EXIT_FAILURE); - } buffer = &(playerData_pd->buffer); @@ -172,16 +155,15 @@ PlayerData *getPlayerData(void) int getPlayerPid(void) { - return *player_pid; + return playerData_pd->pid; } void setPlayerPid(int pid) { - *player_pid = pid; + playerData_pd->pid = pid; } void freePlayerData(void) { shmdt(playerData_pd); - shmdt(player_pid); } diff --git a/src/playerData.h b/src/playerData.h index 500b4b93f..ac64f3b85 100644 --- a/src/playerData.h +++ b/src/playerData.h @@ -38,6 +38,7 @@ typedef struct _PlayerData { PlayerControl playerControl; DecoderControl decoderControl; mpd_sint8 audioDeviceEnabled[AUDIO_MAX_DEVICES]; + int pid; } PlayerData; void initPlayerData(); -- cgit v1.2.3