[Rpm-maint] [rpm-software-management/rpm] Convert variable length arrays to C++ strings and vectors (PR #4113)
Panu Matilainen
notifications at github.com
Wed Feb 25 08:33:12 UTC 2026
@pmatilai commented on this pull request.
> @@ -18,21 +20,16 @@ int rpmvercmp(const char * a, const char * b)
/* easy comparison to see if versions are identical */
if (rstreq(a, b)) return 0;
- char oldch1, oldch2;
- char abuf[strlen(a)+1], bbuf[strlen(b)+1];
- char *str1 = abuf, *str2 = bbuf;
- char * one, * two;
+ std::string abuf(a);
+ std::string bbuf(b);
+ char *str1 = abuf.data(), *str2 = bbuf.data();
Yes, they return the same value. But one is const, and the other one is not. You can't modify what you get from c_str().
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/4113#discussion_r2851587751
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/4113/review/3852656591 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260225/57905fd1/attachment.htm>
More information about the Rpm-maint
mailing list