Skip to content

S_new_SV: mark args unused, make inline, correct typo #22208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -2248,6 +2248,10 @@ AMbdp |CV * |newSUB |I32 floor \
|NULLOK OP *proto \
|NULLOK OP *block
ARdp |SV * |newSV |const STRLEN len
: Perl_new_sv is inline, so needs to be visible outside of sv.c
Ciop |SV * |new_sv |NN const char *file \
|int line \
|NN const char *func
Rp |SV * |newSVavdefelem |NN AV *av \
|SSize_t ix \
|bool extendible
Expand Down
5 changes: 5 additions & 0 deletions proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sv.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ typedef enum {
# define HVAUX_ARENA_ROOT_IX SVt_IV
#endif
#ifdef PERL_IN_SV_C
# define SVt_FIRST SVt_NULL /* the type of SV that new_SV() in sv.c returns */
# define SVt_FIRST SVt_NULL /* the type of SV that new_SV() in sv_inline.h returns */
#endif

#define PERL_ARENA_ROOTS_SIZE (SVt_LAST)
Expand Down
32 changes: 10 additions & 22 deletions sv_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@
SV* Perl_more_sv(pTHX);

/* new_SV(): return a new, empty SV head */

#ifdef DEBUG_LEAKING_SCALARS
/* provide a real function for a debugger to play with */
STATIC SV*
S_new_SV(pTHX_ const char *file, int line, const char *func)
PERL_STATIC_INLINE SV*
Perl_new_sv(pTHX_ const char *file, int line, const char *func)
{
SV* sv;
#ifndef DEBUG_LEAKING_SCALARS
PERL_UNUSED_ARG(file);
PERL_UNUSED_ARG(line);
PERL_UNUSED_ARG(func);
#endif

if (PL_sv_root)
uproot_SV(sv);
Expand All @@ -83,6 +85,7 @@ S_new_SV(pTHX_ const char *file, int line, const char *func)
SvANY(sv) = 0;
SvREFCNT(sv) = 1;
SvFLAGS(sv) = 0;
#ifdef DEBUG_LEAKING_SCALARS
sv->sv_debug_optype = PL_op ? PL_op->op_type : 0;
sv->sv_debug_line = (U16) (PL_parser && PL_parser->copline != NOLINE
? PL_parser->copline
Expand All @@ -99,25 +102,10 @@ S_new_SV(pTHX_ const char *file, int line, const char *func)
MEM_LOG_NEW_SV(sv, file, line, func);
DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%" UVxf ": (%05ld) new_SV (from %s:%d [%s])\n",
PTR2UV(sv), (long)sv->sv_debug_serial, file, line, func));

#endif
return sv;
}
# define new_SV(p) (p)=S_new_SV(aTHX_ __FILE__, __LINE__, FUNCTION__)

#else
# define new_SV(p) \
STMT_START { \
if (PL_sv_root) \
uproot_SV(p); \
else \
(p) = Perl_more_sv(aTHX); \
SvANY(p) = 0; \
SvREFCNT(p) = 1; \
SvFLAGS(p) = 0; \
MEM_LOG_NEW_SV(p, __FILE__, __LINE__, FUNCTION__); \
} STMT_END
#endif

# define new_SV(p) (p)=Perl_new_sv(aTHX_ __FILE__, __LINE__, FUNCTION__)

typedef struct xpvhv_with_aux XPVHV_WITH_AUX;

Expand Down