Author: stefan2
Date: Sat Apr 27 16:36:00 2013
New Revision: 1476615
URL: http://svn.apache.org/r1476615
Log:
On the fsfs-format7 branch: provide cache (de-)serializes for APR arrays
with "flat" elements, i.e. without pointers in them.
* subversion/libsvn_fs_fs/temp_serializer.h
(svn_fs_fs__serialize_apr_array,
svn_fs_fs__deserialize_apr_array): declare (de-)serialization functions
* subversion/libsvn_fs_fs/temp_serializer.c
(svn_fs_fs__serialize_apr_array,
svn_fs_fs__deserialize_apr_array): implement them
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.h
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.c?rev=1476615&r1=1476614&r2=1476615&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.c
(original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.c
Sat Apr 27 16:36:00 2013
@@ -144,6 +144,43 @@ serialize_representation(svn_temp_serial
sizeof(*rep));
}
+void
+svn_fs_fs__serialize_apr_array(svn_temp_serializer__context_t *context,
+ apr_array_header_t **a)
+{
+ const apr_array_header_t *array = *a;
+
+ /* Nothing to do for NULL string references. */
+ if (array == NULL)
+ return;
+
+ /* array header struct */
+ svn_temp_serializer__push(context,
+ (const void * const *)a,
+ sizeof(*array));
+
+ /* contents */
+ svn_temp_serializer__add_leaf(context,
+ (const void * const *)&array->elts,
+ (apr_size_t)array->nelts * array->elt_size);
+
+ /* back to the caller's nesting level */
+ svn_temp_serializer__pop(context);
+}
+
+void
+svn_fs_fs__deserialize_apr_array(void *buffer,
+ apr_array_header_t **array,
+ apr_pool_t *pool)
+{
+ svn_temp_deserializer__resolve(buffer, (void **)array);
+ if (*array == NULL)
+ return;
+
+ svn_temp_deserializer__resolve(*array, (void **)&(*array)->elts);
+ (*array)->pool = pool;
+}
+
/* auxilliary structure representing the content of a directory hash */
typedef struct hash_data_t
{
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.h
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.h?rev=1476615&r1=1476614&r2=1476615&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.h
(original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/temp_serializer.h
Sat Apr 27 16:36:00 2013
@@ -50,6 +50,24 @@ svn_fs_fs__noderev_deserialize(void *buf
node_revision_t **noderev_p);
/**
+ * Serialize APR array @a *a within the serialization @a context.
+ * The elements within the array must not contain pointers.
+ */
+void
+svn_fs_fs__serialize_apr_array(struct svn_temp_serializer__context_t *context,
+ apr_array_header_t **a);
+
+/**
+ * Deserialize APR @a *array within the @a buffer. Set its pool member to
+ * @a pool. The elements within the array must not contain pointers.
+ */
+void
+svn_fs_fs__deserialize_apr_array(void *buffer,
+ apr_array_header_t **array,
+ apr_pool_t *pool);
+
+
+/**
* #svn_txdelta_window_t is not sufficient for caching the data it
* represents because data read process needs auxilliary information.
*/