[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9942: Fix documentation and usage of 2nd argument to mp_pool_new. (in tor/trunk: . src/common src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9942: Fix documentation and usage of 2nd argument to mp_pool_new. (in tor/trunk: . src/common src/or)
- From: nickm@xxxxxxxx
- Date: Tue, 10 Apr 2007 21:27:34 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 10 Apr 2007 21:27:44 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-04-10 21:27:33 -0400 (Tue, 10 Apr 2007)
New Revision: 9942
Modified:
tor/trunk/
tor/trunk/src/common/mempool.c
tor/trunk/src/common/mempool.h
tor/trunk/src/or/relay.c
tor/trunk/src/or/test.c
Log:
r12344@catbus: nickm | 2007-04-10 21:27:25 -0400
Fix documentation and usage of 2nd argument to mp_pool_new.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r12344] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/common/mempool.c
===================================================================
--- tor/trunk/src/common/mempool.c 2007-04-11 00:42:49 UTC (rev 9941)
+++ tor/trunk/src/common/mempool.c 2007-04-11 01:27:33 UTC (rev 9942)
@@ -329,7 +329,7 @@
}
/** Allocate a new memory pool to hold items of size <b>item_size</b>. We'll
- * try to fit about <b>chunk_capacity</b> items in each chunk. */
+ * try to fit about <b>chunk_capacity</b> bytes in each chunk. */
mp_pool_t *
mp_pool_new(size_t item_size, size_t chunk_capacity)
{
Modified: tor/trunk/src/common/mempool.h
===================================================================
--- tor/trunk/src/common/mempool.h 2007-04-11 00:42:49 UTC (rev 9941)
+++ tor/trunk/src/common/mempool.h 2007-04-11 01:27:33 UTC (rev 9942)
@@ -17,7 +17,7 @@
void *mp_pool_get(mp_pool_t *pool);
void mp_pool_release(void *item);
-mp_pool_t *mp_pool_new(size_t item_size, unsigned int n_per_chunk);
+mp_pool_t *mp_pool_new(size_t item_size, size_t chunk_capacity);
void mp_pool_clean(mp_pool_t *pool, int n);
void mp_pool_destroy(mp_pool_t *pool);
void mp_pool_assert_ok(mp_pool_t *pool);
Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c 2007-04-11 00:42:49 UTC (rev 9941)
+++ tor/trunk/src/or/relay.c 2007-04-11 01:27:33 UTC (rev 9942)
@@ -1485,7 +1485,7 @@
init_cell_pool(void)
{
tor_assert(!cell_pool);
- cell_pool = mp_pool_new(sizeof(packed_cell_t), 64);
+ cell_pool = mp_pool_new(sizeof(packed_cell_t), 1<<19);
}
/** Free all storage used to hold cells. */
Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c 2007-04-11 00:42:49 UTC (rev 9941)
+++ tor/trunk/src/or/test.c 2007-04-11 01:27:33 UTC (rev 9942)
@@ -2119,7 +2119,7 @@
test_assert(pool->item_alloc_size >= sizeof(void*)+1);
mp_pool_destroy(pool);
- pool = mp_pool_new(241, 10);
+ pool = mp_pool_new(241, 2500);
test_assert(pool->new_chunk_capacity >= 10);
test_assert(pool->item_alloc_size >= sizeof(void*)+241);
test_eq(pool->item_alloc_size & 0x03, 0);