aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:57:43 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:57:43 +0200
commit94293149b1375dad39745f2f8e5f1b8f0299cc61 (patch)
tree3cb772a8f42d9742132bd549adbebb1685d615f9 /src
parentb332e1cbc8a1e44742ad8815b674a640ef3cdb52 (diff)
downloadmpd-94293149b1375dad39745f2f8e5f1b8f0299cc61.tar.gz
mpd-94293149b1375dad39745f2f8e5f1b8f0299cc61.tar.xz
mpd-94293149b1375dad39745f2f8e5f1b8f0299cc61.zip
command: concatenate strings at compile time
String literals (including those defined in CPP macros) can be concatenated at compile time. This saves some CPU cycles in vsnprintf() at run time.
Diffstat (limited to '')
-rw-r--r--src/command.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/command.c b/src/command.c
index 7ff633857..44f561282 100644
--- a/src/command.c
+++ b/src/command.c
@@ -391,49 +391,49 @@ static int commandStatus(struct client *client, mpd_unused int *permission,
}
client_printf(client,
- "%s: %i\n"
- "%s: %i\n"
- "%s: %i\n"
- "%s: %li\n"
- "%s: %i\n"
- "%s: %i\n"
- "%s: %s\n",
- COMMAND_STATUS_VOLUME, getVolumeLevel(),
- COMMAND_STATUS_REPEAT, getPlaylistRepeatStatus(),
- COMMAND_STATUS_RANDOM, getPlaylistRandomStatus(),
- COMMAND_STATUS_PLAYLIST, getPlaylistVersion(),
- COMMAND_STATUS_PLAYLIST_LENGTH, getPlaylistLength(),
- COMMAND_STATUS_CROSSFADE,
+ COMMAND_STATUS_VOLUME ": %i\n"
+ COMMAND_STATUS_REPEAT ": %i\n"
+ COMMAND_STATUS_RANDOM ": %i\n"
+ COMMAND_STATUS_PLAYLIST ": %li\n"
+ COMMAND_STATUS_PLAYLIST_LENGTH ": %i\n"
+ COMMAND_STATUS_CROSSFADE ": %i\n"
+ COMMAND_STATUS_STATE ": %s\n",
+ getVolumeLevel(),
+ getPlaylistRepeatStatus(),
+ getPlaylistRandomStatus(),
+ getPlaylistVersion(),
+ getPlaylistLength(),
(int)(getPlayerCrossFade() + 0.5),
- COMMAND_STATUS_STATE, state);
+ state);
song = getPlaylistCurrentSong();
if (song >= 0) {
- client_printf(client, "%s: %i\n%s: %i\n",
- COMMAND_STATUS_SONG, song,
- COMMAND_STATUS_SONGID, getPlaylistSongId(song));
+ client_printf(client,
+ COMMAND_STATUS_SONG ": %i\n"
+ COMMAND_STATUS_SONGID ": %i\n",
+ song, getPlaylistSongId(song));
}
if (getPlayerState() != PLAYER_STATE_STOP) {
client_printf(client,
- "%s: %i:%i\n"
- "%s: %li\n"
- "%s: %u:%i:%i\n",
- COMMAND_STATUS_TIME,
+ COMMAND_STATUS_TIME ": %i:%i\n"
+ COMMAND_STATUS_BITRATE ": %li\n"
+ COMMAND_STATUS_AUDIO ": %u:%i:%i\n",
getPlayerElapsedTime(), getPlayerTotalTime(),
- COMMAND_STATUS_BITRATE, getPlayerBitRate(),
- COMMAND_STATUS_AUDIO,
+ getPlayerBitRate(),
getPlayerSampleRate(), getPlayerBits(),
getPlayerChannels());
}
if ((updateJobId = isUpdatingDB())) {
- client_printf(client, "%s: %i\n",
- COMMAND_STATUS_UPDATING_DB, updateJobId);
+ client_printf(client,
+ COMMAND_STATUS_UPDATING_DB ": %i\n",
+ updateJobId);
}
if (getPlayerError() != PLAYER_ERROR_NOERROR) {
- client_printf(client, "%s: %s\n",
- COMMAND_STATUS_ERROR, getPlayerErrorStr());
+ client_printf(client,
+ COMMAND_STATUS_ERROR ": %s\n",
+ getPlayerErrorStr());
}
return 0;