From: Daniel Garcia-Sanchez Date: Tue, 27 Nov 2018 13:39:08 +0000 (+0100) Subject: Remove std::vector copy X-Git-Tag: v9.1.0-rc1~453^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75f1afba164488c7e321c7af806c7eda52d99c70;p=dealii.git Remove std::vector copy --- diff --git a/source/base/hdf5.cc b/source/base/hdf5.cc index d447ac3d3d..cabd97a17a 100644 --- a/source/base/hdf5.cc +++ b/source/base/hdf5.cc @@ -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(rank)); - dimensions.assign(dims, dims + rank); - free(dims); size = 1; for (const auto &dimension : dimensions)