This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OB] Fix build error in ui-file.c


Hi Joel,

What about add comments like other functions in this file?

static void
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
{
  struct stdio_file *stdio = ui_file_data (file);

  if (stdio->magic != &stdio_file_magic)
    internal_error (__FILE__, __LINE__,
		    _("stdio_file_write: bad magic number"));
  /* Calling error crashes when we are called from the exception framework.  */
  if (fwrite (buf, length_buf, 1, stdio->file))
    ;
}

Thanks,
Hui

On Sun, May 15, 2011 at 01:12, Joel Brobecker <brobecker@adacore.com> wrote:
>> Fix it like others in this file.
>>
>> 2011-05-14 ?Hui Zhu ?<teawater@gmail.com>
>>
>> ? ? ? * ui-file.c (stdio_file_write_async_safe): Add empty check for build.
>
> Personally, I think we're just sweeping the problem under the rug.
> I'd rather have something like this:
>
>> - ?write (stdio->fd, buf, length_buf);
>> + ?if (write (stdio->fd, buf, length_buf))
>> + ? ?;
>
> ? ?if (write (stdio->fd, buf, length_buf) < 0)
> ? ? ?/* Ignore this error *because*... */;
>
> --
> Joel
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]