Re: cvs: php4 /main php_ini.c

From: Date: Fri, 19 Apr 2002 14:58:13 +0000
Subject: Re: cvs: php4 /main php_ini.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11239@lists.php.net to get a copy of this message
Now that i see what you meant and what you did i have an objection! The macro S_ISDIR is normally defined to enable changes the structure and therefor make type detection independent of the actual struct layout. If you consider the different occurances for the structure and the many filesystems that exist and the many platforms and ... i think it would be better to keep it or to add a define our own: #ifdef S_ISDIR #define STAT_ISDIR(m) S_ISDIR(m) #else #define STAT_ISDIR(m) ((m.st_mode & S_IFMT) == S_IFDIR) #endif makes diff:
-                       if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
+                       if (!STAT_ISDIR(statbuf)) {
And before anybody else falls over it we should add the other missing defines also:
#define S_ISBLK(m)      (((m)&S_IFMT) == S_IFBLK)
#define S_ISCHR(m)      (((m)&S_IFMT) == S_IFCHR)
#define S_ISDIR(m)      (((m)&S_IFMT) == S_IFDIR)
#define S_ISFIFO(m)     (((m)&S_IFMT) == S_IFIFO)
#define S_ISREG(m)      (((m)&S_IFMT) == S_IFREG)
#define S_ISLNK(m)      (((m)&S_IFMT) == S_IFLNK)
#define S_ISSOCK(m)     (((m)&S_IFMT) == S_IFSOCK)
marcus At 07:48 19.04.2002, Yasuo Ohgaki wrote:
yohgaki         Fri Apr 19 01:48:24 2002 EDT
Modified files:
    /php4/main  php_ini.c
Log: Avoid defining/using S_ISDIR macro. Index: php4/main/php_ini.c diff -u php4/main/php_ini.c:1.84 php4/main/php_ini.c:1.85
--- php4/main/php_ini.c:1.84    Wed Apr 17 13:25:18 2002
+++ php4/main/php_ini.c Fri Apr 19 01:48:22 2002 @@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: php_ini.c,v 1.84 2002/04/17 17:25:18 sebastian Exp $ */ +/* $Id: php_ini.c,v 1.85 2002/04/19 05:48:22 yohgaki Exp $ */ #include "php.h" #ifndef PHP_WIN32 @@ -31,10 +31,6 @@ #include "SAPI.h" #include "php_main.h" -#ifndef S_ISDIR
-#define S_ISDIR( m )    (((m) & S_IFMT) == S_IFDIR)
-#endif - typedef struct _php_extension_lists {
        zend_llist engine;
        zend_llist functions;
@@ -272,7 +268,7 @@
        if (php_ini_path_override && php_ini_path_override[0]) {
                struct stat statbuf;
                if (!VCWD_STAT(php_ini_path_override, &statbuf)) {
-                       if (!S_ISDIR(statbuf.st_mode)) {
+                       if (!((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
                                fh.handle.fp = VCWD_FOPEN(php_ini_path_override, "r");
                        }
                }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.cvs (#11239) next »