binman: Use bytearray instead of string
This is faster if data is being concatenated. Update the section and collection etypes. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
edd4b6ea41
commit
43332d881b
@ -40,7 +40,7 @@ class Entry_collection(Entry):
|
|||||||
"""
|
"""
|
||||||
# Join up all the data
|
# Join up all the data
|
||||||
self.Info('Getting contents, required=%s' % required)
|
self.Info('Getting contents, required=%s' % required)
|
||||||
data = b''
|
data = bytearray()
|
||||||
for entry_phandle in self.content:
|
for entry_phandle in self.content:
|
||||||
entry_data = self.section.GetContentsByPhandle(entry_phandle, self,
|
entry_data = self.section.GetContentsByPhandle(entry_phandle, self,
|
||||||
required)
|
required)
|
||||||
|
@ -166,7 +166,7 @@ class Entry_section(Entry):
|
|||||||
pad_byte = (entry._pad_byte if isinstance(entry, Entry_section)
|
pad_byte = (entry._pad_byte if isinstance(entry, Entry_section)
|
||||||
else self._pad_byte)
|
else self._pad_byte)
|
||||||
|
|
||||||
data = b''
|
data = bytearray()
|
||||||
# Handle padding before the entry
|
# Handle padding before the entry
|
||||||
if entry.pad_before:
|
if entry.pad_before:
|
||||||
data += tools.GetBytes(self._pad_byte, entry.pad_before)
|
data += tools.GetBytes(self._pad_byte, entry.pad_before)
|
||||||
@ -200,7 +200,7 @@ class Entry_section(Entry):
|
|||||||
Returns:
|
Returns:
|
||||||
Contents of the section (bytes)
|
Contents of the section (bytes)
|
||||||
"""
|
"""
|
||||||
section_data = b''
|
section_data = bytearray()
|
||||||
|
|
||||||
for entry in self._entries.values():
|
for entry in self._entries.values():
|
||||||
entry_data = entry.GetData(required)
|
entry_data = entry.GetData(required)
|
||||||
|
Loading…
Reference in New Issue
Block a user