line |
true |
false |
branch |
169
|
0 |
292 |
if(c->is_utf8) |
172
|
0 |
292 |
if (cdb_read(c, buf, len, cdb_datapos(c)) == -1) |
185
|
0 |
277 |
if(c->is_utf8) |
202
|
0 |
215 |
if (newpos < len) { |
213
|
34 |
9 |
if (!head || (head->num >= CDB_HPLIST)) { |
|
0 |
34 |
if (!head || (head->num >= CDB_HPLIST)) { |
223
|
0 |
43 |
if (posplus(c, 8) == -1) |
225
|
0 |
43 |
if (posplus(c, keylen) == -1) |
227
|
0 |
43 |
if (posplus(c, datalen) == -1) |
240
|
672 |
183 |
while (len) { |
276
|
0 |
140 |
if(c->map == NULL) croak("Called cdb_map_addr on a system without mmap"); |
278
|
140 |
0 |
if ((pos > c->size) || (c->size - pos < len)) { |
|
0 |
140 |
if ((pos > c->size) || (c->size - pos < len)) { |
289
|
2150 |
1 |
if (c->map) { |
290
|
2150 |
0 |
if ((pos > c->size) || (c->size - pos < len)) { |
|
0 |
2150 |
if ((pos > c->size) || (c->size - pos < len)) { |
299
|
0 |
1 |
if (PerlIO_seek(c->fh, pos, SEEK_SET) == -1) return -1; |
300
|
1 |
0 |
while (len > 0) { |
304
|
0 |
1 |
while ((r == -1) && (errno == EINTR)); |
|
0 |
0 |
while ((r == -1) && (errno == EINTR)); |
305
|
0 |
1 |
if (r == -1) return -1; |
306
|
1 |
0 |
if (r == 0) { |
319
|
0 |
462 |
if( left->is_utf8 != right->is_utf8 ) { |
320
|
0 |
0 |
if(left->is_utf8) |
327
|
462 |
0 |
return (left->len == right->len) && memEQ(left->pv, right->pv, right->len); |
|
460 |
2 |
return (left->len == right->len) && memEQ(left->pv, right->pv, right->len); |
379
|
140 |
18 |
if (!c->loop) { |
380
|
0 |
140 |
if(to_find->hash != 0) /* hash cache (except when the value is 0) */ |
386
|
1 |
139 |
if (cdb_read(c,buf,8,(u << 3) & 2047) == -1) |
389
|
6 |
133 |
if (!c->hslots) |
399
|
151 |
0 |
while (c->loop < c->hslots) { |
400
|
0 |
151 |
if (cdb_read(c,buf,8,c->kpos) == -1) |
403
|
11 |
140 |
if (!pos) |
407
|
116 |
24 |
if (c->kpos == c->hpos + (c->hslots << 3)) |
410
|
140 |
0 |
if (u == c->khash) { |
411
|
0 |
140 |
if (cdb_read(c,buf,8,pos) == -1) |
414
|
140 |
0 |
if (next_key_len == to_find->len) { |
444
|
548 |
7 |
if (c->curkey_allocated >= len && c->curkey_allocated < CDB_MAX_BUFFER_LEN) return; |
|
548 |
0 |
if (c->curkey_allocated >= len && c->curkey_allocated < CDB_MAX_BUFFER_LEN) return; |
447
|
7 |
0 |
if(len < CDB_MAX_BUFFER_LEN && c->curkey_allocated > CDB_MAX_BUFFER_LEN) { |
|
0 |
7 |
if(len < CDB_MAX_BUFFER_LEN && c->curkey_allocated > CDB_MAX_BUFFER_LEN) { |
454
|
0 |
7 |
if(c->curkey.pv) |
468
|
0 |
53 |
if (cdb_read(c, buf, 4, 0) == -1) |
480
|
409 |
44 |
if (c->curpos < c->end) { |
481
|
0 |
409 |
if (cdb_read(c, buf, 8, c->curpos) == -1) |
487
|
0 |
409 |
if (cdb_read(c, c->curkey.pv, klen, c->curpos + 8) == -1) |
498
|
0 |
401 |
if (cdb_read(c, buf, 8, c->curpos) == -1) |
506
|
30 |
6 |
if (c->end != 0) { |
570
|
0 |
13 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
|
0 |
0 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
|
0 |
0 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
581
|
1 |
12 |
if (!f) |
589
|
12 |
0 |
if (fstat(fd, &st) == 0) { |
590
|
12 |
0 |
if (st.st_size <= 0xffffffff) { |
594
|
11 |
1 |
if (x != (char *)-1) { |
616
|
1 |
166 |
if (!SvOK(k)) { |
|
1 |
0 |
if (!SvOK(k)) { |
|
1 |
0 |
if (!SvOK(k)) { |
620
|
0 |
166 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
0 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
166 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
622
|
0 |
166 |
to_find.is_utf8 = this->is_utf8 && SvUTF8(k); |
|
0 |
0 |
to_find.is_utf8 = this->is_utf8 && SvUTF8(k); |
625
|
158 |
8 |
if (this->end && cdb_key_eq(&this->curkey, &to_find)) { |
|
156 |
2 |
if (this->end && cdb_key_eq(&this->curkey, &to_find)) { |
626
|
0 |
156 |
if (cdb_read(this, buf, 8, this->curpos) == -1) |
630
|
126 |
30 |
if (this->fetch_advance) { |
632
|
13 |
113 |
if (!iter_key(this)) { |
641
|
9 |
1 |
if ((found != 0) && (found != 1)) readerror(); |
|
1 |
8 |
if ((found != 0) && (found != 1)) readerror(); |
644
|
164 |
1 |
if (found) { |
670
|
110 |
11 |
while(iter_key(this)) { |
673
|
110 |
0 |
if ((found != 0) && (found != 1)) |
|
0 |
110 |
if ((found != 0) && (found != 1)) |
681
|
0 |
110 |
if (! hv_store_ent(RETVAL, keysv, keyvalue, 0)) { |
705
|
0 |
12 |
if (!SvOK(k)) { |
|
0 |
0 |
if (!SvOK(k)) { |
|
0 |
0 |
if (!SvOK(k)) { |
712
|
0 |
12 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
0 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
11 |
1 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
718
|
18 |
12 |
if ((found != 0) && (found != 1)) |
|
0 |
18 |
if ((found != 0) && (found != 1)) |
720
|
12 |
18 |
if (!found) |
741
|
1 |
8 |
if (!SvOK(k)) { |
|
1 |
0 |
if (!SvOK(k)) { |
|
1 |
0 |
if (!SvOK(k)) { |
745
|
0 |
8 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
0 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
8 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
750
|
4 |
4 |
if (RETVAL != 0 && RETVAL != 1) |
|
0 |
4 |
if (RETVAL != 0 && RETVAL != 1) |
764
|
13 |
0 |
if (sv_isobject(db) && (SvTYPE(SvRV(db)) == SVt_PVMG) ) { |
|
12 |
1 |
if (sv_isobject(db) && (SvTYPE(SvRV(db)) == SVt_PVMG) ) { |
765
|
12 |
0 |
this = (cdb*)SvIV(SvRV(db)); |
767
|
7 |
5 |
if (this->curkey.pv) |
772
|
11 |
1 |
if (this->map) { |
787
|
21 |
1 |
if (iter_key(this)) { |
804
|
0 |
165 |
if (!SvOK(k)) { |
|
0 |
0 |
if (!SvOK(k)) { |
|
0 |
0 |
if (!SvOK(k)) { |
808
|
0 |
165 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
0 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
|
165 |
0 |
to_find.pv = this->is_utf8 ? SvPVutf8(k, to_find.len) : SvPV(k, to_find.len); |
814
|
164 |
1 |
if (this->end == 0 || !cdb_key_eq(&this->curkey, &to_find)) |
|
0 |
164 |
if (this->end == 0 || !cdb_key_eq(&this->curkey, &to_find)) |
817
|
146 |
19 |
if (iter_key(this)) { |
842
|
0 |
11 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
|
0 |
0 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
|
0 |
0 |
if(strlen(option_key) == 4 && strnEQ("utf8", option_key, 4) && is_utf8 ) |
853
|
1 |
10 |
if (!cdbmake->f) XSRETURN_UNDEF; |
855
|
0 |
10 |
if (cdb_make_start(cdbmake) < 0) XSRETURN_UNDEF; |
880
|
10 |
0 |
if (sv_isobject(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG) ) { |
|
10 |
0 |
if (sv_isobject(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG) ) { |
881
|
10 |
0 |
this = (cdb_make*)SvIV(SvRV(sv)); |
882
|
0 |
10 |
if(this->f) { |
904
|
43 |
42 |
for (x = 1; x < items; x += 2) { |
908
|
0 |
43 |
if(!SvOK(k)) { |
|
0 |
0 |
if(!SvOK(k)) { |
|
0 |
0 |
if(!SvOK(k)) { |
913
|
0 |
43 |
if(!SvOK(v)) { |
|
0 |
0 |
if(!SvOK(v)) { |
|
0 |
0 |
if(!SvOK(v)) { |
918
|
0 |
43 |
kp = is_utf8 ? SvPVutf8(k, klen) : SvPV(k, klen); |
|
0 |
0 |
kp = is_utf8 ? SvPVutf8(k, klen) : SvPV(k, klen); |
|
32 |
11 |
kp = is_utf8 ? SvPVutf8(k, klen) : SvPV(k, klen); |
919
|
0 |
43 |
vp = is_utf8 ? SvPVutf8(v, vlen) : SvPV(v, vlen); |
|
0 |
0 |
vp = is_utf8 ? SvPVutf8(v, vlen) : SvPV(v, vlen); |
|
40 |
3 |
vp = is_utf8 ? SvPVutf8(v, vlen) : SvPV(v, vlen); |
924
|
0 |
43 |
if (PerlIO_write(this->f, packbuf, 8) < 8) |
928
|
0 |
43 |
if (PerlIO_write(this->f, kp, klen) < klen) |
930
|
0 |
43 |
if (PerlIO_write(this->f, vp, vlen) < vlen) |
933
|
0 |
43 |
if (cdb_make_addend(this, klen, vlen, h) == -1) |
950
|
2560 |
10 |
for (i = 0; i < 256; ++i) |
953
|
9 |
10 |
for (x = this->head; x; x = x->next) { |
955
|
43 |
9 |
while (i--) { |
961
|
2560 |
10 |
for (i = 0; i < 256; ++i) { |
963
|
9 |
2551 |
if (u > memsize) |
970
|
0 |
10 |
if (memsize > u) { |
975
|
0 |
10 |
New(0xCDB, this->split, memsize, struct cdb_hp); |
980
|
2560 |
10 |
for (i = 0; i < 256; ++i) { |
986
|
9 |
10 |
for (x = this->head; x; x = x->next) { |
988
|
43 |
9 |
while (i--) { |
992
|
0 |
9 |
if (prev) |
997
|
9 |
1 |
if (prev) |
1000
|
2560 |
10 |
for (i = 0; i < 256; ++i) { |
1007
|
86 |
2560 |
for (u = 0; u < len; ++u) { |
1012
|
43 |
2560 |
for (u = 0; u < count; ++u) { |
1014
|
3 |
43 |
while (this->hash[where].p) { |
1015
|
2 |
1 |
if (++where == len) |
1022
|
86 |
2560 |
for (u = 0; u < len; ++u) { |
1026
|
0 |
86 |
if (PerlIO_write(this->f, buf, 8) == -1) |
1029
|
0 |
86 |
if (posplus(this, 8) == -1) |
1036
|
0 |
10 |
if (PerlIO_flush(this->f) == EOF) writeerror(); |
1039
|
0 |
10 |
if (PerlIO_write(this->f, this->final, sizeof this->final) < sizeof this->final) |
1042
|
0 |
10 |
if (PerlIO_flush(this->f) == EOF) |
1045
|
0 |
10 |
if (fsync(PerlIO_fileno(this->f)) == -1) |
1048
|
0 |
10 |
if (PerlIO_close(this->f) == EOF) |
1052
|
0 |
10 |
if (rename(this->fntemp, this->fn)) { |