#define tryAMAGICunDEREF_var(meth_enum) \
tryAMAGICunW_var(meth_enum,setAGAIN,0,(void)0)
-#define tryAMAGICftest(chr) \
- STMT_START { \
- if (SvAMAGIC(TOPs)) { \
- SV * const tmpsv = amagic_call(TOPs, \
- newSVpvn_flags(&chr, 1, SVs_TEMP), \
- ftest_amg, 0); \
- \
- if (tmpsv) { \
- SPAGAIN; \
- SETs(tmpsv); \
- RETURN; \
- } \
- } \
+#define tryAMAGICftest(chr) \
+ STMT_START { \
+ if (SvAMAGIC(TOPs)) { \
+ const char tmpchr = (chr); \
+ SV * const tmpsv = amagic_call(TOPs, \
+ newSVpvn_flags(&tmpchr, 1, SVs_TEMP), \
+ ftest_amg, 0); \
+ \
+ if (tmpsv) { \
+ SPAGAIN; \
+ SETs(tmpsv); \
+ RETURN; \
+ } \
+ } \
} STMT_END
int stat_mode = S_IRUSR;
bool effective = FALSE;
- char opchar;
+ char opchar = '?';
dSP;
STACKED_FTEST_CHECK;
dVAR;
I32 result;
const int op_type = PL_op->op_type;
+ char opchar = '?';
dSP;
STACKED_FTEST_CHECK;
+
+ switch (op_type) {
+ case OP_FTIS: opchar = 'e'; break;
+ case OP_FTSIZE: opchar = 's'; break;
+ case OP_FTMTIME: opchar = 'M'; break;
+ case OP_FTCTIME: opchar = 'C'; break;
+ case OP_FTATIME: opchar = 'A'; break;
+ }
+ tryAMAGICftest(opchar);
+
result = my_stat();
SPAGAIN;
if (result < 0)
{
dVAR;
I32 result;
+ char opchar = '?';
dSP;
/* I believe that all these three are likely to be defined on most every
system these days. */
+ if (!SvAMAGIC(TOPs)) {
#ifndef S_ISUID
if(PL_op->op_type == OP_FTSUID)
RETPUSHNO;
if(PL_op->op_type == OP_FTSVTX)
RETPUSHNO;
#endif
+ }
STACKED_FTEST_CHECK;
+
+ switch (PL_op->op_type) {
+ case OP_FTROWNED: opchar = 'O'; break;
+ case OP_FTEOWNED: opchar = 'o'; break;
+ case OP_FTZERO: opchar = 'z'; break;
+ case OP_FTSOCK: opchar = 'S'; break;
+ case OP_FTCHR: opchar = 'c'; break;
+ case OP_FTBLK: opchar = 'b'; break;
+ case OP_FTFILE: opchar = 'f'; break;
+ case OP_FTDIR: opchar = 'd'; break;
+ case OP_FTPIPE: opchar = 'p'; break;
+ case OP_FTSUID: opchar = 'u'; break;
+ case OP_FTSGID: opchar = 'g'; break;
+ case OP_FTSVTX: opchar = 'k'; break;
+ }
+ tryAMAGICftest(opchar);
+
result = my_stat();
SPAGAIN;
if (result < 0)
PP(pp_ftlink)
{
dVAR;
- I32 result = my_lstat();
+ I32 result;
dSP;
+
+ tryAMAGICftest('l');
+ result = my_lstat();
if (result < 0)
RETPUSHUNDEF;
if (S_ISLNK(PL_statcache.st_mode))
STACKED_FTEST_CHECK;
+ tryAMAGICftest('t');
+
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
else if (isGV(TOPs))
STACKED_FTEST_CHECK;
+ tryAMAGICftest(PL_op->op_type == OP_FTTEXT ? 'T' : 'B');
+
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
else if (isGV(TOPs))