Use xstrdup and build_unibyte_string where applicable.