Re: [PATCH v2 2/7] Add "help news"

Christian Biesinger
2020-06-23T18:18:52Z

On Tue, Jun 23, 2020 at 8:20 AM Tom Tromey <tom@tromey.com> wrote:
> +static void
> +help_news (struct ui_file *stream)
> +{
> + std::string news_name = std::string (gdb_datadir) + SLASH_STRING + "NEWS";
> + gdb_file_up news_file = gdb_fopen_cloexec (news_name.c_str (), "r");
> + if (news_file == nullptr)
> + perror_with_name (_("could not open the NEWS file"));
> +
> + char buffer[1024];
> + size_t offset = 0;
> + while (true)
> + {
> + size_t nbytes = fread (&buffer[offset], 1, sizeof (buffer) - offset,
> + news_file.get ());

Why not use read_entire_file from your other patch?

Christian