A major lift.
Quite a few uses of raw memory management had to be struck down, in a batch. It could have been a bit more precise to do some of the lower dependencies first, but I didn't start there with my analysis.
This commit is contained in:
@ -165,18 +165,16 @@ void StyleEngine::setId (const char *id) {
|
||||
/**
|
||||
* \brief split a string at sep chars and return a SimpleVector of strings
|
||||
*/
|
||||
static lout::misc::SimpleVector<char *> *splitStr (const char *str, char sep) {
|
||||
static std::vector< std::string > splitStr (const char *str, char sep) {
|
||||
const char *p1 = NULL;
|
||||
lout::misc::SimpleVector<char *> *list =
|
||||
new lout::misc::SimpleVector<char *> (1);
|
||||
std::vector< std::string > list;
|
||||
|
||||
for (;; str++) {
|
||||
if (*str != '\0' && *str != sep) {
|
||||
if (!p1)
|
||||
p1 = str;
|
||||
} else if (p1) {
|
||||
list->increase ();
|
||||
list->set (list->size () - 1, dStrndup (p1, str - p1));
|
||||
list.emplace_back( p1, str - p1 );
|
||||
p1 = NULL;
|
||||
}
|
||||
|
||||
@ -189,7 +187,7 @@ static lout::misc::SimpleVector<char *> *splitStr (const char *str, char sep) {
|
||||
|
||||
void StyleEngine::setClass (const char *klass) {
|
||||
DoctreeNode *dn = doctree->top ();
|
||||
assert (dn->klass == NULL);
|
||||
assert (not dn->klass.has_value());
|
||||
dn->klass = splitStr (klass, ' ');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user