- dst_type = CTF_ERR;
- }
- }
- }
-
- /* If the non-empty name was not found in the appropriate hash, search
- the list of pending dynamic definitions that are not yet committed.
- If a matching name and kind are found, assume this is the type that
- we are looking for. This is necessary to permit ctf_add_type() to
- operate recursively on entities such as a struct that contains a
- pointer member that refers to the same struct type. */
-
- if (dst_type == CTF_ERR && name[0] != '\0')
- {
- for (dtd = ctf_list_prev (&dst_fp->ctf_dtdefs); dtd != NULL
- && LCTF_TYPE_TO_INDEX (src_fp, dtd->dtd_type) > dst_fp->ctf_dtoldid;
- dtd = ctf_list_prev (dtd))
- {
- if (LCTF_INFO_KIND (src_fp, dtd->dtd_data.ctt_info) == kind
- && dtd->dtd_name != NULL && strcmp (dtd->dtd_name, name) == 0)
- {
- int sroot; /* Is the src root-visible? */
- int droot; /* Is the dst root-visible? */
- int match; /* Do the encodings match? */
-
- if (kind != CTF_K_INTEGER && kind != CTF_K_FLOAT && kind != CTF_K_SLICE)
- {
- ctf_add_type_mapping (src_fp, src_type, dst_fp, dtd->dtd_type);
- return dtd->dtd_type;
- }
-
- sroot = (flag & CTF_ADD_ROOT);
- droot = (LCTF_INFO_ISROOT (dst_fp,
- dtd->dtd_data.
- ctt_info) & CTF_ADD_ROOT);
-
- match = (memcmp (&src_en, &dtd->dtd_u.dtu_enc,
- sizeof (ctf_encoding_t)) == 0);
-
- /* If the types share the same encoding then return the id of the
- first unless one type is root-visible and the other is not; in
- that case the new type must get a new id if a match is never
- found. Note: slices are not certain to match even if there is
- no conflict: we must check the contained type too. */
-
- if (match && sroot == droot)