• Christian Hergert's avatar
    gresourcefile: simplify path canonicalization · 38ffcd29
    Christian Hergert authored
    Previously, the path canonicalization for resources had liberal use of
    strlen() and memmove() while walking through the path. This patch avoids
    any secondary strlen() and removes all use of memmove().
    A single allocation is created up front as we should only ever need one
    additional byte more than then length of the incoming path string.
    To keep the implementation readable, the mechanics are kept in external
    functions. memrchr() was not used due to its lack of portability.
    This is faster in every test case I've tested. Paths that contain
    relative ../ have the most speedup.
gresourcefile.c 27.5 KB