X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=psi.d%2Fglob.psi;h=4e5589a579fa5b1470e7b074f4b2de62a1986663;hp=5e6d21534d452d34c36304878dfb533dbd06f16c;hb=c0873cbbe9e5a83305adbc2bbd94aede5437f33d;hpb=7df12c88a4e14611a2585d6e7c994c59e8d7485a diff --git a/psi.d/glob.psi b/psi.d/glob.psi index 5e6d215..4e5589a 100644 --- a/psi.d/glob.psi +++ b/psi.d/glob.psi @@ -1,7 +1,12 @@ +#include + function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $errfn = NULL) : int { let path = strval($pattern); let flags = intval($flags); - let err = callback intval($errfn( + let err = callback( + epath, + eerrno + ) as intval($errfn( to_string(epath), to_int(eerrno) )); @@ -14,7 +19,7 @@ function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $er strval($gl_pathv) ) ); - return to_int(glob); + return glob(path, flags, err, buf) as to_int(glob); set $glob = to_array(*buf, to_int(gl_matchc), to_int(gl_pathc), @@ -22,4 +27,5 @@ function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $er to_int(gl_flags), to_array(*gl_pathv, gl_pathc + gl_offs, to_string(*gl_pathv)) ); + free globfree(buf); }