subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r990536 - /subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c
Date Sun, 29 Aug 2010 10:27:49 GMT
Author: stefan2
Date: Sun Aug 29 10:27:49 2010
New Revision: 990536

URL: http://svn.apache.org/viewvc?rev=990536&view=rev
Log:
Minor improvement of the serialization API implementation: slightly faster
and with fixed comments.

* subversion/libsvn_subr/svn_temp_serializer.c
  (store_current_end_pointer): calculate the target offset only if we actually need it;
  improve commentary
  (svn_temp_serializer__set_null): improve commentary
  

Modified:
    subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c

Modified: subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c?rev=990536&r1=990535&r2=990536&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/svn_temp_serializer.c Sun Aug 29
10:27:49 2010
@@ -142,7 +142,6 @@ store_current_end_pointer(svn_temp_seria
                           const void * const * source_pointer)
 {
   apr_size_t ptr_offset;
-  apr_size_t target_offset;
   apr_size_t *target_ptr;
 
   /* if *source_pointer is the root struct, there will be no parent structure
@@ -150,11 +149,10 @@ store_current_end_pointer(svn_temp_seria
   if (context->source == NULL)
     return;
 
-  /* relative position of the serialized pointer to the begin of the buffer */
+  /* position of the serialized pointer relative to the begin of the buffer */
   ptr_offset = (const char *)source_pointer
              - (const char *)context->source->source_struct
              + context->source->target_offset;
-  target_offset = context->buffer->len - context->source->target_offset;
 
   /* the offset must be within the serialized data. Otherwise, you forgot
    * to serialize the respective sub-struct. */
@@ -165,7 +163,9 @@ store_current_end_pointer(svn_temp_seria
 
   /* store the current buffer length because that's where we will append
    * the serialized data of the sub-struct or string */
-  *target_ptr = *source_pointer == NULL ? 0 : target_offset;
+  *target_ptr = *source_pointer == NULL 
+              ? 0
+              : context->buffer->len - context->source->target_offset;
 }
 
 /* Begin serialization of a referenced sub-structure within the
@@ -247,7 +247,7 @@ svn_temp_serializer__set_null(svn_temp_s
   /* there must be a parent structure */
   assert(context->source);
 
-  /* relative position of the serialized pointer to the begin of the buffer */
+  /* position of the serialized pointer relative to the begin of the buffer */
   offset = (const char *)ptr
          - (const char *)context->source->source_struct
          + context->source->target_offset;



Mime
View raw message