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.
This commit is contained in:
parent
b332e1cbc8
commit
94293149b1
@ -391,49 +391,49 @@ static int commandStatus(struct client *client, mpd_unused int *permission,
|
|||||||
}
|
}
|
||||||
|
|
||||||
client_printf(client,
|
client_printf(client,
|
||||||
"%s: %i\n"
|
COMMAND_STATUS_VOLUME ": %i\n"
|
||||||
"%s: %i\n"
|
COMMAND_STATUS_REPEAT ": %i\n"
|
||||||
"%s: %i\n"
|
COMMAND_STATUS_RANDOM ": %i\n"
|
||||||
"%s: %li\n"
|
COMMAND_STATUS_PLAYLIST ": %li\n"
|
||||||
"%s: %i\n"
|
COMMAND_STATUS_PLAYLIST_LENGTH ": %i\n"
|
||||||
"%s: %i\n"
|
COMMAND_STATUS_CROSSFADE ": %i\n"
|
||||||
"%s: %s\n",
|
COMMAND_STATUS_STATE ": %s\n",
|
||||||
COMMAND_STATUS_VOLUME, getVolumeLevel(),
|
getVolumeLevel(),
|
||||||
COMMAND_STATUS_REPEAT, getPlaylistRepeatStatus(),
|
getPlaylistRepeatStatus(),
|
||||||
COMMAND_STATUS_RANDOM, getPlaylistRandomStatus(),
|
getPlaylistRandomStatus(),
|
||||||
COMMAND_STATUS_PLAYLIST, getPlaylistVersion(),
|
getPlaylistVersion(),
|
||||||
COMMAND_STATUS_PLAYLIST_LENGTH, getPlaylistLength(),
|
getPlaylistLength(),
|
||||||
COMMAND_STATUS_CROSSFADE,
|
|
||||||
(int)(getPlayerCrossFade() + 0.5),
|
(int)(getPlayerCrossFade() + 0.5),
|
||||||
COMMAND_STATUS_STATE, state);
|
state);
|
||||||
|
|
||||||
song = getPlaylistCurrentSong();
|
song = getPlaylistCurrentSong();
|
||||||
if (song >= 0) {
|
if (song >= 0) {
|
||||||
client_printf(client, "%s: %i\n%s: %i\n",
|
client_printf(client,
|
||||||
COMMAND_STATUS_SONG, song,
|
COMMAND_STATUS_SONG ": %i\n"
|
||||||
COMMAND_STATUS_SONGID, getPlaylistSongId(song));
|
COMMAND_STATUS_SONGID ": %i\n",
|
||||||
|
song, getPlaylistSongId(song));
|
||||||
}
|
}
|
||||||
if (getPlayerState() != PLAYER_STATE_STOP) {
|
if (getPlayerState() != PLAYER_STATE_STOP) {
|
||||||
client_printf(client,
|
client_printf(client,
|
||||||
"%s: %i:%i\n"
|
COMMAND_STATUS_TIME ": %i:%i\n"
|
||||||
"%s: %li\n"
|
COMMAND_STATUS_BITRATE ": %li\n"
|
||||||
"%s: %u:%i:%i\n",
|
COMMAND_STATUS_AUDIO ": %u:%i:%i\n",
|
||||||
COMMAND_STATUS_TIME,
|
|
||||||
getPlayerElapsedTime(), getPlayerTotalTime(),
|
getPlayerElapsedTime(), getPlayerTotalTime(),
|
||||||
COMMAND_STATUS_BITRATE, getPlayerBitRate(),
|
getPlayerBitRate(),
|
||||||
COMMAND_STATUS_AUDIO,
|
|
||||||
getPlayerSampleRate(), getPlayerBits(),
|
getPlayerSampleRate(), getPlayerBits(),
|
||||||
getPlayerChannels());
|
getPlayerChannels());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((updateJobId = isUpdatingDB())) {
|
if ((updateJobId = isUpdatingDB())) {
|
||||||
client_printf(client, "%s: %i\n",
|
client_printf(client,
|
||||||
COMMAND_STATUS_UPDATING_DB, updateJobId);
|
COMMAND_STATUS_UPDATING_DB ": %i\n",
|
||||||
|
updateJobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getPlayerError() != PLAYER_ERROR_NOERROR) {
|
if (getPlayerError() != PLAYER_ERROR_NOERROR) {
|
||||||
client_printf(client, "%s: %s\n",
|
client_printf(client,
|
||||||
COMMAND_STATUS_ERROR, getPlayerErrorStr());
|
COMMAND_STATUS_ERROR ": %s\n",
|
||||||
|
getPlayerErrorStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user