public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Binutils Development <binutils@sourceware.org>
Subject: [PATCH 5/5] fix up docs
Date: Fri, 03 Aug 2012 16:10:00 -0000	[thread overview]
Message-ID: <87lihwnhx5.fsf@fleche.redhat.com> (raw)

This patch fixes up the BFD archive docs to describe memory management
for archive member BFDs.

	* archive.c: Update archive documentation.
---
 bfd/archive.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/bfd/archive.c b/bfd/archive.c
index 8407745..d5133d0 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -42,11 +42,22 @@ DESCRIPTION
 	have to read the entire archive if you don't want
 	to!  Read it until you find what you want.
 
+	A BFD returned by <<bfd_openr_next_archived_file>> will not
+	automatically be closed.  If you want to close it, you must
+	call <<bfd_close>>.  If you do not close it, then a second
+	iteration through the members of an archive may return the
+	same BFD.
+
+	A member BFD is not fully independent of its containing
+	archive BFD.  So, if you close the archive BFD, you must
+	ensure that either the member BFDs have been closed first, or
+	that they are never referred to (and thus effectively leaked).
+
 	Archive contents of output BFDs are chained through the
-	<<next>> pointer in a BFD.  The first one is findable through
-	the <<archive_head>> slot of the archive.  Set it with
-	<<bfd_set_archive_head>> (q.v.).  A given BFD may be in only one
-	open output archive at a time.
+	<<archive_next>> pointer in a BFD.  The first one is findable
+	through the <<archive_head>> slot of the archive.  Set it with
+	<<bfd_set_archive_head>> (q.v.).  A given BFD may be in only
+	one open output archive at a time.
 
 	As expected, the BFD archive code is more general than the
 	archive code of any given environment.  BFD archives may
-- 
1.7.7.6

             reply	other threads:[~2012-08-03 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-03 16:10 Tom Tromey [this message]
2012-08-07 13:21 ` nick clifton
2012-08-08 17:21   ` Tom Tromey

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=87lihwnhx5.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=binutils@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).