Changeset 24bb20e in git
- Timestamp:
- 2012-03-29T16:48:19Z (8 years ago)
- Branches:
- 3.0, 3.1, 3.2, master, trunk
- Children:
- 5474326
- Parents:
- b5ed73a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
xcache.c
rc82a4d4 r24bb20e 900 900 /* }}} */ 901 901 902 #define XC_INCLUDE_PATH_XSTAT_FUNC(name) zend_bool name(const char * absolute_path, size_t absolute_path_len, void *data TSRMLS_DC)902 #define XC_INCLUDE_PATH_XSTAT_FUNC(name) zend_bool name(const char *filepath, size_t absolute_path_len, void *data TSRMLS_DC) 903 903 typedef XC_INCLUDE_PATH_XSTAT_FUNC((*include_path_xstat_func_t)); 904 static zend_bool xc_include_path_apply(const char *filepath, char * opened_path_buffer, include_path_xstat_func_t xstat_func, void *data TSRMLS_DC) /* {{{ */904 static zend_bool xc_include_path_apply(const char *filepath, char *path_buffer, include_path_xstat_func_t xstat_func, void *data TSRMLS_DC) /* {{{ */ 905 905 { 906 906 char *paths, *path; … … 916 916 917 917 for (path = php_strtok_r(paths, tokens, &tokbuf); path; path = php_strtok_r(NULL, tokens, &tokbuf)) { 918 absolute_path_len = snprintf( opened_path_buffer, MAXPATHLEN, "%s/%s", path, filepath);918 absolute_path_len = snprintf(path_buffer, MAXPATHLEN, "%s/%s", path, filepath); 919 919 if (absolute_path_len < MAXPATHLEN - 1) { 920 if (xstat_func( opened_path_buffer, absolute_path_len, data)) {920 if (xstat_func(path_buffer, absolute_path_len, data)) { 921 921 ret = 1; 922 922 goto finish; … … 936 936 if (dirname_len + filename_len < MAXPATHLEN - 1) { 937 937 ++dirname_len; /* include tailing slash */ 938 memcpy( opened_path_buffer, executed_filename, dirname_len);939 memcpy( opened_path_buffer + dirname_len, filepath, filename_len);938 memcpy(path_buffer, executed_filename, dirname_len); 939 memcpy(path_buffer + dirname_len, filepath, filename_len); 940 940 absolute_path_len = dirname_len + filename_len; 941 if (xstat_func( opened_path_buffer, absolute_path_len, data) == 0) {941 if (xstat_func(path_buffer, absolute_path_len, data) == 0) { 942 942 ret = 1; 943 943 goto finish; … … 960 960 static XC_INCLUDE_PATH_XSTAT_FUNC(xc_stat_file) /* {{{ */ 961 961 { 962 return VCWD_STAT( absolute_path, (struct stat *) data) == 0 ? 1 : 0;963 } 964 /* }}} */ 965 static int xc_include_path_stat(const char *filepath, char * opened_path_buffer, struct stat *pbuf TSRMLS_DC) /* {{{ */966 { 967 return xc_include_path_apply(filepath, opened_path_buffer, xc_stat_file, (void *) pbuf TSRMLS_DC)962 return VCWD_STAT(filepath, (struct stat *) data) == 0 ? 1 : 0; 963 } 964 /* }}} */ 965 static int xc_include_path_stat(const char *filepath, char *path_buffer, struct stat *pbuf TSRMLS_DC) /* {{{ */ 966 { 967 return xc_include_path_apply(filepath, path_buffer, xc_stat_file, (void *) pbuf TSRMLS_DC) 968 968 ? SUCCESS 969 969 : FAILURE; … … 980 980 xc_compiler_t *compiler = entry_find_include_path_data->compiler; 981 981 982 compiler->new_entry.entry.name.str.val = absolute_path;982 compiler->new_entry.entry.name.str.val = expand_filepath(filepath, compiler->opened_path_buffer TSRMLS_CC); 983 983 compiler->new_entry.entry.name.str.len = strlen(compiler->new_entry.entry.name.str.val); 984 984 … … 993 993 } 994 994 /* }}} */ 995 static int xc_entry_find_include_path_dmz(xc_compiler_t *compiler, const char *filepath, char *opened_path_buffer, xc_entry_php_t **stored_entry TSRMLS_DC) /* {{{ */ 996 { 995 static int xc_entry_find_include_path_dmz(xc_compiler_t *compiler, const char *filepath, xc_entry_php_t **stored_entry TSRMLS_DC) /* {{{ */ 996 { 997 char path_buffer[MAXPATHLEN]; 997 998 xc_entry_find_include_path_data_t entry_find_include_path_data; 998 999 entry_find_include_path_data.compiler = compiler; 999 1000 entry_find_include_path_data.stored_entry = stored_entry; 1000 1001 1001 return xc_include_path_apply(filepath, opened_path_buffer, xc_entry_find_include_path_func_dmz, (void *) &entry_find_include_path_data TSRMLS_DC)1002 return xc_include_path_apply(filepath, path_buffer, xc_entry_find_include_path_func_dmz, (void *) &entry_find_include_path_data TSRMLS_DC) 1002 1003 ? SUCCESS 1003 1004 : FAILURE; … … 1058 1059 1059 1060 if (xc_entry_php_quick_resolve_opened_path(compiler, &buf TSRMLS_CC) != SUCCESS) { 1060 if (xc_include_path_stat(compiler->filename, compiler->opened_path_buffer, &buf TSRMLS_CC) != SUCCESS) { 1061 char path_buffer[MAXPATHLEN]; 1062 if (xc_include_path_stat(compiler->filename, path_buffer, &buf TSRMLS_CC) != SUCCESS) { 1061 1063 return FAILURE; 1062 1064 } 1063 compiler->opened_path = compiler->opened_path_buffer;1065 compiler->opened_path = expand_filepath(path_buffer, compiler->opened_path_buffer TSRMLS_CC); 1064 1066 } 1065 1067 … … 1855 1857 1856 1858 ENTER_LOCK_EX(cache) { 1857 if (!compiler->opened_path && xc_entry_find_include_path_dmz(compiler, compiler->filename, compiler->opened_path_buffer,&stored_entry TSRMLS_CC) == SUCCESS) {1859 if (!compiler->opened_path && xc_entry_find_include_path_dmz(compiler, compiler->filename, &stored_entry TSRMLS_CC) == SUCCESS) { 1858 1860 compiler->opened_path = compiler->opened_path_buffer; 1859 1861 } … … 1864 1866 } 1865 1867 /* fall back to real stat call */ 1866 else if (xc_include_path_stat(compiler->filename, compiler->opened_path_buffer, &statbuf TSRMLS_CC) == SUCCESS) {1867 compiler->opened_path = compiler->opened_path_buffer;1868 }1869 1868 else { 1870 gaveup = 1; 1871 break; 1869 char path_buffer[MAXPATHLEN]; 1870 if (xc_include_path_stat(compiler->filename, path_buffer, &statbuf TSRMLS_CC) == SUCCESS) { 1871 compiler->opened_path = expand_filepath(path_buffer, compiler->opened_path_buffer TSRMLS_CC); 1872 } 1873 else { 1874 gaveup = 1; 1875 break; 1876 } 1872 1877 } 1873 1878 }
Note: See TracChangeset
for help on using the changeset viewer.