-
Notifications
You must be signed in to change notification settings - Fork 41
Add support for getting the prefix length when looking up an IP #51
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
Conversation
This provides a small performance improvement.
The reason for doing this now is that the code was already untidy according to uncrustify. Given this, I took the opportunity to switch to clang-format given that is the direction we have been moving in other repos.
horgh
left a comment
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.
Great! Just a couple minor things I noticed.
extension/maxminddb.c
Outdated
| }; | ||
| static PyMethodDef Metadata_methods[] = {{NULL, NULL, 0, NULL}}; | ||
|
|
||
| /* *INDENT-OFF* */ |
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.
We could remove these comments I think?
extension/maxminddb.c
Outdated
| static PyTypeObject Metadata_Type = { | ||
| PyVarObject_HEAD_INIT(NULL, 0) | ||
| .tp_basicsize = sizeof(Metadata_obj), | ||
| PyVarObject_HEAD_INIT(NULL, 0).tp_basicsize = sizeof(Metadata_obj), |
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.
Hrm, this isn't great. I saw one like this above (first file in the commit) as well, though not as weird.
| PyErr_SetString( | ||
| PyExc_RuntimeError, | ||
| "getaddrinfo was successful but failed to set the addrinfo"); | ||
| return 0; |
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.
Good catch!
No description provided.