mochi / egeoip

Erlang IP Geolocation module, currently supporting the MaxMind GeoLite City Database.
Other
95 stars 57 forks source link

Fix wrong function clause order #11

Closed chrisavl closed 11 years ago

chrisavl commented 11 years ago

Fixes wrong order of clauses in address_fast, an ip like 1.2.3.4 would be unnecessarily parsed with inet_parse since address_fast would crash.

twonds commented 11 years ago

Thanks for this! I added tests for your change, but I have also removed the catch before address_fast/3 is called and have the function handle all function clauses. However, I am not sure this is correct. I would like to remove this catch in the case but want to make sure we do not have issues or regressions from this change.

If I can not come up with a solution I like soon, then I will keep the catch and merge your change with the added tests for address_fast/3.

my branch: https://github.com/mochi/egeoip/tree/address_fast_function_order-11