This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Alexander Chemeris gerrit-no-reply at lists.osmocom.orgAlexander Chemeris has submitted this change and it was merged.
Change subject: vector: Introduce shrink() function to shrink vector size without loosing data.
......................................................................
vector: Introduce shrink() function to shrink vector size without loosing data.
Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
---
M CommonLibs/Vector.h
1 file changed, 7 insertions(+), 0 deletions(-)
Approvals:
Tom Tsou: Looks good to me, approved
Harald Welte: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/CommonLibs/Vector.h b/CommonLibs/Vector.h
index 7062e17..eae674b 100644
--- a/CommonLibs/Vector.h
+++ b/CommonLibs/Vector.h
@@ -92,6 +92,13 @@
mEnd = mStart + newSize;
}
+ /** Reduce addressable size of the Vector, keeping content. */
+ void shrink(size_t newSize)
+ {
+ assert(newSize <= mEnd - mStart);
+ mEnd = mStart + newSize;
+ }
+
/** Release memory and clear pointers. */
void clear() { resize(0); }
--
To view, visit https://gerrit.osmocom.org/2157
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9c0ac2715aea1a90c9e6ebcd982522b80a547099
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Alexander Chemeris <Alexander.Chemeris at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou <tom at tsou.cc>