X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=php5-apc.git;a=blobdiff_plain;f=php_apc.c;fp=php_apc.c;h=207016d564a67cef8ac5ce0359a92c8d01234775;hp=ab2009187a8112d5f7a6782ebc5b6aa0899ffddd;hb=10aea07a14325aa0bfb5fe75ddcf19432c6e2c64;hpb=3682e0a7a26931aabca2b6e54eb08efd7dc0430b diff --git a/php_apc.c b/php_apc.c index ab20091..207016d 100644 --- a/php_apc.c +++ b/php_apc.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | APC | +----------------------------------------------------------------------+ - | Copyright (c) 2006 The PHP Group | + | Copyright (c) 2008 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -26,7 +26,7 @@ */ -/* $Id: php_apc.c,v 3.154.2.2 2008/03/28 18:35:41 gopalv Exp $ */ +/* $Id: php_apc.c,v 3.154.2.5 2008/05/11 18:57:00 rasmus Exp $ */ #include "apc_zend.h" #include "apc_cache.h" @@ -226,7 +226,7 @@ static PHP_MINFO_FUNCTION(apc) #else php_info_print_table_row(2, "Locking type", "File Locks"); #endif - php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.2 $"); + php_info_print_table_row(2, "Revision", "$Revision: 3.154.2.5 $"); php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -559,18 +559,18 @@ int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int HANDLE_BLOCK_INTERRUPTIONS(); APCG(mem_size_ptr) = &mem_size; - APCG(current_cache) = apc_user_cache; if (!(entry = apc_cache_make_user_entry(strkey, strkey_len + 1, val, ttl))) { APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; + apc_cache_expunge(apc_cache,t); + apc_cache_expunge(apc_user_cache,t); HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } if (!apc_cache_make_user_key(&key, strkey, strkey_len + 1, t)) { APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; apc_cache_free_entry(entry); + /* make_user_key doesn't allocate anything, so no expunge */ HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } @@ -578,13 +578,16 @@ int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int if (!apc_cache_user_insert(apc_user_cache, key, entry, t, exclusive TSRMLS_CC)) { apc_cache_free_entry(entry); APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; + /* + No expunge here - user_insert can fail for non-memory related reasons + The alloc-based expunge hook in 3.1 will do a better job here + (removing the expunge here also fixes bug #13336) + */ HANDLE_UNBLOCK_INTERRUPTIONS(); return 0; } APCG(mem_size_ptr) = NULL; - APCG(current_cache) = NULL; HANDLE_UNBLOCK_INTERRUPTIONS();