diff mbox

[U-Boot,09/11] dtoc: Add a comment about string replace in conv_name_to_c()

Message ID 20170619040906.147519-10-sjg@chromium.org
State Accepted
Commit 30107b08d7df87e4c92e413d92896a847f1c74dd
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass June 19, 2017, 4:09 a.m. UTC
This function uses several separate string replaces where a regular
expression might seem more reasonable. Add a comment justifying the way it
is currently done.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/dtb_platdata.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass July 6, 2017, 2:48 p.m. UTC | #1
This function uses several separate string replaces where a regular
expression might seem more reasonable. Add a comment justifying the way it
is currently done.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/dtb_platdata.py | 3 +++
 1 file changed, 3 insertions(+)

Applied to u-boot-dm, thanks!
Simon Glass July 6, 2017, 2:51 p.m. UTC | #2
This function uses several separate string replaces where a regular
expression might seem more reasonable. Add a comment justifying the way it
is currently done.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/dtb_platdata.py | 3 +++
 1 file changed, 3 insertions(+)

Applied to u-boot-dm, thanks!
Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 9923892dc3..1f85343a9f 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -46,6 +46,9 @@  VAL_PREFIX = 'dtv_'
 def conv_name_to_c(name):
     """Convert a device-tree name to a C identifier
 
+    This uses multiple replace() calls instead of re.sub() since it is faster
+    (400ms for 1m calls versus 1000ms for the 're' version).
+
     Args:
         name:   Name to convert
     Return: