/* Routines for handling XML generic OS data provided by target.
- Copyright (C) 2008-2017 Free Software Foundation, Inc.
+ Copyright (C) 2008-2019 Free Software Foundation, Inc.
This file is part of GDB.
static void
osdata_start_osdata (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
- void *user_data, VEC(gdb_xml_value_s) *attributes)
+ void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
if (data->osdata != NULL)
gdb_xml_error (parser, _("Seen more than on osdata element"));
- char *type = (char *) xml_find_attribute (attributes, "type")->value;
+ char *type = (char *) xml_find_attribute (attributes, "type")->value.get ();
data->osdata.reset (new struct osdata (std::string (type)));
}
static void
osdata_start_item (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
- void *user_data, VEC(gdb_xml_value_s) *attributes)
+ void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
data->osdata->items.emplace_back ();
static void
osdata_start_column (struct gdb_xml_parser *parser,
const struct gdb_xml_element *element,
- void *user_data, VEC(gdb_xml_value_s) *attributes)
+ void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
const char *name
- = (const char *) xml_find_attribute (attributes, "name")->value;
+ = (const char *) xml_find_attribute (attributes, "name")->value.get ();
data->property_name.assign (name);
}
osdata_item &item = osdata->items.back ();
item.columns.emplace_back (std::move (data->property_name),
- std::move (std::string (body_text)));
+ std::string (body_text));
}
/* The allowed elements and attributes for OS data object.
get_osdata (const char *type)
{
std::unique_ptr<osdata> osdata;
- gdb::unique_xmalloc_ptr<char> xml = target_get_osdata (type);
+ gdb::optional<gdb::char_vector> xml = target_get_osdata (type);
if (xml)
{
- if (xml.get ()[0] == '\0')
+ if ((*xml)[0] == '\0')
{
if (type)
warning (_("Empty data returned by target. Wrong osdata type?"));
warning (_("Empty type list returned by target. No type data?"));
}
else
- osdata = osdata_parse (xml.get ());
+ osdata = osdata_parse (xml->data ());
}
if (osdata == NULL)
error (_("Can not fetch data now."));
- return std::move (osdata);
+ return osdata;
}
const std::string *