aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-dedup.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-04-12 14:46:00 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-04-19 16:14:48 +0100
commit7e1368b58f37f89152c5811eab98f4667d807b04 (patch)
tree1bf4045835c57a18d604ea341ce64256836a05b6 /libctf/ctf-dedup.c
parentb5ac272b872db997adc184b23da74f755d4b8f08 (diff)
downloadbinutils-7e1368b58f37f89152c5811eab98f4667d807b04.zip
binutils-7e1368b58f37f89152c5811eab98f4667d807b04.tar.gz
binutils-7e1368b58f37f89152c5811eab98f4667d807b04.tar.bz2
libctf: don't pass errno into ctf_err_warn so often
The libctf-internal warning function ctf_err_warn() can be passed a libctf errno as a parameter, and will add its textual errmsg form to the passed-in error message. But if there is an error on the fp already, and this is specifically an error and not a warning, ctf_err_warn() will print the error out regardless: there's no need to pass in anything but 0. There are still a lot of places where we do ctf_err_warn (fp, 0, EFOO, ...); return ctf_set_errno (fp, 0, EFOO); I've left all of those alone, because fixing it makes the code a bit longer: but fixing the cases where no return is involved and the error has just been set on the fp itself costs nothing and reduces redundancy a bit. libctf/ * ctf-dedup.c (ctf_dedup_walk_output_mapping): Drop the errno arg. (ctf_dedup_emit): Likewise. (ctf_dedup_type_mapping): Likewise. * ctf-link.c (ctf_create_per_cu): Likewise. (ctf_link_deduplicating_close_inputs): Likewise. (ctf_link_deduplicating_one_symtypetab): Likewise. (ctf_link_deduplicating_per_cu): Likewise. * ctf-lookup.c (ctf_lookup_symbol_idx): Likewise. * ctf-subr.c (ctf_assert_fail_internal): Likewise.
Diffstat (limited to 'libctf/ctf-dedup.c')
-rw-r--r--libctf/ctf-dedup.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c
index dc7a1cf..c7db6ab 100644
--- a/libctf/ctf-dedup.c
+++ b/libctf/ctf-dedup.c
@@ -2398,8 +2398,8 @@ ctf_dedup_walk_output_mapping (ctf_dict_t *output, ctf_dict_t **inputs,
}
if (err != ECTF_NEXT_END)
{
- ctf_err_warn (output, 0, err, _("cannot recurse over output mapping"));
ctf_set_errno (output, err);
+ ctf_err_warn (output, 0, 0, _("cannot recurse over output mapping"));
goto err;
}
ctf_dynset_destroy (already_visited);
@@ -3092,9 +3092,9 @@ ctf_dedup_emit (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
if ((outputs = calloc (num_outputs, sizeof (ctf_dict_t *))) == NULL)
{
- ctf_err_warn (output, 0, ENOMEM,
- _("out of memory allocating link outputs array"));
ctf_set_errno (output, ENOMEM);
+ ctf_err_warn (output, 0, 0,
+ _("out of memory allocating link outputs array"));
return NULL;
}
*noutputs = num_outputs;
@@ -3146,7 +3146,7 @@ ctf_dedup_type_mapping (ctf_dict_t *fp, ctf_dict_t *src_fp, ctf_id_t src_type)
else
{
ctf_set_errno (fp, ECTF_INTERNAL);
- ctf_err_warn (fp, 0, ECTF_INTERNAL,
+ ctf_err_warn (fp, 0, 0,
_("dict %p passed to ctf_dedup_type_mapping is not a "
"deduplicated output"), (void *) fp);
return CTF_ERR;