public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: David Faust <david.faust@oracle.com>
Cc: binutils@sourceware.org, stephen.brennan@oracle.com
Subject: Re: [PATCH 11/11] libctf, include: new functions for looking up enumerators
Date: Mon, 17 Jun 2024 14:43:02 +0100	[thread overview]
Message-ID: <87tthrfzx5.fsf@esperi.org.uk> (raw)
In-Reply-To: <7481daf9-33eb-4172-b025-f5ed42378e5a@oracle.com> (David Faust's message of "Fri, 14 Jun 2024 10:51:18 -0700")

On 14 Jun 2024, David Faust uttered the following:

> On 6/13/24 11:54, Nick Alcock wrote:
>> Three new functions for looking up the enum type containing a given
>> enumeration constant, and optionally that constant's value.
>
> The new functions make sense to me, though I don't have much experience
> as a user of libctf or it's APIs.

The APIs I got help on from Stephen Brennan and Indu Bhagat earlier. I'm
fairly confident that at least *one* user will like them. :)

> Just a few small comments/nits below.

Thanks! All fixed as you suggested.

>> +   from end-of-iteration.  DICT should be NULL before the first call and is set
>> +   to NULL after the last and on error: on successful call it is the caller's
>> +   responsibility to ctf_dict_close() it.  The caller should  otherwise pass it
>
> IMO it would be good to also clearly say that on success DICT is set to
> point to the dictionary containing the returned type.  (Which has been
> implicitly opened and therefore must be closed via ctf_dict_close by the
> caller).

True! I, uh, assumed that would go without saying, which in
documentation is probably a bad stance :)

The "pass in DICT unchanged, we actually use it to store state" thing is
a bit weird but seems more or less harmless (when I get dict leaks, it's
not because of that, it's because I forget to close them on error
paths), and without it I'd need to add the ability for ctf_next_t
iterators to hold archives and dicts at the same time, which does get
quite complex. (I tried, and honestly the _next iterators are complex
enough to write as it is!)

-- 
NULL && (void)

  reply	other threads:[~2024-06-17 13:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 18:54 [PATCH libctf 00/11] enumerator query API, plus some bugfixes Nick Alcock
2024-06-13 18:54 ` [PATCH 01/11] libctf: strtab corruption when strings are added to ctf_open()ed dicts Nick Alcock
2024-06-13 18:54 ` [PATCH 02/11] include: fix libctf ECTF_NOENUMNAM error message Nick Alcock
2024-06-13 18:54 ` [PATCH 03/11] libctf: doc: fix ctf_stype_t typedef string in spec Nick Alcock
2024-06-13 18:54 ` [PATCH 04/11] libctf: dedup: enums with overlapping enumerators are conflicting Nick Alcock
2024-06-13 18:54 ` [PATCH 05/11] libctf: don't leak enums if ctf_add_type fails Nick Alcock
2024-06-13 18:54 ` [PATCH 06/11] libctf: fix dict leak on archive-wide symbol lookup error path Nick Alcock
2024-06-13 18:54 ` [PATCH 07/11] libctf: suppress spurious failure of malloc-counting tests under valgrind Nick Alcock
2024-06-13 18:54 ` [PATCH 08/11] libctf: prohibit addition of enums with overlapping enumerator constants Nick Alcock
2024-06-13 18:54 ` [PATCH 09/11] libctf: make the ctf_next ctn_fp non-const Nick Alcock
2024-06-13 18:54 ` [PATCH 10/11] include: libctf: comment improvements Nick Alcock
2024-06-13 18:54 ` [PATCH 11/11] libctf, include: new functions for looking up enumerators Nick Alcock
2024-06-14 17:51   ` David Faust
2024-06-17 13:43     ` Nick Alcock [this message]
2024-06-14 14:14 ` [PATCH libctf 00/11] enumerator query API, plus some bugfixes Tom Tromey
2024-06-14 17:57   ` Nick Alcock

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=87tthrfzx5.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=david.faust@oracle.com \
    --cc=stephen.brennan@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).