The ext/Cwd/Cwd.xs part of...
Robin Barker [Sat, 22 Dec 2007 00:52:54 +0000 (00:52 +0000)]
Subject: consting Cwd and ExtUtils::ParseXS
From: "Robin Barker" <Robin.Barker@npl.co.uk>
Message-ID: <46A0F33545E63740BC7563DE59CA9C6D0939A0@exchsvr2.npl.ad.local>

lib/ExtUtils/ParseXS.pm had changes already made with change
#32691.

p4raw-id: //depot/perl@32710

ext/Cwd/Cwd.xs

index 7434dfa..4958bd2 100644 (file)
@@ -79,7 +79,8 @@ bsd_realpath(const char *path, char *resolved)
        return Perl_rmsexpand(aTHX_ (char*)path, resolved, NULL, 0);
 #else
        int rootd, serrno;
-       char *p, *q, wbuf[MAXPATHLEN];
+       const char *p;
+       char *q, wbuf[MAXPATHLEN];
        int symlinks = 0;
 
        /* Save the starting point. */
@@ -112,17 +113,18 @@ bsd_realpath(const char *path, char *resolved)
 loop:
        q = strrchr(resolved, '/');
        if (q != NULL) {
+               const char *dir;
                p = q + 1;
                if (q == resolved)
-                       q = "/";
+                       dir = "/";
                else {
                        do {
                                --q;
                        } while (q > resolved && *q == '/');
                        q[1] = '\0';
-                       q = resolved;
+                       dir = resolved;
                }
-               if (chdir(q) < 0)
+               if (chdir(dir) < 0)
                        goto err1;
        } else
                p = resolved;