chore: Remove some bloat, reduce firmware size (#4288)

This commit is contained in:
Raphael Coeffic
2023-11-08 22:05:54 +10:00
committed by GitHub
parent aa184cec5e
commit 373bb33f4b
12 changed files with 60 additions and 190 deletions
+14 -4
View File
@@ -442,15 +442,25 @@ std::string ModelMap::toCSV(const LabelsVector &labels)
* @return vector of all labels
*/
LabelsVector ModelMap::fromCSV(const char *str)
LabelsVector ModelMap::fromCSV(const char* str)
{
LabelsVector lbls;
std::istringstream f(str);
std::string lbl;
while (std::getline(f, lbl, ',')) {
const char* prev_c = str;
const char* c = strchr(prev_c, ',');
while(c != nullptr) {
std::string lbl(prev_c, c - prev_c);
unEscapeCSV(lbl);
lbls.push_back(lbl);
prev_c = ++c;
c = strchr(c, ',');
}
{
std::string lbl(prev_c);
unEscapeCSV(lbl);
lbls.push_back(lbl);
}
return lbls;
}