From b443363aa6081749883a92f9955a95c4301df00a Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sun, 14 Jan 2007 03:07:53 +0000
Subject: [PATCH] Don't initialize globals to zero (or NULL)

Some compilers and linkers aren't smart enough to optimize this,
as global variables are implictly initialized to zero.  As a
result, binaries are a bit smaller as more goes in the .bss and
less in the text section.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
---
 src/audio.c                          | 18 +++++++++---------
 src/audioOutput.h                    | 13 +------------
 src/audioOutputs/audioOutput_ao.c    |  2 +-
 src/audioOutputs/audioOutput_shout.c |  2 +-
 src/command.c                        |  6 +++---
 src/compress.c                       | 10 +++++-----
 src/conf.c                           |  2 +-
 src/decode.c                         |  2 +-
 src/directory.c                      | 10 +++++-----
 src/inputPlugin.c                    |  6 +++---
 src/inputPlugins/aac_plugin.c        | 13 +------------
 src/inputPlugins/audiofile_plugin.c  | 13 +------------
 src/inputPlugins/flac_plugin.c       | 13 +------------
 src/inputPlugins/mod_plugin.c        | 17 +++--------------
 src/inputPlugins/mp3_plugin.c        | 13 +------------
 src/inputPlugins/mp4_plugin.c        | 13 +------------
 src/inputPlugins/mpc_plugin.c        | 13 +------------
 src/inputPlugins/oggflac_plugin.c    | 13 +------------
 src/inputPlugins/oggvorbis_plugin.c  | 13 +------------
 src/inputStream_http.c               |  8 ++++----
 src/interface.c                      | 12 ++++++------
 src/listen.c                         |  6 +++---
 src/localization.c                   |  4 ++--
 src/log.c                            | 10 +++++-----
 src/outputBuffer.c                   |  8 ++++----
 src/path.c                           |  6 +++---
 src/pcm_utils.c                      |  8 ++++----
 src/player.c                         |  6 +++---
 src/playlist.c                       |  6 +++---
 src/song.c                           |  6 +++---
 src/state_file.c                     |  2 +-
 src/tagTracker.c                     | 10 +---------
 src/volume.c                         |  2 +-
 src/zeroconf.c                       |  8 ++++----
 34 files changed, 88 insertions(+), 206 deletions(-)

diff --git a/src/audio.c b/src/audio.c
index 45067e27c..9fba7911b 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -39,12 +39,12 @@
 #define AUDIO_DEVICE_STATE_LEN	19	/* strlen(AUDIO_DEVICE_STATE) */
 #define AUDIO_BUFFER_SIZE	2*MAXPATHLEN
 
-static AudioFormat audio_format = { 0, 0, 0 };
+static AudioFormat audio_format;
 
-static AudioFormat *audio_configFormat = NULL;
+static AudioFormat *audio_configFormat;
 
-static AudioOutput *audioOutputArray = NULL;
-static mpd_uint8 audioOutputArraySize = 0;
+static AudioOutput *audioOutputArray;
+static mpd_uint8 audioOutputArraySize;
 
 #define	DEVICE_OFF        0x00
 #define DEVICE_ENABLE	  0x01   /* currently off, but to be turned on */
@@ -53,13 +53,13 @@ static mpd_uint8 audioOutputArraySize = 0;
 
 /* the audioEnabledArray should be stuck into shared memory, and then disable
    and enable in playAudio() routine */
-static mpd_uint8 *audioDeviceStates = NULL;
+static mpd_uint8 *audioDeviceStates;
 
-static mpd_uint8 audioOpened = 0;
+static mpd_uint8 audioOpened;
 
-static mpd_sint32 audioBufferSize = 0;
-static char *audioBuffer = NULL;
-static mpd_sint32 audioBufferPos = 0;
+static mpd_sint32 audioBufferSize;
+static char *audioBuffer;
+static mpd_sint32 audioBufferPos;
 
 size_t audio_device_count(void)
 {
diff --git a/src/audioOutput.h b/src/audioOutput.h
index bc318dea2..235d7eda1 100644
--- a/src/audioOutput.h
+++ b/src/audioOutput.h
@@ -27,18 +27,7 @@
 #include "conf.h"
 #include "utils.h"
 
-#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) \
-	AudioOutputPlugin plugin = { \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL, \
-		NULL \
-	};
+#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) AudioOutputPlugin plugin;
 
 typedef struct _AudioOutput AudioOutput;
 
diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c
index 00e354d54..734a6538d 100644
--- a/src/audioOutputs/audioOutput_ao.c
+++ b/src/audioOutputs/audioOutput_ao.c
@@ -27,7 +27,7 @@
 
 #include <ao/ao.h>
 
-static int driverInitCount = 0;
+static int driverInitCount;
 
 typedef struct _AoData {
 	int writeSize;
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index 2092b56d7..11c577e15 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -34,7 +34,7 @@
 
 #define CONN_ATTEMPT_INTERVAL	60
 
-static int shoutInitCount = 0;
+static int shoutInitCount;
 
 /* lots of this code blatantly stolent from bossogg/bossao2 */
 
diff --git a/src/command.c b/src/command.c
index 36587af36..e544a83bc 100644
--- a/src/command.c
+++ b/src/command.c
@@ -134,8 +134,8 @@ struct _CommandEntry {
 	CommandListHandlerFunction listHandler;
 };
 
-static char *current_command = NULL;
-static int command_listNum = 0;
+static char *current_command;
+static int command_listNum;
 
 static CommandEntry *getCommandEntryFromString(char *string, int *permission);
 
@@ -516,7 +516,7 @@ static int listHandleUpdate(int fd,
 			    char *argv[],
 			    struct strnode *cmdnode, CommandEntry * cmd)
 {
-	static List *pathList = NULL;
+	static List *pathList;
 	CommandEntry *nextCmd = NULL;
 	struct strnode *next = cmdnode->next;
 
diff --git a/src/compress.c b/src/compress.c
index e05265ed7..266f50076 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -39,7 +39,7 @@ static int screen;
 static GC blackGC, whiteGC, blueGC, yellowGC, dkyellowGC, redGC;
 #endif
 
-static int *peaks = NULL;
+static int *peaks;
 static int gainCurrent, gainTarget;
 
 static struct {
@@ -52,13 +52,13 @@ static struct {
 } prefs;
 
 #ifdef USE_X
-static int mon_init = 0;
+static int mon_init;
 #endif
 
 void CompressCfg(int show_mon, int anticlip, int target, int gainmax,
 		 int gainsmooth, int buckets)
 {
-	static int lastsize = 0;
+	static int lastsize;
 
 	prefs.show_mon = show_mon;
 	prefs.anticlip = anticlip;
@@ -179,9 +179,9 @@ void CompressDo(void *data, unsigned int length)
 	int gr, gf, gn;
 	static int pn = -1;
 #ifdef STATS
-	static int clip = 0;
+	static int clip;
 #endif
-	static int clipped = 0;
+	static int clipped;
 
 	if (!peaks)
 		return;
diff --git a/src/conf.c b/src/conf.c
index a2609710e..0960dfbbc 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -48,7 +48,7 @@ typedef struct _configEntry {
 	List *configParamList;
 } ConfigEntry;
 
-static List *configEntriesList = NULL;
+static List *configEntriesList;
 
 static ConfigParam *newConfigParam(char *value, int line)
 {
diff --git a/src/decode.c b/src/decode.c
index bef27cd45..3641b760e 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <string.h>
 
-static int decode_pid = 0;
+static int decode_pid;
 
 void decodeSigHandler(int sig, siginfo_t * si, void *v)
 {
diff --git a/src/directory.c b/src/directory.c
index 03ae16699..ee8d51d94 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -59,15 +59,15 @@
 #define DIRECTORY_RETURN_UPDATE         1
 #define DIRECTORY_RETURN_ERROR         -1
 
-Directory *mp3rootDirectory = NULL;
+static Directory *mp3rootDirectory;
 
-time_t directory_dbModTime = 0;
+static time_t directory_dbModTime;
 
-volatile int directory_updatePid = 0;
+static volatile int directory_updatePid;
 
-volatile int directory_reReadDB = 0;
+static volatile int directory_reReadDB;
 
-volatile mpd_uint16 directory_updateJobId = 0;
+static volatile mpd_uint16 directory_updateJobId;
 
 static DirectoryList *newDirectoryList();
 
diff --git a/src/inputPlugin.c b/src/inputPlugin.c
index 1c795c59c..eee78f66d 100644
--- a/src/inputPlugin.c
+++ b/src/inputPlugin.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-static List *inputPlugin_list = NULL;
+static List *inputPlugin_list;
 
 void loadInputPlugin(InputPlugin * inputPlugin)
 {
@@ -59,7 +59,7 @@ static int stringFoundInStringArray(char **array, char *suffix)
 
 InputPlugin *getInputPluginFromSuffix(char *suffix, unsigned int next)
 {
-	static ListNode *pos = NULL;
+	static ListNode *pos;
 	ListNode *node;
 	InputPlugin *plugin;
 
@@ -88,7 +88,7 @@ InputPlugin *getInputPluginFromSuffix(char *suffix, unsigned int next)
 
 InputPlugin *getInputPluginFromMimeType(char *mimeType, unsigned int next)
 {
-	static ListNode *pos = NULL;
+	static ListNode *pos;
 	ListNode *node;
 	InputPlugin *plugin;
 
diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c
index 04000e746..d68a8c6b7 100644
--- a/src/inputPlugins/aac_plugin.c
+++ b/src/inputPlugins/aac_plugin.c
@@ -470,17 +470,6 @@ InputPlugin aacPlugin = {
 
 #else
 
-InputPlugin aacPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL,
-};
+InputPlugin aacPlugin;
 
 #endif /* HAVE_FAAD */
diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c
index 91dc9ea07..979d7b863 100644
--- a/src/inputPlugins/audiofile_plugin.c
+++ b/src/inputPlugins/audiofile_plugin.c
@@ -183,17 +183,6 @@ InputPlugin audiofilePlugin = {
 
 #else
 
-InputPlugin audiofilePlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL
-};
+InputPlugin audiofilePlugin;
 
 #endif /* HAVE_AUDIOFILE */
diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c
index 0b5ad5752..627bca6f6 100644
--- a/src/inputPlugins/flac_plugin.c
+++ b/src/inputPlugins/flac_plugin.c
@@ -525,17 +525,6 @@ InputPlugin flacPlugin = {
 
 #else /* !HAVE_FLAC */
 
-InputPlugin flacPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL,
-};
+InputPlugin flacPlugin;
 
 #endif /* HAVE_FLAC */
diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c
index a73c267be..475937ad0 100644
--- a/src/inputPlugins/mod_plugin.c
+++ b/src/inputPlugins/mod_plugin.c
@@ -92,8 +92,8 @@ static MDRIVER drv_mpd = {
 	VC_VoiceRealVolume
 };
 
-static int mod_mikModInitiated = 0;
-static int mod_mikModInitError = 0;
+static int mod_mikModInitiated;
+static int mod_mikModInitError;
 
 static int mod_initMikMod(void)
 {
@@ -285,17 +285,6 @@ InputPlugin modPlugin = {
 
 #else
 
-InputPlugin modPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL
-};
+InputPlugin modPlugin;
 
 #endif /* HAVE_AUDIOFILE */
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index 224b0ed06..a93d136fa 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -1087,17 +1087,6 @@ InputPlugin mp3Plugin = {
 };
 #else
 
-InputPlugin mp3Plugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL
-};
+InputPlugin mp3Plugin;
 
 #endif
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c
index b3439056d..654125121 100644
--- a/src/inputPlugins/mp4_plugin.c
+++ b/src/inputPlugins/mp4_plugin.c
@@ -450,17 +450,6 @@ InputPlugin mp4Plugin = {
 
 #else
 
-InputPlugin mp4Plugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL
-};
+InputPlugin mp4Plugin;
 
 #endif /* HAVE_FAAD */
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index e8671b7fa..441af29a5 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -355,17 +355,6 @@ InputPlugin mpcPlugin = {
 
 #else
 
-InputPlugin mpcPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL
-};
+InputPlugin mpcPlugin;
 
 #endif
diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c
index 4b03d5c7b..f66a9b7d4 100644
--- a/src/inputPlugins/oggflac_plugin.c
+++ b/src/inputPlugins/oggflac_plugin.c
@@ -418,17 +418,6 @@ InputPlugin oggflacPlugin = {
 
 #else /* !HAVE_FLAC */
 
-InputPlugin oggflacPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL,
-};
+InputPlugin oggflacPlugin;
 
 #endif /* HAVE_OGGFLAC */
diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c
index f032824b2..b54a7d9ad 100644
--- a/src/inputPlugins/oggvorbis_plugin.c
+++ b/src/inputPlugins/oggvorbis_plugin.c
@@ -429,17 +429,6 @@ InputPlugin oggvorbisPlugin = {
 
 #else /* !HAVE_OGGVORBIS */
 
-InputPlugin oggvorbisPlugin = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0,
-	NULL,
-	NULL,
-};
+InputPlugin oggvorbisPlugin;
 
 #endif /* HAVE_OGGVORBIS */
diff --git a/src/inputStream_http.c b/src/inputStream_http.c
index 979ead580..5df85fb67 100644
--- a/src/inputStream_http.c
+++ b/src/inputStream_http.c
@@ -47,10 +47,10 @@
 
 #define HTTP_REDIRECT_MAX    10
 
-static char *proxyHost = NULL;
-static char *proxyPort = NULL;
-static char *proxyUser = NULL;
-static char *proxyPassword = NULL;
+static char *proxyHost;
+static char *proxyPort;
+static char *proxyUser;
+static char *proxyPassword;
 static int bufferSize = HTTP_BUFFER_SIZE_DEFAULT;
 static int prebufferSize = HTTP_PREBUFFER_SIZE_DEFAULT;
 
diff --git a/src/interface.c b/src/interface.c
index 4c2190783..31f8666e0 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -56,7 +56,7 @@
 #define INTERFACE_MAX_OUTPUT_BUFFER_SIZE_DEFAULT	(8192*1024)
 
 /* set this to zero to indicate we have no possible interfaces */
-static int interface_max_connections = 0;	/*INTERFACE_MAX_CONNECTIONS_DEFAULT; */
+static int interface_max_connections;	/*INTERFACE_MAX_CONNECTIONS_DEFAULT; */
 static int interface_timeout = INTERFACE_TIMEOUT_DEFAULT;
 static size_t interface_max_command_list_size =
     INTERFACE_MAX_COMMAND_LIST_DEFAULT;
@@ -70,9 +70,9 @@ static struct ioOps *ioList;
 static long int interface_list_cache_size = 32;
 
 /* shared globally between all interfaces: */
-static struct strnode *list_cache = NULL;
-static struct strnode *list_cache_head = NULL;
-static struct strnode *list_cache_tail = NULL;
+static struct strnode *list_cache;
+static struct strnode *list_cache_head;
+static struct strnode *list_cache_tail;
 
 typedef struct _Interface {
 	char buffer[INTERFACE_MAX_BUFFER_LENGTH];
@@ -98,7 +98,7 @@ typedef struct _Interface {
 	int send_buf_alloc;	/* bytes actually allocated */
 } Interface;
 
-static Interface *interfaces = NULL;
+static Interface *interfaces;
 
 static void flushInterfaceBuffer(Interface * interface);
 
@@ -731,7 +731,7 @@ static void flushInterfaceBuffer(Interface * interface)
 
 int interfacePrintWithFD(int fd, char *buffer, int buflen)
 {
-	static int i = 0;
+	static int i;
 	int copylen;
 	Interface *interface;
 
diff --git a/src/listen.c b/src/listen.c
index 6a8d55388..df50c2493 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -45,9 +45,9 @@
 	ERROR("maybe MPD is still running?\n"); \
 } while (0);
 
-int *listenSockets = NULL;
-int numberOfListenSockets = 0;
-static int boundPort = 0;
+static int *listenSockets;
+static int numberOfListenSockets;
+static int boundPort;
 
 static int establishListen(unsigned int port,
                            struct sockaddr *addrp, socklen_t addrlen)
diff --git a/src/localization.c b/src/localization.c
index 74783fab1..b58c83945 100644
--- a/src/localization.c
+++ b/src/localization.c
@@ -31,11 +31,11 @@
 #endif
 #endif
 
-static char *localeCharset = NULL;
+static char *localeCharset;
 
 char *utf8ToLocaleCharset(char *str)
 {
-	static char *ret = NULL;
+	static char *ret;
 
 	if (localeCharset)
 		ret = convCharset(localeCharset, "UTF-8", str, ret);
diff --git a/src/log.c b/src/log.c
index 6b7e3c2d4..b2e1e1339 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,13 +30,13 @@
 #include <time.h>
 
 static unsigned int logLevel = LOG_LEVEL_LOW;
-static int warningFlushed = 0;
+static int warningFlushed;
 static int stdout_mode = 1;
-static char *warningBuffer = NULL;
+static char *warningBuffer;
 static int out_fd = -1;
 static int err_fd = -1;
-static const char *out_filename = NULL;
-static const char *err_filename = NULL;
+static const char *out_filename;
+static const char *err_filename;
 
 /* redirect stdin to /dev/null to work around a libao bug */
 static void redirect_stdin(void)
@@ -60,7 +60,7 @@ static void redirect_logs(void)
 
 static const char *log_date(void)
 {
-	static char buf[16] = { '\0' };
+	static char buf[16];
 	time_t t = time(NULL);
 	strftime(buf, 16, "%b %d %H:%M : ", localtime(&t));
 	return buf;
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index d3a3ef464..c27a8e671 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -30,7 +30,7 @@
 static mpd_sint16 currentChunk = -1;
 
 static mpd_sint8 currentMetaChunk = -1;
-static mpd_sint8 sendMetaChunk = 0;
+static mpd_sint8 sendMetaChunk;
 
 void clearAllMetaChunkSets(OutputBuffer * cb)
 {
@@ -76,8 +76,8 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
 	mpd_uint16 chunkLeft;
 	char *data;
 	size_t datalen;
-	static char *convBuffer = NULL;
-	static long convBufferLen = 0;
+	static char *convBuffer;
+	static long convBufferLen;
 
 	if (cmpAudioFormat(&(cb->audioFormat), &(dc->audioFormat)) == 0) {
 		data = dataIn;
@@ -158,7 +158,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
 int copyMpdTagToOutputBuffer(OutputBuffer * cb, MpdTag * tag)
 {
 	int nextChunk;
-	static MpdTag *last = NULL;
+	static MpdTag *last;
 
 	if (!cb->acceptMetadata || !tag) {
 		sendMetaChunk = 0;
diff --git a/src/path.c b/src/path.c
index 21597f5e6..0753727ea 100644
--- a/src/path.c
+++ b/src/path.c
@@ -34,11 +34,11 @@
 
 const char *musicDir;
 static const char *playlistDir;
-static char *fsCharset = NULL;
+static char *fsCharset;
 
 char *fsCharsetToUtf8(char *str)
 {
-	static char *ret = NULL;
+	static char *ret;
 
 	ret = convCharset("UTF-8", fsCharset, str, ret);
 
@@ -52,7 +52,7 @@ char *fsCharsetToUtf8(char *str)
 
 char *utf8ToFsCharset(char *str)
 {
-	static char *ret = NULL;
+	static char *ret;
 
 	ret = convCharset(fsCharset, "UTF-8", str, ret);
 
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index c041cbfb8..b56ed33ac 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -137,10 +137,10 @@ void pcm_mix(char *buffer1, char *buffer2, size_t bufferSize1,
 void pcm_convertAudioFormat(AudioFormat * inFormat, char *inBuffer, size_t
 			    inSize, AudioFormat * outFormat, char *outBuffer)
 {
-	static char *bitConvBuffer = NULL;
-	static int bitConvBufferLength = 0;
-	static char *channelConvBuffer = NULL;
-	static int channelConvBufferLength = 0;
+	static char *bitConvBuffer;
+	static int bitConvBufferLength;
+	static char *channelConvBuffer;
+	static int channelConvBufferLength;
 	char *dataChannelConv;
 	int dataChannelLen;
 	char *dataBitConv;
diff --git a/src/player.c b/src/player.c
index 6e2e11afe..b976dce7f 100644
--- a/src/player.c
+++ b/src/player.c
@@ -297,7 +297,7 @@ int getPlayerError(void)
 
 char *getPlayerErrorStr(void)
 {
-	static char *error = NULL;
+	static char *error;
 	int errorlen = MAXPATHLEN + 1024;
 	PlayerControl *pc = &(getPlayerData()->playerControl);
 
@@ -504,8 +504,8 @@ void playerCycleLogFiles(void)
 /* this actually creates a dupe of the current metadata */
 Song *playerCurrentDecodeSong(void)
 {
-	static Song *song = NULL;
-	static MetadataChunk *prev = NULL;
+	static Song *song;
+	static MetadataChunk *prev;
 	Song *ret = NULL;
 	PlayerControl *pc = &(getPlayerData()->playerControl);
 
diff --git a/src/playlist.c b/src/playlist.c
index a9ffe5982..4e82857f1 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -83,9 +83,9 @@ static Playlist playlist;
 static int playlist_state = PLAYLIST_STATE_STOP;
 static int playlist_max_length = DEFAULT_PLAYLIST_MAX_LENGTH;
 static int playlist_stopOnError;
-static int playlist_errorCount = 0;
+static int playlist_errorCount;
 static int playlist_queueError;
-static int playlist_noGoToNext = 0;
+static int playlist_noGoToNext;
 
 static int playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
 
@@ -1301,7 +1301,7 @@ int setPlaylistRandomStatus(int fd, int status)
 
 int previousSongInPlaylist(int fd)
 {
-	static time_t lastTime = 0;
+	static time_t lastTime;
 	time_t diff = time(NULL) - lastTime;
 
 	lastTime += diff;
diff --git a/src/song.c b/src/song.c
index 902cbeaf2..5466a7442 100644
--- a/src/song.c
+++ b/src/song.c
@@ -320,9 +320,9 @@ int updateSongInfo(Song * song)
  * 	we free and recreate this memory we make sure to print it correctly*/
 char *getSongUrl(Song * song)
 {
-	static char *buffer = NULL;
-	static int bufferSize = 0;
-	static Song *lastSong = NULL;
+	static char *buffer;
+	static int bufferSize;
+	static Song *lastSong;
 	int slen;
 	int dlen;
 	int size;
diff --git a/src/state_file.c b/src/state_file.c
index 452031ed6..c43a9c303 100644
--- a/src/state_file.c
+++ b/src/state_file.c
@@ -41,7 +41,7 @@ static struct _sf_cb {
 	{ readPlaylistState, savePlaylistState },
 };
 
-static const char *sfpath = NULL;
+static const char *sfpath;
 
 static void get_state_file_path(void)
 {
diff --git a/src/tagTracker.c b/src/tagTracker.c
index 93d3d1928..6f7ea3598 100644
--- a/src/tagTracker.c
+++ b/src/tagTracker.c
@@ -26,15 +26,7 @@
 #include <assert.h>
 #include <stdlib.h>
 
-static Tree *tagTrees[TAG_NUM_OF_ITEM_TYPES] = {
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+static Tree *tagTrees[TAG_NUM_OF_ITEM_TYPES];
 
 typedef struct tagTrackerItem {
 	int count;
diff --git a/src/volume.c b/src/volume.c
index cd09966cc..cf6cd264a 100644
--- a/src/volume.c
+++ b/src/volume.c
@@ -73,7 +73,7 @@ static int volume_ossControl = SOUND_MIXER_PCM;
 #endif
 
 #ifdef HAVE_ALSA
-static snd_mixer_t *volume_alsaMixerHandle = NULL;
+static snd_mixer_t *volume_alsaMixerHandle;
 static snd_mixer_elem_t *volume_alsaElem;
 static long volume_alsaMin;
 static long volume_alsaMax;
diff --git a/src/zeroconf.c b/src/zeroconf.c
index cd54d9669..7ae6dfecd 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -46,11 +46,11 @@
 #include <avahi-common/error.h>
 
 /* Static avahi data */
-static AvahiEntryGroup *avahiGroup = NULL;
-static char *avahiName = NULL;
-static AvahiClient* avahiClient = NULL;
+static AvahiEntryGroup *avahiGroup;
+static char *avahiName;
+static AvahiClient* avahiClient;
 static AvahiPoll avahiPoll;
-static int avahiRunning = 0;
+static int avahiRunning;
 
 static int avahiFdset( fd_set* rfds, fd_set* wfds, fd_set* efds );
 static int avahiFdconsume( int fdCount, fd_set* rfds, fd_set* wfds, fd_set* efds );
-- 
2.24.1