Last comments are all nits (I promise!) ChangeLog has merge markers in the review diff; and today is now the 31st, so this needs a ChangeLog header of its own. - /* Skip initial delimiters */ - while (repeat && strchr (delim, *str)) + /* Skip initial delimiters taking care not to walk + * beyond the end of the string + */ There's no need to change this comment, leave it as it is. + toklen = str - ptr; + + /* Don't create an empty string array element in repeat + * mode if there is no token (as a result of a + * duplicated delimiter character). + */ + if (repeat && !toklen) + continue; + Calculating the length of the token and checking it is completely unnecessary. A much better check would be: if (repeat && (str == ptr)) This is much clearer that you mean "if we're repeating, and the end of the string is the start" On Wed, Aug 31, 2011 at 10:02 AM, James Hunt