diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-21 19:08:28 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-21 19:08:28 +0000 |
commit | 00536bfc9b527920fdb38d3e40d0078a06ab314d (patch) | |
tree | 5c2ff9d1cdebc552c49fe4234e305b3b088855ca /ext/Cwd/Cwd.xs | |
parent | e3d944f4dd784cff30477bcd6cf567adfcabc9ba (diff) | |
download | perl-00536bfc9b527920fdb38d3e40d0078a06ab314d.tar.gz |
Cwd tweak from Doug MacEachern.
p4raw-id: //depot/perl@10796
Diffstat (limited to 'ext/Cwd/Cwd.xs')
-rw-r--r-- | ext/Cwd/Cwd.xs | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 6935155a40..10c6f15422 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -211,29 +211,21 @@ PPCODE: dXSTARG; char *path; STRLEN len; - char *buf; - - New(0, buf, MAXPATHLEN, char); - if (buf) { - buf[MAXPATHLEN] = 0; - if (pathsv) - path = SvPV(pathsv, len); - else { - path = "."; - len = 1; - } + char buf[MAXPATHLEN]; - if (bsd_realpath(path, buf)) { - sv_setpvn(TARG, buf, strlen(buf)); - SvPOK_only(TARG); - } - else - sv_setsv(TARG, &PL_sv_undef); + if (pathsv) + path = SvPV(pathsv, len); + else { + path = "."; + len = 1; + } - Safefree(buf); + if (bsd_realpath(path, buf)) { + sv_setpvn(TARG, buf, strlen(buf)); + SvPOK_only(TARG); } else - sv_setsv(TARG, &PL_sv_undef); + sv_setsv(TARG, &PL_sv_undef); XSprePUSH; PUSHTARG; } |