Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [OB] Fix build error in ui-file.c
Date: Sun, 15 May 2011 02:59:00 -0000	[thread overview]
Message-ID: <BANLkTinREo6mDbqzfJCjBPLvs_hykD13dA@mail.gmail.com> (raw)
In-Reply-To: <20110514171204.GE19356@adacore.com>

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
>


  reply	other threads:[~2011-05-15  2:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-14  3:41 Hui Zhu
2011-05-14 17:12 ` Joel Brobecker
2011-05-15  2:59   ` Hui Zhu [this message]
2011-05-16 16:08     ` Tom Tromey
2011-05-16 18:26       ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinREo6mDbqzfJCjBPLvs_hykD13dA@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox