aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-01-22 18:59:01 +0100
committerMax Kellermann <max@duempel.org>2015-01-22 18:59:01 +0100
commite9d4b73cc3ab03c9a2fa40d8a11a2351227ef044 (patch)
tree09e3772cfe28706de6aa67d789f14f2c93b395c5 /src
parent929ec70512e08989b744c299a0b281ad2718be23 (diff)
downloadmpd-e9d4b73cc3ab03c9a2fa40d8a11a2351227ef044.tar.gz
mpd-e9d4b73cc3ab03c9a2fa40d8a11a2351227ef044.tar.xz
mpd-e9d4b73cc3ab03c9a2fa40d8a11a2351227ef044.zip
util/format: move code to is_name_char()
Diffstat (limited to 'src')
-rw-r--r--src/util/format.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util/format.c b/src/util/format.c
index d360df3dc..250bdd7ea 100644
--- a/src/util/format.c
+++ b/src/util/format.c
@@ -71,6 +71,12 @@ skip_format(const char *p)
return p;
}
+static bool
+is_name_char(char ch)
+{
+ return ch >= 'a' && ch <= 'z';
+}
+
static char *
format_object2(const char *format, const char **last, const void *object,
const char *(*getter)(const void *object, const char *name))
@@ -181,7 +187,7 @@ format_object2(const char *format, const char **last, const void *object,
/* find the extent of this format specifier
(stop at \0, ' ', or esc) */
const char *end = p + 1;
- while (*end >= 'a' && *end <= 'z')
+ while (is_name_char(*end))
++end;
const size_t length = end - p + 1;