]> granicus.if.org Git - php/commitdiff
reduce realpath_cache_bucket size by 8 bytes on 64-bit
authorAnatol Belski <ab@php.net>
Sun, 13 Nov 2016 15:48:36 +0000 (16:48 +0100)
committerAnatol Belski <ab@php.net>
Sun, 13 Nov 2016 19:21:44 +0000 (20:21 +0100)
This limits the path length to 64kb which is already far above the
use case. In return, the whole path cache storage size is reduced
by 8kb.

Zend/zend_virtual_cwd.c
Zend/zend_virtual_cwd.h

index 8192b424b4b531cc5a570fb1f71052d0b7fb8abc..420bc54a7b366a39d947b36b20159178f9e96cab 100644 (file)
@@ -648,7 +648,7 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
                        memcpy(bucket->realpath, realpath, realpath_len+1);
                }
                bucket->realpath_len = realpath_len;
-               bucket->is_dir = is_dir;
+               bucket->is_dir = is_dir > 0;
 #ifdef ZEND_WIN32
                bucket->is_rvalid   = 0;
                bucket->is_readable = 0;
index 1f927bb035446e36f7b15e78bbfccf3cf7bc2808..538a2f8a73022150e29bfb7b72a3ccfeaa536c0c 100644 (file)
@@ -204,14 +204,14 @@ typedef struct _realpath_cache_bucket {
        char                          *realpath;
        struct _realpath_cache_bucket *next;
        time_t                         expires;
-       int                            path_len;
-       int                            realpath_len;
-       int                            is_dir;
+       uint16_t                       path_len;
+       uint16_t                       realpath_len;
+       uint8_t                        is_dir:1;
 #ifdef ZEND_WIN32
-       unsigned char                  is_rvalid;
-       unsigned char                  is_readable;
-       unsigned char                  is_wvalid;
-       unsigned char                  is_writable;
+       uint8_t                        is_rvalid:1;
+       uint8_t                        is_readable:1;
+       uint8_t                        is_wvalid:1;
+       uint8_t                        is_writable:1;
 #endif
 } realpath_cache_bucket;