diff options
author | Simon Glass <sjg@chromium.org> | 2022-03-06 06:18:56 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-03-19 04:24:25 +0300 |
commit | 0ded4d434dc38031a256eab4428d5e339967dd6b (patch) | |
tree | e12d94745e1f34c272cf88f6227efe20680c5781 /tools/dtoc/fdt.py | |
parent | b13114cd216703769ef56a4d1129934380902996 (diff) | |
download | u-boot-0ded4d434dc38031a256eab4428d5e339967dd6b.tar.xz |
dtoc: Tidy up implementation of AddStringList()
Refactor this to avoid a loop. Also add a test for an empty string.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r-- | tools/dtoc/fdt.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index c16909a876..d933972918 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -516,9 +516,7 @@ class Node: Returns: Prop added """ - out = b'' - for string in val: - out += bytes(string, 'utf-8') + b'\0' + out = b'\0'.join(bytes(s, 'utf-8') for s in val) + b'\0' if val else b'' return self.AddData(prop_name, out) def AddInt(self, prop_name, val): |