Lieven Govaerts <svnlgo_at_mobsol.be <mailto:svnlgo_at_mobsol.be?Subject=Re:%20svn%20commit:%20r979193%20-%20in%20/subversion/branches/performance/subversion:%20include/private/svn_cache.h%20libsvn_subr/cache-membuffer.c>> wrote:

building on Mac OS X 64-bits raises some warnings (and an error, but
that's in another revision).

Comments inline.

Lieven

On Mon, Jul 26, 2010 at 10:30 AM, <stefan2_at_apache.org> wrote:
/> Author: stefan2 /
/> Date: Mon Jul 26 08:30:08 2010 /
/> New Revision: 979193 /
/> /
/> URL: http://svn.apache.org/viewvc?rev=979193&view=rev <http://svn.apache.org/viewvc?rev=979193&view=rev> /
/> Log: /
/> Provide a memcached-like implementation of svn_cache_t that does not have / /> the same latency and reliability issues. Detailed descriptions can be found in /
/> the .c file. /
/> /
[..]

/> +/* Get the entry references for the given ENTRY. /
/> + */ /
/> +static APR_INLINE apr_uint32_t /
/> +get_index(membuffer_cache_t *cache, entry_t *entry) /
/> +{ /
/> +  return entry - (entry_t *)cache->directory; /
/> +} /

In a 64-bit build this function triggers a "implicit conversion
shortens 64-bit value into a 32-bit value" warning.

I fixed the whole potential overflow problem in r990541.
Also, r990600 and others fix some of the typos you found.

However, I simply fail to identify the typos you are referring
to below. Could you give me the search&replacement spec
("s/typpo/typo/")?

/> +           * to 2 times the average hit count. /
/> +           */ /
/> +          average_hits = cache->hit_count / cache->used_entries; /

Typo.

/> +          if (average_hits < 1) /
/> +            average_hits = 1; /
/> + /
[..]
/> +svn_error_t* /
/> +svn_cache__membuffer_cache_create(membuffer_cache_t **cache, /
/> +                                  apr_size_t total_size, /
/> +                                  apr_size_t directory_size, /
/> +                                  svn_boolean_t thread_safe, /
/> +                                  apr_pool_t *pool) /
/> +{ /
/> +  membuffer_cache_t* c = apr_palloc(pool, sizeof(*c)); /
/> +  int i, k; /
/> + /
/> + /* We use this sub-pool to allocate the data buffer and the dictionary /
/> +   * so that we can release that memory easily upon OOM. /
/> +   */ /
/> +  apr_pool_t *sub_pool = svn_pool_create(pool); /
/> + /
/> + /* prevent pathological conditions: ensure a certain minimum cache size /
/> +   */ /
/> +  if (total_size < 2 * sizeof(entry_group_t)) /
/> +    total_size = 2 * sizeof(entry_group_t); /
/> + /
/> +  /* adapt the dictionary size accordingly, if necessary: /
/> + * It must hold at least one group and must not exceed the cache size. /
/> +   */ /
/> +  if (directory_size > total_size - sizeof(entry_group_t)) /
/> +    directory_size = total_size - sizeof(entry_group_t); /
/> +  if (directory_size < sizeof(entry_group_t)) /
/> +    directory_size = sizeof(entry_group_t); /
/> + /
/> +  /* allocate buffers and initialize cache members /
/> +   */ /
/> +  c->group_count = directory_size / sizeof (entry_group_t); /

And here.

/
/
Thanks for the feedback!

-- Stefan^2.


Reply via email to