libctf: eliminate dtd_u, part 2: arrays
This is even simpler than ints, floats and slices, with the only extra complication being the need to manually transfer the array parameter in the rarely-used function ctf_set_array. (Arrays are unique in libctf in that they can be modified post facto, not just created and appended to. I'm not sure why they got this exemption, but it's easy to maintain.) libctf/ChangeLog 2021-03-18 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h (ctf_dtdef_t) <dtd_u.dtu_arr>: Remove. * ctf-create.c (ctf_add_array): Use the dtd_vlen, not dtu_arr. (ctf_set_array): Likewise. * ctf-serialize.c (ctf_emit_type_sect): Just copy the dtd_vlen. * ctf-types.c (ctf_array_info): Just use the vlen.
This commit is contained in:
parent
7879dd88ef
commit
534444b1ee
5 changed files with 27 additions and 16 deletions
|
@ -857,7 +857,6 @@ ctf_emit_type_sect (ctf_dict_t *fp, unsigned char **tptr)
|
|||
uint32_t kind = LCTF_INFO_KIND (fp, dtd->dtd_data.ctt_info);
|
||||
uint32_t vlen = LCTF_INFO_VLEN (fp, dtd->dtd_data.ctt_info);
|
||||
|
||||
ctf_array_t cta;
|
||||
size_t len;
|
||||
ctf_stype_t *copied;
|
||||
const char *name;
|
||||
|
@ -888,11 +887,8 @@ ctf_emit_type_sect (ctf_dict_t *fp, unsigned char **tptr)
|
|||
break;
|
||||
|
||||
case CTF_K_ARRAY:
|
||||
cta.cta_contents = (uint32_t) dtd->dtd_u.dtu_arr.ctr_contents;
|
||||
cta.cta_index = (uint32_t) dtd->dtd_u.dtu_arr.ctr_index;
|
||||
cta.cta_nelems = dtd->dtd_u.dtu_arr.ctr_nelems;
|
||||
memcpy (t, &cta, sizeof (cta));
|
||||
t += sizeof (cta);
|
||||
memcpy (t, dtd->dtd_vlen, sizeof (struct ctf_array));
|
||||
t += sizeof (struct ctf_array);
|
||||
break;
|
||||
|
||||
case CTF_K_FUNCTION:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue