line |
true |
false |
branch |
41
|
4011 |
322 |
while (c = *src++) { |
42
|
917 |
3094 |
if (c == '.') { |
43
|
917 |
0 |
if (++parts > 3 || part < 0) return 0; |
|
903 |
14 |
if (++parts > 3 || part < 0) return 0; |
46
|
2905 |
189 |
} else if ((c -= '0') >= 0 |
47
|
2814 |
91 |
&& c <= 9) { |
48
|
1239 |
1575 |
if (part < 0) part = c; |
49
|
1547 |
28 |
else if ((part = part*10 + c) > 255) return 0; |
52
|
301 |
21 |
if (part < 0 || parts < 3) return 0; |
74
|
0 |
9 |
if (mode > 3) croak("operand of IP::World::new = %d, should be 0-3", mode); |
76
|
7 |
2 |
if (mode != 2) self.io.p = PerlIO_open(filepath, "rb"); |
80
|
0 |
9 |
if (!self.io.f) croak("Can't open %s: %s", filepath, strerror(errno)); |
84
|
2 |
7 |
if (mode == 1) { |
92
|
0 |
2 |
if (self.addr == MAP_FAILED) |
96
|
3 |
4 |
if (mode < 2) { |
103
|
0 |
3 |
if (!self.addr) croak ("memory allocation for %s failed", filepath); |
110
|
0 |
3 |
if (readLen < 0) croak("read from %s failed: %s", filepath, strerror(errno)); |
111
|
0 |
3 |
if ((STRLEN)readLen != fileLen) |
117
|
5 |
4 |
if (mode < 2) |
149
|
651 |
0 |
if (sv_isobject(self_ref)) { |
151
|
651 |
0 |
if (SvPOK(self_deref)) s = SvPV(self_deref, len); |
|
651 |
0 |
if (SvPOK(self_deref)) s = SvPV(self_deref, len); |
153
|
0 |
651 |
if (len != sizeof(wip_self)) |
157
|
7 |
644 |
if (!SvOK(ip_sv)) goto set_retval; |
|
7 |
0 |
if (!SvOK(ip_sv)) goto set_retval; |
|
0 |
7 |
if (!SvOK(ip_sv)) goto set_retval; |
159
|
644 |
0 |
if (!(flgs & (SVp_POK|SVf_NOK|SVp_NOK|SVf_IOK|SVp_IOK))) goto set_retval; |
160
|
644 |
0 |
s = SvPV(ip_sv, len); |
163
|
343 |
301 |
if (ck_ip4(s, netip) > 0) s = (char *)netip; |
164
|
315 |
28 |
else if (len != 4) goto set_retval; |
169
|
352 |
264 |
if (self.mode < 2) { |
172
|
4512 |
264 |
while (bottom < top-1) { |
175
|
2199 |
2313 |
if (ip < ips[i]) top = i; |
183
|
6016 |
352 |
while (bottom < top-1) { |
187
|
3008 |
3008 |
if (self.mode == 3) { |
197
|
3084 |
2932 |
if (ip < word) top = i; |
203
|
176 |
176 |
if (self.mode == 3) { |
219
|
161 |
455 |
if (word == 26*26) c[0] = c[1] = '?'; |
240
|
9 |
0 |
if (sv_isobject(self_ref)) { |
242
|
9 |
0 |
if (SvPOK(self_deref)) |
243
|
9 |
0 |
s = SvPV(self_deref, len); |
245
|
0 |
9 |
if (len != sizeof(wip_self)) |
249
|
2 |
7 |
if (self.mode == 1) munmap((caddr_t)self.addr, (size_t)((self.entries<<4)/3)); |
252
|
3 |
4 |
if (self.mode < 2) Safefree(self.addr); |
255
|
2 |
2 |
if (self.mode == 3) PerlIO_close(self.io.p); |