Skip to content

Const MMDB_s#199

Merged
oschwald merged 2 commits intomaxmind:masterfrom
kurt-nj:const_mmdb_s
May 6, 2019
Merged

Const MMDB_s#199
oschwald merged 2 commits intomaxmind:masterfrom
kurt-nj:const_mmdb_s

Conversation

@kurt-nj
Copy link
Contributor

@kurt-nj kurt-nj commented Mar 25, 2019

According to #24, libmaxminddb is supposed to be thread safe. This pull request adds const modifiers to the MMDB_s pointer to make it clear that the structure doesn't get modified. This allows people to use a const MMDB without needing to cast away the const.

Also removes one spot that appears to be unnecessarily modifying the MMDB_s from the ip lookup method.

uint16_t start_bit = max_depth0;

if (mmdb->metadata.ip_version == 6 && address_family == AF_INET) {
int mmdb_error = find_ipv4_start_node(mmdb);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_ipv4_start_node already gets called from MMDB_open if ip_version == 6. It doesn't appear that this method would need to be called again.

@oschwald oschwald merged commit ea5dd4a into maxmind:master May 6, 2019
@oschwald
Copy link
Member

oschwald commented May 6, 2019

Thanks! This looks great.

oschwald added a commit that referenced this pull request May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants