From b43335a23854b2620140eda6cca2ffae59e8de23 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Fri, 9 Sep 2011 12:16:29 -0700 Subject: dtc: Refactor character literal parsing code Move the parsing of hex, octal and escaped characters from data.c to util.c where it can be used for character literal parsing within strings as well as for stand alone C style character literals. Signed-off-by: Anton Staaf Acked-by: David Gibson --- util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index cc68933..f251480 100644 --- a/util.h +++ b/util.h @@ -64,4 +64,12 @@ extern char *join_path(const char *path, const char *name); * @return 1 if a valid printable string, 0 if not */ int util_is_printable_string(const void *data, int len); +/* + * Parse an escaped character starting at index i in string s. The resulting + * character will be returned and the index i will be updated to point at the + * character directly after the end of the encoding, this may be the '\0' + * terminator of the string. + */ +char get_escape_char(const char *s, int *i); + #endif /* _UTIL_H */ -- cgit v1.1