st_got_dot_dot,
st_got_slash,
st_got_slash_slash,
- } state = st_normal;
+ st_replace_backslash,
+ } state = st_normal, next_state;
p = path;
end = path + len;
state = st_got_dot;
dot = p;
}
+ else if (G_UNLIKELY (*p == '\\')) {
+ state = st_replace_backslash;
+ next_state = st_normal;
+ continue;
+ }
else {
*o++ = *p;
}
*o++ = *p;
state = st_got_slash_slash;
}
+ else if (G_UNLIKELY (*p == '\\')) {
+ state = st_replace_backslash;
+ next_state = st_got_slash;
+ continue;
+ }
else if (G_UNLIKELY (*p == '.')) {
dot = p;
state = st_got_dot;
/* Ignore last slash */
state = st_normal;
}
+ else if (G_UNLIKELY (*p == '\\')) {
+ state = st_replace_backslash;
+ next_state = st_got_dot;
+ continue;
+ }
else if (*p == '.') {
/* Double dot character */
state = st_got_dot_dot;
continue;
}
}
+ else if (G_UNLIKELY (*p == '\\')) {
+ state = st_replace_backslash;
+ next_state = st_got_dot_dot;
+ continue;
+ }
else {
/* We have something like ..bla or ... */
if (slash) {
p ++;
break;
+ case st_replace_backslash:
+ /*
+ * Replace backslash and return to the previous state as it was
+ * a normal slash
+ */
+ *(gchar *)p = '/';
+ state = next_state;
+ break;
}
}