aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJohannes Singler <singler@ira.uka.de>2009-09-11 16:33:58 +0000
committerJohannes Singler <singler@gcc.gnu.org>2009-09-11 16:33:58 +0000
commit6aa8519d86fb7d29325bed07046085c435876da2 (patch)
treee66ee8c7079c6d2eef74cb35f63999670c0de35f /libstdc++-v3
parent603bb63effce598498cdec596afb4860a64935f2 (diff)
downloadgcc-6aa8519d86fb7d29325bed07046085c435876da2.zip
gcc-6aa8519d86fb7d29325bed07046085c435876da2.tar.gz
gcc-6aa8519d86fb7d29325bed07046085c435876da2.tar.bz2
2009-09-11 Johannes Singler <singler@ira.uka.de>
* include/parallel/multiway_merge.h (multiway_merge_exact_splitting): Deallocate borders correctly. (parallel_multiway_merge): Remove unnecessarily complicated allocation, random access iterators are default-constructible; deallocate ne_seqs correctly. From-SVN: r151640
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/parallel/multiway_merge.h19
2 files changed, 15 insertions, 12 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 7d1ce93..8cb9560 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2009-09-11 Johannes Singler <singler@ira.uka.de>
+
+ * include/parallel/multiway_merge.h
+ (multiway_merge_exact_splitting): Deallocate borders correctly.
+ (parallel_multiway_merge): Remove unnecessarily complicated
+ allocation, random access iterators are default-constructible;
+ deallocate ne_seqs correctly.
+
2009-09-11 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/41316
diff --git a/libstdc++-v3/include/parallel/multiway_merge.h b/libstdc++-v3/include/parallel/multiway_merge.h
index bacff8d..fe32053 100644
--- a/libstdc++-v3/include/parallel/multiway_merge.h
+++ b/libstdc++-v3/include/parallel/multiway_merge.h
@@ -1224,7 +1224,7 @@ void multiway_merge_exact_splitting(
offsets[num_threads - 1].begin(), comp);
}
}
-
+ delete[] borders;
for (int slab = 0; slab < num_threads; ++slab)
{
@@ -1305,11 +1305,8 @@ template<
std::iterator_traits<RandomAccessIterator1>::value_type value_type;
// Leave only non-empty sequences.
- std::pair<RandomAccessIterator1, RandomAccessIterator1>* ne_seqs =
- static_cast<std::pair<RandomAccessIterator1, RandomAccessIterator1>*>(
- ::operator new(
- sizeof(std::pair<RandomAccessIterator1, RandomAccessIterator1>)
- * (seqs_end - seqs_begin)));
+ typedef std::pair<RandomAccessIterator1, RandomAccessIterator1> seq_type;
+ seq_type* ne_seqs = new seq_type[seqs_end - seqs_begin];
int k = 0;
difference_type total_length = 0;
for (RandomAccessIteratorIterator raii = seqs_begin;
@@ -1319,9 +1316,7 @@ template<
if(seq_length > 0)
{
total_length += seq_length;
- //ne_seqs[k] = *raii;
- new(&(ne_seqs[k++]))
- std::pair<RandomAccessIterator1, RandomAccessIterator1>(*raii);
+ ne_seqs[k++] = *raii;
}
}
@@ -1331,7 +1326,7 @@ template<
if (total_length == 0 || k == 0)
{
- ::operator delete(ne_seqs);
+ delete[] ne_seqs;
return target;
}
@@ -1366,8 +1361,7 @@ template<
for (int c = 0; c < k; ++c)
target_position += pieces[iam][c].first;
- std::pair<RandomAccessIterator1, RandomAccessIterator1>* chunks
- = new std::pair<RandomAccessIterator1, RandomAccessIterator1>[k];
+ seq_type* chunks = new seq_type[k];
for (int s = 0; s < k; ++s)
{
@@ -1399,6 +1393,7 @@ template<
}
delete[] pieces;
+ delete[] ne_seqs;
return target + length;
}