Skip to content

Commit

Permalink
Use const T& for the constructor of UserSegmentHistoryRewriter.
Browse files Browse the repository at this point in the history
#codehealth

PiperOrigin-RevId: 723744533
  • Loading branch information
hiroyuki-komatsu committed Feb 6, 2025
1 parent 380f4f3 commit 1fa3dd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/rewriter/rewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Rewriter::Rewriter(const engine::Modules &modules) {
const DataManager &data_manager = modules.GetDataManager();
const dictionary::DictionaryInterface &dictionary = *modules.GetDictionary();
const dictionary::PosMatcher &pos_matcher = *modules.GetPosMatcher();
const dictionary::PosGroup *pos_group = modules.GetPosGroup();
const dictionary::PosGroup &pos_group = *modules.GetPosGroup();

#ifdef MOZC_USER_DICTIONARY_REWRITER
AddRewriter(std::make_unique<UserDictionaryRewriter>());
Expand All @@ -158,7 +158,7 @@ Rewriter::Rewriter(const engine::Modules &modules) {
if (absl::GetFlag(FLAGS_use_history_rewriter)) {
AddRewriter(std::make_unique<UserBoundaryHistoryRewriter>());
AddRewriter(
std::make_unique<UserSegmentHistoryRewriter>(&pos_matcher, pos_group));
std::make_unique<UserSegmentHistoryRewriter>(pos_matcher, pos_group));
}

#ifdef MOZC_DATE_REWRITERS
Expand Down
6 changes: 3 additions & 3 deletions src/rewriter/user_segment_history_rewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,10 @@ bool UserSegmentHistoryRewriter::SortCandidates(
}

UserSegmentHistoryRewriter::UserSegmentHistoryRewriter(
const PosMatcher *pos_matcher, const PosGroup *pos_group)
const PosMatcher &pos_matcher, const PosGroup &pos_group)
: storage_(std::make_unique<LruStorage>()),
pos_matcher_(pos_matcher),
pos_group_(pos_group) {
pos_matcher_(&pos_matcher),
pos_group_(&pos_group) {
Reload();

CHECK_EQ(sizeof(uint32_t), sizeof(FeatureValue));
Expand Down
4 changes: 2 additions & 2 deletions src/rewriter/user_segment_history_rewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace mozc {

class UserSegmentHistoryRewriter : public RewriterInterface {
public:
UserSegmentHistoryRewriter(const dictionary::PosMatcher *pos_matcher,
const dictionary::PosGroup *pos_group);
UserSegmentHistoryRewriter(const dictionary::PosMatcher &pos_matcher,
const dictionary::PosGroup &pos_group);

bool Rewrite(const ConversionRequest &request,
Segments *segments) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/rewriter/user_segment_history_rewriter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class UserSegmentHistoryRewriterTest : public testing::TestWithTempUserProfile {
}

UserSegmentHistoryRewriter *CreateUserSegmentHistoryRewriter() const {
return new UserSegmentHistoryRewriter(&pos_matcher_, pos_group_.get());
return new UserSegmentHistoryRewriter(pos_matcher_, *pos_group_);
}

void SetNumberForm(Config::CharacterForm form) {
Expand Down

0 comments on commit 1fa3dd4

Please sign in to comment.