aboutsummaryrefslogtreecommitdiffstats
path: root/src/volume.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-23 20:48:12 +0200
committerMax Kellermann <max@duempel.org>2008-09-23 20:48:12 +0200
commit27fad52c6bb1d8803f400a6e95fa5c24396a1c12 (patch)
tree9b1fadeef43c3193b29344cda223c7b2c754433b /src/volume.c
parentf5df13f853cf4c0e529244dd40ab57c78a7d1bc6 (diff)
downloadmpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.tar.gz
mpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.tar.xz
mpd-27fad52c6bb1d8803f400a6e95fa5c24396a1c12.zip
start using prefixcmp()
LOC reduction and less noise makes things easier for tired old folks to follow.
Diffstat (limited to '')
-rw-r--r--src/volume.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/volume.c b/src/volume.c
index 519bb814e..bf3e58f02 100644
--- a/src/volume.c
+++ b/src/volume.c
@@ -508,26 +508,22 @@ int changeVolumeLevel(int change, int rel)
void read_sw_volume_state(FILE *fp)
{
- /* strlen(SW_VOLUME_STATE) + strlen('100') + '\0' */
- #define bufsize 16
- char buf[bufsize];
- const size_t len = strlen(SW_VOLUME_STATE);
+ char buf[sizeof(SW_VOLUME_STATE) + sizeof("100") - 1];
char *end = NULL;
long int sv;
if (volume_mixerType != VOLUME_MIXER_TYPE_SOFTWARE)
return;
- while (myFgets(buf, bufsize, fp)) {
- if (strncmp(buf, SW_VOLUME_STATE, len))
+ while (myFgets(buf, sizeof(buf), fp)) {
+ if (prefixcmp(buf, SW_VOLUME_STATE))
continue;
- sv = strtol(buf + len, &end, 10);
+ sv = strtol(buf + strlen(SW_VOLUME_STATE), &end, 10);
if (mpd_likely(!*end))
changeSoftwareVolume(sv, 0);
else
ERROR("Can't parse software volume: %s\n", buf);
return;
}
- #undef bufsize
}
void save_sw_volume_state(FILE *fp)