Changeset 74 for branches/1.0
- Timestamp:
- 2006-06-08T09:15:16+02:00 (7 years ago)
- File:
-
- 1 edited
-
branches/1.0/xcache.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/xcache.c
r65 r74 1738 1738 1739 1739 /* {{{ PHP_INI */ 1740 static PHP_INI_MH(xc_OnUpdateLong)1741 {1742 long *p = (long *)mh_arg1;1743 *p = zend_atoi(new_value, new_value_length);1744 return SUCCESS;1745 }1746 1740 1747 1741 static PHP_INI_MH(xc_OnUpdateBool) … … 1755 1749 *p = (zend_bool) 1; 1756 1750 } 1757 return SUCCESS;1758 }1759 1760 static PHP_INI_MH(xc_OnUpdateHashInfo)1761 {1762 xc_hash_t *p = (xc_hash_t *)mh_arg1;1763 int bits, size;1764 1765 p->size = zend_atoi(new_value, new_value_length);1766 for (size = 1, bits = 1; size < p->size; bits ++, size <<= 1) {1767 /* empty body */1768 }1769 p->size = size;1770 p->bits = bits;1771 p->mask = size - 1;1772 1773 1751 return SUCCESS; 1774 1752 } … … 1784 1762 return SUCCESS; 1785 1763 } 1764 1786 1765 #ifdef ZEND_ENGINE_2 1787 1766 #define OnUpdateInt OnUpdateLong … … 1794 1773 #endif 1795 1774 PHP_INI_BEGIN() 1796 PHP_INI_ENTRY1 ("xcache.size", "0", PHP_INI_SYSTEM, xc_OnUpdateLong, &xc_php_size)1797 PHP_INI_ENTRY1 ("xcache.count", "1", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_php_hcache)1798 PHP_INI_ENTRY1 ("xcache.slots", "8K", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_php_hentry)1799 1800 PHP_INI_ENTRY1 ("xcache.var_size", "0", PHP_INI_SYSTEM, xc_OnUpdateLong, &xc_var_size)1801 PHP_INI_ENTRY1 ("xcache.var_count", "1", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_var_hcache)1802 PHP_INI_ENTRY1 ("xcache.var_slots", "8K", PHP_INI_SYSTEM, xc_OnUpdateHashInfo, &xc_var_hentry)1803 1804 1775 PHP_INI_ENTRY1 ("xcache.mmap_path", DEFAULT_PATH, PHP_INI_SYSTEM, xc_OnUpdateString, &xc_mmap_path) 1805 1776 PHP_INI_ENTRY1 ("xcache.coredump_directory", "", PHP_INI_SYSTEM, xc_OnUpdateString, &xc_coredump_dir) … … 1867 1838 } 1868 1839 /* }}} */ 1840 static int xc_config_hash(xc_hash_t *p, char *name, char *default_value) /* {{{ */ 1841 { 1842 int bits, size; 1843 char *value; 1844 1845 if (cfg_get_string(name, &value) != SUCCESS) { 1846 value = default_value; 1847 } 1848 1849 p->size = zend_atoi(value, strlen(value)); 1850 for (size = 1, bits = 1; size < p->size; bits ++, size <<= 1) { 1851 /* empty body */ 1852 } 1853 p->size = size; 1854 p->bits = bits; 1855 p->mask = size - 1; 1856 1857 return SUCCESS; 1858 } 1859 static int xc_config_long(long *p, char *name, char *default_value) /* {{{ */ 1860 { 1861 char *value; 1862 1863 if (cfg_get_string(name, &value) != SUCCESS) { 1864 value = default_value; 1865 } 1866 1867 *p = zend_atoi(value, strlen(value)); 1868 return SUCCESS; 1869 } 1870 /* }}} */ 1869 1871 /* {{{ PHP_MINIT_FUNCTION(xcache) */ 1870 1872 static PHP_MINIT_FUNCTION(xcache) … … 1892 1894 } 1893 1895 } 1896 1897 xc_config_long(&xc_php_size, "xcache.size", "0"); 1898 xc_config_hash(&xc_php_hcache, "xcache.count", "1"); 1899 xc_config_hash(&xc_php_hentry, "xcache.slots", "8K"); 1900 1901 xc_config_long(&xc_var_size, "xcache.var_size", "0"); 1902 xc_config_hash(&xc_var_hcache, "xcache.var_count", "1"); 1903 xc_config_hash(&xc_var_hentry, "xcache.var_slots", "8K"); 1894 1904 1895 1905 if (xc_php_size <= 0) {
Note: See TracChangeset
for help on using the changeset viewer.

