mmdb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/mmdb/mmdb.c +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e5f7bbfaa5e24e81cfd768fa0832cabc759e253
|
4
|
+
data.tar.gz: d016b0ec38b2ac3fca4d8fae2f19eebf1f81fa52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dff7fdc715b8e670a316da3e790f705b027d54bbd483e333f240dbe547da799e325cb803369eaefedc22d26a56b948d250f6fb104509ca0a5f9286aeb32daed
|
7
|
+
data.tar.gz: 8657a8313b32767fd274cb02fdf2919a2b1882abc41c30a98e5d966e9a63f891d2c1e5c2484a0e744d95f1dca51e92d47c92d33d15764c35d684270edccfc890
|
data/ext/mmdb/mmdb.c
CHANGED
@@ -52,6 +52,7 @@ maxminddb_memsize(const void *p) {
|
|
52
52
|
void
|
53
53
|
maxminddb_free(void *p) {
|
54
54
|
struct MaxMindDB *ptr = p;
|
55
|
+
|
55
56
|
if (ptr) {
|
56
57
|
if (ptr->mmdb) {
|
57
58
|
MMDB_close(ptr->mmdb);
|
@@ -72,9 +73,11 @@ static const rb_data_type_t mmdb_data_type = {
|
|
72
73
|
static struct MaxMindDB*
|
73
74
|
get_maxminddb(VALUE self) {
|
74
75
|
struct MaxMindDB *ptr = check_maxminddb(self);
|
76
|
+
|
75
77
|
if (!ptr) {
|
76
78
|
rb_raise(rb_eStandardError, "uninitialized");
|
77
79
|
}
|
80
|
+
|
78
81
|
return ptr;
|
79
82
|
}
|
80
83
|
|
@@ -134,7 +137,6 @@ maxminddb_initialize(int argc, VALUE* argv, VALUE self) {
|
|
134
137
|
VALUE
|
135
138
|
maxminddb_lookup(VALUE self, VALUE ip) {
|
136
139
|
VALUE ret;
|
137
|
-
char *target;
|
138
140
|
int gai_error, mmdb_error;
|
139
141
|
struct MaxMindDB *ptr = MaxMindDB(self);
|
140
142
|
MMDB_s *mmdb = ptr->mmdb;
|
@@ -143,9 +145,7 @@ maxminddb_lookup(VALUE self, VALUE ip) {
|
|
143
145
|
return Qnil;
|
144
146
|
}
|
145
147
|
|
146
|
-
|
147
|
-
|
148
|
-
MMDB_lookup_result_s lookuped = MMDB_lookup_string(mmdb, target, &gai_error, &mmdb_error);
|
148
|
+
MMDB_lookup_result_s lookuped = MMDB_lookup_string(mmdb, StringValuePtr(ip), &gai_error, &mmdb_error);
|
149
149
|
if (gai_error) {
|
150
150
|
rb_sys_fail(gai_strerror(gai_error));
|
151
151
|
}
|
@@ -185,6 +185,7 @@ maxminddb_close(VALUE self) {
|
|
185
185
|
if (ptr) {
|
186
186
|
if (ptr->mmdb) {
|
187
187
|
MMDB_close(ptr->mmdb);
|
188
|
+
ptr->mmdb = NULL;
|
188
189
|
}
|
189
190
|
}
|
190
191
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoppi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|