]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove std::vector copy
authorDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Tue, 27 Nov 2018 13:39:08 +0000 (14:39 +0100)
committerDaniel Garcia-Sanchez <daniel.garcia-sanchez@insp.upmc.fr>
Wed, 9 Jan 2019 18:29:23 +0000 (19:29 +0100)
source/base/hdf5.cc

index d447ac3d3debef644c8a1a0c67b2d323eaa771ad..cabd97a17a7c62ff6a3adde0ef2fb74b875c82f2 100644 (file)
@@ -556,12 +556,10 @@ namespace HDF5
     Assert(*dataspace >= 0, ExcMessage("Error at H5Dget_space"));
     rank_ret = H5Sget_simple_extent_ndims(*dataspace);
     Assert(rank_ret >= 0, ExcInternalError());
-    rank          = rank_ret;
-    hsize_t *dims = (hsize_t *)malloc(rank * sizeof(hsize_t));
-    rank_ret      = H5Sget_simple_extent_dims(*dataspace, dims, NULL);
+    rank = rank_ret;
+    dimensions.resize(rank);
+    rank_ret = H5Sget_simple_extent_dims(*dataspace, dimensions.data(), NULL);
     AssertDimension(rank_ret, static_cast<int>(rank));
-    dimensions.assign(dims, dims + rank);
-    free(dims);
 
     size = 1;
     for (const auto &dimension : dimensions)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.