Skip to content
Draft
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
19 changes: 10 additions & 9 deletions FileCheck.xs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static int gl_debug = 0;
#define RETURN_CALL_REAL_OP_IF_CALL_WITH_DEFGV() STMT_START { \
if (gl_overload_ft->op[OP_STAT].is_mocked) { \
SV *arg = *PL_stack_sp; GV *gv; \
if ( SvTYPE(arg) == SVt_PVAV ) arg = arg + AvMAX( arg ); \
if ( SvTYPE(arg) == SVt_PVAV && AvMAX((AV*)arg) >= 0 ) \
arg = arg + AvMAX( arg ); \
if ( PL_op->op_flags & OPf_REF ) \
gv = cGVOP_gv; \
else { \
Expand All @@ -60,6 +61,10 @@ static int gl_debug = 0;

OverloadFTOps *gl_overload_ft = 0;

#define ASSERT_OVERLOAD_FT_INITIALIZED() \
if (!gl_overload_ft) \
croak("Overload::FileCheck: internal state not initialized (gl_overload_ft is NULL)")

/*
* common helper to callback the pure perl function Overload::FileCheck::_check
* and get the mocked value for the -X check
Expand Down Expand Up @@ -254,8 +259,7 @@ int _overload_ft_stat(Stat_t *stat, int *size) {
PP(pp_overload_ft_yes_no) {
int check_status;

if (!gl_overload_ft)
croak("Overload::FileCheck: internal state not initialized (gl_overload_ft is NULL)");
ASSERT_OVERLOAD_FT_INITIALIZED();

/* not currently mocked */
RETURN_CALL_REAL_OP_IF_UNMOCK();
Expand All @@ -279,8 +283,7 @@ PP(pp_overload_ft_int) {
int check_status;
int saved_errno;

if (!gl_overload_ft)
croak("Overload::FileCheck: internal state not initialized (gl_overload_ft is NULL)");
ASSERT_OVERLOAD_FT_INITIALIZED();

/* not currently mocked */
RETURN_CALL_REAL_OP_IF_UNMOCK();
Expand Down Expand Up @@ -314,8 +317,7 @@ PP(pp_overload_ft_nv) {
SV *status;
int saved_errno;

if (!gl_overload_ft)
croak("Overload::FileCheck: internal state not initialized (gl_overload_ft is NULL)");
ASSERT_OVERLOAD_FT_INITIALIZED();

/* not currently mocked */
RETURN_CALL_REAL_OP_IF_UNMOCK();
Expand Down Expand Up @@ -362,8 +364,7 @@ PP(pp_overload_stat) { /* stat & lstat */
int size;


if (!gl_overload_ft)
croak("Overload::FileCheck: internal state not initialized (gl_overload_ft is NULL)");
ASSERT_OVERLOAD_FT_INITIALIZED();

/* not currently mocked */
RETURN_CALL_REAL_OP_IF_UNMOCK();
Expand Down
Loading