Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: bfd_read and bfd_write
Date: Tue, 04 Sep 2001 22:20:00 -0000	[thread overview]
Message-ID: <20010905145037.K13524@bubble.sa.bigpond.net.au> (raw)

I have a (rather large) patch to clean up a few things in bfd that I'd
like to apply in the next day or so, but first thought I'd better give
people fair warning and a chance to object.

One of the changes I've made is to bfd_read, and similarly bfd_write.

 bfd_size_type
-bfd_read (ptr, size, nitems, abfd)
+bfd_read (ptr, size, abfd)
      PTR ptr;
      bfd_size_type size;
-     bfd_size_type nitems;
      bfd *abfd;

Why the change?  Well, in having both "size" and "nitems", you'd expect
bfd_read to behave like fread, but it doesn't.  bfd_read returns
"size * nitems" on success, whereas fread returns "nitems".  Additionally,
many places in bfd swap the "size" and "nitems" args, and technically
we should always have size == 1 since we are operating on files of bytes.
This doesn't really matter as bfd_read does the multiplication and
passes size == 1 down to fread, but we're breaking the fread abstraction.

This change will of course break gdb, for which I have patches, and
any uncontributed ports.

Comments/flames?

Alan


             reply	other threads:[~2001-09-04 22:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-04 22:20 Alan Modra [this message]
2001-09-05  9:45 ` Andrew Cagney
2001-09-05 12:21   ` Richard Henderson
2001-09-05 17:26     ` Andrew Cagney
2001-09-05 18:52       ` Alan Modra
2001-09-05 20:03         ` Andrew Cagney
2001-09-06 10:33           ` Nick Clifton
2001-09-18  3:27             ` Alan Modra
2001-09-19 11:58               ` Andrew Cagney
2001-09-20  9:52               ` Andrew Cagney
2001-09-05 23:15         ` Andreas Jaeger
2001-09-06  0:01           ` Alan Modra
2001-09-05 20:13 ` Hans-Peter Nilsson
2001-09-05 20:30   ` Alan Modra
2001-09-08 22:42   ` Jim Blandy
2001-09-09  7:24     ` Hans-Peter Nilsson
2001-09-10  9:51       ` Ian Lance Taylor
2001-09-10 17:56         ` Hans-Peter Nilsson
2001-09-10 18:04           ` Ian Lance Taylor

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=20010905145037.K13524@bubble.sa.bigpond.net.au \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /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