summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2011-09-09 12:16:29 -0700
committerJon Loeliger <jdl@jdl.com>2011-09-09 16:05:36 -0500
commitb43335a23854b2620140eda6cca2ffae59e8de23 (patch)
tree89be04a4524dc4e77b9426e8282d5c8faec4633e /util.h
parented8fee1a649b5430afc9b551e3bb6746ebe32449 (diff)
downloaddtc-b43335a23854b2620140eda6cca2ffae59e8de23.tar.gz
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 <robotboy@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.h')
-rw-r--r--util.h8
1 files changed, 8 insertions, 0 deletions
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 */