util/format: move code to is_name_char()
This commit is contained in:
parent
929ec70512
commit
e9d4b73cc3
@ -71,6 +71,12 @@ skip_format(const char *p)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_name_char(char ch)
|
||||||
|
{
|
||||||
|
return ch >= 'a' && ch <= 'z';
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
format_object2(const char *format, const char **last, const void *object,
|
format_object2(const char *format, const char **last, const void *object,
|
||||||
const char *(*getter)(const void *object, const char *name))
|
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
|
/* find the extent of this format specifier
|
||||||
(stop at \0, ' ', or esc) */
|
(stop at \0, ' ', or esc) */
|
||||||
const char *end = p + 1;
|
const char *end = p + 1;
|
||||||
while (*end >= 'a' && *end <= 'z')
|
while (is_name_char(*end))
|
||||||
++end;
|
++end;
|
||||||
|
|
||||||
const size_t length = end - p + 1;
|
const size_t length = end - p + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user