diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-06-04 17:21:10 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2020-07-22 18:02:18 +0100 |
commit | 3166467b00a08050366120fc3cd64336a51fa12c (patch) | |
tree | 1ff98117b986c2a6ef0960e9fb75da4d737cfa79 /libctf/ctf-link.c | |
parent | 43a61d7d3e619385b98c03d43733572b5b1dc015 (diff) | |
download | fsf-binutils-gdb-3166467b00a08050366120fc3cd64336a51fa12c.zip fsf-binutils-gdb-3166467b00a08050366120fc3cd64336a51fa12c.tar.gz fsf-binutils-gdb-3166467b00a08050366120fc3cd64336a51fa12c.tar.bz2 |
libctf: rename the type_mapping_key to type_key
The name was just annoyingly long and I kept misspelling it.
It's also a bad name: it's not a mapping the type might be *used* in a
type mapping, but it is itself a representation of a type (a ctf_file_t
/ ctf_id_t pair), not of a mapping at all.
libctf/
* ctf-impl.h (ctf_link_type_mapping_key): Rename to...
(ctf_link_type_key): ... this, adjusting member prefixes to
match.
(ctf_hash_type_mapping_key): Rename to...
(ctf_hash_type_key): ... this.
(ctf_hash_eq_type_mapping_key): Rename to...
(ctf_hash_eq_type_key): ... this.
* ctf-hash.c (ctf_hash_type_mapping_key): Rename to...
(ctf_hash_type_key): ... this, and adjust for member name
changes.
(ctf_hash_eq_type_mapping_key): Rename to...
(ctf_hash_eq_type_key): ... this, and adjust for member name
changes.
* ctf-link.c (ctf_add_type_mapping): Adjust. Note the lack of
need for out-of-memory checking in this code.
(ctf_type_mapping): Adjust.
Diffstat (limited to 'libctf/ctf-link.c')
-rw-r--r-- | libctf/ctf-link.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 31179ae..c331fde 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -53,22 +53,25 @@ ctf_add_type_mapping (ctf_file_t *src_fp, ctf_id_t src_type, if (dst_fp->ctf_link_type_mapping == NULL) { - ctf_hash_fun f = ctf_hash_type_mapping_key; - ctf_hash_eq_fun e = ctf_hash_eq_type_mapping_key; + ctf_hash_fun f = ctf_hash_type_key; + ctf_hash_eq_fun e = ctf_hash_eq_type_key; if ((dst_fp->ctf_link_type_mapping = ctf_dynhash_create (f, e, free, NULL)) == NULL) return; } - ctf_link_type_mapping_key_t *key; - key = calloc (1, sizeof (struct ctf_link_type_mapping_key)); + ctf_link_type_key_t *key; + key = calloc (1, sizeof (struct ctf_link_type_key)); if (!key) return; - key->cltm_fp = src_fp; - key->cltm_idx = src_type; + key->cltk_fp = src_fp; + key->cltk_idx = src_type; + /* No OOM checking needed, because if this doesn't work the worst we'll do is + add a few more duplicate types (which will probably run out of memory + anyway). */ ctf_dynhash_insert (dst_fp->ctf_link_type_mapping, key, (void *) (uintptr_t) dst_type); } @@ -78,7 +81,7 @@ ctf_add_type_mapping (ctf_file_t *src_fp, ctf_id_t src_type, ctf_id_t ctf_type_mapping (ctf_file_t *src_fp, ctf_id_t src_type, ctf_file_t **dst_fp) { - ctf_link_type_mapping_key_t key; + ctf_link_type_key_t key; ctf_file_t *target_fp = *dst_fp; ctf_id_t dst_type = 0; @@ -86,8 +89,8 @@ ctf_type_mapping (ctf_file_t *src_fp, ctf_id_t src_type, ctf_file_t **dst_fp) src_fp = src_fp->ctf_parent; src_type = LCTF_TYPE_TO_INDEX(src_fp, src_type); - key.cltm_fp = src_fp; - key.cltm_idx = src_type; + key.cltk_fp = src_fp; + key.cltk_idx = src_type; if (target_fp->ctf_link_type_mapping) dst_type = (uintptr_t) ctf_dynhash_lookup (target_fp->ctf_link_type_mapping, |