summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/hwstub/tools/hwstub_shell.cpp10
-rw-r--r--utils/regtools/lib/soc_desc.cpp12
-rw-r--r--utils/regtools/lib/soc_desc.hpp3
-rw-r--r--utils/regtools/qeditor/backend.cpp10
4 files changed, 18 insertions, 17 deletions
diff --git a/utils/hwstub/tools/hwstub_shell.cpp b/utils/hwstub/tools/hwstub_shell.cpp
index 61cb617509..3cc6f8c259 100644
--- a/utils/hwstub/tools/hwstub_shell.cpp
+++ b/utils/hwstub/tools/hwstub_shell.cpp
@@ -647,13 +647,13 @@ bool my_lua_import_soc(const soc_t& soc)
return true;
}
-bool my_lua_import_soc(const std::vector< soc_t >& socs)
+bool my_lua_import_soc(const std::list< soc_t >& socs)
{
- for(size_t i = 0; i < socs.size(); i++)
+ for(std::list< soc_t >::const_iterator it = socs.begin(); it != socs.end(); ++it)
{
if(!g_quiet)
- printf("importing %s...\n", socs[i].name.c_str());
- if(!my_lua_import_soc(socs[i]))
+ printf("importing %s...\n", it->name.c_str());
+ if(!my_lua_import_soc(*it))
return false;
}
return true;
@@ -711,7 +711,7 @@ int main(int argc, char **argv)
}
// load register descriptions
- std::vector< soc_t > socs;
+ std::list< soc_t > socs;
for(int i = optind; i < argc; i++)
if(!soc_desc_parse_xml(argv[i], socs))
{
diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp
index 4b9f51b9ae..223a6d8f53 100644
--- a/utils/regtools/lib/soc_desc.cpp
+++ b/utils/regtools/lib/soc_desc.cpp
@@ -64,14 +64,14 @@
#define MATCH_ELEM_NODE(node_name, array, parse_fn) \
if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \
array.resize(array.size() + 1); \
- if(!parse_fn(sub, array[array.size() - 1])) \
+ if(!parse_fn(sub, array.back())) \
return false; \
}
#define SOFT_MATCH_ELEM_NODE(node_name, array, parse_fn) \
if(sub->type == XML_ELEMENT_NODE && strcmp(XML_CHAR_TO_CHAR(sub->name), node_name) == 0) { \
array.resize(array.size() + 1); \
- if(!parse_fn(sub, array[array.size() - 1])) \
+ if(!parse_fn(sub, array.back())) \
array.pop_back(); \
}
@@ -189,7 +189,7 @@ bool parse_add_trivial_addr(const std::string& str, soc_reg_t& reg)
bool parse_reg_elem(xmlNode *node, soc_reg_t& reg)
{
- std::vector< soc_reg_formula_t > formulas;
+ std::list< soc_reg_formula_t > formulas;
BEGIN_ATTR_MATCH(node->properties)
MATCH_TEXT_ATTR("name", reg.name)
SOFT_MATCH_SCT_ATTR("sct", reg.flags)
@@ -208,7 +208,7 @@ bool parse_reg_elem(xmlNode *node, soc_reg_t& reg)
return false;
}
if(formulas.size() == 1)
- reg.formula = formulas[0];
+ reg.formula = formulas.front();
return true;
}
@@ -252,7 +252,7 @@ bool parse_soc_elem(xmlNode *node, soc_t& soc)
return true;
}
-bool parse_root_elem(xmlNode *node, std::vector< soc_t >& soc)
+bool parse_root_elem(xmlNode *node, std::list< soc_t >& soc)
{
BEGIN_NODE_MATCH(node)
MATCH_ELEM_NODE("soc", soc, parse_soc_elem)
@@ -260,7 +260,7 @@ bool parse_root_elem(xmlNode *node, std::vector< soc_t >& soc)
return true;
}
-bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& socs)
+bool soc_desc_parse_xml(const std::string& filename, std::list< soc_t >& socs)
{
LIBXML_TEST_VERSION
diff --git a/utils/regtools/lib/soc_desc.hpp b/utils/regtools/lib/soc_desc.hpp
index 476ea1d242..d1a1f0cb50 100644
--- a/utils/regtools/lib/soc_desc.hpp
+++ b/utils/regtools/lib/soc_desc.hpp
@@ -23,6 +23,7 @@
#include <stdint.h>
#include <vector>
+#include <list>
#include <string>
/**
@@ -142,6 +143,6 @@ struct soc_t
/** Parse a SoC description from a XML file, append it to <soc>. A file
* can contain multiple SoC descriptions */
-bool soc_desc_parse_xml(const std::string& filename, std::vector< soc_t >& soc);
+bool soc_desc_parse_xml(const std::string& filename, std::list< soc_t >& soc);
#endif /* __SOC_DESC__ */ \ No newline at end of file
diff --git a/utils/regtools/qeditor/backend.cpp b/utils/regtools/qeditor/backend.cpp
index d2b75be701..22210916b1 100644
--- a/utils/regtools/qeditor/backend.cpp
+++ b/utils/regtools/qeditor/backend.cpp
@@ -14,17 +14,17 @@ Backend::Backend()
QStringList Backend::GetSocNameList()
{
QStringList sl;
- for(size_t i = 0; i < m_socs.size(); i++)
- sl.append(QString(m_socs[i].name.c_str()));
+ foreach(const soc_t& soc, m_socs)
+ sl.append(QString(soc.name.c_str()));
return sl;
}
bool Backend::GetSocByName(const QString& name, soc_t& s)
{
- for(size_t i = 0; i < m_socs.size(); i++)
- if(m_socs[i].name == name.toStdString())
+ for(std::list< soc_t >::iterator it = m_socs.begin(); it != m_socs.end(); ++it)
+ if(it->name == name.toStdString())
{
- s = m_socs[i];
+ s = *it;
return true;
}
return false;