[cleanup] Untangle the rat's nest in inifile.c

- There is ancient const-confused code
- The code to actually find the ini file is quite messy
- `realpath` is already implemented in `root/filename.h` (and realpath does the exact same thing as `canonicalize_file_name`)
- The code already allocates every second line, so jumping through hoops to save memory is a waste of time
- `goto` makes the flow much harder to reason about