geoip2_c 0.3.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +23 -0
- data/.github/workflows/ubuntu.yml +17 -8
- data/.github/workflows/windows.yml +18 -8
- data/.gitmodules +0 -3
- data/ext/geoip2/extconf.rb +9 -25
- data/ext/geoip2/geoip2.c +82 -32
- data/geoip2_c.gemspec +1 -0
- data/lib/geoip2/version.rb +1 -1
- metadata +18 -182
- data/ext/geoip2/libmaxminddb/.gitignore +0 -38
- data/ext/geoip2/libmaxminddb/.gitmodules +0 -9
- data/ext/geoip2/libmaxminddb/.perltidyrc +0 -11
- data/ext/geoip2/libmaxminddb/.travis.yml +0 -70
- data/ext/geoip2/libmaxminddb/.uncrustify.cfg +0 -78
- data/ext/geoip2/libmaxminddb/AUTHORS +0 -0
- data/ext/geoip2/libmaxminddb/Changes.md +0 -277
- data/ext/geoip2/libmaxminddb/LICENSE +0 -202
- data/ext/geoip2/libmaxminddb/Makefile.am +0 -41
- data/ext/geoip2/libmaxminddb/NOTICE +0 -13
- data/ext/geoip2/libmaxminddb/README.dev.md +0 -69
- data/ext/geoip2/libmaxminddb/README.md +0 -122
- data/ext/geoip2/libmaxminddb/appveyor.yml +0 -33
- data/ext/geoip2/libmaxminddb/bin/Makefile.am +0 -10
- data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +0 -715
- data/ext/geoip2/libmaxminddb/bootstrap +0 -21
- data/ext/geoip2/libmaxminddb/common.mk +0 -7
- data/ext/geoip2/libmaxminddb/configure.ac +0 -132
- data/ext/geoip2/libmaxminddb/dev-bin/make-man-pages.pl +0 -76
- data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +0 -53
- data/ext/geoip2/libmaxminddb/dev-bin/regen-prototypes.pl +0 -136
- data/ext/geoip2/libmaxminddb/dev-bin/regen-win32-test-projs.pl +0 -54
- data/ext/geoip2/libmaxminddb/dev-bin/release.sh +0 -113
- data/ext/geoip2/libmaxminddb/dev-bin/uncrustify-all.sh +0 -21
- data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +0 -53
- data/ext/geoip2/libmaxminddb/doc/libmaxminddb.md +0 -889
- data/ext/geoip2/libmaxminddb/doc/mmdblookup.md +0 -103
- data/ext/geoip2/libmaxminddb/include/maxminddb.h +0 -241
- data/ext/geoip2/libmaxminddb/include/maxminddb_config.h.in +0 -14
- data/ext/geoip2/libmaxminddb/projects/VS12/README.md +0 -59
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-release.props +0 -32
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-x64.props +0 -14
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.props +0 -32
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.sln +0 -150
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +0 -143
- data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +0 -32
- data/ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h +0 -14
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/bad_pointers.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/basic_lookup.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_entry_list.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_types.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/dump.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value_pointer_bug.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv4_start_cache.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv6_lookup_in_ipv4.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/libtap.vcxproj +0 -85
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/maxminddb_test_helper.vcxproj +0 -107
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata_pointers.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/no_map_get_value.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/read_node.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/shared.vcxproj +0 -104
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/threads.vcxproj +0 -103
- data/ext/geoip2/libmaxminddb/projects/VS12-tests/version.vcxproj +0 -105
- data/ext/geoip2/libmaxminddb/projects/test.vcxproj.template +0 -105
- data/ext/geoip2/libmaxminddb/src/Makefile.am +0 -25
- data/ext/geoip2/libmaxminddb/src/data-pool.c +0 -180
- data/ext/geoip2/libmaxminddb/src/data-pool.h +0 -52
- data/ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in +0 -11
- data/ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h +0 -167
- data/ext/geoip2/libmaxminddb/src/maxminddb.c +0 -2181
- data/ext/geoip2/libmaxminddb/t/Makefile.am +0 -27
- data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +0 -67
- data/ext/geoip2/libmaxminddb/t/bad_pointers_t.c +0 -53
- data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +0 -207
- data/ext/geoip2/libmaxminddb/t/compile_c++_t.pl +0 -107
- data/ext/geoip2/libmaxminddb/t/data-pool-t.c +0 -374
- data/ext/geoip2/libmaxminddb/t/data_entry_list_t.c +0 -353
- data/ext/geoip2/libmaxminddb/t/data_types_t.c +0 -439
- data/ext/geoip2/libmaxminddb/t/dump_t.c +0 -103
- data/ext/geoip2/libmaxminddb/t/external_symbols_t.pl +0 -106
- data/ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c +0 -66
- data/ext/geoip2/libmaxminddb/t/get_value_t.c +0 -249
- data/ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c +0 -36
- data/ext/geoip2/libmaxminddb/t/ipv6_lookup_in_ipv4_t.c +0 -48
- data/ext/geoip2/libmaxminddb/t/libtap/.gitignore +0 -13
- data/ext/geoip2/libmaxminddb/t/libtap/.travis.yml +0 -13
- data/ext/geoip2/libmaxminddb/t/libtap/COPYING +0 -165
- data/ext/geoip2/libmaxminddb/t/libtap/INSTALL +0 -41
- data/ext/geoip2/libmaxminddb/t/libtap/Makefile +0 -72
- data/ext/geoip2/libmaxminddb/t/libtap/Makefile.win +0 -37
- data/ext/geoip2/libmaxminddb/t/libtap/README.md +0 -268
- data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.c +0 -20
- data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.expected +0 -28
- data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.c +0 -16
- data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.expected +0 -37
- data/ext/geoip2/libmaxminddb/t/libtap/t/diag.c +0 -10
- data/ext/geoip2/libmaxminddb/t/libtap/t/diag.expected +0 -2
- data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.c +0 -14
- data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.expected +0 -6
- data/ext/geoip2/libmaxminddb/t/libtap/t/is.c +0 -24
- data/ext/geoip2/libmaxminddb/t/libtap/t/is.expected +0 -58
- data/ext/geoip2/libmaxminddb/t/libtap/t/like.c +0 -10
- data/ext/geoip2/libmaxminddb/t/libtap/t/like.expected +0 -4
- data/ext/geoip2/libmaxminddb/t/libtap/t/simple.c +0 -31
- data/ext/geoip2/libmaxminddb/t/libtap/t/simple.expected +0 -32
- data/ext/geoip2/libmaxminddb/t/libtap/t/skip.c +0 -23
- data/ext/geoip2/libmaxminddb/t/libtap/t/skip.expected +0 -9
- data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.c +0 -13
- data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.expected +0 -9
- data/ext/geoip2/libmaxminddb/t/libtap/t/test.c +0 -28
- data/ext/geoip2/libmaxminddb/t/libtap/t/todo.c +0 -17
- data/ext/geoip2/libmaxminddb/t/libtap/t/todo.expected +0 -11
- data/ext/geoip2/libmaxminddb/t/libtap/tap.c +0 -354
- data/ext/geoip2/libmaxminddb/t/libtap/tap.h +0 -115
- data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitattributes +0 -1
- data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitconfig +0 -2
- data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitignore +0 -2
- data/ext/geoip2/libmaxminddb/t/maxmind-db/.perltidyallrc +0 -11
- data/ext/geoip2/libmaxminddb/t/maxmind-db/.tidyallrc +0 -7
- data/ext/geoip2/libmaxminddb/t/maxmind-db/LICENSE +0 -4
- data/ext/geoip2/libmaxminddb/t/maxmind-db/MaxMind-DB-spec.md +0 -558
- data/ext/geoip2/libmaxminddb/t/maxmind-db/README.md +0 -4
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/README.md +0 -7
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +0 -1
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-string-length.mmdb +0 -1
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +0 -1
- data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/perltidyrc +0 -12
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Anonymous-IP-Test.json +0 -32
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-City-Test.json +0 -12616
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Connection-Type-Test.json +0 -102
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Country-Test.json +0 -10975
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-DensityIncome-Test.json +0 -14
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Domain-Test.json +0 -452
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Enterprise-Test.json +0 -666
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-ISP-Test.json +0 -12585
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Precision-Enterprise-Test.json +0 -1035
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoLite2-ASN-Test.json +0 -37
- data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/README +0 -13
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Country-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Domain-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-ISP-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoLite2-ASN-Test.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-nested.mmdb +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/README.md +0 -26
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/maps-with-pointers.raw +0 -0
- data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/write-test-data.pl +0 -614
- data/ext/geoip2/libmaxminddb/t/maxmind-db/tidyall.ini +0 -5
- data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.c +0 -255
- data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.h +0 -69
- data/ext/geoip2/libmaxminddb/t/metadata_pointers_t.c +0 -32
- data/ext/geoip2/libmaxminddb/t/metadata_t.c +0 -226
- data/ext/geoip2/libmaxminddb/t/mmdblookup_t.pl +0 -158
- data/ext/geoip2/libmaxminddb/t/no_map_get_value_t.c +0 -32
- data/ext/geoip2/libmaxminddb/t/read_node_t.c +0 -157
- data/ext/geoip2/libmaxminddb/t/threads_t.c +0 -196
- data/ext/geoip2/libmaxminddb/t/version_t.c +0 -10
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
-
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
-
<ProjectConfiguration Include="Debug|Win32">
|
|
5
|
-
<Configuration>Debug</Configuration>
|
|
6
|
-
<Platform>Win32</Platform>
|
|
7
|
-
</ProjectConfiguration>
|
|
8
|
-
<ProjectConfiguration Include="Release|Win32">
|
|
9
|
-
<Configuration>Release</Configuration>
|
|
10
|
-
<Platform>Win32</Platform>
|
|
11
|
-
</ProjectConfiguration>
|
|
12
|
-
</ItemGroup>
|
|
13
|
-
<PropertyGroup Label="Globals">
|
|
14
|
-
<ProjectGuid>{8E11E9FC-7B63-11E4-AE98-6B41E8A9DDB2}</ProjectGuid>
|
|
15
|
-
<Keyword>Win32Proj</Keyword>
|
|
16
|
-
<RootNamespace>threads</RootNamespace>
|
|
17
|
-
<ProjectName>test_threads</ProjectName>
|
|
18
|
-
</PropertyGroup>
|
|
19
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
20
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
21
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
22
|
-
<UseDebugLibraries>true</UseDebugLibraries>
|
|
23
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
24
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
25
|
-
</PropertyGroup>
|
|
26
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
27
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
28
|
-
<UseDebugLibraries>false</UseDebugLibraries>
|
|
29
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
30
|
-
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
31
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
32
|
-
</PropertyGroup>
|
|
33
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
34
|
-
<ImportGroup Label="ExtensionSettings">
|
|
35
|
-
</ImportGroup>
|
|
36
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
37
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
38
|
-
</ImportGroup>
|
|
39
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
40
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
41
|
-
</ImportGroup>
|
|
42
|
-
<PropertyGroup Label="UserMacros" />
|
|
43
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
44
|
-
<LinkIncremental>true</LinkIncremental>
|
|
45
|
-
</PropertyGroup>
|
|
46
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
47
|
-
<LinkIncremental>false</LinkIncremental>
|
|
48
|
-
</PropertyGroup>
|
|
49
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
50
|
-
<ClCompile>
|
|
51
|
-
<PrecompiledHeader>
|
|
52
|
-
</PrecompiledHeader>
|
|
53
|
-
<WarningLevel>Level3</WarningLevel>
|
|
54
|
-
<Optimization>Disabled</Optimization>
|
|
55
|
-
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
56
|
-
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
|
|
57
|
-
</ClCompile>
|
|
58
|
-
<Link>
|
|
59
|
-
<SubSystem>Console</SubSystem>
|
|
60
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
61
|
-
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
62
|
-
</Link>
|
|
63
|
-
</ItemDefinitionGroup>
|
|
64
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
65
|
-
<ClCompile>
|
|
66
|
-
<WarningLevel>Level3</WarningLevel>
|
|
67
|
-
<PrecompiledHeader>
|
|
68
|
-
</PrecompiledHeader>
|
|
69
|
-
<Optimization>MaxSpeed</Optimization>
|
|
70
|
-
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
71
|
-
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
72
|
-
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
73
|
-
</ClCompile>
|
|
74
|
-
<Link>
|
|
75
|
-
<SubSystem>Console</SubSystem>
|
|
76
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
77
|
-
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
78
|
-
<OptimizeReferences>true</OptimizeReferences>
|
|
79
|
-
</Link>
|
|
80
|
-
</ItemDefinitionGroup>
|
|
81
|
-
<ItemGroup>
|
|
82
|
-
<ClCompile Include="..\..\t\threads_t.c" />
|
|
83
|
-
</ItemGroup>
|
|
84
|
-
<ItemGroup>
|
|
85
|
-
<ProjectReference Include="libtap.vcxproj">
|
|
86
|
-
<Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
|
|
87
|
-
</ProjectReference>
|
|
88
|
-
<ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
|
|
89
|
-
<Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
|
|
90
|
-
</ProjectReference>
|
|
91
|
-
<ProjectReference Include="maxminddb_test_helper.vcxproj">
|
|
92
|
-
<Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
|
|
93
|
-
<Private>true</Private>
|
|
94
|
-
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
|
95
|
-
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
|
96
|
-
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
|
97
|
-
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
|
98
|
-
</ProjectReference>
|
|
99
|
-
</ItemGroup>
|
|
100
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
101
|
-
<ImportGroup Label="ExtensionTargets">
|
|
102
|
-
</ImportGroup>
|
|
103
|
-
</Project>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
-
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
-
<ProjectConfiguration Include="Debug|Win32">
|
|
5
|
-
<Configuration>Debug</Configuration>
|
|
6
|
-
<Platform>Win32</Platform>
|
|
7
|
-
</ProjectConfiguration>
|
|
8
|
-
<ProjectConfiguration Include="Release|Win32">
|
|
9
|
-
<Configuration>Release</Configuration>
|
|
10
|
-
<Platform>Win32</Platform>
|
|
11
|
-
</ProjectConfiguration>
|
|
12
|
-
</ItemGroup>
|
|
13
|
-
<PropertyGroup Label="Globals">
|
|
14
|
-
<ProjectGuid>{B19851FA-376C-11E7-A95B-48C58C130AD6}</ProjectGuid>
|
|
15
|
-
<Keyword>Win32Proj</Keyword>
|
|
16
|
-
<RootNamespace>version</RootNamespace>
|
|
17
|
-
<ProjectName>test_version</ProjectName>
|
|
18
|
-
</PropertyGroup>
|
|
19
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
20
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
21
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
22
|
-
<UseDebugLibraries>true</UseDebugLibraries>
|
|
23
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
24
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
25
|
-
</PropertyGroup>
|
|
26
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
27
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
28
|
-
<UseDebugLibraries>false</UseDebugLibraries>
|
|
29
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
30
|
-
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
31
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
32
|
-
</PropertyGroup>
|
|
33
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
34
|
-
<ImportGroup Label="ExtensionSettings">
|
|
35
|
-
</ImportGroup>
|
|
36
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
37
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
38
|
-
</ImportGroup>
|
|
39
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
40
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
41
|
-
</ImportGroup>
|
|
42
|
-
<PropertyGroup Label="UserMacros" />
|
|
43
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
44
|
-
<LinkIncremental>true</LinkIncremental>
|
|
45
|
-
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
|
46
|
-
</PropertyGroup>
|
|
47
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
48
|
-
<LinkIncremental>false</LinkIncremental>
|
|
49
|
-
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
|
50
|
-
</PropertyGroup>
|
|
51
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
52
|
-
<ClCompile>
|
|
53
|
-
<PrecompiledHeader>
|
|
54
|
-
</PrecompiledHeader>
|
|
55
|
-
<WarningLevel>Level3</WarningLevel>
|
|
56
|
-
<Optimization>Disabled</Optimization>
|
|
57
|
-
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
58
|
-
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
|
|
59
|
-
</ClCompile>
|
|
60
|
-
<Link>
|
|
61
|
-
<SubSystem>Console</SubSystem>
|
|
62
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
63
|
-
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
64
|
-
</Link>
|
|
65
|
-
</ItemDefinitionGroup>
|
|
66
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
67
|
-
<ClCompile>
|
|
68
|
-
<WarningLevel>Level3</WarningLevel>
|
|
69
|
-
<PrecompiledHeader>
|
|
70
|
-
</PrecompiledHeader>
|
|
71
|
-
<Optimization>MaxSpeed</Optimization>
|
|
72
|
-
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
73
|
-
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
74
|
-
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
75
|
-
</ClCompile>
|
|
76
|
-
<Link>
|
|
77
|
-
<SubSystem>Console</SubSystem>
|
|
78
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
79
|
-
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
80
|
-
<OptimizeReferences>true</OptimizeReferences>
|
|
81
|
-
</Link>
|
|
82
|
-
</ItemDefinitionGroup>
|
|
83
|
-
<ItemGroup>
|
|
84
|
-
<ClCompile Include="..\..\t\version_t.c" />
|
|
85
|
-
</ItemGroup>
|
|
86
|
-
<ItemGroup>
|
|
87
|
-
<ProjectReference Include="libtap.vcxproj">
|
|
88
|
-
<Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
|
|
89
|
-
</ProjectReference>
|
|
90
|
-
<ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
|
|
91
|
-
<Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
|
|
92
|
-
</ProjectReference>
|
|
93
|
-
<ProjectReference Include="maxminddb_test_helper.vcxproj">
|
|
94
|
-
<Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
|
|
95
|
-
<Private>true</Private>
|
|
96
|
-
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
|
97
|
-
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
|
98
|
-
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
|
99
|
-
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
|
100
|
-
</ProjectReference>
|
|
101
|
-
</ItemGroup>
|
|
102
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
103
|
-
<ImportGroup Label="ExtensionTargets">
|
|
104
|
-
</ImportGroup>
|
|
105
|
-
</Project>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
-
<ItemGroup Label="ProjectConfigurations">
|
|
4
|
-
<ProjectConfiguration Include="Debug|Win32">
|
|
5
|
-
<Configuration>Debug</Configuration>
|
|
6
|
-
<Platform>Win32</Platform>
|
|
7
|
-
</ProjectConfiguration>
|
|
8
|
-
<ProjectConfiguration Include="Release|Win32">
|
|
9
|
-
<Configuration>Release</Configuration>
|
|
10
|
-
<Platform>Win32</Platform>
|
|
11
|
-
</ProjectConfiguration>
|
|
12
|
-
</ItemGroup>
|
|
13
|
-
<PropertyGroup Label="Globals">
|
|
14
|
-
<ProjectGuid>{%UUID%}</ProjectGuid>
|
|
15
|
-
<Keyword>Win32Proj</Keyword>
|
|
16
|
-
<RootNamespace>%TESTNAME%</RootNamespace>
|
|
17
|
-
<ProjectName>test_%TESTNAME%</ProjectName>
|
|
18
|
-
</PropertyGroup>
|
|
19
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
20
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
21
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
22
|
-
<UseDebugLibraries>true</UseDebugLibraries>
|
|
23
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
24
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
25
|
-
</PropertyGroup>
|
|
26
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
27
|
-
<ConfigurationType>Application</ConfigurationType>
|
|
28
|
-
<UseDebugLibraries>false</UseDebugLibraries>
|
|
29
|
-
<PlatformToolset>v120</PlatformToolset>
|
|
30
|
-
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
31
|
-
<CharacterSet>Unicode</CharacterSet>
|
|
32
|
-
</PropertyGroup>
|
|
33
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
34
|
-
<ImportGroup Label="ExtensionSettings">
|
|
35
|
-
</ImportGroup>
|
|
36
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
37
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
38
|
-
</ImportGroup>
|
|
39
|
-
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
40
|
-
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
41
|
-
</ImportGroup>
|
|
42
|
-
<PropertyGroup Label="UserMacros" />
|
|
43
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
44
|
-
<LinkIncremental>true</LinkIncremental>
|
|
45
|
-
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
|
46
|
-
</PropertyGroup>
|
|
47
|
-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
48
|
-
<LinkIncremental>false</LinkIncremental>
|
|
49
|
-
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
|
|
50
|
-
</PropertyGroup>
|
|
51
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
52
|
-
<ClCompile>
|
|
53
|
-
<PrecompiledHeader>
|
|
54
|
-
</PrecompiledHeader>
|
|
55
|
-
<WarningLevel>Level3</WarningLevel>
|
|
56
|
-
<Optimization>Disabled</Optimization>
|
|
57
|
-
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
58
|
-
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\include;$(SolutionDir)\..\..\t\libtap</AdditionalIncludeDirectories>
|
|
59
|
-
</ClCompile>
|
|
60
|
-
<Link>
|
|
61
|
-
<SubSystem>Console</SubSystem>
|
|
62
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
63
|
-
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
64
|
-
</Link>
|
|
65
|
-
</ItemDefinitionGroup>
|
|
66
|
-
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
67
|
-
<ClCompile>
|
|
68
|
-
<WarningLevel>Level3</WarningLevel>
|
|
69
|
-
<PrecompiledHeader>
|
|
70
|
-
</PrecompiledHeader>
|
|
71
|
-
<Optimization>MaxSpeed</Optimization>
|
|
72
|
-
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
73
|
-
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
74
|
-
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
75
|
-
</ClCompile>
|
|
76
|
-
<Link>
|
|
77
|
-
<SubSystem>Console</SubSystem>
|
|
78
|
-
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
79
|
-
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
80
|
-
<OptimizeReferences>true</OptimizeReferences>
|
|
81
|
-
</Link>
|
|
82
|
-
</ItemDefinitionGroup>
|
|
83
|
-
<ItemGroup>
|
|
84
|
-
<ClCompile Include="..\..\t\%TESTNAME%_t.c" />
|
|
85
|
-
</ItemGroup>
|
|
86
|
-
<ItemGroup>
|
|
87
|
-
<ProjectReference Include="libtap.vcxproj">
|
|
88
|
-
<Project>{4dfc985a-83d7-4e61-85fe-c6ea6e43e3aa}</Project>
|
|
89
|
-
</ProjectReference>
|
|
90
|
-
<ProjectReference Include="..\VS12\libmaxminddb.vcxproj">
|
|
91
|
-
<Project>{82953bda-2960-4ada-a6d5-92e65ccb4a3d}</Project>
|
|
92
|
-
</ProjectReference>
|
|
93
|
-
<ProjectReference Include="maxminddb_test_helper.vcxproj">
|
|
94
|
-
<Project>{a8f568f6-5507-4ec2-a834-f2c0a3c635a5}</Project>
|
|
95
|
-
<Private>true</Private>
|
|
96
|
-
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
|
97
|
-
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
|
98
|
-
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
|
99
|
-
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
|
100
|
-
</ProjectReference>
|
|
101
|
-
</ItemGroup>
|
|
102
|
-
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
103
|
-
<ImportGroup Label="ExtensionTargets">
|
|
104
|
-
</ImportGroup>
|
|
105
|
-
</Project>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
include $(top_srcdir)/common.mk
|
|
2
|
-
|
|
3
|
-
lib_LTLIBRARIES = libmaxminddb.la
|
|
4
|
-
|
|
5
|
-
libmaxminddb_la_SOURCES = maxminddb.c maxminddb-compat-util.h \
|
|
6
|
-
data-pool.c data-pool.h
|
|
7
|
-
libmaxminddb_la_LDFLAGS = -version-info 0:7:0 -export-symbols-regex '^MMDB_.*'
|
|
8
|
-
include_HEADERS = $(top_srcdir)/include/maxminddb.h
|
|
9
|
-
|
|
10
|
-
pkgconfig_DATA = libmaxminddb.pc
|
|
11
|
-
|
|
12
|
-
TESTS = test-data-pool
|
|
13
|
-
|
|
14
|
-
check_PROGRAMS = test-data-pool
|
|
15
|
-
|
|
16
|
-
test_data_pool_SOURCES = data-pool.c data-pool.h
|
|
17
|
-
test_data_pool_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/t -DTEST_DATA_POOL
|
|
18
|
-
test_data_pool_LDADD = $(top_srcdir)/t/libmmdbtest.la \
|
|
19
|
-
$(top_srcdir)/t/libtap/libtap.a
|
|
20
|
-
|
|
21
|
-
$(top_srcdir)/t/libmmdbtest.la:
|
|
22
|
-
$(MAKE) -C $(top_srcdir)/t libmmdbtest.la
|
|
23
|
-
|
|
24
|
-
$(top_srcdir)/t/libtap/libtap.a:
|
|
25
|
-
$(MAKE) -C $(top_srcdir)/t/libtap libtap.a
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
#include "data-pool.h"
|
|
2
|
-
#include "maxminddb.h"
|
|
3
|
-
|
|
4
|
-
#include <stdbool.h>
|
|
5
|
-
#include <stddef.h>
|
|
6
|
-
#include <stdlib.h>
|
|
7
|
-
|
|
8
|
-
static bool can_multiply(size_t const, size_t const, size_t const);
|
|
9
|
-
|
|
10
|
-
// Allocate an MMDB_data_pool_s. It initially has space for size
|
|
11
|
-
// MMDB_entry_data_list_s structs.
|
|
12
|
-
MMDB_data_pool_s *data_pool_new(size_t const size)
|
|
13
|
-
{
|
|
14
|
-
MMDB_data_pool_s *const pool = calloc(1, sizeof(MMDB_data_pool_s));
|
|
15
|
-
if (!pool) {
|
|
16
|
-
return NULL;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (size == 0 ||
|
|
20
|
-
!can_multiply(SIZE_MAX, size, sizeof(MMDB_entry_data_list_s))) {
|
|
21
|
-
data_pool_destroy(pool);
|
|
22
|
-
return NULL;
|
|
23
|
-
}
|
|
24
|
-
pool->size = size;
|
|
25
|
-
pool->blocks[0] = calloc(pool->size, sizeof(MMDB_entry_data_list_s));
|
|
26
|
-
if (!pool->blocks[0]) {
|
|
27
|
-
data_pool_destroy(pool);
|
|
28
|
-
return NULL;
|
|
29
|
-
}
|
|
30
|
-
pool->blocks[0]->pool = pool;
|
|
31
|
-
|
|
32
|
-
pool->sizes[0] = size;
|
|
33
|
-
|
|
34
|
-
pool->block = pool->blocks[0];
|
|
35
|
-
|
|
36
|
-
return pool;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Determine if we can multiply m*n. We can do this if the result will be below
|
|
40
|
-
// the given max. max will typically be SIZE_MAX.
|
|
41
|
-
//
|
|
42
|
-
// We want to know if we'll wrap around.
|
|
43
|
-
static bool can_multiply(size_t const max, size_t const m, size_t const n)
|
|
44
|
-
{
|
|
45
|
-
if (m == 0) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return n <= max / m;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Clean up the data pool.
|
|
53
|
-
void data_pool_destroy(MMDB_data_pool_s *const pool)
|
|
54
|
-
{
|
|
55
|
-
if (!pool) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (size_t i = 0; i <= pool->index; i++) {
|
|
60
|
-
free(pool->blocks[i]);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
free(pool);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Claim a new struct from the pool. Doing this may cause the pool's size to
|
|
67
|
-
// grow.
|
|
68
|
-
MMDB_entry_data_list_s *data_pool_alloc(MMDB_data_pool_s *const pool)
|
|
69
|
-
{
|
|
70
|
-
if (!pool) {
|
|
71
|
-
return NULL;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (pool->used < pool->size) {
|
|
75
|
-
MMDB_entry_data_list_s *const element = pool->block + pool->used;
|
|
76
|
-
pool->used++;
|
|
77
|
-
return element;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Take it from a new block of memory.
|
|
81
|
-
|
|
82
|
-
size_t const new_index = pool->index + 1;
|
|
83
|
-
if (new_index == DATA_POOL_NUM_BLOCKS) {
|
|
84
|
-
// See the comment about not growing this on DATA_POOL_NUM_BLOCKS.
|
|
85
|
-
return NULL;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!can_multiply(SIZE_MAX, pool->size, 2)) {
|
|
89
|
-
return NULL;
|
|
90
|
-
}
|
|
91
|
-
size_t const new_size = pool->size * 2;
|
|
92
|
-
|
|
93
|
-
if (!can_multiply(SIZE_MAX, new_size, sizeof(MMDB_entry_data_list_s))) {
|
|
94
|
-
return NULL;
|
|
95
|
-
}
|
|
96
|
-
pool->blocks[new_index] = calloc(new_size, sizeof(MMDB_entry_data_list_s));
|
|
97
|
-
if (!pool->blocks[new_index]) {
|
|
98
|
-
return NULL;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// We don't need to set this, but it's useful for introspection in tests.
|
|
102
|
-
pool->blocks[new_index]->pool = pool;
|
|
103
|
-
|
|
104
|
-
pool->index = new_index;
|
|
105
|
-
pool->block = pool->blocks[pool->index];
|
|
106
|
-
|
|
107
|
-
pool->size = new_size;
|
|
108
|
-
pool->sizes[pool->index] = pool->size;
|
|
109
|
-
|
|
110
|
-
MMDB_entry_data_list_s *const element = pool->block;
|
|
111
|
-
pool->used = 1;
|
|
112
|
-
return element;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Turn the structs in the array-like pool into a linked list.
|
|
116
|
-
//
|
|
117
|
-
// Before calling this function, the list isn't linked up.
|
|
118
|
-
MMDB_entry_data_list_s *data_pool_to_list(MMDB_data_pool_s *const pool)
|
|
119
|
-
{
|
|
120
|
-
if (!pool) {
|
|
121
|
-
return NULL;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (pool->index == 0 && pool->used == 0) {
|
|
125
|
-
return NULL;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
for (size_t i = 0; i <= pool->index; i++) {
|
|
129
|
-
MMDB_entry_data_list_s *const block = pool->blocks[i];
|
|
130
|
-
|
|
131
|
-
size_t size = pool->sizes[i];
|
|
132
|
-
if (i == pool->index) {
|
|
133
|
-
size = pool->used;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
for (size_t j = 0; j < size - 1; j++) {
|
|
137
|
-
MMDB_entry_data_list_s *const cur = block + j;
|
|
138
|
-
cur->next = block + j + 1;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (i < pool->index) {
|
|
142
|
-
MMDB_entry_data_list_s *const last = block + size - 1;
|
|
143
|
-
last->next = pool->blocks[i + 1];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return pool->blocks[0];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
#ifdef TEST_DATA_POOL
|
|
151
|
-
|
|
152
|
-
#include <libtap/tap.h>
|
|
153
|
-
#include <maxminddb_test_helper.h>
|
|
154
|
-
|
|
155
|
-
static void test_can_multiply(void);
|
|
156
|
-
|
|
157
|
-
int main(void)
|
|
158
|
-
{
|
|
159
|
-
plan(NO_PLAN);
|
|
160
|
-
test_can_multiply();
|
|
161
|
-
done_testing();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
static void test_can_multiply(void)
|
|
165
|
-
{
|
|
166
|
-
{
|
|
167
|
-
ok(can_multiply(SIZE_MAX, 1, SIZE_MAX), "1*SIZE_MAX is ok");
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
ok(!can_multiply(SIZE_MAX, 2, SIZE_MAX), "2*SIZE_MAX is not ok");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
{
|
|
175
|
-
ok(can_multiply(SIZE_MAX, 10240, sizeof(MMDB_entry_data_list_s)),
|
|
176
|
-
"1024 entry_data_list_s's are okay");
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
#endif
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#ifndef DATA_POOL_H
|
|
2
|
-
#define DATA_POOL_H
|
|
3
|
-
|
|
4
|
-
#include "maxminddb.h"
|
|
5
|
-
|
|
6
|
-
#include <stdbool.h>
|
|
7
|
-
#include <stddef.h>
|
|
8
|
-
|
|
9
|
-
// This should be large enough that we never need to grow the array of pointers
|
|
10
|
-
// to blocks. 32 is enough. Even starting out of with size 1 (1 struct), the
|
|
11
|
-
// 32nd element alone will provide 2**32 structs as we exponentially increase
|
|
12
|
-
// the number in each block. Being confident that we do not have to grow the
|
|
13
|
-
// array lets us avoid writing code to do that. That code would be risky as it
|
|
14
|
-
// would rarely be hit and likely not be well tested.
|
|
15
|
-
#define DATA_POOL_NUM_BLOCKS 32
|
|
16
|
-
|
|
17
|
-
// A pool of memory for MMDB_entry_data_list_s structs. This is so we can
|
|
18
|
-
// allocate multiple up front rather than one at a time for performance
|
|
19
|
-
// reasons.
|
|
20
|
-
//
|
|
21
|
-
// The order you add elements to it (by calling data_pool_alloc()) ends up as
|
|
22
|
-
// the order of the list.
|
|
23
|
-
//
|
|
24
|
-
// The memory only grows. There is no support for releasing an element you take
|
|
25
|
-
// back to the pool.
|
|
26
|
-
typedef struct MMDB_data_pool_s {
|
|
27
|
-
// Index of the current block we're allocating out of.
|
|
28
|
-
size_t index;
|
|
29
|
-
|
|
30
|
-
// The size of the current block, counting by structs.
|
|
31
|
-
size_t size;
|
|
32
|
-
|
|
33
|
-
// How many used in the current block, counting by structs.
|
|
34
|
-
size_t used;
|
|
35
|
-
|
|
36
|
-
// The current block we're allocating out of.
|
|
37
|
-
MMDB_entry_data_list_s *block;
|
|
38
|
-
|
|
39
|
-
// The size of each block.
|
|
40
|
-
size_t sizes[DATA_POOL_NUM_BLOCKS];
|
|
41
|
-
|
|
42
|
-
// An array of pointers to blocks of memory holding space for list
|
|
43
|
-
// elements.
|
|
44
|
-
MMDB_entry_data_list_s *blocks[DATA_POOL_NUM_BLOCKS];
|
|
45
|
-
} MMDB_data_pool_s;
|
|
46
|
-
|
|
47
|
-
MMDB_data_pool_s *data_pool_new(size_t const);
|
|
48
|
-
void data_pool_destroy(MMDB_data_pool_s *const);
|
|
49
|
-
MMDB_entry_data_list_s *data_pool_alloc(MMDB_data_pool_s *const);
|
|
50
|
-
MMDB_entry_data_list_s *data_pool_to_list(MMDB_data_pool_s *const);
|
|
51
|
-
|
|
52
|
-
#endif
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
prefix=@prefix@
|
|
2
|
-
exec_prefix=@prefix@
|
|
3
|
-
libdir=@libdir@
|
|
4
|
-
includedir=@includedir@
|
|
5
|
-
|
|
6
|
-
Name: libmaxminddb
|
|
7
|
-
Description: C library for the MaxMind DB file format
|
|
8
|
-
URL: http://maxmind.github.io/libmaxminddb/
|
|
9
|
-
Version: @PACKAGE_VERSION@
|
|
10
|
-
Libs: -L${libdir} -lmaxminddb
|
|
11
|
-
Cflags: -I${includedir}
|