Author: stefan2 Date: Sun Aug 1 09:35:10 2010 New Revision: 981189 URL: http://svn.apache.org/viewvc?rev=981189&view=rev Log: In reaction to http://svn.haxx.se/dev/archive-2010-08/0000.shtml and http://svn.haxx.se/dev/archive-2010-08/0007.shtml , make crystal clear that this is a serialization utility for temporary data, ONLY.
Basically, rename all svn_serializer_* to svn_temp_serializer_*, including the file names. Also, put a Doxygen note at the beginning of the header file. * rename subversion/include/private/svn_serializer.h to subversion/include/private/svn_temp_serializer.h * rename subversion/libsvn_subr/svn_serializer.c to subversion/libsvn_subr/svn_temp_serializer.c * subversion/include/private/svn_temp_serializer.h enhance Doxygen commentary (svn_serializer_*): rename to svn_temp_serializer_* (svn_deserializer_*): rename to svn_temp_deserializer_* * subversion/libsvn_subr/svn_temp_serializer.c (svn_serializer_*): rename to svn_temp_serializer_* (svn_deserializer_*): rename to svn_temp_deserializer_* Added: subversion/branches/performance/subversion/include/private/svn_temp_serializer.h (contents, props changed) - copied, changed from r981090, subversion/branches/performance/subversion/include/private/svn_serializer.h subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c (contents, props changed) - copied, changed from r981090, subversion/branches/performance/subversion/libsvn_subr/svn_serializer.c Removed: subversion/branches/performance/subversion/include/private/svn_serializer.h subversion/branches/performance/subversion/libsvn_subr/svn_serializer.c Copied: subversion/branches/performance/subversion/include/private/svn_temp_serializer.h (from r981090, subversion/branches/performance/subversion/include/private/svn_serializer.h) URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/include/private/svn_temp_serializer.h?p2=subversion/branches/performance/subversion/include/private/svn_temp_serializer.h&p1=subversion/branches/performance/subversion/include/private/svn_serializer.h&r1=981090&r2=981189&rev=981189&view=diff ============================================================================== --- subversion/branches/performance/subversion/include/private/svn_serializer.h (original) +++ subversion/branches/performance/subversion/include/private/svn_temp_serializer.h Sun Aug 1 09:35:10 2010 @@ -21,7 +21,11 @@ * @endcopyright * * @file svn_serializer.h - * @brief Structure serialization helper API + * @brief Helper API for serializing _temporarily_ data structures. + * + * @note This API is intended for efficient serialization and duplication + * of temporary, e.g. cached, data structures ONLY. It is not + * suitable for persistent data. */ #include <apr.h> @@ -43,7 +47,7 @@ typedef void * * PPVOID; * Opaque structure controlling the serialization process and holding the * intermediate as well as final results. */ -typedef struct svn_serializer__context_t svn_serializer__context_t; +typedef struct svn_temp_serializer__context_t svn_temp_serializer__context_t; /** * Begin the serialization process for the @a source_struct and all objects @@ -62,11 +66,11 @@ typedef struct svn_serializer__context_t * * @return the serization context. */ -svn_serializer__context_t * -svn_serializer__init(const void *source_struct, - apr_size_t struct_size, - apr_size_t suggested_buffer_size, - apr_pool_t *pool); +svn_temp_serializer__context_t * +svn_temp_serializer__init(const void *source_struct, + apr_size_t struct_size, + apr_size_t suggested_buffer_size, + apr_pool_t *pool); /** * Begin serialization of a referenced sub-structure within the @@ -80,9 +84,9 @@ svn_serializer__init(const void *source_ * svn_serializer__pop to realign the serialization context. */ void -svn_serializer__push(svn_serializer__context_t *context, - PCPCVOID source_struct, - apr_size_t struct_size); +svn_temp_serializer__push(svn_temp_serializer__context_t *context, + PCPCVOID source_struct, + apr_size_t struct_size); /** * End the serialization of the current sub-structure. The serialization @@ -93,7 +97,7 @@ svn_serializer__push(svn_serializer__con * of the serialization process. */ void -svn_serializer__pop(svn_serializer__context_t *context); +svn_temp_serializer__pop(svn_temp_serializer__context_t *context); /** * Serialize a string referenced from the current structure within the @@ -102,14 +106,14 @@ svn_serializer__pop(svn_serializer__cont * serialized structure can be established. */ void -svn_serializer__add_string(svn_serializer__context_t *context, PCPCSTR s); +svn_temp_serializer__add_string(svn_temp_serializer__context_t *context, PCPCSTR s); /** * @return a reference to the data buffer containing the data serialialized * so far in the given serialization @a context. */ struct svn_stringbuf_t * -svn_serializer__get(svn_serializer__context_t *context); +svn_temp_serializer__get(svn_temp_serializer__context_t *context); /** * Deserialization is straightforward: just copy the serialized buffer to @@ -121,4 +125,4 @@ svn_serializer__get(svn_serializer__cont * the pointer to resolve in @a ptr. */ void -svn_deserializer__resolve(void *buffer, PPVOID ptr); +svn_temp_deserializer__resolve(void *buffer, PPVOID ptr); Propchange: subversion/branches/performance/subversion/include/private/svn_temp_serializer.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/branches/performance/subversion/include/private/svn_temp_serializer.h ------------------------------------------------------------------------------ svn:mergeinfo = Copied: subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c (from r981090, subversion/branches/performance/subversion/libsvn_subr/svn_serializer.c) URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c?p2=subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c&p1=subversion/branches/performance/subversion/libsvn_subr/svn_serializer.c&r1=981090&r2=981189&rev=981189&view=diff ============================================================================== --- subversion/branches/performance/subversion/libsvn_subr/svn_serializer.c (original) +++ subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c Sun Aug 1 09:35:10 2010 @@ -1,5 +1,5 @@ /* - * svn_serializer.c: serialization helper functions + * svn_serializer.c: implement the tempoary structure serialization API * * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one @@ -22,7 +22,7 @@ */ #include <assert.h> -#include "private/svn_serializer.h" +#include "private/svn_temp_serializer.h" #include "svn_string.h" /* This is a very efficient serialization and especially efficient @@ -58,7 +58,7 @@ typedef struct source_stack_t /* Serialization context info. It basically consists of the buffer holding * the serialized result and the stack of source structure information. */ -struct svn_serializer__context_t +struct svn_temp_serializer__context_t { /* allocations are made from this pool */ apr_pool_t *pool; @@ -77,7 +77,7 @@ struct svn_serializer__context_t * guarantees. */ static void -align_buffer_end(svn_serializer__context_t *context) +align_buffer_end(svn_temp_serializer__context_t *context) { apr_size_t current_len = context->buffer->len; apr_size_t aligned_len = APR_ALIGN_DEFAULT(current_len); @@ -95,8 +95,8 @@ align_buffer_end(svn_serializer__context * re-allocations during the serialization process. All allocations will * be made from POOL. */ -svn_serializer__context_t * -svn_serializer__init(const void *source_struct, +svn_temp_serializer__context_t * +svn_temp_serializer__init(const void *source_struct, apr_size_t struct_size, apr_size_t suggested_buffer_size, apr_pool_t *pool) @@ -108,7 +108,7 @@ svn_serializer__init(const void *source_ /* create the serialization context and initialize it, including the * structure stack */ - svn_serializer__context_t *context = apr_palloc(pool, sizeof(*context)); + svn_temp_serializer__context_t *context = apr_palloc(pool, sizeof(*context)); context->pool = pool; context->buffer = svn_stringbuf_create_ensure(init_size, pool); context->source = apr_palloc(pool, sizeof(*context->source)); @@ -128,7 +128,7 @@ svn_serializer__init(const void *source_ * right after this function call. */ static void -store_current_end_pointer(svn_serializer__context_t *context, +store_current_end_pointer(svn_temp_serializer__context_t *context, PCPCVOID source_pointer) { /* relative position of the serialized pointer to the begin of the buffer */ @@ -155,9 +155,9 @@ store_current_end_pointer(svn_serializer * result of sizeof() of the actual structure. */ void -svn_serializer__push(svn_serializer__context_t *context, - PCPCVOID source_struct, - apr_size_t struct_size) +svn_temp_serializer__push(svn_temp_serializer__context_t *context, + PCPCVOID source_struct, + apr_size_t struct_size) { /* create a new entry for the structure stack */ source_stack_t *new = apr_palloc(context->pool, sizeof(*new)); @@ -187,7 +187,7 @@ svn_serializer__push(svn_serializer__con /* Remove the lastest structure from the stack. */ void -svn_serializer__pop(svn_serializer__context_t *context) +svn_temp_serializer__pop(svn_temp_serializer__context_t *context) { /* we may pop the original struct but not further */ assert(context->source); @@ -202,7 +202,7 @@ svn_serializer__pop(svn_serializer__cont * structure can be established. */ void -svn_serializer__add_string(svn_serializer__context_t *context, PCPCSTR s) +svn_temp_serializer__add_string(svn_temp_serializer__context_t *context, PCPCSTR s) { /* Store the offset at which the string data that will the appended. * Write 0 for NULL pointers. Strings don't need special alignment. */ @@ -217,7 +217,7 @@ svn_serializer__add_string(svn_serialize * the given serialization CONTEXT. */ svn_stringbuf_t * -svn_serializer__get(svn_serializer__context_t *context) +svn_temp_serializer__get(svn_temp_serializer__context_t *context) { return context->buffer; } @@ -226,7 +226,7 @@ svn_serializer__get(svn_serializer__cont * proper pointer value. */ void -svn_deserializer__resolve(void *buffer, PPVOID ptr) +svn_temp_deserializer__resolve(void *buffer, PPVOID ptr) { if ((apr_size_t)*ptr) { Propchange: subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c ------------------------------------------------------------------------------ svn:mergeinfo =