mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 18:54:57 +00:00
LibTimeZone+LibUnicode: Generate string data with run-length encoding
Currently, the unique string lists are stored in the initialized data sections of their shared libraries. In order to move the data to the read-only section, generate the strings using RLE arrays. We generate two arrays: the first is the RLE data itself, the second is a list of indices into the RLE array for each string. We then generate a decoding method to convert an RLE string to a StringView.
This commit is contained in:
parent
de980de0e4
commit
becec3578f
6 changed files with 138 additions and 59 deletions
|
@ -218,7 +218,7 @@ struct RelativeTimeFormatImpl {
|
|||
{
|
||||
RelativeTimeFormat relative_time_format {};
|
||||
relative_time_format.plurality = plurality;
|
||||
relative_time_format.pattern = s_string_list[pattern];
|
||||
relative_time_format.pattern = decode_string(pattern);
|
||||
|
||||
return relative_time_format;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ Vector<RelativeTimeFormat> get_relative_time_format_patterns(StringView locale,
|
|||
continue;
|
||||
if (locale_format.style != style)
|
||||
continue;
|
||||
if (s_string_list[locale_format.tense_or_number] != tense_or_number)
|
||||
if (decode_string(locale_format.tense_or_number) != tense_or_number)
|
||||
continue;
|
||||
|
||||
formats.append(locale_format.to_relative_time_format());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue