From 3166467b00a08050366120fc3cd64336a51fa12c Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Thu, 4 Jun 2020 17:21:10 +0100 Subject: 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. --- libctf/ctf-hash.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'libctf/ctf-hash.c') diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c index a026ef2..ed06f1f 100644 --- a/libctf/ctf-hash.c +++ b/libctf/ctf-hash.c @@ -94,26 +94,27 @@ ctf_hash_eq_string (const void *a, const void *b) return !strcmp((const char *) hep_a->key, (const char *) hep_b->key); } -/* Hash a type_mapping_key. */ +/* Hash a type_key. */ unsigned int -ctf_hash_type_mapping_key (const void *ptr) +ctf_hash_type_key (const void *ptr) { ctf_helem_t *hep = (ctf_helem_t *) ptr; - ctf_link_type_mapping_key_t *k = (ctf_link_type_mapping_key_t *) hep->key; + ctf_link_type_key_t *k = (ctf_link_type_key_t *) hep->key; - return htab_hash_pointer (k->cltm_fp) + 59 * htab_hash_pointer ((void *) k->cltm_idx); + return htab_hash_pointer (k->cltk_fp) + 59 + * htab_hash_pointer ((void *) (uintptr_t) k->cltk_idx); } int -ctf_hash_eq_type_mapping_key (const void *a, const void *b) +ctf_hash_eq_type_key (const void *a, const void *b) { ctf_helem_t *hep_a = (ctf_helem_t *) a; ctf_helem_t *hep_b = (ctf_helem_t *) b; - ctf_link_type_mapping_key_t *key_a = (ctf_link_type_mapping_key_t *) hep_a->key; - ctf_link_type_mapping_key_t *key_b = (ctf_link_type_mapping_key_t *) hep_b->key; + ctf_link_type_key_t *key_a = (ctf_link_type_key_t *) hep_a->key; + ctf_link_type_key_t *key_b = (ctf_link_type_key_t *) hep_b->key; - return (key_a->cltm_fp == key_b->cltm_fp) - && (key_a->cltm_idx == key_b->cltm_idx); + return (key_a->cltk_fp == key_b->cltk_fp) + && (key_a->cltk_idx == key_b->cltk_idx); } -- cgit v1.1