Skip to content

Commit

Permalink
Make PL_origfilename a pointer to const char
Browse files Browse the repository at this point in the history
Commit dd37466 both made `scriptname`
a `const char *` and added the cast to the string literal.  The latter
is unnecessary given the former, and by making PL_origfilename a
`const char *`, we can avoid casting the const away from `scriptname`
as well.
  • Loading branch information
ilmari committed Oct 25, 2021
1 parent 7ab87c6 commit b6cb774
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion intrpvar.h
Expand Up @@ -467,7 +467,7 @@ PERLVAR(I, origargv, char **)
PERLVAR(I, envgv, GV *)
PERLVAR(I, incgv, GV *)
PERLVAR(I, hintgv, GV *)
PERLVAR(I, origfilename, char *)
PERLVAR(I, origfilename, const char *)
PERLVARI(I, xsubfilename, const char *, NULL)
PERLVAR(I, diehook, SV *)
PERLVAR(I, warnhook, SV *)
Expand Down
4 changes: 2 additions & 2 deletions perl.c
Expand Up @@ -4017,15 +4017,15 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript)
}
scriptname = savepv(s + 1);
Safefree(PL_origfilename);
PL_origfilename = (char *)scriptname;
PL_origfilename = scriptname;
}
}
}

CopFILE_free(PL_curcop);
CopFILE_set(PL_curcop, PL_origfilename);
if (*PL_origfilename == '-' && PL_origfilename[1] == '\0')
scriptname = (char *)"";
scriptname = "";
if (fdscript >= 0) {
rsfp = PerlIO_fdopen(fdscript,PERL_SCRIPT_MODE);
}
Expand Down
2 changes: 1 addition & 1 deletion pod/perldelta.pod
Expand Up @@ -348,7 +348,7 @@ well.

=item *

XXX
C<PL_origifilename> is now declared as C<const char *>.

=back

Expand Down

0 comments on commit b6cb774

Please sign in to comment.