diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-19 21:22:20 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-19 21:38:28 +0100 |
commit | 920409e9149f99e894eb2e3bcd316e51a65e1bde (patch) | |
tree | 49e29313a3abf2174bad4e4ba082fa447d2d2599 /scripts | |
parent | Automatically fetch keys for undecrypted messages after verification (diff) | |
download | nheko-920409e9149f99e894eb2e3bcd316e51a65e1bde.tar.xz |
Reduce code bloat a bit
Especially the emoji array shrinks a lot with this, but adds a few extra relocations on startup. But it removes a lot of exception handling code at runtime, which is nice and possibly this is still faster.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/emoji_codegen.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/emoji_codegen.py b/scripts/emoji_codegen.py index 7e4f4702..d3935473 100755 --- a/scripts/emoji_codegen.py +++ b/scripts/emoji_codegen.py @@ -15,11 +15,11 @@ class Emoji(object): def generate_qml_list(**kwargs): entrycount = sum([len(c[1]) for c in kwargs.items()]) tmpl = Template(''' -const std::array<Emoji, {{ entrycount }} > emoji::Provider::emoji = { +constexpr std::array<Emoji, {{ entrycount }} > emoji::Provider::emoji = { {%- for c in kwargs.items() %} // {{ c[0].capitalize() }} {%- for e in c[1] %} - Emoji{QStringLiteral(u"{{ e.code }}"), QStringLiteral(u"{{ e.shortname }}"), QStringLiteral(u"{{ e.unicodename }}"), emoji::Emoji::Category::{{ c[0].capitalize() }}}, + Emoji{null_literal(u"{{ e.code }}"), null_literal(u"{{ e.shortname }}"), null_literal(u"{{ e.unicodename }}"), emoji::Emoji::Category::{{ c[0].capitalize() }}}, {%- endfor %} {%- endfor %} }; |