You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/04/10 14:31:36 UTC

svn commit: r1090788 - in /subversion/trunk/subversion: include/private/svn_cache.h libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Sun Apr 10 12:31:35 2011
New Revision: 1090788

URL: http://svn.apache.org/viewvc?rev=1090788&view=rev
Log:
Clarify the content of the 'found' return parameter. The problem is
that partial getters perform two lookups: the whole entry by key
and then the sub-item defined by baton and the deserializer logic.

* subversion/include/private/svn_cache.h
  (svn_cache__get_partial): in docstring, clarify the meaning of 'found'
* subversion/libsvn_subr/cache-membuffer.c
  (membuffer_cache_get_partial): make usage of 'found' comply to
  API definition

Modified:
    subversion/trunk/subversion/include/private/svn_cache.h
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/include/private/svn_cache.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_cache.h?rev=1090788&r1=1090787&r2=1090788&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_cache.h (original)
+++ subversion/trunk/subversion/include/private/svn_cache.h Sun Apr 10 12:31:35 2011
@@ -381,7 +381,9 @@ svn_cache__iter(svn_boolean_t *completed
 
 /**
  * Similar to @ref svn_cache__set but will call a specific de-serialization
- * function @a func.
+ * function @a func. @a found will be set depending on whether the @a key
+ * has been found. Even if that reports @c TRUE, @a values may still return
+ * a @c NULL pointer depending on the logic inside @a func.
  */
 svn_error_t *
 svn_cache__get_partial(void **value,

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1090788&r1=1090787&r2=1090788&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Sun Apr 10 12:31:35 2011
@@ -1179,6 +1179,7 @@ membuffer_cache_get_partial(svn_membuffe
                             const void *key,
                             apr_size_t key_len,
                             void **item,
+                            svn_boolean_t *found,
                             svn_cache__partial_getter_func_t deserializer,
                             void *baton,
                             DEBUG_CACHE_MEMBUFFER_TAG_ARG
@@ -1198,9 +1199,12 @@ membuffer_cache_get_partial(svn_membuffe
   if (entry == NULL)
     {
       *item = NULL;
+      *found = FALSE;
     }
   else
     {
+      *found = TRUE;
+
       entry->hit_count++;
       cache->hit_count++;
       cache->total_hits++;
@@ -1473,7 +1477,7 @@ svn_membuffer_cache_get_partial(void **v
                                       baton,
                                       DEBUG_CACHE_MEMBUFFER_TAG
                                       pool));
-  *found = *value_p != NULL;
+
   return SVN_NO_ERROR;
 }