summaryrefslogtreecommitdiffstats
path: root/dwflpp.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-08-25 18:20:39 -0700
committerJosh Stone <jistone@redhat.com>2009-08-25 18:37:59 -0700
commitc1c5bb9a8bd0a58f98708f949e4dbe74561898a7 (patch)
tree331075858f997f9b1cf6e7475edf43071671a2c4 /dwflpp.cxx
parentbe53d3135d2f22032917b0da19a2f9783d3f2705 (diff)
downloadsystemtap-steved-c1c5bb9a8bd0a58f98708f949e4dbe74561898a7.tar.gz
systemtap-steved-c1c5bb9a8bd0a58f98708f949e4dbe74561898a7.tar.xz
systemtap-steved-c1c5bb9a8bd0a58f98708f949e4dbe74561898a7.zip
Avoid needless Dwarf_Die copying
* dwflpp.cxx (dwflpp::iterate_over_cus): Use the Dwarf_Die as a pointer directly into the vector. (dwflpp::iterate_over_inline_instances): Ditto. (dwflpp::iterate_over_functions): Ditto in a map.
Diffstat (limited to 'dwflpp.cxx')
-rw-r--r--dwflpp.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/dwflpp.cxx b/dwflpp.cxx
index 7d4fa3ab..436ee88f 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -480,12 +480,11 @@ dwflpp::iterate_over_cus (int (*callback)(Dwarf_Die * die, void * arg),
}
}
- for (unsigned i = 0; i < v->size(); i++)
+ for (vector<Dwarf_Die>::iterator i = v->begin(); i != v->end(); ++i)
{
- if (pending_interrupts) return;
- Dwarf_Die die = v->at(i);
- int rc = (*callback)(& die, data);
- if (rc != DWARF_CB_OK) break;
+ int rc = (*callback)(&*i, data);
+ if (rc != DWARF_CB_OK || pending_interrupts)
+ break;
}
}
@@ -522,12 +521,11 @@ dwflpp::iterate_over_inline_instances (int (* callback)(Dwarf_Die * die, void *
dwarf_func_inline_instances (function, cu_inl_function_caching_callback, v);
}
- for (unsigned i=0; i<v->size(); i++)
+ for (vector<Dwarf_Die>::iterator i = v->begin(); i != v->end(); ++i)
{
- if (pending_interrupts) return;
- Dwarf_Die die = v->at(i);
- int rc = (*callback)(& die, data);
- if (rc != DWARF_CB_OK) break;
+ int rc = (*callback)(&*i, data);
+ if (rc != DWARF_CB_OK || pending_interrupts)
+ break;
}
}
@@ -629,7 +627,7 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query *
}
else if (name_has_wildcard (function))
{
- for (it = v->begin(); it != v->end(); it++)
+ for (it = v->begin(); it != v->end(); ++it)
{
if (pending_interrupts) return DWARF_CB_ABORT;
const string& func_name = it->first;
@@ -647,10 +645,9 @@ dwflpp::iterate_over_functions (int (* callback)(Dwarf_Die * func, base_query *
}
else if (has_statement_num) // searching all for kernel.statement
{
- for (cu_function_cache_t::iterator it = v->begin(); it != v->end(); it++)
+ for (it = v->begin(); it != v->end(); ++it)
{
- Dwarf_Die die = it->second;
- rc = (*callback)(& die, q);
+ rc = (*callback)(&it->second, q);
if (rc != DWARF_CB_OK) break;
}
}