[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH][merge-tracking]ra_dav mergeinfo accumulation over 'stringbuf' rather than a 'char *'

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-11-21 12:29:07 CET

Hi All,
Find the attached patch and log.

With regards
Kamesh Jayachandran

[[[

Accumulate the mergeinfo with stringbuf rather than char*.

* subversion/libsvn_ra_dav/mergeinfo.c
  (struct mergeinfo_baton):
   Change type of 'curr_info' from 'const char*' to 'svn_stringbuf_t'.
  (start_element):
   set 'curr_info' empty.
  (end_element):
   Fix for 'curr_info' type change.
  (cdata_handler):
   Fix for 'curr_info' type change.
  (svn_ra_dav__get_merge_info):
   We already initialize 'struct mergeinfo_baton' 's members to NULL.
   No need to do it once more.
   Initialize 'struct mergeinfo_baton' 's curr_info with empty buffer.
   
Patch by: Kamesh Jayachandran <kamesh@collab.net>
]]]

Index: subversion/libsvn_ra_dav/mergeinfo.c
===================================================================
--- subversion/libsvn_ra_dav/mergeinfo.c (revision 22374)
+++ subversion/libsvn_ra_dav/mergeinfo.c (working copy)
@@ -43,7 +43,7 @@
 {
   apr_pool_t *pool;
   const char *curr_path;
- const char *curr_info;
+ svn_stringbuf_t *curr_info;
   apr_hash_t *result;
   svn_error_t *err;
 };
@@ -84,7 +84,7 @@
 
   if (elm->id == ELEM_merge_info_item)
     {
- mb->curr_info = NULL;
+ svn_stringbuf_setempty(mb->curr_info);
       mb->curr_path = NULL;
     }
 
@@ -111,7 +111,7 @@
         {
           apr_hash_t *temp;
 
- mb->err = svn_mergeinfo_parse(mb->curr_info, &temp, mb->pool);
+ mb->err = svn_mergeinfo_parse(mb->curr_info->data, &temp, mb->pool);
           SVN_ERR(mb->err);
 
           apr_hash_set(mb->result, mb->curr_path, APR_HASH_KEY_STRING,
@@ -136,15 +136,7 @@
 
     case ELEM_merge_info_info:
       if (mb->curr_info)
- {
- char *to_append = apr_pstrmemdup(mb->pool, cdata, len);
- mb->curr_info = apr_pstrcat(mb->pool, mb->curr_info, to_append,
- NULL);
- }
- else
- {
- mb->curr_info = apr_pstrndup(mb->pool, cdata, nlen);
- }
+ svn_stringbuf_appendbytes(mb->curr_info, cdata, nlen);
       break;
 
     default:
@@ -214,9 +206,8 @@
 
   mb.pool = pool;
   mb.err = SVN_NO_ERROR;
- mb.curr_path = NULL;
- mb.curr_info = NULL;
   mb.result = apr_hash_make(pool);
+ mb.curr_info = svn_stringbuf_create("", pool);
 
   SVN_ERR (svn_ra_dav__parsed_request(ras->sess,
                                       "REPORT",

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 21 12:29:26 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.