-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add support for net:getaddrinfo/1,2 #903
Conversation
8b15181
to
4ff90ec
Compare
4ff90ec
to
a8e0f66
Compare
aa1f891
to
0136c71
Compare
Open question -- is this slightly over-engineered? Here's why. This functionality is being implemented as an entirely new component, with (in the case of ESP32) a Config entry, a NIF registration macro, etc. Is this really necessary? An alternative approach would be to draw a link-time dependency between this code and the OTP-socket code, which would pull this code into the runtime "for free". The linkage might be a little "artificial", but I would be okay with that. I guess it is a question of whether anyone would have use for this feature without the OTP socket code, and I think the answer to that is, "probably not". Thoughts? Also, it just occurred to me that this code might not be linking into the Pico port, so that should be investigated (and might be solved by the above proposal) |
0136c71
to
d70b774
Compare
src/libAtomVM/term.h
Outdated
@@ -87,6 +87,7 @@ extern "C" { | |||
#define TUPLE_SIZE(elems) ((int) (elems + 1)) | |||
#define CONS_SIZE 2 | |||
#define REFC_BINARY_CONS_OFFSET 4 | |||
#define LIST_SIZE(num_elements, element_size) (num_elements * (element_size + CONS_SIZE)) |
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.
Further nitpicking (this might save us a lot of headache).
Macro should be rewritten as: ((num_elements) * ((element_size) + CONS_SIZE))
.
If you do something like: LIST_SIZE(a_elements + b_elements, TUPLE_SIZE(3))
it will expand as: (a_elements + b_elements * (TUPLE_SIZE(3) + CONS_SIZE))
.
I can assure that debugging this is very painful.
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.
I don't think it's nitpicking at all, and I should have picked up on this first, so my bad. Nice catch. Please re-review change.
Signed-off-by: Fred Dushin <[email protected]>
d70b774
to
b8b74c6
Compare
This PR adds support for the
net:getaddrinfo/1,2
family of functions.Addresses Issue #902
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later