Over the lifetime of the jack AudioOutput object, we want a single valid JackData object, so we can persistently store data there (configuration etc.). Allocate JackData in jack_initDriver(). After that, we can safely remove all audioOutput->data==NULL checks (and replace them with assertions). ---
src/audioOutputs/audioOutput_jack.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c index 47997df..9fc5205 100644 --- a/src/audioOutputs/audioOutput_jack.c +++ b/src/audioOutputs/audioOutput_jack.c @@ -205,7 +205,7 @@ static int jack_initDriver(AudioOutput *audioOutput, ConfigParam *param) int val; char *cp = NULL; - audioOutput->data = NULL; + audioOutput->data = newJackData(); DEBUG("jack_initDriver (pid=%d)\n", getpid()); if ( ! param ) return 0; @@ -345,11 +345,7 @@ static int jack_openDevice(AudioOutput *audioOutput) { JackData *jd = audioOutput->data; - if ( !jd ) { - DEBUG("connect!\n"); - jd = newJackData(); - audioOutput->data = jd; - } + assert(jd != NULL); if (jd->client == NULL && connect_jack(audioOutput) < 0) { freeJackClient(jd); ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team