Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* bfd_read and bfd_write
@ 2001-09-04 22:20 Alan Modra
  2001-09-05  9:45 ` Andrew Cagney
  2001-09-05 20:13 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 19+ messages in thread
From: Alan Modra @ 2001-09-04 22:20 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches

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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2001-09-20  9:52 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-04 22:20 bfd_read and bfd_write Alan Modra
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox