Local string.
This commit is contained in:
@ -143,7 +143,7 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
||||
// Convert the a pattern like 'a1bc3d4' into a string of chars 'abcd'
|
||||
// and a list of points [ 0, 1, 0, 3, 4 ].
|
||||
int l = strlen (s);
|
||||
char *chars = new char[l + 1];
|
||||
std::string chars;
|
||||
SimpleVector<char> points (1);
|
||||
|
||||
// TODO numbers consisting of multiple digits?
|
||||
@ -155,7 +155,8 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
||||
points.setSize(numChars + 1, '0');
|
||||
points.set(numChars, s[i]);
|
||||
} else {
|
||||
chars[numChars++] = s[i];
|
||||
numChars++;
|
||||
chars+= s[i];
|
||||
}
|
||||
}
|
||||
chars[numChars] = 0;
|
||||
@ -169,8 +170,7 @@ void Hyphenator::insertPattern (TrieBuilder *trieBuilder, char *s)
|
||||
|
||||
//printf("insertPattern %s\n", chars);
|
||||
|
||||
trieBuilder->insert (chars, points.getArray ());
|
||||
delete[] chars;
|
||||
trieBuilder->insert (chars.c_str(), points.getArray ());
|
||||
}
|
||||
|
||||
void Hyphenator::insertException (char *s)
|
||||
|
Reference in New Issue
Block a user