From 4d6c81123d5050b577ab22e550fee2b39fb23f46 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Mon, 17 Dec 2012 19:23:56 +0100 Subject: Small simplification. --- kconfiglib.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 97c0450..2b65ee1 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -699,16 +699,8 @@ class Config(): quote = c i += 1 - # Fast path: If the rest of the string contains no backslashes - # (almost always), we can simply look for the matching quote. - if s.find("\\", i) == -1: - end = s.find(quote, i) - if end == -1: - _tokenization_error(s, strlen, filename, linenr) - append(s[i:end]) - i = end + 1 - else: - # Slow path. This could probably be sped up, but it's a + if "\\" in s: + # Slow path: This could probably be sped up, but it's a # very unusual case anyway. value = "" while 1: @@ -727,6 +719,14 @@ class Config(): i += 1 i += 1 append(value) + else: + # Fast path: If the rest of the string contains no backslashes + # (almost always) we can simply look for the matching quote. + end = s.find(quote, i) + if end == -1: + _tokenization_error(s, strlen, filename, linenr) + append(s[i:end]) + i = end + 1 elif c == "&": if i + 1 >= strlen: -- cgit v1.2.3