replace: Don't assume replacement text doesn't contain NUL bytes

Unfortunately this changes nothing because there are more places to fix.
Remove ptr_array abuse

Allocations are not that expensive.
gbuf: Don't keep buffer NUL-terminated
Rename gbuf_add_ch() to gbuf_add_byte() and add unicode aware gbuf_add_ch()
Add gbuf_insert_ch()
compiler/go: Ignore comments
Add path_basename()
Add path_dirname()
Search tag files from parent directories too
do_collect_files: Don't assume dirprefix has trailing slash
Variable usage cleanup
collect_files: Use path_dirname() and path_basename()
Make it obvious that buffer returned bu gbuf_steal() isn't NUL-terminated
Bash-like "cd -"
Fix potential bug in ptr_array_add()

Allocation size wouldn't increase if previous value was 1.