[Rpm-maint] [rpm-software-management/rpm] Convert major librpmbuild structs to native C++ allocation / initialization (PR #3099)
Panu Matilainen
notifications at github.com
Thu May 16 05:29:55 UTC 2024
@pmatilai commented on this pull request.
> }
StringBuf freeStringBuf(StringBuf sb)
{
- if (sb) {
- sb->buf = _free(sb->buf);
- sb = _free(sb);
- }
- return sb;
+ delete sb;
Oh, absolutely. This is really just stage 1 of the C++ onboarding, with many more to follow as time permits. The early steps look something like this:
Stage 1: natively allocate everything to allow use of non-trivial structures within
Stage 2: make our structs behave in STL containers (ie add destructors and copy-control)
Stage 3: take advantage of smart pointers and similar (look to replace manual reference counting, mutex locking and such)
...
And of course, look for opportunities to move stuff over to STL types is an on-going thing. I've been eliminating explicit new/delete where easily achieved when moving to STL containers. Stage 1 is sticking with these manual allocations just to keep things simple, just moving to STL containers presents plenty enough of unexpected side-effects :smile:
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3099#discussion_r1602639404
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/3099/review/2059629406 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240515/ce4a5f1c/attachment.html>
More information about the Rpm-maint
mailing list