Skip to content

Commit f0c8168

Browse files
committed
feat(core): marker fixes per review comments 🙀
- move prepend_marker() to inline - clear the string in context_to_string() For: #9119
1 parent f21bd82 commit f0c8168

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

core/src/ldml/ldml_processor.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ void ldml_processor::emit_marker(km_kbp_state *state, KMX_DWORD marker_no) {
396396

397397
size_t
398398
ldml_processor::context_to_string(km_kbp_state *state, std::u32string &str) {
399+
str.clear();
399400
auto &cp = state->context();
400401
size_t ctxlen = 0; // TODO-LDML: is this needed?
401402
// We're only interested in as much of the context as is a KM_KBP_BT_CHAR.
@@ -413,15 +414,6 @@ ldml_processor::context_to_string(km_kbp_state *state, std::u32string &str) {
413414
return ctxlen; // consumed the entire context buffer.
414415
}
415416

416-
void ldml_processor::prepend_marker(std::u32string &str, KMX_DWORD marker) {
417-
km_kbp_usv triple[] = {
418-
LDML_UC_SENTINEL,
419-
LDML_MARKER_CODE,
420-
marker
421-
};
422-
str.insert(0, triple, 3);
423-
}
424-
425417

426418
} // namespace kbp
427419
} // namespace km

core/src/ldml/ldml_processor.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ namespace kbp {
103103
static size_t context_to_string(km_kbp_state *state, std::u32string &str);
104104

105105
/** prepend the marker string in UC_SENTINEL format to the str */
106-
static void prepend_marker(std::u32string &str, KMX_DWORD marker);
106+
inline static void prepend_marker(std::u32string &str, KMX_DWORD marker);
107107
};
108+
109+
void
110+
ldml_processor::prepend_marker(std::u32string &str, KMX_DWORD marker) {
111+
km_kbp_usv triple[] = {LDML_UC_SENTINEL, LDML_MARKER_CODE, marker};
112+
str.insert(0, triple, 3);
113+
}
114+
108115
} // namespace kbp
109116
} // namespace km

0 commit comments

Comments
 (0)