I have been working on Gjay to add support for http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki where I had what initially looked like a strange problem. When WITH_MPDCLIENT was defined, the program would crash in all sorts of weird places when the main program structure had this:
#ifdef WITH_MPDCLIENT struct mpd_connection *mpdclient_connection; #endif
But would work fine when it was:
struct mpd_connection *mpdclient_connection; #ifdef WITH_MPDCLIENT #endif /* WITH_MPDCLIENT */
I tried changing the structure to just void *blah to see if it made a difference and it didn’t. The program would crash every time.
The answer was pretty simple in the end. The WITH_MPDCLIENT is defined in the file config.h
and not every c source file was including it. Needless to say, they should! So half the program was using one version of the structure and the other was using another; no wonder the whole program was a mess because anything beyond this entry in the structure would be a few bytes out.
With that little insanity out of the way, I can get back to making gjay work with MPD.