gfileutils: Improve performance of g_canonicalize_filename()

Improve the performance of canonicalising filenames with many `..` or
`.` components, by modifying the path inline rather than calling
`memmove()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2541
10 jobs for 2541-canonicalize-performance in 17 minutes and 56 seconds