git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9068
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
/** @brief Splits a string into a dynar of strings, taking quotes into account
*
* It basically does the same argument separation than the shell, where white
/** @brief Splits a string into a dynar of strings, taking quotes into account
*
* It basically does the same argument separation than the shell, where white
- * spaces can be escaped and where arguments are never splitted within a
+ * spaces can be escaped and where arguments are never split within a
* quote group.
* Several subsequent spaces are ignored (unless within quotes, of course).
* quote group.
* Several subsequent spaces are ignored (unless within quotes, of course).
+ * You may want to trim the input string, if you want to avoid empty entries
return res;
beg = str_to_free = xbt_strdup(s);
return res;
beg = str_to_free = xbt_strdup(s);
- /* trim leading spaces */
- xbt_str_ltrim(beg, " ");
+ /* do not trim leading spaces: caller responsability to clean his cruft */
end = beg;
while (!done) {
end = beg;
while (!done) {
- xbt_str_ltrim(beg, " ");
+ /* trim within the string, manually to speed things up */
+ while (*beg == ' ')
+ beg++;