Skip to content

Commit 90b8802

Browse files
committed
Use TRIE_CHAR_TERM in TAIL I/O methods.
* datrie/tail.c (tail_fwrite): - Replace strlen() with trie_char_strlen() on suffix, which is TrieChar string. * datrie/tail.c (tail_fread): - Append TRIE_CHAR_TERM, rather than literal zero, as suffix terminator.
1 parent da3b902 commit 90b8802

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2021-01-15 Theppitak Karoonboonyanan <[email protected]>
2+
3+
Use TRIE_CHAR_TERM in TAIL I/O methods.
4+
5+
* datrie/tail.c (tail_fwrite):
6+
- Replace strlen() with trie_char_strlen() on suffix,
7+
which is TrieChar string.
8+
* datrie/tail.c (tail_fread):
9+
- Append TRIE_CHAR_TERM, rather than literal zero,
10+
as suffix terminator.
11+
112
2021-01-15 Theppitak Karoonboonyanan <[email protected]>
213

314
Use TRIE_CHAR_TERM in TrieIterator methods.

datrie/tail.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ tail_fread (FILE *file)
166166
goto exit_in_loop;
167167
}
168168
}
169-
t->tails[i].suffix[length] = '\0';
169+
t->tails[i].suffix[length] = TRIE_CHAR_TERM;
170170
}
171171

172172
return t;
@@ -237,7 +237,7 @@ tail_fwrite (const Tail *t, FILE *file)
237237
return -1;
238238
}
239239

240-
length = t->tails[i].suffix ? strlen ((const char *)t->tails[i].suffix)
240+
length = t->tails[i].suffix ? trie_char_strlen (t->tails[i].suffix)
241241
: 0;
242242
if (!file_write_int16 (file, length))
243243
return -1;

0 commit comments

Comments
 (0)