MCPcopy Create free account
hub / github.com/dillo-browser/dillo / splitStr

Function splitStr

src/styleengine.cc:169–189  ·  view source on GitHub ↗

* \brief split a string at sep chars and return a SimpleVector of strings */

Source from the content-addressed store, hash-verified

167 * \brief split a string at sep chars and return a SimpleVector of strings
168 */
169static lout::misc::SimpleVector<char *> *splitStr (const char *str, char sep) {
170 const char *p1 = NULL;
171 lout::misc::SimpleVector<char *> *list =
172 new lout::misc::SimpleVector<char *> (1);
173
174 for (;; str++) {
175 if (*str != '\0' && *str != sep) {
176 if (!p1)
177 p1 = str;
178 } else if (p1) {
179 list->increase ();
180 list->set (list->size () - 1, dStrndup (p1, str - p1));
181 p1 = NULL;
182 }
183
184 if (*str == '\0')
185 break;
186 }
187
188 return list;
189}
190
191void StyleEngine::setClass (const char *klass) {
192 DoctreeNode *dn = doctree->top ();

Callers 1

setClassMethod · 0.85

Calls 4

dStrndupFunction · 0.85
increaseMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected