]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dtoc: Add a comment about string replace in conv_name_to_c()
authorSimon Glass <sjg@chromium.org>
Mon, 19 Jun 2017 04:09:04 +0000 (22:09 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 11 Jul 2017 16:08:20 +0000 (10:08 -0600)
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

index 9923892dc359bf8cd21426b295b197e2c4812bf6..1f85343a9fd2de7532b5f032c7939e20ec5f5df2 100644 (file)
@@ -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: