From: Nick Alcock Date: Tue, 2 Jun 2020 19:28:16 +0000 (+0100) Subject: libctf, create: member names of "" and NULL should be the same X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ab769488e75272c3cbea4626a346fd0c336b2de6;p=binutils-gdb.git libctf, create: member names of "" and NULL should be the same This matters for the case of unnamed bitfields, whose names are the null string. These are special in that they are the only members whose "names" are allowed to be duplicated in a single struct, but we were only handling this for the case where name == NULL. Translate "" to NULL to help callers. libctf/ * ctf-create.c (ctf_add_member_offset): Support names of "" as if they were the null pointer. --- diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 61aebd1422e..acff0b185a5 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,8 @@ +2020-07-22 Nick Alcock + + * ctf-create.c (ctf_add_member_offset): Support names of "" + as if they were the null pointer. + 2020-07-22 Nick Alcock * ctf-open.c (init_types): Remove typeless CTF_K_FORWARD diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index bc0ad802dd2..848e725ef24 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -1371,6 +1371,9 @@ ctf_add_member_offset (ctf_file_t *fp, ctf_id_t souid, const char *name, if (dtd == NULL) return (ctf_set_errno (fp, ECTF_BADID)); + if (name != NULL && name[0] == '\0') + name = NULL; + kind = LCTF_INFO_KIND (fp, dtd->dtd_data.ctt_info); root = LCTF_INFO_ISROOT (fp, dtd->dtd_data.ctt_info); vlen = LCTF_INFO_VLEN (fp, dtd->dtd_data.ctt_info);