| line |
true |
false |
branch |
|
126
|
28 |
28 |
if (!g_file_plugin_registry) |
|
134
|
56 |
0 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
|
56 |
0 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
|
0 |
56 |
if (!plugin || !plugin->name || !*plugin->name) return -1; |
|
138
|
1 |
55 |
if (hv_exists(g_file_plugin_registry, plugin->name, name_len)) |
|
142
|
0 |
55 |
if (!hv_store(g_file_plugin_registry, plugin->name, name_len, entry, 0)) { |
|
150
|
12 |
0 |
if (!g_file_plugin_registry || !name) return 0; |
|
|
0 |
12 |
if (!g_file_plugin_registry || !name) return 0; |
|
151
|
7 |
5 |
if (g_file_last_plugin && strcmp(g_file_last_plugin->name, name) == 0) |
|
|
7 |
0 |
if (g_file_last_plugin && strcmp(g_file_last_plugin->name, name) == 0) |
|
161
|
0 |
66 |
if (!name) return NULL; |
|
162
|
49 |
17 |
if (g_file_last_plugin && strcmp(g_file_last_plugin->name, name) == 0) |
|
|
21 |
28 |
if (g_file_last_plugin && strcmp(g_file_last_plugin->name, name) == 0) |
|
164
|
0 |
45 |
if (!g_file_plugin_registry) return NULL; |
|
167
|
40 |
5 |
if (!svp || !*svp) return NULL; |
|
|
0 |
40 |
if (!svp || !*svp) return NULL; |
|
181
|
0 |
60 |
if (start >= items) return NULL; |
|
182
|
2 |
58 |
if ((items - start) % 2 != 0) |
|
187
|
73 |
58 |
for (i = start; i < items; i += 2) { |
|
193
|
0 |
73 |
if (!SvOK(key_sv)) |
|
197
|
0 |
73 |
if (!hv_store(opts, key, (I32)key_len, SvREFCNT_inc(val_sv), 0)) { |
|
202
|
55 |
18 |
if (key_len == 6 && memcmp(key, "plugin", 6) == 0) |
|
|
55 |
0 |
if (key_len == 6 && memcmp(key, "plugin", 6) == 0) |
|
206
|
3 |
55 |
if (!has_plugin) { |
|
247
|
16 |
30 |
if (chain->per_plugin) { |
|
248
|
28 |
16 |
for (i = 0; i < chain->count; i++) { |
|
249
|
3 |
25 |
if (chain->per_plugin[i]) |
|
255
|
16 |
30 |
if (chain->shared) { |
|
259
|
46 |
0 |
if (chain->plugins) { |
|
283
|
51 |
0 |
if (!slot || !*slot || !SvOK(*slot)) |
|
|
51 |
0 |
if (!slot || !*slot || !SvOK(*slot)) |
|
|
0 |
51 |
if (!slot || !*slot || !SvOK(*slot)) |
|
288
|
34 |
17 |
if (!SvROK(plugin_sv)) { |
|
291
|
4 |
30 |
if (!p) croak("File::Raw::%s: unknown plugin '%s'", fn_name, name); |
|
298
|
0 |
17 |
if (SvTYPE(SvRV(plugin_sv)) != SVt_PVAV) |
|
304
|
0 |
17 |
if (n <= 0) |
|
307
|
0 |
17 |
Newx(out->plugins, n, const FilePlugin *); |
|
310
|
30 |
17 |
for (i = 0; i < n; i++) { |
|
314
|
30 |
0 |
if (!np || !*np || !SvOK(*np)) |
|
|
30 |
0 |
if (!np || !*np || !SvOK(*np)) |
|
|
0 |
30 |
if (!np || !*np || !SvOK(*np)) |
|
317
|
0 |
30 |
if (SvROK(*np)) |
|
322
|
0 |
30 |
if (!p) |
|
333
|
0 |
17 |
Newxz(out->per_plugin, n, HV *); |
|
338
|
22 |
17 |
while ((he = hv_iternext(opts))) { |
|
345
|
17 |
5 |
if (klen == 6 && memcmp(key, "plugin", 6) == 0) continue; |
|
|
17 |
0 |
if (klen == 6 && memcmp(key, "plugin", 6) == 0) continue; |
|
347
|
3 |
2 |
if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
|
3 |
0 |
if (SvROK(val) && SvTYPE(SvRV(val)) == SVt_PVHV) { |
|
349
|
4 |
0 |
for (j = 0; j < (int)n; j++) { |
|
352
|
3 |
1 |
if (plen == klen && memcmp(key, pn, klen) == 0) { |
|
|
3 |
0 |
if (plen == klen && memcmp(key, pn, klen) == 0) { |
|
359
|
3 |
2 |
if (matched >= 0) { |
|
378
|
4 |
0 |
if (!slot || !*slot || !SvOK(*slot)) |
|
|
4 |
0 |
if (!slot || !*slot || !SvOK(*slot)) |
|
|
0 |
4 |
if (!slot || !*slot || !SvOK(*slot)) |
|
380
|
2 |
2 |
if (SvROK(*slot)) |
|
386
|
1 |
1 |
if (!p) croak("File::Raw::%s: unknown plugin '%s'", fn_name, name); |
|
402
|
28 |
0 |
if (chain->shared) { |
|
404
|
4 |
28 |
while ((he = hv_iternext(chain->shared))) { |
|
411
|
28 |
0 |
if (chain->per_plugin && chain->per_plugin[idx]) { |
|
|
3 |
25 |
if (chain->per_plugin && chain->per_plugin[idx]) { |
|
414
|
4 |
3 |
while ((he = hv_iternext(pp))) { |
|
446
|
22 |
11 |
if (chain.shared == NULL) { |
|
450
|
0 |
22 |
if (!p->read_fn) { |
|
464
|
1 |
21 |
if (ctx.cancel) return NULL; |
|
472
|
20 |
9 |
for (i = 0; i < chain.count; i++) { |
|
478
|
0 |
20 |
if (!p->read_fn) { |
|
479
|
0 |
0 |
if (we_own) SvREFCNT_dec(current); |
|
498
|
18 |
1 |
if (ctx.cancel || !next) { |
|
|
0 |
18 |
if (ctx.cancel || !next) { |
|
499
|
1 |
0 |
if (we_own) SvREFCNT_dec(current); |
|
504
|
18 |
0 |
if (next != current) { |
|
505
|
7 |
11 |
if (we_own) SvREFCNT_dec(current); |
|
536
|
8 |
6 |
if (chain.shared == NULL) { |
|
540
|
1 |
7 |
if (!p->write_fn) { |
|
554
|
1 |
6 |
if (ctx.cancel) return NULL; |
|
561
|
8 |
5 |
for (i = chain.count - 1; i >= 0; i--) { |
|
567
|
0 |
8 |
if (!p->write_fn) { |
|
568
|
0 |
0 |
if (we_own) SvREFCNT_dec(current); |
|
587
|
7 |
1 |
if (ctx.cancel || !next) { |
|
|
0 |
7 |
if (ctx.cancel || !next) { |
|
588
|
1 |
0 |
if (we_own) SvREFCNT_dec(current); |
|
593
|
7 |
0 |
if (next != current) { |
|
594
|
1 |
6 |
if (we_own) SvREFCNT_dec(current); |
|
613
|
0 |
0 |
if (!p->record_fn) |
|
626
|
0 |
0 |
if (ctx.cancel) return NULL; |
|
640
|
1 |
0 |
if (!p->stream_fn) |
|
644
|
0 |
0 |
if (fd < 0) return NULL; |
|
655
|
0 |
0 |
while ((n = read(fd, buf, sizeof(buf))) > 0) { |
|
656
|
0 |
0 |
if (p->stream_fn(aTHX_ &ctx, buf, (size_t)n, 0) || ctx.cancel) { |
|
|
0 |
0 |
if (p->stream_fn(aTHX_ &ctx, buf, (size_t)n, 0) || ctx.cancel) { |
|
661
|
0 |
0 |
if (!cancelled) { |
|
666
|
0 |
0 |
return (cancelled || ctx.cancel) ? NULL : &PL_sv_yes; |
|
|
0 |
0 |
return (cancelled || ctx.cancel) ? NULL : &PL_sv_yes; |
|
690
|
335 |
51 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
148 |
187 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
695
|
32 |
206 |
if (stat(path, st) < 0) { |
|
702
|
206 |
0 |
if (len < STAT_CACHE_PATH_MAX) { |
|
726
|
1 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
1 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
738
|
1 |
8 |
if (cached_stat(path, &st) < 0) return 0; |
|
740
|
8 |
0 |
if (g_stat_cache.uid == 0) return 1; /* root can read anything */ |
|
742
|
0 |
0 |
if (st.st_uid == g_stat_cache.uid) { |
|
744
|
0 |
0 |
} else if (st.st_gid == g_stat_cache.gid) { |
|
759
|
1 |
8 |
if (cached_stat(path, &st) < 0) return 0; |
|
761
|
8 |
0 |
if (g_stat_cache.uid == 0) return 1; /* root can write anything */ |
|
763
|
0 |
0 |
if (st.st_uid == g_stat_cache.uid) { |
|
765
|
0 |
0 |
} else if (st.st_gid == g_stat_cache.gid) { |
|
788
|
0 |
8 |
if (cached_stat(path, &st) < 0) return 0; |
|
790
|
8 |
0 |
if (g_stat_cache.uid == 0) return 1; /* root can execute anything */ |
|
792
|
0 |
0 |
if (st.st_uid == g_stat_cache.uid) { |
|
794
|
0 |
0 |
} else if (st.st_gid == g_stat_cache.gid) { |
|
896
|
0 |
76 |
if (fd < 0) { |
|
902
|
76 |
0 |
if (fstat(fd, &st) < 0 || !S_ISREG(st.st_mode)) { |
|
|
0 |
76 |
if (fstat(fd, &st) < 0 || !S_ISREG(st.st_mode)) { |
|
910
|
1 |
75 |
if (st.st_size == 0) { |
|
928
|
0 |
75 |
if (st.st_size >= MMAP_SLURP_THRESHOLD) { |
|
930
|
0 |
0 |
if (map != MAP_FAILED) { |
|
949
|
75 |
0 |
if (n == st.st_size) { |
|
960
|
0 |
0 |
if (n < 0) { |
|
961
|
0 |
0 |
if (errno == EINTR) { |
|
973
|
0 |
0 |
while (total < st.st_size) { |
|
975
|
0 |
0 |
if (n < 0) { |
|
976
|
0 |
0 |
if (errno == EINTR) continue; |
|
983
|
0 |
0 |
if (n == 0) break; |
|
1002
|
86 |
0 |
PUSHs(file_spew_internal(aTHX_ path, data) ? &PL_sv_yes : &PL_sv_no); |
|
1012
|
140 |
7 |
PUSHs(file_exists_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1032
|
17 |
12 |
PUSHs(file_is_file_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1042
|
10 |
14 |
PUSHs(file_is_dir_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1055
|
0 |
6 |
if (content == &PL_sv_undef) { |
|
1072
|
1 |
1 |
PUSHs(file_unlink_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1082
|
1 |
0 |
if (SvOK(path_sv)) { |
|
1101
|
4 |
0 |
PUSHs(file_mkdir_internal(path, 0755) ? &PL_sv_yes : &PL_sv_no); |
|
1111
|
1 |
0 |
PUSHs(file_rmdir_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1121
|
1 |
0 |
PUSHs(file_touch_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1201
|
2 |
4 |
PUSHs(file_is_link_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1211
|
7 |
0 |
PUSHs(file_is_readable_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1221
|
6 |
0 |
PUSHs(file_is_writable_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1231
|
8 |
0 |
PUSHs(file_is_executable_internal(path) ? &PL_sv_yes : &PL_sv_no); |
|
1265
|
1 |
0 |
PUSHs(file_copy_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no); |
|
1277
|
0 |
0 |
PUSHs(file_move_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no); |
|
1289
|
0 |
0 |
PUSHs(file_chmod_internal(path, mode) ? &PL_sv_yes : &PL_sv_no); |
|
1300
|
2 |
0 |
PUSHs(file_append_internal(aTHX_ path, data) ? &PL_sv_yes : &PL_sv_no); |
|
1311
|
0 |
0 |
PUSHs(file_atomic_spew_internal(aTHX_ path, data) ? &PL_sv_yes : &PL_sv_no); |
|
1325
|
265 |
0 |
OP *o = OpSIBLING(pushop); |
|
1327
|
684 |
265 |
while (o) { |
|
1329
|
419 |
265 |
o = OpSIBLING(o); |
|
1346
|
189 |
0 |
if (!OpHAS_SIBLING(pushop)) { |
|
1350
|
20 |
169 |
if (file_count_call_args(pushop) != 1) return entersubop; |
|
1353
|
169 |
0 |
argop = OpSIBLING(pushop); |
|
1354
|
0 |
169 |
if (!argop) return entersubop; |
|
1356
|
169 |
0 |
cvop = OpSIBLING(argop); |
|
1357
|
0 |
169 |
if (!cvop) return entersubop; |
|
1388
|
76 |
0 |
if (!OpHAS_SIBLING(pushop)) { |
|
1392
|
15 |
61 |
if (file_count_call_args(pushop) != 2) return entersubop; |
|
1395
|
61 |
0 |
pathop = OpSIBLING(pushop); |
|
1396
|
0 |
61 |
if (!pathop) return entersubop; |
|
1398
|
61 |
0 |
dataop = OpSIBLING(pathop); |
|
1399
|
0 |
61 |
if (!dataop) return entersubop; |
|
1401
|
61 |
0 |
cvop = OpSIBLING(dataop); |
|
1402
|
0 |
61 |
if (!cvop) return entersubop; |
|
1515
|
0 |
28 |
if (file_initialized) return; |
|
1518
|
0 |
28 |
Newxz(g_mmaps, g_mmaps_size, MmapEntry); |
|
1520
|
0 |
28 |
Newxz(g_free_mmaps, g_free_mmaps_size, IV); |
|
1523
|
0 |
28 |
Newxz(g_iters, g_iters_size, LineIterEntry); |
|
1525
|
0 |
28 |
Newxz(g_free_iters, g_free_iters_size, IV); |
|
1557
|
3 |
70 |
if (fd < 0 && errno == EPERM) { |
|
|
0 |
3 |
if (fd < 0 && errno == EPERM) { |
|
1561
|
3 |
70 |
if (fd < 0) { |
|
1565
|
0 |
70 |
if (fstat(fd, &st) < 0) { |
|
1574
|
70 |
0 |
if (S_ISREG(st.st_mode) && st.st_size > 0) { |
|
|
65 |
5 |
if (S_ISREG(st.st_mode) && st.st_size > 0) { |
|
1577
|
0 |
65 |
if (st.st_size >= MMAP_SLURP_THRESHOLD) { |
|
1579
|
0 |
0 |
if (map != MAP_FAILED) { |
|
1604
|
65 |
65 |
while (total < st.st_size) { |
|
1606
|
0 |
65 |
if (n < 0) { |
|
1607
|
0 |
0 |
if (errno == EINTR) continue; |
|
1612
|
0 |
65 |
if (n == 0) break; |
|
1626
|
0 |
5 |
if (total >= (ssize_t)capacity - 1) { |
|
1628
|
0 |
0 |
SvGROW(result, capacity); |
|
|
0 |
0 |
SvGROW(result, capacity); |
|
1633
|
0 |
5 |
if (n < 0) { |
|
1634
|
0 |
0 |
if (errno == EINTR) continue; |
|
1639
|
5 |
0 |
if (n == 0) break; |
|
1676
|
0 |
2 |
if (fd < 0 && errno == EPERM) { |
|
|
0 |
0 |
if (fd < 0 && errno == EPERM) { |
|
1680
|
0 |
2 |
if (fd < 0) { |
|
1684
|
0 |
2 |
if (fstat(fd, &st) < 0) { |
|
1692
|
2 |
0 |
if (S_ISREG(st.st_mode) && st.st_size > 0) { |
|
|
2 |
0 |
if (S_ISREG(st.st_mode) && st.st_size > 0) { |
|
1695
|
0 |
2 |
if (st.st_size >= MMAP_SLURP_THRESHOLD) { |
|
1697
|
0 |
0 |
if (map != MAP_FAILED) { |
|
1719
|
2 |
2 |
while (total < st.st_size) { |
|
1721
|
0 |
2 |
if (n < 0) { |
|
1722
|
0 |
0 |
if (errno == EINTR) continue; |
|
1727
|
0 |
2 |
if (n == 0) break; |
|
1740
|
0 |
0 |
if (total >= (ssize_t)capacity - 1) { |
|
1742
|
0 |
0 |
SvGROW(result, capacity); |
|
|
0 |
0 |
SvGROW(result, capacity); |
|
1747
|
0 |
0 |
if (n < 0) { |
|
1748
|
0 |
0 |
if (errno == EINTR) continue; |
|
1753
|
0 |
0 |
if (n == 0) break; |
|
1789
|
0 |
177 |
if (UNLIKELY(fd < 0)) { |
|
1790
|
0 |
0 |
if (free_write_data) SvREFCNT_dec(write_data); |
|
1796
|
4 |
173 |
if (len >= 65536) { |
|
1803
|
177 |
0 |
if (LIKELY(n == (ssize_t)len)) { |
|
1805
|
0 |
177 |
if (free_write_data) SvREFCNT_dec(write_data); |
|
1807
|
62 |
115 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
2 |
60 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
1814
|
0 |
0 |
if (n < 0) { |
|
1815
|
0 |
0 |
if (errno != EINTR) { |
|
1817
|
0 |
0 |
if (free_write_data) SvREFCNT_dec(write_data); |
|
1826
|
0 |
0 |
while ((size_t)written < len) { |
|
1828
|
0 |
0 |
if (n < 0) { |
|
1829
|
0 |
0 |
if (errno == EINTR) continue; |
|
1831
|
0 |
0 |
if (free_write_data) SvREFCNT_dec(write_data); |
|
1839
|
0 |
0 |
if (free_write_data) SvREFCNT_dec(write_data); |
|
1841
|
0 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
0 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
1865
|
0 |
7 |
if (UNLIKELY(fd < 0)) { |
|
1871
|
7 |
0 |
if (LIKELY(n == (ssize_t)len)) { |
|
1874
|
4 |
3 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
1 |
3 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
1881
|
0 |
0 |
if (n < 0) { |
|
1882
|
0 |
0 |
if (errno != EINTR) { |
|
1892
|
0 |
0 |
while ((size_t)written < len) { |
|
1894
|
0 |
0 |
if (n < 0) { |
|
1895
|
0 |
0 |
if (errno == EINTR) continue; |
|
1905
|
0 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
0 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
1916
|
0 |
4 |
if (needed >= g_mmaps_size) { |
|
1917
|
0 |
0 |
IV new_size = g_mmaps_size ? g_mmaps_size * 2 : 16; |
|
1919
|
0 |
0 |
while (new_size <= needed) new_size *= 2; |
|
1920
|
0 |
0 |
Renew(g_mmaps, new_size, MmapEntry); |
|
1921
|
0 |
0 |
for (i = g_mmaps_size; i < new_size; i++) { |
|
1939
|
10 |
4 |
if (g_free_mmaps_count > 0) { |
|
1952
|
14 |
0 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
|
0 |
14 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
1968
|
14 |
0 |
if (entry->addr && entry->addr != MAP_FAILED) { |
|
|
14 |
0 |
if (entry->addr && entry->addr != MAP_FAILED) { |
|
1971
|
14 |
0 |
if (entry->fd >= 0) { |
|
1980
|
0 |
14 |
if (g_free_mmaps_count >= g_free_mmaps_size) { |
|
1982
|
0 |
0 |
Renew(g_free_mmaps, g_free_mmaps_size, IV); |
|
2042
|
1 |
15 |
int flags = writable ? O_RDWR : O_RDONLY; |
|
2043
|
1 |
15 |
int prot = writable ? (PROT_READ | PROT_WRITE) : PROT_READ; |
|
2046
|
1 |
15 |
if (fd < 0) { |
|
2050
|
0 |
15 |
if (fstat(fd, &st) < 0) { |
|
2055
|
1 |
14 |
if (st.st_size == 0) { |
|
2064
|
0 |
14 |
if (addr == MAP_FAILED) { |
|
2083
|
14 |
0 |
if (idx < 0 || idx >= g_mmaps_count) { |
|
|
0 |
14 |
if (idx < 0 || idx >= g_mmaps_count) { |
|
2093
|
14 |
0 |
if (!entry->addr || entry->addr == MAP_FAILED) { |
|
|
0 |
14 |
if (!entry->addr || entry->addr == MAP_FAILED) { |
|
2100
|
14 |
0 |
SvUPGRADE(sv, SVt_PV); |
|
2112
|
14 |
2 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
|
0 |
14 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
2116
|
14 |
0 |
if (entry->refcount <= 0) { |
|
2125
|
2 |
0 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
|
0 |
2 |
if (idx < 0 || idx >= g_mmaps_count) return; |
|
2133
|
2 |
0 |
if (entry->addr && entry->addr != MAP_FAILED) { |
|
|
2 |
0 |
if (entry->addr && entry->addr != MAP_FAILED) { |
|
2144
|
0 |
12 |
if (needed >= g_iters_size) { |
|
2145
|
0 |
0 |
IV new_size = g_iters_size ? g_iters_size * 2 : 16; |
|
2147
|
0 |
0 |
while (new_size <= needed) new_size *= 2; |
|
2148
|
0 |
0 |
Renew(g_iters, new_size, LineIterEntry); |
|
2149
|
0 |
0 |
for (i = g_iters_size; i < new_size; i++) { |
|
2166
|
61 |
12 |
if (g_free_iters_count > 0) { |
|
2179
|
72 |
0 |
if (idx < 0 || idx >= g_iters_count) return; |
|
|
0 |
72 |
if (idx < 0 || idx >= g_iters_count) return; |
|
2182
|
70 |
2 |
if (entry->fd >= 0) { |
|
2185
|
70 |
2 |
if (entry->buffer) { |
|
2188
|
70 |
2 |
if (entry->path) { |
|
2191
|
2 |
70 |
if (entry->records) { |
|
2206
|
0 |
72 |
if (g_free_iters_count >= g_free_iters_size) { |
|
2208
|
0 |
0 |
Renew(g_free_iters, g_free_iters_size, IV); |
|
2225
|
4 |
71 |
if (fd < 0) { |
|
2262
|
1395 |
0 |
if (idx < 0 || idx >= g_iters_count) { |
|
|
0 |
1395 |
if (idx < 0 || idx >= g_iters_count) { |
|
2267
|
0 |
1395 |
if (entry->fd < 0) { |
|
2273
|
1365 |
109 |
if (entry->buf_pos < entry->buf_len) { |
|
2277
|
1353 |
12 |
if (newline) { |
|
2286
|
42 |
79 |
if (entry->eof) { |
|
2288
|
6 |
36 |
if (entry->buf_pos < entry->buf_len) { |
|
2298
|
33 |
46 |
if (entry->buf_pos > 0) { |
|
2300
|
6 |
27 |
if (remaining > 0) { |
|
2308
|
0 |
79 |
if (entry->buf_len >= entry->buf_size - 1) { |
|
2316
|
0 |
79 |
if (n < 0) { |
|
2317
|
0 |
0 |
if (errno == EINTR) continue; |
|
2320
|
36 |
43 |
if (n == 0) { |
|
2332
|
0 |
0 |
if (idx < 0 || idx >= g_iters_count) { |
|
|
0 |
0 |
if (idx < 0 || idx >= g_iters_count) { |
|
2337
|
0 |
0 |
return entry->eof && entry->buf_pos >= entry->buf_len; |
|
|
0 |
0 |
return entry->eof && entry->buf_pos >= entry->buf_len; |
|
2342
|
72 |
1 |
if (idx < 0 || idx >= g_iters_count) return; |
|
|
0 |
72 |
if (idx < 0 || idx >= g_iters_count) return; |
|
2346
|
72 |
0 |
if (entry->refcount <= 0) { |
|
2358
|
2 |
63 |
if (cached_stat(path, &st) < 0) { |
|
2373
|
2 |
31 |
if (cached_stat(path, &st) < 0) return 0; |
|
2380
|
7 |
31 |
if (cached_stat(path, &st) < 0) return 0; |
|
2397
|
1 |
30 |
if (cached_stat(path, &st) < 0) { |
|
2406
|
1 |
7 |
if (cached_stat(path, &st) < 0) { |
|
2415
|
1 |
7 |
if (cached_stat(path, &st) < 0) { |
|
2424
|
1 |
4 |
if (cached_stat(path, &st) < 0) { |
|
2435
|
1 |
3 |
if (cached_stat(path, &st) < 0) { |
|
2445
|
2 |
1 |
hv_store(result, "is_file", 7, S_ISREG(st.st_mode) ? &PL_sv_yes : &PL_sv_no, 0); |
|
2446
|
1 |
2 |
hv_store(result, "is_dir", 6, S_ISDIR(st.st_mode) ? &PL_sv_yes : &PL_sv_no, 0); |
|
2465
|
1 |
9 |
if (lstat(path, &st) < 0) return 0; |
|
2500
|
2 |
4 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
2 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
2525
|
1 |
3 |
if (fd_src < 0) return 0; |
|
2527
|
3 |
0 |
if (fstat(fd_src, &st) < 0 || !S_ISREG(st.st_mode)) { |
|
|
0 |
3 |
if (fstat(fd_src, &st) < 0 || !S_ISREG(st.st_mode)) { |
|
2533
|
0 |
3 |
if (fd_dst < 0) { |
|
2539
|
2 |
3 |
while (offset < st.st_size) { |
|
2541
|
0 |
2 |
if (sent < 0) { |
|
2542
|
0 |
0 |
if (errno == EINTR) continue; |
|
2543
|
0 |
0 |
if (errno == EINVAL || errno == ENOSYS) { |
|
|
0 |
0 |
if (errno == EINVAL || errno == ENOSYS) { |
|
2555
|
0 |
0 |
if (n_read < 0) { |
|
2556
|
0 |
0 |
if (errno == EINTR) continue; |
|
2559
|
0 |
0 |
if (n_read == 0) { result = 1; break; } |
|
2562
|
0 |
0 |
while (written < n_read) { |
|
2564
|
0 |
0 |
if (n_written < 0) { |
|
2565
|
0 |
0 |
if (errno == EINTR) continue; |
|
2575
|
0 |
0 |
if (result && g_stat_cache.valid && strcmp(dst, g_stat_cache.path) == 0) { |
|
|
0 |
0 |
if (result && g_stat_cache.valid && strcmp(dst, g_stat_cache.path) == 0) { |
|
|
0 |
0 |
if (result && g_stat_cache.valid && strcmp(dst, g_stat_cache.path) == 0) { |
|
2584
|
0 |
2 |
if (sent == 0) break; |
|
2590
|
1 |
2 |
if (g_stat_cache.valid && strcmp(dst, g_stat_cache.path) == 0) { |
|
|
0 |
1 |
if (g_stat_cache.valid && strcmp(dst, g_stat_cache.path) == 0) { |
|
2661
|
2 |
1 |
if (rename(src, dst) == 0) { |
|
2665
|
0 |
1 |
else if (errno == EXDEV) { |
|
2666
|
0 |
0 |
if (file_copy_internal(aTHX_ src, dst)) { |
|
2676
|
1 |
1 |
if (g_stat_cache.valid) { |
|
2677
|
1 |
0 |
if (strcmp(src, g_stat_cache.path) == 0 || strcmp(dst, g_stat_cache.path) == 0) { |
|
|
0 |
1 |
if (strcmp(src, g_stat_cache.path) == 0 || strcmp(dst, g_stat_cache.path) == 0) { |
|
2707
|
1 |
2 |
if (utime(path, NULL) == 0) { |
|
2712
|
0 |
2 |
if (fd < 0) { |
|
2720
|
2 |
1 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
1 |
1 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
2735
|
1 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
0 |
1 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
2751
|
6 |
12 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
1 |
5 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
2766
|
2 |
7 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
2 |
0 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
2810
|
2 |
5 |
if (!dir) return result; |
|
2812
|
27 |
5 |
while ((entry = readdir(dir)) != NULL) { |
|
2814
|
22 |
5 |
if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) { |
|
|
17 |
5 |
if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) { |
|
2833
|
2 |
81 |
if (len == 0) return newSVpvs(""); |
|
2836
|
85 |
3 |
while (len > 0 && (path[len-1] == '/' || path[len-1] == '\\')) { |
|
|
7 |
78 |
while (len > 0 && (path[len-1] == '/' || path[len-1] == '\\')) { |
|
|
0 |
78 |
while (len > 0 && (path[len-1] == '/' || path[len-1] == '\\')) { |
|
2839
|
3 |
78 |
if (len == 0) return newSVpvs(""); |
|
2843
|
732 |
3 |
while (p > path && *p != '/' && *p != '\\') { |
|
|
657 |
75 |
while (p > path && *p != '/' && *p != '\\') { |
|
|
657 |
0 |
while (p > path && *p != '/' && *p != '\\') { |
|
2846
|
3 |
75 |
if (*p == '/' || *p == '\\') p++; |
|
|
0 |
3 |
if (*p == '/' || *p == '\\') p++; |
|
2855
|
1 |
19 |
if (len == 0) return newSVpvs("."); |
|
2859
|
19 |
2 |
while (end > path && (*end == '/' || *end == '\\')) { |
|
|
2 |
17 |
while (end > path && (*end == '/' || *end == '\\')) { |
|
|
0 |
17 |
while (end > path && (*end == '/' || *end == '\\')) { |
|
2864
|
131 |
6 |
while (end > path && *end != '/' && *end != '\\') { |
|
|
118 |
13 |
while (end > path && *end != '/' && *end != '\\') { |
|
|
118 |
0 |
while (end > path && *end != '/' && *end != '\\') { |
|
2868
|
6 |
13 |
if (end == path) { |
|
2869
|
2 |
4 |
if (*end == '/' || *end == '\\') { |
|
|
0 |
2 |
if (*end == '/' || *end == '\\') { |
|
2876
|
14 |
0 |
while (end > path && (*(end-1) == '/' || *(end-1) == '\\')) { |
|
|
1 |
13 |
while (end > path && (*(end-1) == '/' || *(end-1) == '\\')) { |
|
|
0 |
13 |
while (end > path && (*(end-1) == '/' || *(end-1) == '\\')) { |
|
2888
|
1 |
48 |
if (len == 0) return newSVpvs(""); |
|
2892
|
440 |
12 |
while (basename > path && *basename != '/' && *basename != '\\') { |
|
|
404 |
36 |
while (basename > path && *basename != '/' && *basename != '\\') { |
|
|
404 |
0 |
while (basename > path && *basename != '/' && *basename != '\\') { |
|
2895
|
12 |
36 |
if (*basename == '/' || *basename == '\\') basename++; |
|
|
0 |
12 |
if (*basename == '/' || *basename == '\\') basename++; |
|
2899
|
44 |
4 |
if (!dot || dot == basename) return newSVpvs(""); |
|
|
2 |
42 |
if (!dot || dot == basename) return newSVpvs(""); |
|
2912
|
0 |
12 |
if (len == 0) return newSVpvs(""); |
|
2915
|
28 |
12 |
for (i = 0; i < len; i++) { |
|
2917
|
28 |
0 |
if (sv && SvPOK(*sv)) { |
|
|
28 |
0 |
if (sv && SvPOK(*sv)) { |
|
2928
|
28 |
12 |
for (i = 0; i < len; i++) { |
|
2930
|
28 |
0 |
if (sv && SvPOK(*sv)) { |
|
|
28 |
0 |
if (sv && SvPOK(*sv)) { |
|
2934
|
1 |
27 |
if (part_len == 0) continue; |
|
2937
|
29 |
0 |
while (part_len > 0 && (*part == '/' || *part == '\\')) { |
|
|
9 |
20 |
while (part_len > 0 && (*part == '/' || *part == '\\')) { |
|
|
0 |
20 |
while (part_len > 0 && (*part == '/' || *part == '\\')) { |
|
2938
|
9 |
0 |
if (!need_sep && p == buf) break; /* Keep root slash */ |
|
|
7 |
2 |
if (!need_sep && p == buf) break; /* Keep root slash */ |
|
2943
|
12 |
15 |
if (need_sep && part_len > 0) { |
|
|
12 |
0 |
if (need_sep && part_len > 0) { |
|
2951
|
27 |
0 |
if (part_len > 0) { |
|
2956
|
24 |
3 |
need_sep = (*(p-1) != '/' && *(p-1) != '\\'); |
|
|
24 |
0 |
need_sep = (*(p-1) != '/' && *(p-1) != '\\'); |
|
2976
|
1 |
5 |
if (n <= 0) return result; |
|
2979
|
1 |
4 |
if (idx < 0) return result; |
|
2981
|
20 |
2 |
while (count < n && (line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
|
18 |
2 |
while (count < n && (line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
2997
|
1 |
5 |
if (n <= 0) return result; |
|
3000
|
1 |
4 |
if (idx < 0) return result; |
|
3006
|
43 |
4 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
3007
|
25 |
18 |
if (av_len(buffer) + 1 >= n) { |
|
3018
|
18 |
4 |
for (i = 0; i < buf_len; i++) { |
|
3020
|
18 |
0 |
if (sv) { |
|
3045
|
7 |
2 |
if (count <= 0 || from < 1) return result; |
|
|
2 |
5 |
if (count <= 0 || from < 1) return result; |
|
3048
|
0 |
5 |
if (idx < 0) return result; |
|
3051
|
56 |
4 |
for (i = 0; i < from - 1; i++) { |
|
3053
|
1 |
55 |
if (line == &PL_sv_undef) { |
|
3062
|
16 |
3 |
for (i = 0; i < count; i++) { |
|
3064
|
1 |
15 |
if (line == &PL_sv_undef) break; |
|
3097
|
0 |
17 |
if (fd < 0) { |
|
3101
|
16 |
17 |
while ((size_t)written < len) { |
|
3103
|
0 |
16 |
if (n < 0) { |
|
3104
|
0 |
0 |
if (errno == EINTR) continue; |
|
3123
|
0 |
17 |
if (rename(temp_path, path) != 0) { |
|
3129
|
10 |
7 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
|
0 |
10 |
if (g_stat_cache.valid && strcmp(path, g_stat_cache.path) == 0) { |
|
3148
|
14 |
2 |
while (start < end) { |
|
3150
|
10 |
4 |
if (p) { |
|
3154
|
4 |
0 |
if (start < end) { |
|
3173
|
0 |
46 |
if (items < 1) |
|
3179
|
17 |
29 |
if (items > 1) { |
|
3183
|
2 |
11 |
if (!out) { |
|
3188
|
11 |
0 |
if (out != bytes) { |
|
3202
|
0 |
2 |
if (items != 1) croak("Usage: file::slurp_raw(path)"); |
|
3215
|
0 |
94 |
if (items < 2) |
|
3221
|
9 |
85 |
if (items > 2) { |
|
3225
|
2 |
5 |
if (!bytes_to_write) { |
|
3232
|
90 |
0 |
ST(0) = file_spew_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
3242
|
0 |
5 |
if (items < 2) |
|
3248
|
3 |
2 |
if (items > 2) { |
|
3252
|
0 |
3 |
if (!bytes_to_write) { |
|
3259
|
5 |
0 |
ST(0) = file_append_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
3268
|
0 |
11 |
if (items != 1) croak("Usage: file::size(path)"); |
|
3281
|
0 |
4 |
if (items != 1) croak("Usage: file::mtime(path)"); |
|
3293
|
0 |
21 |
if (items != 1) croak("Usage: file::exists(path)"); |
|
3296
|
14 |
7 |
ST(0) = file_exists_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
3304
|
0 |
4 |
if (items != 1) croak("Usage: file::is_file(path)"); |
|
3307
|
3 |
1 |
ST(0) = file_is_file_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
3315
|
0 |
7 |
if (items != 1) croak("Usage: file::is_dir(path)"); |
|
3318
|
4 |
3 |
ST(0) = file_is_dir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
3326
|
0 |
2 |
if (items != 1) croak("Usage: file::is_readable(path)"); |
|
3329
|
1 |
1 |
ST(0) = file_is_readable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
3337
|
0 |
3 |
if (items != 1) croak("Usage: file::is_writable(path)"); |
|
3340
|
2 |
1 |
ST(0) = file_is_writable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
3360
|
0 |
9 |
if (items < 1) |
|
3369
|
2 |
7 |
if (items > 1) { |
|
3374
|
0 |
2 |
if (!out) { |
|
3379
|
2 |
0 |
if (out != bytes) SvREFCNT_dec(bytes); |
|
3380
|
1 |
1 |
if (SvROK(out) && SvTYPE(SvRV(out)) == SVt_PVAV) { |
|
|
1 |
0 |
if (SvROK(out) && SvTYPE(SvRV(out)) == SVt_PVAV) { |
|
3393
|
3 |
0 |
while (cursor < bend) { |
|
3395
|
2 |
1 |
if (nl) { |
|
3399
|
1 |
0 |
if (cursor < bend) |
|
3411
|
1 |
6 |
if (UNLIKELY(fd < 0)) { |
|
3417
|
6 |
0 |
if (UNLIKELY(fstat(fd, &st) < 0 || st.st_size == 0)) { |
|
|
1 |
5 |
if (UNLIKELY(fstat(fd, &st) < 0 || st.st_size == 0)) { |
|
3428
|
5 |
5 |
while ((size_t)total_read < file_size) { |
|
3430
|
0 |
5 |
if (UNLIKELY(n < 0)) { |
|
3431
|
0 |
0 |
if (errno == EINTR) continue; |
|
3434
|
0 |
5 |
if (n == 0) break; |
|
3439
|
0 |
5 |
if (UNLIKELY(total_read == 0)) { |
|
3454
|
15 |
0 |
while (p < end) { |
|
3456
|
10 |
5 |
if (LIKELY(p != NULL)) { |
|
3462
|
5 |
0 |
if (line_start < end) { |
|
3482
|
16 |
0 |
if (items < 1 || items > 2) croak("Usage: file::mmap_open(path, [writable])"); |
|
|
0 |
16 |
if (items < 1 || items > 2) croak("Usage: file::mmap_open(path, [writable])"); |
|
3485
|
1 |
15 |
writable = (items > 1 && SvTRUE(ST(1))) ? 1 : 0; |
|
|
1 |
0 |
writable = (items > 1 && SvTRUE(ST(1))) ? 1 : 0; |
|
3488
|
2 |
14 |
if (idx < 0) { |
|
3507
|
0 |
14 |
if (items != 1) croak("Usage: $mmap->data"); |
|
3509
|
14 |
0 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
|
0 |
14 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
3515
|
14 |
0 |
idx = idx_sv ? SvIV(*idx_sv) : -1; |
|
3527
|
0 |
2 |
if (items != 1) croak("Usage: $mmap->sync"); |
|
3529
|
2 |
0 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
|
0 |
2 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
3535
|
2 |
0 |
idx = idx_sv ? SvIV(*idx_sv) : -1; |
|
3547
|
0 |
16 |
if (items != 1) croak("Usage: $mmap->close"); |
|
3549
|
16 |
0 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
|
0 |
16 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
3555
|
16 |
0 |
idx = idx_sv ? SvIV(*idx_sv) : -1; |
|
3570
|
0 |
14 |
if (PL_dirty) XSRETURN_EMPTY; |
|
3572
|
14 |
0 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
|
0 |
14 |
if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVHV) { |
|
3578
|
14 |
0 |
idx = idx_sv ? SvIV(*idx_sv) : -1; |
|
3580
|
0 |
14 |
if (idx >= 0) { |
|
3592
|
0 |
24 |
if (items < 1) |
|
3602
|
5 |
19 |
if (items > 1) { |
|
3613
|
0 |
3 |
if (!out) { |
|
3618
|
3 |
0 |
if (out != bytes) SvREFCNT_dec(bytes); |
|
3619
|
2 |
1 |
if (!SvROK(out) || SvTYPE(SvRV(out)) != SVt_PVAV) { |
|
|
0 |
2 |
if (!SvROK(out) || SvTYPE(SvRV(out)) != SVt_PVAV) { |
|
3648
|
1 |
18 |
if (idx < 0) { |
|
3670
|
0 |
161 |
if (items != 1) croak("Usage: $iter->next"); |
|
3673
|
0 |
161 |
if (UNLIKELY(!SvROK(rv))) { |
|
3680
|
161 |
0 |
if (UNLIKELY(idx < 0 || idx >= g_iters_count)) { |
|
|
0 |
161 |
if (UNLIKELY(idx < 0 || idx >= g_iters_count)) { |
|
3688
|
4 |
157 |
if (entry->records) { |
|
3690
|
0 |
4 |
if (entry->records_idx >= total) { |
|
3695
|
4 |
0 |
ST(0) = (rp && *rp) ? sv_2mortal(newSVsv(*rp)) : &PL_sv_undef; |
|
|
4 |
0 |
ST(0) = (rp && *rp) ? sv_2mortal(newSVsv(*rp)) : &PL_sv_undef; |
|
3699
|
0 |
157 |
if (UNLIKELY(entry->fd < 0)) { |
|
3707
|
166 |
25 |
if (entry->buf_pos < entry->buf_len) { |
|
3711
|
142 |
24 |
if (newline) { |
|
3721
|
15 |
34 |
if (entry->eof) { |
|
3723
|
11 |
4 |
if (entry->buf_pos < entry->buf_len) { |
|
3735
|
13 |
21 |
if (entry->buf_pos > 0) { |
|
3737
|
10 |
3 |
if (remaining > 0) { |
|
3745
|
1 |
33 |
if (entry->buf_len >= entry->buf_size - 1) { |
|
3753
|
0 |
34 |
if (n < 0) { |
|
3754
|
0 |
0 |
if (errno == EINTR) continue; |
|
3758
|
15 |
19 |
if (n == 0) { |
|
3772
|
0 |
131 |
if (items != 1) croak("Usage: $iter->eof"); |
|
3775
|
0 |
131 |
if (UNLIKELY(!SvROK(rv))) { |
|
3782
|
131 |
0 |
if (UNLIKELY(idx < 0 || idx >= g_iters_count)) { |
|
|
0 |
131 |
if (UNLIKELY(idx < 0 || idx >= g_iters_count)) { |
|
3788
|
4 |
127 |
if (entry->records) { |
|
3790
|
1 |
3 |
? &PL_sv_yes : &PL_sv_no; |
|
3793
|
9 |
118 |
ST(0) = (entry->eof && entry->buf_pos >= entry->buf_len) ? &PL_sv_yes : &PL_sv_no; |
|
|
9 |
0 |
ST(0) = (entry->eof && entry->buf_pos >= entry->buf_len) ? &PL_sv_yes : &PL_sv_no; |
|
3802
|
0 |
19 |
if (items != 1) croak("Usage: $iter->close"); |
|
3805
|
0 |
19 |
if (UNLIKELY(!SvROK(rv))) { |
|
3824
|
0 |
20 |
if (PL_dirty) XSRETURN_EMPTY; |
|
3827
|
0 |
20 |
if (UNLIKELY(!SvROK(rv))) { |
|
3833
|
2 |
18 |
if (idx >= 0) { |
|
3861
|
64 |
16 |
for (i = 0; i < len; i++) { |
|
3862
|
43 |
21 |
if (s[i] != ' ' && s[i] != '\t' && s[i] != '\r' && s[i] != '\n') { |
|
|
43 |
0 |
if (s[i] != ' ' && s[i] != '\t' && s[i] != '\r' && s[i] != '\n') { |
|
|
43 |
0 |
if (s[i] != ' ' && s[i] != '\t' && s[i] != '\r' && s[i] != '\n') { |
|
|
43 |
0 |
if (s[i] != ' ' && s[i] != '\t' && s[i] != '\r' && s[i] != '\n') { |
|
3885
|
32 |
8 |
while (len > 0 && (*s == ' ' || *s == '\t')) { |
|
|
11 |
21 |
while (len > 0 && (*s == ' ' || *s == '\t')) { |
|
|
0 |
21 |
while (len > 0 && (*s == ' ' || *s == '\t')) { |
|
3889
|
21 |
8 |
return len > 0 && *s == '#'; |
|
|
6 |
15 |
return len > 0 && *s == '#'; |
|
3903
|
28 |
0 |
if (PL_dirty) { |
|
3916
|
33 |
28 |
if (g_file_callback_registry) return; |
|
3971
|
0 |
23 |
if (!g_file_callback_registry) return NULL; |
|
3973
|
19 |
4 |
if (svp && SvIOK(*svp)) { |
|
|
19 |
0 |
if (svp && SvIOK(*svp)) { |
|
4000
|
1 |
13 |
if (items < 2) |
|
4006
|
12 |
1 |
if (!SvROK(callback) || SvTYPE(SvRV(callback)) != SVt_PVCV) { |
|
|
0 |
12 |
if (!SvROK(callback) || SvTYPE(SvRV(callback)) != SVt_PVCV) { |
|
4013
|
4 |
8 |
if (items > 2) { |
|
4022
|
1 |
7 |
if (idx < 0) { |
|
4028
|
7 |
0 |
old_defsv = DEFSV; |
|
4030
|
7 |
0 |
DEFSV = line_sv; |
|
4033
|
0 |
7 |
PUSH_MULTICALL(block_cv); |
|
4038
|
1027 |
12 |
if (entry->buf_pos < entry->buf_len) { |
|
4042
|
1021 |
6 |
if (newline) { |
|
4056
|
6 |
12 |
if (entry->eof) { |
|
4058
|
3 |
3 |
if (entry->buf_pos < entry->buf_len) { |
|
4072
|
5 |
7 |
if (entry->buf_pos > 0) { |
|
4074
|
3 |
2 |
if (remaining > 0) { |
|
4082
|
0 |
12 |
if (entry->buf_len >= entry->buf_size - 1) { |
|
4090
|
0 |
12 |
if (n < 0) { |
|
4091
|
0 |
0 |
if (errno == EINTR) continue; |
|
4094
|
6 |
6 |
if (n == 0) { |
|
4102
|
6 |
0 |
POP_MULTICALL; |
|
4105
|
6 |
0 |
DEFSV = old_defsv; |
|
4119
|
0 |
13 |
if (!out) { |
|
4123
|
13 |
0 |
if (out != bytes) SvREFCNT_dec(bytes); |
|
4124
|
12 |
1 |
if (!SvROK(out) || SvTYPE(SvRV(out)) != SVt_PVAV) { |
|
|
0 |
12 |
if (!SvROK(out) || SvTYPE(SvRV(out)) != SVt_PVAV) { |
|
4140
|
0 |
21 |
PUSHMARK(SP); |
|
4141
|
0 |
21 |
XPUSHs(record); |
|
4145
|
21 |
0 |
if (n > 0) { |
|
4164
|
0 |
25 |
if (items < 2) |
|
4171
|
4 |
21 |
if (items > 2) { |
|
4178
|
3 |
1 |
if (!SvROK(predicate) || SvTYPE(SvRV(predicate)) != SVt_PVCV) |
|
|
0 |
3 |
if (!SvROK(predicate) || SvTYPE(SvRV(predicate)) != SVt_PVCV) |
|
4185
|
0 |
2 |
if (!records) { |
|
4192
|
8 |
2 |
for (i = 0; i < n; i++) { |
|
4194
|
8 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
|
8 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
4195
|
7 |
1 |
if (file_call_predicate_cv(aTHX_ (CV *)SvRV(predicate), rec)) |
|
4205
|
5 |
16 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
|
5 |
0 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
4210
|
1 |
15 |
if (!fcb) { |
|
4216
|
0 |
20 |
if (idx < 0) { |
|
4222
|
15 |
5 |
if (fcb && fcb->predicate) { |
|
|
12 |
3 |
if (fcb && fcb->predicate) { |
|
4223
|
91 |
12 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4224
|
49 |
42 |
if (fcb->predicate(aTHX_ line)) { |
|
4237
|
3 |
5 |
SV *cb_sv = fcb ? fcb->perl_callback : (SV*)block_cv; |
|
4238
|
1057 |
8 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4243
|
0 |
1057 |
PUSHMARK(SP); |
|
4244
|
0 |
1057 |
XPUSHs(line); |
|
4248
|
1057 |
0 |
if (count > 0) { |
|
4253
|
26 |
1031 |
if (matches) { |
|
4277
|
0 |
9 |
if (items < 1) |
|
4288
|
2 |
7 |
if (items > 2) { |
|
4296
|
1 |
1 |
if (has_pred && (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVCV)) |
|
|
1 |
0 |
if (has_pred && (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVCV)) |
|
|
0 |
1 |
if (has_pred && (!SvROK(ST(1)) || SvTYPE(SvRV(ST(1))) != SVt_PVCV)) |
|
4303
|
0 |
2 |
if (!records) { |
|
4308
|
1 |
1 |
if (!has_pred) { |
|
4311
|
5 |
1 |
for (i = 0; i < n; i++) { |
|
4313
|
5 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
|
5 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
4314
|
4 |
1 |
if (file_call_predicate_cv(aTHX_ (CV *)SvRV(ST(1)), rec)) |
|
4324
|
4 |
3 |
if (items == 1) { |
|
4336
|
1 |
3 |
if (UNLIKELY(fd < 0)) { |
|
4344
|
2 |
3 |
while ((n = read(fd, buffer, FILE_BUFFER_SIZE)) > 0) { |
|
4347
|
1008 |
2 |
while ((p = memchr(p, '\n', end - p)) != NULL) { |
|
4358
|
2 |
1 |
if (total_read > 0 && last_char != '\n') { |
|
|
1 |
1 |
if (total_read > 0 && last_char != '\n') { |
|
4369
|
2 |
1 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
|
2 |
0 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
4374
|
0 |
1 |
if (!fcb) { |
|
4380
|
0 |
3 |
if (idx < 0) { |
|
4386
|
1 |
2 |
if (fcb && fcb->predicate) { |
|
|
1 |
0 |
if (fcb && fcb->predicate) { |
|
4387
|
9 |
1 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4388
|
7 |
2 |
if (fcb->predicate(aTHX_ line)) { |
|
4400
|
0 |
2 |
SV *cb_sv = fcb ? fcb->perl_callback : (SV*)block_cv; |
|
4401
|
13 |
2 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4406
|
0 |
13 |
PUSHMARK(SP); |
|
4407
|
0 |
13 |
XPUSHs(line); |
|
4411
|
13 |
0 |
if (n > 0) { |
|
4416
|
10 |
3 |
if (matches) { |
|
4438
|
0 |
8 |
if (items < 2) |
|
4444
|
2 |
6 |
if (items > 2) { |
|
4450
|
2 |
0 |
if (!SvROK(predicate) || SvTYPE(SvRV(predicate)) != SVt_PVCV) |
|
|
0 |
2 |
if (!SvROK(predicate) || SvTYPE(SvRV(predicate)) != SVt_PVCV) |
|
4457
|
0 |
2 |
if (!records) XSRETURN_UNDEF; |
|
4460
|
8 |
1 |
for (i = 0; i < n; i++) { |
|
4462
|
8 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
|
8 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
4463
|
1 |
7 |
if (file_call_predicate_cv(aTHX_ (CV *)SvRV(predicate), rec)) { |
|
4475
|
5 |
1 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
|
5 |
0 |
if (SvROK(predicate) && SvTYPE(SvRV(predicate)) == SVt_PVCV) { |
|
4480
|
0 |
1 |
if (!fcb) { |
|
4486
|
0 |
6 |
if (idx < 0) { |
|
4491
|
1 |
5 |
if (fcb && fcb->predicate) { |
|
|
1 |
0 |
if (fcb && fcb->predicate) { |
|
4492
|
6 |
0 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4493
|
1 |
5 |
if (fcb->predicate(aTHX_ line)) { |
|
4506
|
0 |
5 |
SV *cb_sv = fcb ? fcb->perl_callback : (SV*)block_cv; |
|
4507
|
25 |
1 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4512
|
0 |
25 |
PUSHMARK(SP); |
|
4513
|
0 |
25 |
XPUSHs(line); |
|
4517
|
25 |
0 |
if (n > 0) { |
|
4522
|
4 |
21 |
if (matches) { |
|
4543
|
0 |
5 |
if (items < 2) |
|
4550
|
5 |
0 |
if (!SvROK(callback) || SvTYPE(SvRV(callback)) != SVt_PVCV) { |
|
|
0 |
5 |
if (!SvROK(callback) || SvTYPE(SvRV(callback)) != SVt_PVCV) { |
|
4554
|
1 |
4 |
if (items > 2) { |
|
4565
|
0 |
1 |
if (!records) { |
|
4572
|
5 |
1 |
for (i = 0; i < n; i++) { |
|
4574
|
5 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
|
5 |
0 |
SV *rec = (rp && *rp) ? *rp : &PL_sv_undef; |
|
4578
|
0 |
5 |
PUSHMARK(SP); |
|
4579
|
0 |
5 |
XPUSHs(rec); |
|
4583
|
5 |
0 |
if (rn > 0) { |
|
4595
|
0 |
4 |
if (idx < 0) { |
|
4602
|
27 |
4 |
while ((line = file_lines_next(aTHX_ idx)) != &PL_sv_undef) { |
|
4606
|
0 |
27 |
PUSHMARK(SP); |
|
4607
|
0 |
27 |
XPUSHs(sv_2mortal(line)); |
|
4611
|
27 |
0 |
if (count > 0) { |
|
4659
|
0 |
13 |
if (!b) return; |
|
4660
|
10 |
3 |
if (b->read_cv) SvREFCNT_dec(b->read_cv); |
|
4661
|
1 |
12 |
if (b->write_cv) SvREFCNT_dec(b->write_cv); |
|
4662
|
1 |
12 |
if (b->record_cv) SvREFCNT_dec(b->record_cv); |
|
4663
|
13 |
0 |
if (b->name) Safefree(b->name); |
|
4675
|
0 |
42 |
PUSHMARK(SP); |
|
4676
|
0 |
42 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
|
42 |
0 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
4677
|
0 |
42 |
XPUSHs(sv_2mortal(newSVsv(ctx->data))); |
|
4678
|
0 |
42 |
XPUSHs(sv_2mortal(newRV_inc((SV *)ctx->options))); |
|
4684
|
42 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
1 |
41 |
if (SvTRUE(ERRSV)) { |
|
4685
|
1 |
0 |
SV *err = newSVsv(ERRSV); |
|
4686
|
1 |
0 |
FREETMPS; |
|
4690
|
41 |
0 |
if (count > 0) { |
|
4692
|
39 |
2 |
if (SvOK(ret)) { |
|
4703
|
41 |
0 |
FREETMPS; |
|
4716
|
0 |
15 |
PUSHMARK(SP); |
|
4717
|
0 |
15 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
|
15 |
0 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
4718
|
0 |
15 |
XPUSHs(sv_2mortal(newSVsv(ctx->data))); |
|
4719
|
0 |
15 |
XPUSHs(sv_2mortal(newRV_inc((SV *)ctx->options))); |
|
4725
|
15 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
15 |
if (SvTRUE(ERRSV)) { |
|
4726
|
0 |
0 |
SV *err = newSVsv(ERRSV); |
|
4727
|
0 |
0 |
FREETMPS; |
|
4731
|
15 |
0 |
if (count > 0) { |
|
4733
|
13 |
2 |
if (SvOK(ret)) { |
|
4744
|
15 |
0 |
FREETMPS; |
|
4757
|
0 |
0 |
PUSHMARK(SP); |
|
4758
|
0 |
0 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
|
0 |
0 |
XPUSHs(sv_2mortal(newSVpv(ctx->path ? ctx->path : "", 0))); |
|
4759
|
0 |
0 |
XPUSHs(sv_2mortal(newSVsv(record))); |
|
4760
|
0 |
0 |
XPUSHs(sv_2mortal(newRV_inc((SV *)ctx->options))); |
|
4766
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
|
0 |
0 |
if (SvTRUE(ERRSV)) { |
|
4767
|
0 |
0 |
SV *err = newSVsv(ERRSV); |
|
4768
|
0 |
0 |
FREETMPS; |
|
4772
|
0 |
0 |
if (count > 0) { |
|
4774
|
0 |
0 |
if (SvOK(ret)) { |
|
4783
|
0 |
0 |
FREETMPS; |
|
4811
|
0 |
0 |
if (!svp || !*svp || !SvOK(*svp)) |
|
|
0 |
0 |
if (!svp || !*svp || !SvOK(*svp)) |
|
|
0 |
0 |
if (!svp || !*svp || !SvOK(*svp)) |
|
4815
|
0 |
0 |
if (!g_file_callback_registry) |
|
4819
|
0 |
0 |
if (!svp || !*svp) |
|
|
0 |
0 |
if (!svp || !*svp) |
|
4823
|
0 |
0 |
if (cb->predicate) { |
|
4824
|
0 |
0 |
return cb->predicate(aTHX_ record) ? record : &PL_sv_undef; |
|
4825
|
0 |
0 |
} else if (cb->perl_callback) { |
|
4826
|
0 |
0 |
SV *old_defsv = DEFSV; |
|
4832
|
0 |
0 |
DEFSV = record; |
|
4835
|
0 |
0 |
PUSHMARK(SP); |
|
4839
|
0 |
0 |
if (count > 0) { |
|
4844
|
0 |
0 |
FREETMPS; |
|
4846
|
0 |
0 |
DEFSV = old_defsv; |
|
4847
|
0 |
0 |
return matched ? record : &PL_sv_undef; |
|
4874
|
1 |
7 |
if (items != 2) |
|
4880
|
5 |
2 |
if (!SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) |
|
|
0 |
5 |
if (!SvROK(coderef) || SvTYPE(SvRV(coderef)) != SVt_PVCV) |
|
4886
|
2 |
3 |
if (existing) { |
|
4887
|
2 |
0 |
if (existing->perl_callback) SvREFCNT_dec(existing->perl_callback); |
|
4909
|
3 |
0 |
if (g_file_callback_registry) { |
|
4911
|
39 |
3 |
while ((he = hv_iternext(g_file_callback_registry))) { |
|
4933
|
32 |
1 |
if (items < 2 || items > 3) |
|
|
0 |
32 |
if (items < 2 || items > 3) |
|
4937
|
0 |
32 |
if (name_len == 0) |
|
4941
|
31 |
1 |
if (!SvROK(spec) || SvTYPE(SvRV(spec)) != SVt_PVHV) |
|
|
0 |
31 |
if (!SvROK(spec) || SvTYPE(SvRV(spec)) != SVt_PVHV) |
|
4945
|
1 |
30 |
if (items == 3) override = SvTRUE(ST(2)); |
|
4947
|
1 |
30 |
if (override) (void)file_unregister_plugin(aTHX_ name); |
|
4953
|
28 |
3 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
28 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
27 |
1 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
27 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
4958
|
8 |
23 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
8 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
8 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
8 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
4963
|
1 |
30 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
1 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
1 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
|
1 |
0 |
if (svp && *svp && SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVCV) { |
|
4968
|
1 |
30 |
if (hv_exists(spec_hv, "stream", 6)) |
|
4972
|
3 |
27 |
if (!b->plugin.read_fn && !b->plugin.write_fn && !b->plugin.record_fn) { |
|
|
3 |
0 |
if (!b->plugin.read_fn && !b->plugin.write_fn && !b->plugin.record_fn) { |
|
|
2 |
1 |
if (!b->plugin.read_fn && !b->plugin.write_fn && !b->plugin.record_fn) { |
|
4982
|
1 |
27 |
if (rc != 1) { |
|
4984
|
1 |
0 |
if (rc == 0) |
|
4990
|
12 |
15 |
if (!g_perl_plugins) g_perl_plugins = newHV(); |
|
5003
|
0 |
11 |
if (items != 1) |
|
5008
|
11 |
0 |
if (g_perl_plugins) { |
|
5010
|
10 |
1 |
if (svp && *svp) { |
|
|
10 |
0 |
if (svp && *svp) { |
|
5018
|
1 |
10 |
if (!removed_perl) |
|
5031
|
3 |
0 |
if (g_file_plugin_registry) { |
|
5033
|
4 |
3 |
while ((he = hv_iternext(g_file_plugin_registry))) { |
|
5048
|
0 |
2 |
if (items != 1) croak("Usage: file::atime(path)"); |
|
5057
|
0 |
2 |
if (items != 1) croak("Usage: file::ctime(path)"); |
|
5066
|
0 |
2 |
if (items != 1) croak("Usage: file::mode(path)"); |
|
5077
|
0 |
4 |
if (items != 1) croak("Usage: File::Raw::stat(path)"); |
|
5080
|
1 |
3 |
if (result == NULL) { |
|
5091
|
0 |
4 |
if (items != 1) croak("Usage: file::is_link(path)"); |
|
5093
|
1 |
3 |
ST(0) = file_is_link_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5100
|
0 |
0 |
if (items != 1) croak("Usage: file::is_executable(path)"); |
|
5102
|
0 |
0 |
ST(0) = file_is_executable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5110
|
0 |
4 |
if (items != 1) croak("Usage: file::unlink(path)"); |
|
5112
|
2 |
2 |
ST(0) = file_unlink_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5120
|
0 |
3 |
if (items != 2) croak("Usage: file::copy(src, dst)"); |
|
5123
|
2 |
1 |
ST(0) = file_copy_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no; |
|
5131
|
0 |
3 |
if (items != 2) croak("Usage: file::move(src, dst)"); |
|
5134
|
2 |
1 |
ST(0) = file_move_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no; |
|
5141
|
0 |
2 |
if (items != 1) croak("Usage: file::touch(path)"); |
|
5143
|
2 |
0 |
ST(0) = file_touch_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5149
|
0 |
1 |
if (items > 1) croak("Usage: file::clear_stat_cache() or file::clear_stat_cache(path)"); |
|
5151
|
0 |
1 |
if (items == 1 && SvOK(ST(0))) { |
|
|
0 |
0 |
if (items == 1 && SvOK(ST(0))) { |
|
5166
|
0 |
1 |
if (items != 2) croak("Usage: file::chmod(path, mode)"); |
|
5169
|
1 |
0 |
ST(0) = file_chmod_internal(path, mode) ? &PL_sv_yes : &PL_sv_no; |
|
5177
|
12 |
0 |
if (items < 1 || items > 2) croak("Usage: file::mkdir(path, [mode])"); |
|
|
0 |
12 |
if (items < 1 || items > 2) croak("Usage: file::mkdir(path, [mode])"); |
|
5179
|
0 |
12 |
if (items > 1) mode = SvIV(ST(1)); |
|
5180
|
8 |
4 |
ST(0) = file_mkdir_internal(path, mode) ? &PL_sv_yes : &PL_sv_no; |
|
5187
|
0 |
6 |
if (items != 1) croak("Usage: file::rmdir(path)"); |
|
5189
|
2 |
4 |
ST(0) = file_rmdir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5197
|
0 |
5 |
if (items != 1) croak("Usage: file::readdir(path)"); |
|
5208
|
0 |
12 |
if (items != 1) croak("Usage: file::basename(path)"); |
|
5217
|
0 |
10 |
if (items != 1) croak("Usage: file::dirname(path)"); |
|
5226
|
0 |
13 |
if (items != 1) croak("Usage: file::extname(path)"); |
|
5237
|
0 |
11 |
if (items < 1) croak("Usage: file::join(part1, part2, ...)"); |
|
5240
|
26 |
11 |
for (i = 0; i < items; i++) { |
|
5258
|
0 |
1 |
if (items != 1) croak("Usage: file_mkpath(path)"); |
|
5260
|
0 |
1 |
if (path_len >= sizeof(buf)) croak("Path too long"); |
|
5262
|
35 |
1 |
for (i = 0; i <= path_len; i++) { |
|
5263
|
34 |
1 |
if (i == path_len || path[i] == '/' || path[i] == '\\') { |
|
|
30 |
4 |
if (i == path_len || path[i] == '/' || path[i] == '\\') { |
|
|
0 |
30 |
if (i == path_len || path[i] == '/' || path[i] == '\\') { |
|
5264
|
1 |
4 |
if (i == 0) { |
|
5274
|
0 |
4 |
if (i == 2 && buf[1] == ':') continue; |
|
|
0 |
0 |
if (i == 2 && buf[1] == ':') continue; |
|
5276
|
2 |
2 |
if (!file_is_dir_internal(buf)) { |
|
5277
|
2 |
0 |
if (file_mkdir_internal(buf, 0755)) |
|
5283
|
0 |
1 |
ST(0) = created || file_is_dir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
|
0 |
0 |
ST(0) = created || file_is_dir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5292
|
0 |
2 |
if (!file_is_dir_internal(path)) { |
|
5299
|
1 |
2 |
for (i = 0; i < len; i++) { |
|
5301
|
1 |
0 |
if (sv) { |
|
5311
|
1 |
0 |
if (file_is_dir_internal(child)) { |
|
5329
|
0 |
1 |
if (items != 1) croak("Usage: file_rm_rf(path)"); |
|
5348
|
0 |
8 |
if (items < 1) |
|
5352
|
5 |
3 |
n_positional = (items % 2 == 0) ? 2 : 1; |
|
5353
|
5 |
3 |
if (n_positional == 2) n = SvIV(ST(1)); |
|
5355
|
2 |
6 |
if (items > n_positional) { |
|
5365
|
0 |
2 |
if (!records) { |
|
5372
|
0 |
2 |
if (take < 0) take = 0; |
|
5374
|
7 |
2 |
for (i = 0; i < take; i++) { |
|
5376
|
7 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
|
7 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
5395
|
0 |
7 |
if (items < 1) |
|
5399
|
5 |
2 |
n_positional = (items % 2 == 0) ? 2 : 1; |
|
5400
|
5 |
2 |
if (n_positional == 2) n = SvIV(ST(1)); |
|
5402
|
1 |
6 |
if (items > n_positional) { |
|
5412
|
0 |
1 |
if (!records) { |
|
5419
|
0 |
1 |
if (take < 0) take = 0; |
|
5422
|
2 |
1 |
for (i = start; i < total; i++) { |
|
5424
|
2 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
|
2 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
5447
|
2 |
14 |
if (items < 3) |
|
5457
|
5 |
9 |
if (items > 3) { |
|
5467
|
0 |
2 |
if (!records) { |
|
5472
|
2 |
0 |
if (from < 1 || count <= 0) { |
|
|
0 |
2 |
if (from < 1 || count <= 0) { |
|
5479
|
0 |
2 |
if (start >= total) { |
|
5485
|
1 |
1 |
if (end > total) end = total; |
|
5487
|
5 |
2 |
for (i = start; i < end; i++) { |
|
5489
|
5 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
|
5 |
0 |
av_push(out, SvREFCNT_inc(rp && *rp ? *rp : &PL_sv_undef)); |
|
5508
|
0 |
17 |
if (items < 2) |
|
5514
|
3 |
14 |
if (items > 2) { |
|
5518
|
0 |
3 |
if (!bytes_to_write) { |
|
5525
|
17 |
0 |
ST(0) = file_atomic_spew_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
5538
|
0 |
1 |
if (items < 1) |
|
5544
|
1 |
0 |
if (items > 1) { |
|
5548
|
0 |
1 |
if (!out) { |
|
5553
|
1 |
0 |
if (out != bytes) { |
|
5567
|
0 |
1 |
if (items < 2) |
|
5573
|
0 |
1 |
if (items > 2) { |
|
5577
|
0 |
0 |
if (!out) { ST(0) = &PL_sv_no; XSRETURN(1); } |
|
5580
|
1 |
0 |
ST(0) = file_spew_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
5587
|
0 |
0 |
if (items != 1) croak("Usage: file_exists($path)"); |
|
5589
|
0 |
0 |
ST(0) = file_exists_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5596
|
0 |
0 |
if (items != 1) croak("Usage: file_size($path)"); |
|
5605
|
0 |
0 |
if (items != 1) croak("Usage: file_is_file($path)"); |
|
5607
|
0 |
0 |
ST(0) = file_is_file_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5614
|
0 |
0 |
if (items != 1) croak("Usage: file_is_dir($path)"); |
|
5616
|
0 |
0 |
ST(0) = file_is_dir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5626
|
0 |
0 |
if (items < 1) |
|
5631
|
0 |
0 |
if (items > 1) { |
|
5636
|
0 |
0 |
if (!out) { |
|
5641
|
0 |
0 |
if (out != bytes) SvREFCNT_dec(bytes); |
|
5642
|
0 |
0 |
if (SvROK(out) && SvTYPE(SvRV(out)) == SVt_PVAV) { |
|
|
0 |
0 |
if (SvROK(out) && SvTYPE(SvRV(out)) == SVt_PVAV) { |
|
5653
|
0 |
0 |
if (content == &PL_sv_undef) { |
|
5666
|
0 |
0 |
if (items != 1) croak("Usage: file_unlink($path)"); |
|
5668
|
0 |
0 |
ST(0) = file_unlink_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5675
|
0 |
0 |
if (items != 1) croak("Usage: file_mkdir($path)"); |
|
5677
|
0 |
0 |
ST(0) = file_mkdir_internal(path, 0755) ? &PL_sv_yes : &PL_sv_no; |
|
5684
|
0 |
0 |
if (items != 1) croak("Usage: file_rmdir($path)"); |
|
5686
|
0 |
0 |
ST(0) = file_rmdir_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5693
|
0 |
0 |
if (items != 1) croak("Usage: file_touch($path)"); |
|
5695
|
0 |
0 |
ST(0) = file_touch_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5701
|
0 |
0 |
if (items > 1) croak("Usage: file_clear_stat_cache() or file_clear_stat_cache($path)"); |
|
5703
|
0 |
0 |
if (items == 1 && SvOK(ST(0))) { |
|
|
0 |
0 |
if (items == 1 && SvOK(ST(0))) { |
|
5717
|
0 |
0 |
if (items != 1) croak("Usage: file_basename($path)"); |
|
5726
|
0 |
0 |
if (items != 1) croak("Usage: file_dirname($path)"); |
|
5735
|
0 |
0 |
if (items != 1) croak("Usage: file_extname($path)"); |
|
5744
|
0 |
0 |
if (items != 1) croak("Usage: file_mtime($path)"); |
|
5753
|
0 |
0 |
if (items != 1) croak("Usage: file_atime($path)"); |
|
5762
|
0 |
0 |
if (items != 1) croak("Usage: file_ctime($path)"); |
|
5771
|
0 |
0 |
if (items != 1) croak("Usage: file_mode($path)"); |
|
5780
|
0 |
0 |
if (items != 1) croak("Usage: file_is_link($path)"); |
|
5782
|
0 |
0 |
ST(0) = file_is_link_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5789
|
0 |
0 |
if (items != 1) croak("Usage: file_is_readable($path)"); |
|
5791
|
0 |
0 |
ST(0) = file_is_readable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5798
|
0 |
0 |
if (items != 1) croak("Usage: file_is_writable($path)"); |
|
5800
|
0 |
0 |
ST(0) = file_is_writable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5807
|
0 |
0 |
if (items != 1) croak("Usage: file_is_executable($path)"); |
|
5809
|
0 |
0 |
ST(0) = file_is_executable_internal(path) ? &PL_sv_yes : &PL_sv_no; |
|
5817
|
0 |
0 |
if (items != 1) croak("Usage: file_readdir($path)"); |
|
5827
|
0 |
0 |
if (items != 1) croak("Usage: file_slurp_raw($path)"); |
|
5837
|
0 |
0 |
if (items != 2) croak("Usage: file_copy($src, $dst)"); |
|
5840
|
0 |
0 |
ST(0) = file_copy_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no; |
|
5848
|
0 |
0 |
if (items != 2) croak("Usage: file_move($src, $dst)"); |
|
5851
|
0 |
0 |
ST(0) = file_move_internal(aTHX_ src, dst) ? &PL_sv_yes : &PL_sv_no; |
|
5859
|
0 |
0 |
if (items != 2) croak("Usage: file_chmod($path, $mode)"); |
|
5862
|
0 |
0 |
ST(0) = file_chmod_internal(path, mode) ? &PL_sv_yes : &PL_sv_no; |
|
5871
|
0 |
0 |
if (items < 2) |
|
5877
|
0 |
0 |
if (items > 2) { |
|
5881
|
0 |
0 |
if (!out) { ST(0) = &PL_sv_no; XSRETURN(1); } |
|
5884
|
0 |
0 |
ST(0) = file_append_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
5893
|
0 |
0 |
if (items < 2) |
|
5899
|
0 |
0 |
if (items > 2) { |
|
5903
|
0 |
0 |
if (!out) { ST(0) = &PL_sv_no; XSRETURN(1); } |
|
5906
|
0 |
0 |
ST(0) = file_atomic_spew_internal(aTHX_ path, payload) ? &PL_sv_yes : &PL_sv_no; |
|
5964
|
20 |
135 |
if (e->args == 0) { |
|
5969
|
105 |
30 |
} else if (e->args == 1) { |
|
5978
|
136 |
4 |
for (i = 0; import_funcs[i].name != NULL; i++) { |
|
5990
|
36 |
0 |
pkg = CopSTASHPV(PL_curcop); |
|
|
36 |
0 |
pkg = CopSTASHPV(PL_curcop); |
|
|
36 |
0 |
pkg = CopSTASHPV(PL_curcop); |
|
|
0 |
36 |
pkg = CopSTASHPV(PL_curcop); |
|
|
0 |
0 |
pkg = CopSTASHPV(PL_curcop); |
|
|
36 |
0 |
pkg = CopSTASHPV(PL_curcop); |
|
|
0 |
36 |
pkg = CopSTASHPV(PL_curcop); |
|
5993
|
26 |
10 |
if (items <= 1) { |
|
5998
|
23 |
6 |
for (i = 1; i < items; i++) { |
|
6003
|
8 |
15 |
if ((len == 4 && strEQ(arg, ":all")) || |
|
|
6 |
2 |
if ((len == 4 && strEQ(arg, ":all")) || |
|
6004
|
6 |
15 |
(len == 6 && strEQ(arg, "import"))) { |
|
|
2 |
4 |
(len == 6 && strEQ(arg, "import"))) { |
|
6010
|
357 |
0 |
for (j = 0; import_funcs[j].name != NULL; j++) { |
|
6011
|
19 |
338 |
if (strEQ(arg, import_funcs[j].name)) { |
|
6018
|
0 |
19 |
if (import_funcs[j].name == NULL) { |
|
6338
|
0 |
28 |
if (file_register_plugin(aTHX_ &g_predicate_plugin) != 1) { |