From: Jarkko Hietaniemi Date: Thu, 21 Jun 2001 19:08:28 +0000 (+0000) Subject: Cwd tweak from Doug MacEachern. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=00536bfc9b527920fdb38d3e40d0078a06ab314d;p=p5sagit%2Fp5-mst-13.2.git Cwd tweak from Doug MacEachern. p4raw-id: //depot/perl@10796 --- diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 6935155..10c6f15 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; }