Author: ahristov
Date: 2008-01-28 21:02:02 +0100 (Mon, 28 Jan 2008)
New Revision: 1232
Added:
trunk/mysqlnd/mysqlnd_block_alloc.h
Modified:
trunk/mysqlnd/config.w32
trunk/mysqlnd/config9.m4
trunk/mysqlnd/mysqlnd.c
trunk/mysqlnd/mysqlnd_block_alloc.c
trunk/mysqlnd/mysqlnd_priv.h
trunk/mysqlnd/mysqlnd_result.c
Log:
Block allocator in separate file.
Other small changes
Modified: trunk/mysqlnd/config.w32
===================================================================
--- trunk/mysqlnd/config.w32 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/config.w32 2008-01-28 20:02:02 UTC (rev 1232)
@@ -1,15 +1,12 @@
// $Id: config.w32,v 1.6 2007/11/02 17:37:41 stas Exp $
// vim:ft=javascript
-ARG_WITH("mysqlnd", "MySQL-nd support", "no");
-
-if (PHP_MYSQLND != "no") {
-mysqld_source = "";
if (CHECK_LIB("ws2_32.lib", "mysqlnd")) {
mysqlnd_source =
"mysqlnd.c " +
- "mysqlnd_debug.c " +
+ "mysqlnd_block_alloc.c" +
"mysqlnd_charset.c " +
+ "mysqlnd_debug.c " +
"mysqlnd_loaddata.c " +
"mysqlnd_palloc.c " +
"mysqlnd_ps.c " +
@@ -21,4 +18,3 @@
"mysqlnd_wireprotocol.c";
EXTENSION("mysqlnd", mysqlnd_source, false);
}
-}
\ No newline at end of file
Modified: trunk/mysqlnd/config9.m4
===================================================================
--- trunk/mysqlnd/config9.m4 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/config9.m4 2008-01-28 20:02:02 UTC (rev 1232)
@@ -7,7 +7,8 @@
mysqlnd_sources="mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \
mysqlnd_ps.c mysqlnd_loaddata.c mysqlnd_palloc.c \
mysqlnd_ps_codec.c mysqlnd_statistics.c mysqlnd_qcache.c\
- mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c"
+ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\
+ mysqlnd_block_alloc.c"
PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, no)
PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
Modified: trunk/mysqlnd/mysqlnd.c
===================================================================
--- trunk/mysqlnd/mysqlnd.c 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/mysqlnd.c 2008-01-28 20:02:02 UTC (rev 1232)
@@ -127,141 +127,7 @@
/* }}} */
#endif /* MYSQLND_THREADED */
-/************************************************************************************************/
-/* Let's don't use pool allocation for now */
-/* {{{ mysqlnd_mempool_free_chunk */
-static
-void mysqlnd_mempool_free_contents(MYSQLND_MEMORY_POOL * pool TSRMLS_DC)
-{
- DBG_ENTER("mysqlnd_mempool_dtor");
- uint i;
- for (i = 0; i < pool->free_chunk_list_elements; i++) {
- MYSQLND_MEMORY_POOL_CHUNK * chunk = pool->free_chunk_list[i];
- chunk->free_chunk(chunk, FALSE TSRMLS_CC);
- }
-
- DBG_VOID_RETURN;
-}
-/* }}} */
-/* Let's don't use pool allocation for now */
-/* {{{ mysqlnd_mempool_free_chunk */
-static
-void mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it
TSRMLS_DC)
-{
- DBG_ENTER("mysqlnd_mempool_free_chunk");
- MYSQLND_MEMORY_POOL * pool = chunk->pool;
- if (chunk->from_pool) {
- /* Try to back-off and guess if this is the last block allocated */
- if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size -
chunk->size))) {
- /*
- This was the last allocation. Lucky us, we can free
- a bit of memory from the pool. Next time we will return from the same ptr.
- */
- pool->free_size += chunk->size;
- }
- pool->refcount--;
- } else {
- mnd_free(chunk->ptr);
- }
- if (cache_it && pool->free_chunk_list_elements <
MYSQLND_MEMORY_POOL_CHUNK_LIST_SIZE) {
- chunk->ptr = NULL;
- pool->free_chunk_list[pool->free_chunk_list_elements++] = chunk;
- } else {
- /* We did not cache it -> free it */
- mnd_free(chunk);
- }
- DBG_VOID_RETURN;
-}
-/* }}} */
-
-
-/* {{{ mysqlnd_mempool_resize_chunk */
-static void
-mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size TSRMLS_DC)
-{
- DBG_ENTER("mysqlnd_mempool_resize_chunk");
- if (chunk->from_pool) {
- MYSQLND_MEMORY_POOL * pool = chunk->pool;
- /* Try to back-off and guess if this is the last block allocated */
- if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size -
chunk->size))) {
- /*
- This was the last allocation. Lucky us, we can free
- a bit of memory from the pool. Next time we will return from the same ptr.
- */
- if ((chunk->size + pool->free_size) < size) {
- zend_uchar *new_ptr;
- new_ptr = mnd_malloc(size);
- memcpy(new_ptr, chunk->ptr, chunk->size);
- chunk->ptr = new_ptr;
- pool->free_size += chunk->size;
- chunk->size = size;
- chunk->pool = NULL; /* now we have no pool memory */
- pool->refcount--;
- } else {
- /* If the chunk is > than asked size then free_memory increases, otherwise
decreases*/
- pool->free_size += (chunk->size - size);
- }
- } else {
- /* Not last chunk, if the user asks for less, give it to him */
- if (chunk->size >= size) {
- ; /* nop */
- } else {
- zend_uchar *new_ptr;
- new_ptr = mnd_malloc(size);
- memcpy(new_ptr, chunk->ptr, chunk->size);
- chunk->ptr = new_ptr;
- chunk->size = size;
- chunk->pool = NULL; /* now we have no pool memory */
- pool->refcount--;
- }
- }
- } else {
- chunk->ptr = mnd_realloc(chunk->ptr, size);
- }
- DBG_VOID_RETURN;
-}
-/* }}} */
-
-
-/* {{{ mysqlnd_mempool_get_chunk */
-static
-MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, uint
size TSRMLS_DC)
-{
- MYSQLND_MEMORY_POOL_CHUNK *chunk = NULL;
- DBG_ENTER("mysqlnd_mempool_get_chunk");
-
- if (pool->free_chunk_list_elements) {
- chunk = pool->free_chunk_list[--pool->free_chunk_list_elements];
- } else {
- chunk = mnd_malloc(sizeof(MYSQLND_MEMORY_POOL_CHUNK));
- }
-
- chunk->free_chunk = mysqlnd_mempool_free_chunk;
- chunk->resize_chunk = mysqlnd_mempool_resize_chunk;
- chunk->size = size;
- /*
- Should not go over MYSQLND_MAX_PACKET_SIZE, since we
- expect non-arena memory in mysqlnd_wireprotocol.c . We
- realloc the non-arena memory.
- */
- chunk->pool = pool;
- if (size > pool->free_size) {
- chunk->ptr = mnd_malloc(size);
- chunk->from_pool = FALSE;
- } else {
- chunk->from_pool = TRUE;
- ++pool->refcount;
- chunk->ptr = pool->arena + (pool->arena_size - pool->free_size);
- /* Last step, update free_size */
- pool->free_size -= size;
- }
- DBG_RETURN(chunk);
-}
-/* }}} */
-/************************************************************************************************/
-
-
/* {{{ mysqlnd_library_init */
static
void mysqlnd_library_init(TSRMLS_D)
Modified: trunk/mysqlnd/mysqlnd_block_alloc.c
===================================================================
--- trunk/mysqlnd/mysqlnd_block_alloc.c 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/mysqlnd_block_alloc.c 2008-01-28 20:02:02 UTC (rev 1232)
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 6 |
+----------------------------------------------------------------------+
- | Copyright (c) 2006-2007 The PHP Group |
+ | Copyright (c) 2006-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 |
@@ -16,265 +16,148 @@
| Andrey Hristov <andrey@stripped> |
| Ulf Wendel <uwendel@stripped> |
+----------------------------------------------------------------------+
-
*/
-/* $Id: mysqlnd_alloc.c,v 1.1.2.2 2007/10/07 21:47:36 davidw Exp $ */
+/* $Id: mysqlnd.c,v 1.10 2008/01/08 13:13:39 andrey Exp $ */
+
#include "php.h"
#include "mysqlnd.h"
+#include "mysqlnd_block_alloc.h"
+#include "mysqlnd_debug.h"
#include "mysqlnd_priv.h"
-#include "mysqlnd_palloc.h"
-
-#define MYSQLND_SILENT
-#define MYSQLND_DONT_DUMP_STATS
-
-#define MYSQLND_ZVALS_MAX_CACHE 5000
-
-
-#if A0
-/* Caching zval allocator */
-zval * mysqlnd_alloc_get_zval(MYSQLND_ZVAL_CACHE * const cache);
-void mysqlnd_alloc_zval_ptr_dtor(zval **zv, MYSQLND_ZVAL_CACHE * const cache);
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_init_cache();
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_get_cache_reference(MYSQLND_ZVAL_CACHE *cache);
-void mysqlnd_alloc_free_cache_reference(MYSQLND_ZVAL_CACHE **cache);
-#endif
-
-
-/*
- The cache line is a big contiguous array of zval pointers.
- Because the CPU cache will cache starting from an address, and not
- before it, then we have to organize our structure according to this.
- Thus, if 'last_added' is valid pointer (not NULL) then last_added is
- increased. When zval is cached, if there is room, last_added is decreased
- and then the zval pointer will be assigned to it. This means that some
- positions may become hot points and stay in the cache.
- Imagine we have 5 pointers in a line
- 1. last_added = list_item->ptr_line + cache->max_items;
- 2. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
- 3. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
- 4. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
- 0x0
- 0x0
- 0x0
- 0x0
- 0x0
- ---
- empty_position, always 0x0 <-- last_added
-
- 5. free_zval -> if (free_items++ != max_items) {// we can add more
- *(--last_added) = zval_ptr;
- }
- (memory addresses increase downwards)
- 0x0
- 0x0
- 0x0
- 0x0
- 0xA <-- last_added
- ---
- 0x0
-
- 6. free_zval -> if (free_items++ != max_items) {// we can add more
- *(--last_added) = zval_ptr;
- }
- 0x0
- 0x0
- 0x0
- 0xB <-- last_added
- 0xA
- ---
- 0x0
-
- 7. free_zval -> if (free_items++ != max_items) {// we can add more
- *(--last_added) = zval_ptr;
- }
- 0x0
- 0x0
- 0xC <-- last_added
- 0xB
- 0xA
- ---
- 0x0
-
- 8. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
- 0x0
- 0x0
- 0x0
- 0xB <-- last_added
- 0xA
- ---
- 0x0
-
- 9. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
- 0x0
- 0x0
- 0x0
- 0x0
- 0xA <-- last_added
- ---
- 0x0
-
-10. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
- 0x0
- 0x0
- 0x0
- 0x0
- 0x0
- ---
- 0x0 <-- last_added
-
-*/
-
-
-zval * mysqlnd_alloc_get_zval(MYSQLND_ZVAL_CACHE * const cache)
+/* Let's don't use pool allocation for now */
+/* {{{ mysqlnd_mempool_free_chunk */
+void
+mysqlnd_mempool_free_contents(MYSQLND_MEMORY_POOL * pool TSRMLS_DC)
{
- zval *ret = NULL;
-
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_get_zval %p] *last_added=%p free_items=%d ", cache, cache?
cache->free_list->last_added:NULL, cache->free_items);
-#endif
-
- if (cache) {
- if ((ret = *cache->free_list->last_added)) {
- *cache->free_list->last_added++ = NULL;
-
- --cache->free_items;
- ++cache->get_hits;
- } else {
- ++cache->get_misses;
- }
+ DBG_ENTER("mysqlnd_mempool_dtor");
+ uint i;
+ for (i = 0; i < pool->free_chunk_list_elements; i++) {
+ MYSQLND_MEMORY_POOL_CHUNK * chunk = pool->free_chunk_list[i];
+ chunk->free_chunk(chunk, FALSE TSRMLS_CC);
}
- if (!ret) {
- ALLOC_ZVAL(ret);
- }
- INIT_PZVAL(ret);
-
-#ifndef MYSQLND_SILENT
- php_printf("ret=%p\n", ret);
-#endif
- return ret;
+
+ DBG_VOID_RETURN;
}
+/* }}} */
-static
-void mysqlnd_alloc_cache_prealloc(MYSQLND_ZVAL_CACHE * const cache, unsigned int count)
+/* Let's don't use pool allocation for now */
+/* {{{ mysqlnd_mempool_free_chunk */
+void
+mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it
TSRMLS_DC)
{
- zval *data;
- cache->free_items = count;
- while (count--) {
- MAKE_STD_ZVAL(data);
- ZVAL_NULL(data);
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_prealloc %p] items=%d data=%p\n", cache,
cache->free_items, data);
-#endif
-
- *(--cache->free_list->last_added) = data;
+ DBG_ENTER("mysqlnd_mempool_free_chunk");
+ MYSQLND_MEMORY_POOL * pool = chunk->pool;
+ if (chunk->from_pool) {
+ /* Try to back-off and guess if this is the last block allocated */
+ if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size -
chunk->size))) {
+ /*
+ This was the last allocation. Lucky us, we can free
+ a bit of memory from the pool. Next time we will return from the same ptr.
+ */
+ pool->free_size += chunk->size;
+ }
+ pool->refcount--;
+ } else {
+ mnd_free(chunk->ptr);
}
+ if (cache_it && pool->free_chunk_list_elements <
MYSQLND_MEMORY_POOL_CHUNK_LIST_SIZE) {
+ chunk->ptr = NULL;
+ pool->free_chunk_list[pool->free_chunk_list_elements++] = chunk;
+ } else {
+ /* We did not cache it -> free it */
+ mnd_free(chunk);
+ }
+ DBG_VOID_RETURN;
}
+/* }}} */
-void mysqlnd_alloc_zval_ptr_dtor(zval **zv, MYSQLND_ZVAL_CACHE * const cache)
+
+/* {{{ mysqlnd_mempool_resize_chunk */
+void
+mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size TSRMLS_DC)
{
- if (!cache || Z_REFCOUNT_PP(zv) > 1 || cache->max_items == cache->free_items) {
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_zval_ptr_dtor %p]1 last_added-1=%p *zv=%p\n",
cache->free_list->last_added, *zv);
-#endif
- /* We can't cache zval's with refcount > 1 */
- zval_ptr_dtor(zv);
- if (cache) {
- if (cache->max_items == cache->free_items) {
- ++cache->put_full_misses;
+ DBG_ENTER("mysqlnd_mempool_resize_chunk");
+ if (chunk->from_pool) {
+ MYSQLND_MEMORY_POOL * pool = chunk->pool;
+ /* Try to back-off and guess if this is the last block allocated */
+ if (chunk->ptr == (pool->arena + (pool->arena_size - pool->free_size -
chunk->size))) {
+ /*
+ This was the last allocation. Lucky us, we can free
+ a bit of memory from the pool. Next time we will return from the same ptr.
+ */
+ if ((chunk->size + pool->free_size) < size) {
+ zend_uchar *new_ptr;
+ new_ptr = mnd_malloc(size);
+ memcpy(new_ptr, chunk->ptr, chunk->size);
+ chunk->ptr = new_ptr;
+ pool->free_size += chunk->size;
+ chunk->size = size;
+ chunk->pool = NULL; /* now we have no pool memory */
+ pool->refcount--;
} else {
- ++cache->put_refcount_misses;
+ /* If the chunk is > than asked size then free_memory increases, otherwise
decreases*/
+ pool->free_size += (chunk->size - size);
}
+ } else {
+ /* Not last chunk, if the user asks for less, give it to him */
+ if (chunk->size >= size) {
+ ; /* nop */
+ } else {
+ zend_uchar *new_ptr;
+ new_ptr = mnd_malloc(size);
+ memcpy(new_ptr, chunk->ptr, chunk->size);
+ chunk->ptr = new_ptr;
+ chunk->size = size;
+ chunk->pool = NULL; /* now we have no pool memory */
+ pool->refcount--;
+ }
}
} else {
- /* refcount is 1 and there is place. Go, cache it! */
- ++cache->free_items;
- zval_dtor(*zv);
- ZVAL_NULL(*zv);
- *(--cache->free_list->last_added) = *zv;
- ++cache->put_hits;
+ chunk->ptr = mnd_realloc(chunk->ptr, size);
}
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_zval_ptr_dtor %p] free_items=%d\n", cache,
cache->free_items);
-#endif
+ DBG_VOID_RETURN;
}
+/* }}} */
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_init_cache(void)
+/* {{{ mysqlnd_mempool_get_chunk */
+MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, uint
size TSRMLS_DC)
{
- MYSQLND_ZVAL_CACHE *ret = ecalloc(1, sizeof(MYSQLND_ZVAL_CACHE));
+ MYSQLND_MEMORY_POOL_CHUNK *chunk = NULL;
+ DBG_ENTER("mysqlnd_mempool_get_chunk");
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_init_cache %p]\n", ret);
-#endif
-
- ret->max_items = MYSQLND_ZVALS_MAX_CACHE;
- ret->free_items = 0;
- ret->references = 1;
-
- /* Let's have always one, so we don't need to do a check in get_zval */
- ret->free_list = ecalloc(1, sizeof(struct st_mysqlnd_zval_list));
-
- /* One more for empty position of last_added */
- ret->free_list->ptr_line = ecalloc(ret->max_items + 1, sizeof(zval *));
- ret->free_list->last_added = ret->free_list->ptr_line + ret->max_items;
-
- mysqlnd_alloc_cache_prealloc(ret, (ret->max_items / 100) * 100);
-
- return ret;
-}
-
-
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_get_cache_reference(MYSQLND_ZVAL_CACHE *cache)
-{
- if (cache) {
- cache->references++;
+ if (pool->free_chunk_list_elements) {
+ chunk = pool->free_chunk_list[--pool->free_chunk_list_elements];
+ } else {
+ chunk = mnd_malloc(sizeof(MYSQLND_MEMORY_POOL_CHUNK));
}
- return cache;
-}
-
-static
-void mysqlnd_alloc_free_cache(MYSQLND_ZVAL_CACHE *cache)
-{
-#ifndef MYSQLND_SILENT
- uint i = 0;
- php_printf("[mysqlnd_alloc_free_cache %p]\n", cache);
-#endif
-
- while (*cache->free_list->last_added) {
-#ifndef MYSQLND_SILENT
- php_printf("\t[free_item %d %p]\n", i++, *cache->free_list->last_added);
-#endif
- zval_ptr_dtor(cache->free_list->last_added);
- cache->free_list->last_added++;
+ chunk->free_chunk = mysqlnd_mempool_free_chunk;
+ chunk->resize_chunk = mysqlnd_mempool_resize_chunk;
+ chunk->size = size;
+ /*
+ Should not go over MYSQLND_MAX_PACKET_SIZE, since we
+ expect non-arena memory in mysqlnd_wireprotocol.c . We
+ realloc the non-arena memory.
+ */
+ chunk->pool = pool;
+ if (size > pool->free_size) {
+ chunk->ptr = mnd_malloc(size);
+ chunk->from_pool = FALSE;
+ } else {
+ chunk->from_pool = TRUE;
+ ++pool->refcount;
+ chunk->ptr = pool->arena + (pool->arena_size - pool->free_size);
+ /* Last step, update free_size */
+ pool->free_size -= size;
}
-#ifndef MYSQLND_DONT_DUMP_STATS
- php_printf("CACHE STATS:\n\tGET\n\t\tHITS:%lu\n\t\tMISSES=%lu\n\t\tHIT RATIO=%1.3f\n\t"
- "PUT\n\t\tHITS:%lu\n\t\tFULL_MISS=%lu\n\t\tREFC_MISS=%lu\n\t\tHIT RATIO=%1.3f\n\n",
- cache->get_hits, cache->get_misses, (1.0*cache->get_hits/(cache->get_hits +
cache->get_misses)),
- cache->put_hits, cache->put_full_misses, cache->put_refcount_misses,
- (1.0 * cache->put_hits / (cache->put_hits + cache->put_full_misses +
cache->put_refcount_misses)));
-#endif
- efree(cache->free_list->ptr_line);
- efree(cache->free_list);
- efree(cache);
+ DBG_RETURN(chunk);
}
+/* }}} */
-
-void mysqlnd_alloc_free_cache_reference(MYSQLND_ZVAL_CACHE **cache)
-{
-#ifndef MYSQLND_SILENT
- php_printf("[mysqlnd_alloc_free_cache_reference %p] refs=%d\n", *cache,
(*cache)->references);
-#endif
- if (*cache && --(*cache)->references == 0) {
- mysqlnd_alloc_free_cache(*cache);
- }
- *cache = NULL;
-}
-
/*
* Local variables:
* tab-width: 4
Added: trunk/mysqlnd/mysqlnd_block_alloc.h
===================================================================
--- trunk/mysqlnd/mysqlnd_block_alloc.h (rev 0)
+++ trunk/mysqlnd/mysqlnd_block_alloc.h 2008-01-28 20:02:02 UTC (rev 1232)
@@ -0,0 +1,41 @@
+/*
+ +----------------------------------------------------------------------+
+ | PHP Version 6 |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2006-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 |
+ | available through the world-wide-web at the following url: |
+ | http://www.php.net/license/3_01.txt |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@stripped so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Authors: Georg Richter <georg@stripped> |
+ | Andrey Hristov <andrey@stripped> |
+ | Ulf Wendel <uwendel@stripped> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id: mysqlnd_priv.h,v 1.8 2008/01/08 13:13:39 andrey Exp $ */
+
+#ifndef MYSQLND_BLOCK_ALLOC_H
+#define MYSQLND_BLOCK_ALLOC_H
+
+void mysqlnd_mempool_free_contents(MYSQLND_MEMORY_POOL * pool TSRMLS_DC);
+void mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it
TSRMLS_DC);
+void mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size
TSRMLS_DC);
+MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, uint
size TSRMLS_DC);
+
+#endif /* MYSQLND_BLOCK_ALLOC_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
Modified: trunk/mysqlnd/mysqlnd_priv.h
===================================================================
--- trunk/mysqlnd/mysqlnd_priv.h 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/mysqlnd_priv.h 2008-01-28 20:02:02 UTC (rev 1232)
@@ -198,6 +198,13 @@
int mysqlnd_set_sock_no_delay(php_stream *stream);
+
+
+void mysqlnd_mempool_free_contents(MYSQLND_MEMORY_POOL * pool TSRMLS_DC);
+void mysqlnd_mempool_free_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, zend_bool cache_it
TSRMLS_DC);
+void mysqlnd_mempool_resize_chunk(MYSQLND_MEMORY_POOL_CHUNK * chunk, uint size
TSRMLS_DC);
+MYSQLND_MEMORY_POOL_CHUNK * mysqlnd_mempool_get_chunk(MYSQLND_MEMORY_POOL * pool, uint
size TSRMLS_DC);
+
#endif /* MYSQLND_PRIV_H */
Modified: trunk/mysqlnd/mysqlnd_result.c
===================================================================
--- trunk/mysqlnd/mysqlnd_result.c 2008-01-28 19:12:14 UTC (rev 1231)
+++ trunk/mysqlnd/mysqlnd_result.c 2008-01-28 20:02:02 UTC (rev 1232)
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysqlnd_result.c,v 1.4.2.5 2008/01/02 21:14:35 andrey Exp $ */
+/* $Id: mysqlnd_result.c,v 1.4.2.6 2008/01/23 19:11:28 andrey Exp $ */
#include "php.h"
#include "mysqlnd.h"
#include "mysqlnd_wireprotocol.h"
@@ -933,7 +933,6 @@
mysqlnd_fetch_row_buffered_c(MYSQLND_RES *result TSRMLS_DC)
{
MYSQLND_ROW_C ret = NULL;
- unsigned int i;
MYSQLND_RES_BUFFERED *set = result->stored_data;
DBG_ENTER("mysqlnd_fetch_row_buffered_c");
@@ -945,6 +944,7 @@
zval **current_row = set->data_cursor;
MYSQLND_FIELD *field = result->meta->fields;
struct mysqlnd_field_hash_key *zend_hash_key = result->meta->zend_hash_keys;
+ unsigned int i;
if (NULL == current_row[0]) {
set->initialized_rows++;
| Thread |
|---|
| • PHP mysqlnd svn commit: r1232 - trunk/mysqlnd | ahristov | 28 Jan |