Commit 288a7087 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

allocate playerData_pd from heap instead of shm

git-svn-id: https://svn.musicpd.org/mpd/trunk@7308 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent eb5d51c9
......@@ -70,10 +70,6 @@
#include <stddef.h> /* needed? this defines NULL + offsetof() */
#include <resolv.h>
/* remove when we switch to pthreads: */
#include <sys/ipc.h>
#include <sys/shm.h>
#ifdef HAVE_UN
#include <sys/un.h>
#endif
......
......@@ -34,7 +34,6 @@ void initPlayerData(void)
{
float perc = DEFAULT_BUFFER_BEFORE_PLAY;
char *test;
int shmid;
int crossfade = 0;
size_t bufferSize = DEFAULT_BUFFER_SIZE;
size_t allocationSize;
......@@ -78,12 +77,7 @@ void initPlayerData(void)
/* for playerData struct */
allocationSize = sizeof(PlayerData);
if ((shmid = shmget(IPC_PRIVATE, allocationSize, IPC_CREAT | 0600)) < 0)
FATAL("problems shmget'ing\n");
if (!(playerData_pd = shmat(shmid, NULL, 0)))
FATAL("problems shmat'ing\n");
if (shmctl(shmid, IPC_RMID, NULL) < 0)
FATAL("problems shmctl'ing\n");
playerData_pd = xmalloc(allocationSize);
playerData_pd->audioDeviceStates = xmalloc(device_array_size);
......@@ -129,5 +123,5 @@ void freePlayerData(void)
waitpid(-1, NULL, 0);
free(playerData_pd->audioDeviceStates);
shmdt(playerData_pd);
free(playerData_pd);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment