dtc: Improve support for string escapes

Jon Loeliger jdl at jdl.com
Tue Oct 16 23:14:20 EST 2007


So, like, the other day David Gibson mumbled:
> dtc supports the use of C-style escapes (\n, \t and so forth) in
> string property definitions via the data_copy_escape_string()
> function.  However, while it supports the most common escape
> characters, it doesn't support the full set that C does, which is a
> potential gotcha.
> 
> Worse, a bug in the lexer means that while data_copy_escape_string()
> can handle the \" escape, a string with such an escape won't lex
> correctly.
> 
> This patch fixes both problems, extending data_copy_escape_string() to
> support the missing escapes, and fixing the regex for strings in the
> lexer to handle internal escaped quotes.
> 
> This also adds a testcase for string escape functionality.
> 
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>

Excellent.  Thanks.

> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ dtc/tests/string_escapes.c	2007-10-16 16:34:20.000000000 +1000
> @@ -0,0 +1,42 @@
> +/*
> + * libfdt - Flat Device Tree manipulation
> + *	Testcase for strinc escapes in dtc

Applied, modulo fixing that typo.

jdl



More information about the Linuxppc-dev mailing list