Skip to content

Commit 69734ba

Browse files
committed
Make savesharedpvn arg Non-Null
It was NULLOK only to stop a compiler warning. No warning happens with c99 and a slight rearrangement; and NULLs are not acceptable input.
1 parent 45d3926 commit 69734ba

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

embed.fnc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,7 @@ Cdp |void |save_set_svflags \
30143014
Aadp |char * |savesharedpv |NULLOK const char *pv
30153015

30163016
: NULLOK only to suppress a compiler warning
3017-
Aadp |char * |savesharedpvn |NULLOK const char * const pv \
3017+
Aadp |char * |savesharedpvn |NN const char * const pv \
30183018
|const STRLEN len
30193019
Cdp |void |save_shared_pvref \
30203020
|NN char **str

proto.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,10 +1359,10 @@ Perl_savesharedpv(pTHX_ const char *pv)
13591359
char *
13601360
Perl_savesharedpvn(pTHX_ const char *const pv, const STRLEN len)
13611361
{
1362-
char *const newaddr = (char*)PerlMemShared_malloc(len + 1);
1363-
1362+
PERL_ARGS_ASSERT_SAVESHAREDPVN;
13641363
PERL_UNUSED_CONTEXT;
1365-
/* PERL_ARGS_ASSERT_SAVESHAREDPVN; */
1364+
1365+
char *const newaddr = (char*)PerlMemShared_malloc(len + 1);
13661366

13671367
if (!newaddr) {
13681368
croak_no_mem_ext(STR_WITH_LEN("util:savesharedpvn"));

0 commit comments

Comments
 (0)