Commit e7f50c96 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove SIs in rules_data.cc.

The global |kRawData| std::map constant have to be initialized when the
program starts. Instead, make it a static local by wrapping it in a
GetRawData() function so the map is initialized on first use instead.
This remove 14 static initializers.

Along the way, make some globals fully const, use |kKeyMapCount| in more
places instead of hardcoding its value, simplify some code, and make the
modified files free of lint errors.

Bug: 537099
Change-Id: I1b6d059f608db108bb4ecb672119a5f43634bef5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824067Reviewed-by: default avatarShu Chen <shuchen@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706278}
parent a991bcfd
......@@ -6,8 +6,9 @@
#define CHROMEOS_SERVICES_IME_PUBLIC_CPP_RULEBASED_RULES_DATA_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <utility>
#include "base/macros.h"
......@@ -66,7 +67,8 @@ class RulesData {
private:
// The KeyMap instances under all the modifier states.
KeyMap key_maps_[8];
static constexpr size_t kKeyMapCount = 8;
KeyMap key_maps_[kKeyMapCount];
// The map from the sub group match index (of the merged regexp) to the
// transform rule (which is a pair of matching regexp, and replace string).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment