aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-08-01 04:18:48 +0000
committerEric Wong <normalperson@yhbt.net>2006-08-01 04:18:48 +0000
commit2532bc36d25318724f5bf50cfe2b122160665386 (patch)
tree1ce5669b720e2196ca75b90f8f5469723c10bae4
parent5aca21a502839e2cfd30f0cfb186badc302a7eb5 (diff)
downloadmpd-2532bc36d25318724f5bf50cfe2b122160665386.tar.gz
mpd-2532bc36d25318724f5bf50cfe2b122160665386.tar.xz
mpd-2532bc36d25318724f5bf50cfe2b122160665386.zip
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
Diffstat (limited to '')
-rw-r--r--src/playerData.c22
-rw-r--r--src/playerData.h1
2 files changed, 3 insertions, 20 deletions
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();