diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-11-02 19:04:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-11-02 19:04:10 +0000 |
commit | f1cb2d481d972775b9a182636a99d99ab903f097 (patch) | |
tree | 14dda7ff486439842dcbcb2ba6c7539fae1d5bb1 | |
parent | d7f0a2f48cb0be80a2bdbd31222d42d9addef98b (diff) | |
download | perl-f1cb2d481d972775b9a182636a99d99ab903f097.tar.gz |
Merge ftzero ftsock ftchr ftblk ftfile ftdir ftpipe into
Perl_pp_ftrowned
p4raw-id: //depot/perl@25961
-rw-r--r-- | mathoms.c | 35 | ||||
-rw-r--r-- | opcode.h | 14 | ||||
-rwxr-xr-x | opcode.pl | 3 | ||||
-rw-r--r-- | pp_sys.c | 139 |
4 files changed, 82 insertions, 109 deletions
@@ -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) { @@ -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), @@ -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)], @@ -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; } |