[Rpm-maint] [rpm-software-management/rpm] Convert macro table to STL containers + native strings (PR #3062)
Panu Matilainen
notifications at github.com
Thu Apr 25 10:28:44 UTC 2024
Use an STL map for the macro entry table, this matches exactly the behavior we manually did with the C array.
The variable length array at end of macro entry structs is not really C++, use native strings for the storage. It's slower, but not tragically so. For now, keep name, opts and body as const char pointers though to the c_str() items to avoid having to change everything at once.
Popping macros is a bit clunky and repetitive, we'll clean it up later. findEntry() returns a pointer to the macro entry itself instead of pointer to pointer, which simplifies things a bit further.
This is a wee bit slower than the "raw C" counterpart, but by no means tragically so and moving to native structures opens up other opportunities in turn, both optimization and feature wise. Further work will be easier now that the highly optimized but also tangled up data structure is (mostly) untangled.
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/3062
-- Commit Summary --
* Add copy control and in particular, destructor to the macro context
* Convert macro table to STL containers + native strings
-- File Changes --
M rpmio/macro.c (245)
-- Patch Links --
https://github.com/rpm-software-management/rpm/pull/3062.patch
https://github.com/rpm-software-management/rpm/pull/3062.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3062
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/3062 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240425/2534a04a/attachment.html>
More information about the Rpm-maint
mailing list