From: Anatol Belski Date: Sun, 13 Nov 2016 15:48:36 +0000 (+0100) Subject: reduce realpath_cache_bucket size by 8 bytes on 64-bit X-Git-Tag: php-7.2.0alpha1~934 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d790486b8036a418544301425bc6f89db990d73;p=php reduce realpath_cache_bucket size by 8 bytes on 64-bit 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. --- diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 8192b424b4..420bc54a7b 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -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; diff --git a/Zend/zend_virtual_cwd.h b/Zend/zend_virtual_cwd.h index 1f927bb035..538a2f8a73 100644 --- a/Zend/zend_virtual_cwd.h +++ b/Zend/zend_virtual_cwd.h @@ -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;