From: Nicholas Clark Date: Wed, 2 Nov 2005 19:04:10 +0000 (+0000) Subject: Merge ftzero ftsock ftchr ftblk ftfile ftdir ftpipe into X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f1cb2d481d972775b9a182636a99d99ab903f097;p=p5sagit%2Fp5-mst-13.2.git Merge ftzero ftsock ftchr ftblk ftfile ftdir ftpipe into Perl_pp_ftrowned p4raw-id: //depot/perl@25961 --- diff --git a/mathoms.c b/mathoms.c index 2ad9de5..bb7230a 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 68c1cbd..46628c9 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 e4cda78..23f6c35 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 98c7348..d005366 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; }