-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allow construction of empty Zonemaster::LDNS::RRList objects #209
Allow construction of empty Zonemaster::LDNS::RRList objects #209
Conversation
CI failures seem to be addressed in #208. |
The change in zonemaster#203 introduced a new() function in the Zonemaster::LDNS::RRList module. However, calling new() with a ref to an empty array as paramater caused the code to croak with the error message "List is empty". However, there are situations where it may be desirable to construct such an empty RRList. This commit ensures that Zonemaster::LDNS::RRList->new([]) works as intended.
Modify the XS code so that Zonemaster::LDNS::RRList::new() can be called with zero arguments, which is equivalent to passing it an empty arrayref.
65024d6
to
a9cac1c
Compare
I’ve rebased on latest develop so that CI works, and included another minor change in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I like the tests you added. I thought of a few additional ones, but maybe that's overkill.
- Checking the return values of
string
,count
andget
for$empty_b
. - Checking
eq
andne
with the$empty_a
on the right side.
Let’s make sure that new() and new([]) have the same semantics, and that the eq operator works correctly in both ways with these empty lists.
@mattias-p @mattias-p please review so it can be merged and zonemaster/zonemaster-engine#1383 updated before the end of development. |
These objects can now be created from empty lists, see zonemaster/zonemaster-ldns#209
Purpose
This PR addresses a design oversight in the constructor for Zonemaster::LDNS::RRList objects. It was for now assumed that it would always be used to construct nonempty RRList objects, but a PR in Zonemaster-Engine elicited the need for exactly that use case.
Context
Follow-up to #203; review of zonemaster/zonemaster-engine#1383.
Changes
Allow calling Zonemaster::LDNS::RRList::new() with either no argument or an empty arrayref.
How to test this PR
Unit tests were added, and should therefore pass.