aboutsummaryrefslogtreecommitdiff
path: root/libctf
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2025-04-25 18:50:54 +0100
committerNick Alcock <nick.alcock@oracle.com>2025-04-25 21:23:07 +0100
commit81b9312ac407e47f6e64cbf0fc993d400c9eadd3 (patch)
tree9f66914a2073170060dc95d6de9dc9ab74d88ef4 /libctf
parentadc6ca003a31e160ffb2dc39be535dbe26d7c2dc (diff)
downloadbinutils-81b9312ac407e47f6e64cbf0fc993d400c9eadd3.zip
binutils-81b9312ac407e47f6e64cbf0fc993d400c9eadd3.tar.gz
binutils-81b9312ac407e47f6e64cbf0fc993d400c9eadd3.tar.bz2
libctf: dedup: comment fixes, debug indentation changes, and a tiny leak
Getting these out of the way to avoid them wrecking the diffs for the next commits.
Diffstat (limited to 'libctf')
-rw-r--r--libctf/ctf-dedup.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c
index 4566752..d3ea5b0 100644
--- a/libctf/ctf-dedup.c
+++ b/libctf/ctf-dedup.c
@@ -892,6 +892,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
}
if (ctf_errno (input) != ECTF_NEXT_END)
{
+ ctf_next_destroy (i);
whaterr = N_("error doing enum member iteration");
goto input_err;
}
@@ -1120,8 +1121,7 @@ ctf_dedup_hash_type (ctf_dict_t *fp, ctf_dict_t *input,
/* We have never seen this type before, and must figure out its hash and the
hashes of the types it cites.
- Hash this type, and call ourselves recursively. (The hashing part is
- optional, and is disabled if overidden_hval is set.) */
+ Hash this type, and call ourselves recursively. */
if ((hval = ctf_dedup_rhash_type (fp, input, inputs, input_num,
type, type_id, tp, name, decorated,
@@ -1232,45 +1232,45 @@ ctf_dedup_populate_mappings (ctf_dict_t *fp, ctf_dict_t *input _libctf_unused_,
}
}
#ifdef ENABLE_LIBCTF_HASH_DEBUGGING
- {
- /* Verify that all types with this hash are of the same kind, and that the
- first TU a type was seen in never falls. */
-
- int err;
- const void *one_id;
- ctf_next_t *i = NULL;
- int orig_kind = ctf_type_kind_unsliced (input, type);
- int orig_first_tu;
-
- orig_first_tu = CTF_DEDUP_GID_TO_INPUT
- (ctf_dynhash_lookup (d->cd_output_first_gid, hval));
- if (!ctf_assert (fp, orig_first_tu <= CTF_DEDUP_GID_TO_INPUT (id)))
- return -1;
-
- while ((err = ctf_dynset_cnext (type_ids, &i, &one_id)) == 0)
- {
- ctf_dict_t *foo = inputs[CTF_DEDUP_GID_TO_INPUT (one_id)];
- ctf_id_t bar = CTF_DEDUP_GID_TO_TYPE (one_id);
- if (ctf_type_kind_unsliced (foo, bar) != orig_kind)
- {
- ctf_err_warn (fp, 1, 0, "added wrong kind to output mapping "
- "for hash %s named %s: %p/%lx from %s is "
- "kind %i, but newly-added %p/%lx from %s is "
- "kind %i", hval,
- decorated_name ? decorated_name : "(unnamed)",
- (void *) foo, bar,
- ctf_link_input_name (foo),
- ctf_type_kind_unsliced (foo, bar),
- (void *) input, type,
- ctf_link_input_name (input), orig_kind);
- if (!ctf_assert (fp, ctf_type_kind_unsliced (foo, bar)
- == orig_kind))
- return -1;
- }
- }
- if (err != ECTF_NEXT_END)
- return ctf_set_errno (fp, err);
- }
+ {
+ /* Verify that all types with this hash are of the same kind, and that the
+ first TU a type was seen in never falls. */
+
+ int err;
+ const void *one_id;
+ ctf_next_t *i = NULL;
+ int orig_kind = ctf_type_kind_unsliced (input, type);
+ int orig_first_tu;
+
+ orig_first_tu = CTF_DEDUP_GID_TO_INPUT
+ (ctf_dynhash_lookup (d->cd_output_first_gid, hval));
+ if (!ctf_assert (fp, orig_first_tu <= CTF_DEDUP_GID_TO_INPUT (id)))
+ return -1;
+
+ while ((err = ctf_dynset_cnext (type_ids, &i, &one_id)) == 0)
+ {
+ ctf_dict_t *foo = inputs[CTF_DEDUP_GID_TO_INPUT (one_id)];
+ ctf_id_t bar = CTF_DEDUP_GID_TO_TYPE (one_id);
+ if (ctf_type_kind_unsliced (foo, bar) != orig_kind)
+ {
+ ctf_err_warn (fp, 1, 0, "added wrong kind to output mapping "
+ "for hash %s named %s: %p/%lx from %s is "
+ "kind %i, but newly-added %p/%lx from %s is "
+ "kind %i", hval,
+ decorated_name ? decorated_name : "(unnamed)",
+ (void *) foo, bar,
+ ctf_link_input_name (foo),
+ ctf_type_kind_unsliced (foo, bar),
+ (void *) input, type,
+ ctf_link_input_name (input), orig_kind);
+ if (!ctf_assert (fp, ctf_type_kind_unsliced (foo, bar)
+ == orig_kind))
+ return -1;
+ }
+ }
+ if (err != ECTF_NEXT_END)
+ return ctf_set_errno (fp, err);
+ }
#endif
/* This function will be repeatedly called for the same types many times: