summaryrefslogtreecommitdiffstats
path: root/util/locale_database/qlocalexml2cpp.py
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2023-02-17 17:59:12 +0100
committerMate Barany <mate.barany@qt.io>2023-03-15 19:48:30 +0100
commit3dcd6b7ec98b2edf9654bcefdb83134c4c3d2a38 (patch)
tree2f981206668a6d50d480d4cc7890ac28d0e6d9d3 /util/locale_database/qlocalexml2cpp.py
parenta9c8870b5e6eddc31b78b7e4afe46b28110e7863 (diff)
Pack languageCodeList tighter
Pack some of the arrays that contain locale data more tightly. The AlphaCode struct is a char[4] but always holds only [a-z]{,3} which could be fit into 16 bits, halving the size of an AlphaCode struct. With the new constructor the initialization of the AlphaCode struct also changes - modify qlocalexml2cpp.py to reflect this change and regenerate the languageCodeList. Fixes: QTBUG-105050 Change-Id: I2b1e93ab7cc3f2d667bf67b45769b74a15211931 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'util/locale_database/qlocalexml2cpp.py')
-rwxr-xr-xutil/locale_database/qlocalexml2cpp.py14
1 files changed, 2 insertions, 12 deletions
diff --git a/util/locale_database/qlocalexml2cpp.py b/util/locale_database/qlocalexml2cpp.py
index 3c8fb84abb..717c567111 100755
--- a/util/locale_database/qlocalexml2cpp.py
+++ b/util/locale_database/qlocalexml2cpp.py
@@ -379,18 +379,8 @@ class LocaleDataWriter (LocaleSourceEditor):
def q(val: Optional[str], size: int) -> str:
"""Quote the value and adjust the result for tabular view."""
- chars = []
- if val is not None:
- for c in val:
- chars.append(f"'{c}'")
- s = ', '.join(chars)
- s = f'{{{s}}}'
- else:
- s = ''
- if size == 0:
- return f'{{{s}}}'
- else:
- return f'{{{s}}},'.ljust(size * 5 + 4)
+ s = '' if val is None else ', '.join(f"'{c}'" for c in val)
+ return f'{{{s}}}' if size == 0 else f'{{{s}}},'.ljust(size * 5 + 2)
for key, value in languages.items():
code = value[1]