From 29bf7393c1eabdb44ee719f1b431b051556fa682 Mon Sep 17 00:00:00 2001 From: Chris Angelico Date: Wed, 4 Jun 2014 03:15:46 +1000 Subject: [PATCH 1/2] Correct file reference (there's no qstrraw.h) --- py/qstr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/qstr.h b/py/qstr.h index fc93fe2c2a..9803e672ca 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -// See qstrraw.h for a list of qstr's that are available as constants. +// See qstrdefs.h for a list of qstr's that are available as constants. // Reference them as MP_QSTR_xxxx. // // Note: it would be possible to define MP_QSTR_xxx as qstr_from_str_static("xxx") From 4867413e6900c10ed8aa665ed4249e0ccc535e1f Mon Sep 17 00:00:00 2001 From: Chris Angelico Date: Wed, 4 Jun 2014 03:26:40 +1000 Subject: [PATCH 2/2] Simplify detection of quote characters in mp_str_print_quoted. Once a double quote has been found, the subsequent discovery of a single quote won't change behaviour at all, so don't bother looking for one. --- py/objstr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/objstr.c b/py/objstr.c index 9ff9106375..440f6347e7 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -68,7 +68,7 @@ void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *e // this escapes characters, but it will be very slow to print (calling print many times) bool has_single_quote = false; bool has_double_quote = false; - for (const byte *s = str_data, *top = str_data + str_len; (!has_single_quote || !has_double_quote) && s < top; s++) { + for (const byte *s = str_data, *top = str_data + str_len; !has_double_quote && s < top; s++) { if (*s == '\'') { has_single_quote = true; } else if (*s == '"') {