[RFC PATCH v1 6/8] libcamera: ipa_data_serializer: Remove some vector `reserve()` calls
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Tue May 20 13:50:24 CEST 2025
Hi Barnabás
On Thu, May 15, 2025 at 02:00:10PM +0200, Barnabás Pőcze wrote:
> `appendPOD()` does a single insertion, so if only a single `appendPOD()`
> will be called on a vector before returning, then calling `reserve()`
> is not that useful, so remove it.
>
> Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
Thanks
j
> ---
> include/libcamera/internal/ipa_data_serializer.h | 1 -
> src/libcamera/ipa_data_serializer.cpp | 1 -
> 2 files changed, 2 deletions(-)
>
> diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h
> index b4614f21d..b1fefba58 100644
> --- a/include/libcamera/internal/ipa_data_serializer.h
> +++ b/include/libcamera/internal/ipa_data_serializer.h
> @@ -309,7 +309,6 @@ public:
> serialize(const Flags<E> &data, [[maybe_unused]] ControlSerializer *cs = nullptr)
> {
> std::vector<uint8_t> dataVec;
> - dataVec.reserve(sizeof(Flags<E>));
> appendPOD<uint32_t>(dataVec, static_cast<typename Flags<E>::Type>(data));
>
> return { dataVec, {} };
> diff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp
> index 2189a2466..0537f785b 100644
> --- a/src/libcamera/ipa_data_serializer.cpp
> +++ b/src/libcamera/ipa_data_serializer.cpp
> @@ -196,7 +196,6 @@ IPADataSerializer<type>::serialize(const type &data, \
> [[maybe_unused]] ControlSerializer *cs) \
> { \
> std::vector<uint8_t> dataVec; \
> - dataVec.reserve(sizeof(type)); \
> appendPOD<type>(dataVec, data); \
> \
> return { dataVec, {} }; \
> --
> 2.49.0
>
More information about the libcamera-devel
mailing list