This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / ext / File / Glob / bsd_glob.c
index 6989df8..0635901 100644 (file)
@@ -261,12 +261,19 @@ bsd_glob(const char *pattern, int flags,
 #ifndef MACOS_TRADITIONAL
        patnext = (U8 *) pattern;
 #endif
+       /* TODO: GLOB_APPEND / GLOB_DOOFFS aren't supported yet */
+#if 0
        if (!(flags & GLOB_APPEND)) {
                pglob->gl_pathc = 0;
                pglob->gl_pathv = NULL;
                if (!(flags & GLOB_DOOFFS))
                        pglob->gl_offs = 0;
        }
+#else
+       pglob->gl_pathc = 0;
+       pglob->gl_pathv = NULL;
+       pglob->gl_offs = 0;
+#endif
        pglob->gl_flags = flags & ~GLOB_MAGCHAR;
        pglob->gl_errfunc = errfunc;
        pglob->gl_matchc = 0;
@@ -325,7 +332,7 @@ bsd_glob(const char *pattern, int flags,
 
        /* We operate on a copy of the pattern */
        len = strlen(pattern);
-       New(0, new_pat, len + 1, char);
+       Newx(new_pat, len + 1, char);
        if (new_pat == NULL)
            return (GLOB_NOSPACE);
 
@@ -1002,7 +1009,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limitp)
        if (pglob->gl_pathv)
                pathv = Renew(pglob->gl_pathv,newsize,char*);
        else
-               New(0,pathv,newsize,char*);
+               Newx(pathv,newsize,char*);
        if (pathv == NULL) {
                if (pglob->gl_pathv) {
                        Safefree(pglob->gl_pathv);
@@ -1023,7 +1030,7 @@ globextend(const Char *path, glob_t *pglob, size_t *limitp)
                ;
        len = (STRLEN)(p - path);
        *limitp += len;
-       New(0, copy, p-path, char);
+       Newx(copy, p-path, char);
        if (copy != NULL) {
                if (g_Ctoc(path, copy, len)) {
                        Safefree(copy);
@@ -1209,7 +1216,7 @@ qprintf(const char *str, register Char *s)
 
 #ifdef MACOS_TRADITIONAL
 
-/* Replace the last occurence of the pattern ":[^:]+::", e.g. ":lib::",
+/* Replace the last occurrence of the pattern ":[^:]+::", e.g. ":lib::",
    with a single ':', if possible. It is not an error, if the pattern
    doesn't match (we return -1), but if there are two consecutive colons
    '::', there must be a preceding ':[^:]+'. Hence,  a volume path like