Introduce make_unique_xstrndup

This adds a new make_unique_xstrndup function, which is the "n"
analogue of make_unique_xstrdup.  It also updates a couple existing
places to use this function.
This commit is contained in:
Tom Tromey 2021-06-04 16:00:33 -06:00
parent 8a89ddbda2
commit be77dd73c7
3 changed files with 14 additions and 5 deletions

View file

@ -199,7 +199,8 @@ parser_state::mark_completion_tag (enum type_code tag, const char *ptr,
|| tag == TYPE_CODE_STRUCT
|| tag == TYPE_CODE_ENUM);
m_completion_state.expout_tag_completion_type = tag;
m_completion_state.expout_completion_name.reset (xstrndup (ptr, length));
m_completion_state.expout_completion_name
= make_unique_xstrndup (ptr, length);
}
/* See parser-defs.h. */