* path.
*/
static int vms_split_path
- (const char * path,
+ (pTHX_ const char * path,
char * * volume,
int * vol_len,
char * * root,
int tunix_len;
int nl_flag;
- Newx(tunix, VMS_MAXRSS + 1,char);
+ tunix = (char *) PerlMem_malloc(VMS_MAXRSS);
strcpy(tunix, spec);
tunix_len = strlen(tunix);
nl_flag = 0;
nl_flag = 1;
}
uspec = decc$translate_vms(tunix);
- Safefree(tunix);
+ PerlMem_free(tunix);
if ((int)uspec > 0) {
strcpy(rslt,uspec);
if (nl_flag) {
#else
cmp_rslt = strncasecmp(spec,"SYS$SCRATCH:", 12);
#endif
- Newx(tmp, VMS_MAXRSS, char);
+ tmp = (char *) PerlMem_malloc(VMS_MAXRSS);
if (cmp_rslt == 0) {
int islnm;
cp2++;
if (*cp2 == ']' || *cp2 == '>') {
*(cp1++) = '.'; *(cp1++) = '/'; *(cp1++) = '\0';
- Safefree(tmp);
+ PerlMem_free(tmp);
return rslt;
}
else if ( *cp2 != '^' && *cp2 != '.' && *cp2 != '-') { /* add the implied device */
if (getcwd(tmp, VMS_MAXRSS-1 ,1) == NULL) {
if (ts) Safefree(rslt);
- Safefree(tmp);
+ PerlMem_free(tmp);
return NULL;
}
trnlnm_iter_count = 0;
while (*cp3) {
*(cp1++) = *(cp3++);
if (cp1 - rslt > (VMS_MAXRSS - 1) && !ts && !buf) {
- Safefree(tmp);
+ PerlMem_free(tmp);
return NULL; /* No room */
}
}
else cp2++;
}
}
- Safefree(tmp);
+ PerlMem_free(tmp);
for (; cp2 <= dirend; cp2++) {
if ((*cp2 == '^')) {
/* EFS file escape, pass the next character as is */
vmspath[vmspath_len] = 0;
if (unixpath[unixlen - 1] == '/')
dir_flag = 1;
- Newx(esa, VMS_MAXRSS, char);
+ esa = (char *) PerlMem_malloc(VMS_MAXRSS);
myfab.fab$l_fna = vmspath;
myfab.fab$b_fns = strlen(vmspath);
myfab.fab$l_naml = &mynam;
/* It failed! Try again as a UNIX filespec */
if (!(sts & 1)) {
- Safefree(esa);
+ PerlMem_free(esa);
return sts;
}
sts = sys$search(&myfab);
/* on any failure, returned the POSIX ^UP^ filespec */
if (!(sts & 1)) {
- Safefree(esa);
+ PerlMem_free(esa);
return sts;
}
specdsc.dsc$a_pointer = vmspath;
}
}
}
- Safefree(esa);
+ PerlMem_free(esa);
return sts;
}
* here that are a VMS device name or concealed logical name instead.
* So to make things work, this procedure must be tolerant.
*/
- Newx(esa, vmspath_len, char);
+ esa = (char *) PerlMem_malloc(vmspath_len);
sts = SS$_NORMAL;
nextslash = strchr(&unixptr[1],'/');
}
} /* non-POSIX translation */
- Safefree(esa);
+ PerlMem_free(esa);
} /* End of relative/absolute path handling */
while ((*unixptr) && (vmslen < vmspath_len)){
}
while (*(++cp2) != '/' && *cp2) *(cp1++) = *cp2;
*cp1 = '\0';
- Newx(trndev, VMS_MAXRSS, char);
+ trndev = (char *) PerlMem_malloc(VMS_MAXRSS);
islnm = my_trnlnm(rslt,trndev,0);
/* DECC special handling */
}
}
}
- Safefree(trndev);
+ PerlMem_free(trndev);
}
else {
*(cp1++) = '[';
* Allocate and fill in the new argument vector, Some Unix's terminate
* the list with an extra null pointer.
*/
- Newx(argv, item_count+1, char *);
argv = (char **) PerlMem_malloc((item_count+1) * sizeof(char *));
*av = argv;
for (j = 0; j < item_count; ++j, list_head = list_head->next)
resultspec.dsc$b_dtype = DSC$K_DTYPE_T;
resultspec.dsc$b_class = DSC$K_CLASS_D;
resultspec.dsc$a_pointer = NULL;
- Newx(vmsspec, VMS_MAXRSS, char);
+ vmsspec = (char *) PerlMem_malloc(VMS_MAXRSS);
if ((isunix = (int) strchr(item,'/')) != (int) NULL)
filespec.dsc$a_pointer = do_tovmsspec(item,vmsspec,0);
if (!isunix || !filespec.dsc$a_pointer)
char *string;
char *c;
- Newx(string,resultspec.dsc$w_length+1,char);
+ string = (char *) PerlMem_malloc(resultspec.dsc$w_length+1);
strncpy(string, resultspec.dsc$a_pointer, resultspec.dsc$w_length);
string[resultspec.dsc$w_length] = '\0';
if (NULL == had_version)
add_item(head, tail, string, count);
++expcount;
}
- Safefree(vmsspec);
+ PerlMem_free(vmsspec);
if (sts != RMS$_NMF)
{
set_vaxc_errno(sts);
break;
}
}
- if (mask != rlst) Safefree(mask);
+ if (mask != rlst) PerlMem_free(mask);
}
/* When Perl is in decc_filename_unix_report mode and is run from a concealed
*template, *base, *end, *cp1, *cp2;
register int tmplen, reslen = 0, dirs = 0;
- Newx(unixwild, VMS_MAXRSS, char);
+ unixwild = (char *) PerlMem_malloc(VMS_MAXRSS);
if (!wildspec || !fspec) return 0;
template = unixwild;
if (strpbrk(wildspec,"]>:") != NULL) {
if (do_tounixspec(wildspec,unixwild,0) == NULL) {
- Safefree(unixwild);
+ PerlMem_free(unixwild);
return 0;
}
}
strncpy(unixwild, wildspec, VMS_MAXRSS-1);
unixwild[VMS_MAXRSS-1] = 0;
}
- Newx(unixified, VMS_MAXRSS, char);
+ unixified = (char *) PerlMem_malloc(VMS_MAXRSS);
if (strpbrk(fspec,"]>:") != NULL) {
if (do_tounixspec(fspec,unixified,0) == NULL) {
- Safefree(unixwild);
- Safefree(unixified);
+ PerlMem_free(unixwild);
+ PerlMem_free(unixified);
return 0;
}
else base = unixified;
/* No prefix or absolute path on wildcard, so nothing to remove */
if (!*template || *template == '/') {
- Safefree(unixwild);
+ PerlMem_free(unixwild);
if (base == fspec) {
- Safefree(unixified);
+ PerlMem_free(unixified);
return 1;
}
tmplen = strlen(unixified);
if (tmplen > reslen) {
- Safefree(unixified);
+ PerlMem_free(unixified);
return 0; /* not enough space */
}
/* Copy unixified resultant, including trailing NUL */
memmove(fspec,unixified,tmplen+1);
- Safefree(unixified);
+ PerlMem_free(unixified);
return 1;
}
if ((*cp1 == '/') && !dirs--) /* postdec so we get front of rel path */
{ cp1++; break; }
if (cp1 != fspec) memmove(fspec,cp1, end - cp1 + 1);
- Safefree(unixified);
- Safefree(unixwild);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
return 1;
}
else {
while ((cp1 = strstr(ellipsis+4,".../")) != NULL) {ellipsis = cp1; ells++;}
totells = ells;
for (cp1 = ellipsis+4; *cp1; cp1++) if (*cp1 == '/') dirs++;
- Newx(tpl, VMS_MAXRSS, char);
+ tpl = PerlMem_malloc(VMS_MAXRSS);
if (ellipsis == template && opts & 1) {
/* Template begins with an ellipsis. Since we can't tell how many
* directory names at the front of the resultant to keep for an
* could match template).
*/
if (getcwd(tpl, (VMS_MAXRSS - 1),0) == NULL) {
- Safefree(tpl);
- Safefree(unixified);
- Safefree(unixwild);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
return 0;
}
if (!decc_efs_case_preserve) {
for (front = cp2+1; *front; front++) if (*front == '/') segdirs--;
if (*cp1 == '\0' && *cp2 == '/' && segdirs < 1) {
memmove(fspec,cp2+1,end - cp2);
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
return 1;
}
}
for (front = end ; front >= base; front--)
if (*front == '/' && !dirs--) { front++; break; }
}
- Newx(lcres, VMS_MAXRSS, char);
+ lcres = (char *) PerlMem_malloc(VMS_MAXRSS);
for (cp1=template,cp2=lcres; *cp1 && cp2 <= lcres + (VMS_MAXRSS - 1);
cp1++,cp2++) {
if (!decc_efs_case_preserve) {
}
}
if (cp1 != '\0') {
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(lcres);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
return 0; /* Path too long. */
}
lcend = cp2;
if (*cp2 == '/') segdirs++;
}
if (cp1 != ellipsis - 1) {
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(lcres);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
+ PerlMem_free(lcres);
return 0; /* Path too long */
}
/* Back up at least as many dirs as in template before matching */
for ( ; cp1 >= lcres; cp1--) if (*cp1 == '/') { cp1++; break; }
}
if (!match) {
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(lcres);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
+ PerlMem_free(lcres);
return 0; /* Can't find prefix ??? */
}
if (match > 1 && opts & 1) {
for (st = cp2+1; *st; st++) if (*st == '/') segdirs--;
if (*cp1 == '\0' && *cp2 == '/') {
memmove(fspec,cp2+1,end - cp2);
- Safefree(lcres);
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
+ PerlMem_free(lcres);
return 1;
}
/* Nope -- stick with lcfront from above and keep going. */
}
}
memmove(fspec,base + (lcfront - lcres), lcend - lcfront + 1);
- Safefree(unixified);
- Safefree(unixwild);
- Safefree(lcres);
- Safefree(tpl);
+ PerlMem_free(tpl);
+ PerlMem_free(unixified);
+ PerlMem_free(unixwild);
+ PerlMem_free(lcres);
return 1;
ellipsis = nextell;
}
/* Skip any directory component and just copy the name. */
sts = vms_split_path
- (buff,
+ (aTHX_ buff,
&v_spec,
&v_len,
&r_spec,
/* Find where all the components are */
v_sts = vms_split_path
- (rstr,
+ (aTHX_ rstr,
&v_spec,
&v_len,
&r_spec,