Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type pedantry and similar cleanups in preparation for c++ #3019

Merged
merged 17 commits into from
Apr 5, 2024

Conversation

pmatilai
Copy link
Member

@pmatilai pmatilai commented Apr 5, 2024

Another batch of delightful trivia to appease c++.

In particular, spec->nextline is written to, so pointing it to
a string literal is undefined behavior. NULL seems to achieve
the same.
rpmTag doesn't include anything suitable for a sentinel value, so don't
use it in array initializers. rpmTagVal works for that, but it's an
unsigned type so use 0 instead of -1.
rpmTagVal is unsigned so we can't really have these -1's in there.
Tag works for this purpose just as well - assuming I spotted all the
explicit comparisons to -1 in the depMsgs code.
This hack here is illegal in c++. Just strdup() the silly little string,
it's not like this is a performance critical spot.
This really belongs to a separate function in the first place, and doing
so allows us to turn 'b' into a const char *, which in turn makes
the assignment to string literal "" in the url2path case legitimate.
Fun times and no functional changes.
Forward declarations to structs like we have in rpmio isn't legitimate
C++, as a minimal bandaid solution declare them as extern in the
internal header, and limit visibility.
Otherwise we'd need casts for each of these accesses, having a function
allows doing more if necessary.
Cleaner than void pointer and avoid casting.
@pmatilai pmatilai merged commit 38b2602 into rpm-software-management:master Apr 5, 2024
1 check passed
@pmatilai pmatilai deleted the typeclean-pr branch April 5, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant