smart_str_appendl(&s, "&", sizeof("&")-1);
break;
case ' ': {
- const char *nextchar = p+1, *prevchar = p-1;
+ const char *nextchar = p;
- /* series of spaces should be converted to 's */
- if (((nextchar < end) && *nextchar==' ')
- || ((prevchar >= str) && *prevchar==' ')) {
- smart_str_appendl(&s, " ", sizeof(" ")-1);
- } else {
- smart_str_appendc(&s, ' ');
- }
+ while (++nextchar < end && *nextchar == ' ');
+
+ p = nextchar;
+ smart_str_appends(&s, " ");
+ continue;
}
break;
case '\t':