Message ID | 20250515120012.3127231-7-barnabas.pocze@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Quoting Barnabás Pőcze (2025-05-15 14:00:10) > `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@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> > --- > 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 >
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, {} }; \
`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@ideasonboard.com> --- include/libcamera/internal/ipa_data_serializer.h | 1 - src/libcamera/ipa_data_serializer.cpp | 1 - 2 files changed, 2 deletions(-)