40 const char *cp, *end, *next;
48 if (flags&SPLIT_SKIP_SPACE) {
49 while (TOR_ISSPACE(*cp)) ++cp;
52 if (max>0 && n == max-1) {
53 end = strchr(cp,
'\0');
57 end = strchr(cp,
'\0');
59 for (end = cp; *end && *end !=
'\t' && *end !=
' '; ++end)
68 next = end+strlen(sep);
71 while (*next ==
'\t' || *next ==
' ')
75 if (flags&SPLIT_SKIP_SPACE) {
76 while (end > cp && TOR_ISSPACE(*(end-1)))
79 if (end != cp || !(flags&SPLIT_IGNORE_BLANK)) {
80 char *
string = tor_strndup(cp, end-cp);
81 if (flags&SPLIT_STRIP_SPACE)
Locale-independent character-type inspection (header)
Headers for util_malloc.c.
void smartlist_add(smartlist_t *sl, void *element)
Top-level declarations for the smartlist_t dynamic array type.
int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, int flags, int max)
Header for smartlist_split.c.
void tor_strstrip(char *s, const char *strip)
Header for util_string.c.