Couple of minor cleanups.
ape: Use smarter memory allocators.
Add filename_build().
Move some strings from heap to stack or string pool.
Use filename_build() in some more places.
uri_to_filename() now eliminates trailing slashes, which are problematic for e.g. util.c's last_path_element().