parser: accept trailing comma in enums; __restrict for arrays
[m6w6/ext-psi] / psi.d / glob.psi
index f4a762a729e1a0bfbac6e1877954d12abf449486..1fd6b15c9bb6f8677a96c232acb0802877ee50f1 100644 (file)
@@ -1,3 +1,5 @@
+#include <glob.h>
+
 function psi\glob(string $pattern, int $flags, array &$glob = NULL, callable $errfn = NULL) : int {
        let path = strval($pattern);
        let flags = intval($flags);
@@ -14,7 +16,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,5 +24,4 @@ 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);
 }