summaryrefslogtreecommitdiffstats
path: root/translate.cxx
diff options
context:
space:
mode:
authorjistone <jistone>2006-01-18 02:06:19 +0000
committerjistone <jistone>2006-01-18 02:06:19 +0000
commitea7f4e8defbca50342a51d2f9864ec4a98de25b4 (patch)
treea71682e75bab97de79abfd54ba537ed1b37be4b4 /translate.cxx
parent4698b0a8dbfdd2bf33064c0dc7090335f1413a5a (diff)
downloadsystemtap-steved-ea7f4e8defbca50342a51d2f9864ec4a98de25b4.tar.gz
systemtap-steved-ea7f4e8defbca50342a51d2f9864ec4a98de25b4.tar.xz
systemtap-steved-ea7f4e8defbca50342a51d2f9864ec4a98de25b4.zip
2006-01-17 Josh Stone <joshua.i.stone@intel.com>
PR 2156 * translate.cxx (c_unparser::visit_foreach_loop): Check the return value of _stp_pmap_agg() for NULL.
Diffstat (limited to 'translate.cxx')
-rw-r--r--translate.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/translate.cxx b/translate.cxx
index 01179e2f..ba383682 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -2021,11 +2021,17 @@ c_unparser::visit_foreach_loop (foreach_loop *s)
if (mv.is_parallel())
{
varlock_w agg_and_maybe_sort_guard(*this, mv);
- o->newline() << mv.calculate_aggregate() << ";";
+ o->newline() << "if (unlikely(NULL == " << mv.calculate_aggregate() << "))";
+ o->newline(1) << "c->last_error = \"unknown error while aggregating " << mv << "\";";
+ o->indent(-1);
+
// sort array if desired
- if (s->sort_direction)
- o->newline() << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", "
- << s->sort_column << ", " << - s->sort_direction << ");";
+ if (s->sort_direction) {
+ o->newline() << "else"; // only sort if aggregation was ok
+ o->newline(1) << "_stp_map_sort (" << mv.fetch_existing_aggregate() << ", "
+ << s->sort_column << ", " << - s->sort_direction << ");";
+ o->indent(-1);
+ }
}
else
{