summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-11-02 19:04:10 +0000
committerNicholas Clark <nick@ccl4.org>2005-11-02 19:04:10 +0000
commitf1cb2d481d972775b9a182636a99d99ab903f097 (patch)
tree14dda7ff486439842dcbcb2ba6c7539fae1d5bb1
parentd7f0a2f48cb0be80a2bdbd31222d42d9addef98b (diff)
downloadperl-f1cb2d481d972775b9a182636a99d99ab903f097.tar.gz
Merge ftzero ftsock ftchr ftblk ftfile ftdir ftpipe into
Perl_pp_ftrowned p4raw-id: //depot/perl@25961
-rw-r--r--mathoms.c35
-rw-r--r--opcode.h14
-rwxr-xr-xopcode.pl3
-rw-r--r--pp_sys.c139
4 files changed, 82 insertions, 109 deletions
diff --git a/mathoms.c b/mathoms.c
index 2ad9de58a5..bb7230abf7 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -871,6 +871,41 @@ PP(pp_ftctime)
return pp_ftis();
}
+PP(pp_ftzero)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftsock)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftchr)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftblk)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftfile)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftdir)
+{
+ return pp_ftrowned();
+}
+
+PP(pp_ftpipe)
+{
+ return pp_ftrowned();
+}
+
U8 *
Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
{
diff --git a/opcode.h b/opcode.h
index 68c1cbd887..46628c979f 100644
--- a/opcode.h
+++ b/opcode.h
@@ -1011,17 +1011,17 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
MEMBER_TO_FPTR(Perl_pp_ftis),
MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_fteowned */
MEMBER_TO_FPTR(Perl_pp_ftrowned),
- MEMBER_TO_FPTR(Perl_pp_ftzero),
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftzero */
MEMBER_TO_FPTR(Perl_pp_ftis), /* Perl_pp_ftsize */
MEMBER_TO_FPTR(Perl_pp_ftis), /* Perl_pp_ftmtime */
MEMBER_TO_FPTR(Perl_pp_ftis), /* Perl_pp_ftatime */
MEMBER_TO_FPTR(Perl_pp_ftis), /* Perl_pp_ftctime */
- MEMBER_TO_FPTR(Perl_pp_ftsock),
- MEMBER_TO_FPTR(Perl_pp_ftchr),
- MEMBER_TO_FPTR(Perl_pp_ftblk),
- MEMBER_TO_FPTR(Perl_pp_ftfile),
- MEMBER_TO_FPTR(Perl_pp_ftdir),
- MEMBER_TO_FPTR(Perl_pp_ftpipe),
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftsock */
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftchr */
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftblk */
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftfile */
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftdir */
+ MEMBER_TO_FPTR(Perl_pp_ftrowned), /* Perl_pp_ftpipe */
MEMBER_TO_FPTR(Perl_pp_ftlink),
MEMBER_TO_FPTR(Perl_pp_ftsuid),
MEMBER_TO_FPTR(Perl_pp_ftsgid),
diff --git a/opcode.pl b/opcode.pl
index e4cda78c0a..23f6c352fb 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -53,7 +53,8 @@ my @raw_alias = (
Perl_pp_ssockopt => ['gsockopt'],
Perl_pp_getpeername => ['getsockname'],
Perl_pp_stat => ['lstat'],
- Perl_pp_ftrowned => ['fteowned'],
+ Perl_pp_ftrowned => [qw(fteowned ftzero ftsock ftchr ftblk
+ ftfile ftdir ftpipe)],
Perl_pp_fttext => ['ftbinary'],
Perl_pp_gmtime => ['localtime'],
Perl_pp_semget => [qw(shmget msgget)],
diff --git a/pp_sys.c b/pp_sys.c
index 98c734842b..d005366d13 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3090,107 +3090,44 @@ PP(pp_ftrowned)
SPAGAIN;
if (result < 0)
RETPUSHUNDEF;
- if (PL_statcache.st_uid == (PL_op->op_type == OP_FTEOWNED ?
- PL_euid : PL_uid) )
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftzero)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (PL_statcache.st_size == 0)
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftsock)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISSOCK(PL_statcache.st_mode))
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftchr)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISCHR(PL_statcache.st_mode))
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftblk)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISBLK(PL_statcache.st_mode))
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftfile)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISREG(PL_statcache.st_mode))
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftdir)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISDIR(PL_statcache.st_mode))
- RETPUSHYES;
- RETPUSHNO;
-}
-
-PP(pp_ftpipe)
-{
- I32 result;
- dSP;
- STACKED_FTEST_CHECK;
- result = my_stat();
- SPAGAIN;
- if (result < 0)
- RETPUSHUNDEF;
- if (S_ISFIFO(PL_statcache.st_mode))
- RETPUSHYES;
+ switch (PL_op->op_type) {
+ case OP_FTROWNED:
+ if (PL_statcache.st_uid == PL_uid);
+ RETPUSHYES;
+ break;
+ case OP_FTEOWNED:
+ if (PL_statcache.st_uid == PL_euid)
+ RETPUSHYES;
+ break;
+ case OP_FTZERO:
+ if (PL_statcache.st_size == 0)
+ RETPUSHYES;
+ break;
+ case OP_FTSOCK:
+ if (S_ISSOCK(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ case OP_FTCHR:
+ if (S_ISCHR(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ case OP_FTBLK:
+ if (S_ISBLK(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ case OP_FTFILE:
+ if (S_ISREG(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ case OP_FTDIR:
+ if (S_ISDIR(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ case OP_FTPIPE:
+ if (S_ISFIFO(PL_statcache.st_mode))
+ RETPUSHYES;
+ break;
+ }
RETPUSHNO;
}