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>
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index c16909a..d933972 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -516,9 +516,7 @@
         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):