public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>,
	       GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 5/7] go32-nat.c: Don't install a deprecated_xfer_memory method
Date: Thu, 20 Feb 2014 16:37:00 -0000	[thread overview]
Message-ID: <53062F27.7040907@redhat.com> (raw)
In-Reply-To: <00c801cf2e59$acae60f0$060b22d0$@muller@ics-cnrs.unistra.fr>

(adding back gdb-patches@)

On 02/20/2014 04:34 PM, Pierre Muller wrote:

>   I found something that looks suspicious in your patch...
> But once again, it could be my lack of proper C formation...
> 
>> +/* Const-correct version of DJGPP's write_child, which unfortunately
>> +   takes a non-const buffer pointer.  */
>> +
>>  static int
>> +my_write_child (unsigned child_addr, const void *buf, unsigned len)
>>  {
>> -  if (write)
>> +  static void *buffer = NULL;
>> +  static unsigned buffer_len = 0;
>   It seems odd to me to use 
> a static variable buffer_len,  which keeps the size
> of the last allocated buffer, when you do
> a xfree before returning from this function...
> 
>> +  int res;
>> +
>> +  if (buffer_len < len)
>>      {
>> -      if (write_child (memaddr, myaddr, len))
>> -	{
>> -	  return 0;
>> -	}
>> -      else
>> -	{
>> -	  return len;
>> -	}
>> +      buffer = xrealloc (buffer, len);
>> +      buffer_len = len;
>>      }
>> +
>> +  memcpy (buffer, buf, len);
>> +  res = write_child (child_addr, buffer, len);
>> +  xfree (buffer);
>   This line should be removed, or did I miss something?

You're right.  I'll remove it.  Thanks!

-- 
Pedro Alves

  parent reply	other threads:[~2014-02-20 16:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 20:29 [PATCH 0/7] eliminate deprecated_xfer_memory Pedro Alves
2014-02-19 20:29 ` [PATCH 1/7] remote-mips.c: Don't install a deprecated_xfer_memory method Pedro Alves
2014-02-19 20:29 ` [PATCH 5/7] go32-nat.c: " Pedro Alves
     [not found]   ` <00c801cf2e59$acae60f0$060b22d0$@muller@ics-cnrs.unistra.fr>
2014-02-20 16:37     ` Pedro Alves [this message]
2014-02-19 20:29 ` [PATCH 3/7] procfs.c: " Pedro Alves
2014-02-20 15:48   ` Joel Brobecker
2014-02-20 15:56     ` Joel Brobecker
2014-02-20 16:38       ` Pedro Alves
2014-02-24 17:53         ` Joel Brobecker
2014-02-24 18:21           ` Pedro Alves
2014-02-24 18:37             ` Joel Brobecker
2014-02-19 20:29 ` [PATCH 6/7] eliminate target_ops->deprecated_xfer_memory Pedro Alves
2014-02-19 20:29 ` [PATCH 4/7] nto-procfs.c: Don't install a deprecated_xfer_memory method Pedro Alves
2014-02-19 20:29 ` [PATCH 2/7] remote-m32r-sdi.c: " Pedro Alves
2014-02-19 20:29 ` [PATCH 7/7] bsd-uthread.c: Don't install a to_xfer_partial method Pedro Alves
2014-02-20 13:26   ` Mark Kettenis
2014-02-20 16:42     ` Pedro Alves
2014-02-20 18:27 ` [PATCH 0/7] eliminate deprecated_xfer_memory Tom Tromey
2014-02-26 14:50   ` Pedro Alves

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=53062F27.7040907@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).