subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1339816 - in /subversion/trunk/subversion: libsvn_ra_neon/util.c libsvn_ra_serf/util.c
Date Thu, 17 May 2012 19:35:35 GMT
Author: philip
Date: Thu May 17 19:35:35 2012
New Revision: 1339816

URL: http://svn.apache.org/viewvc?rev=1339816&view=rev
Log:
* subversion/libsvn_ra_serf/util.c
  (end_error, end_207): Use strip function to strip DEBUG_CR whitespace.

* subversion/libsvn_ra_neon/util.c
  (end_207_element): ditto

Modified:
    subversion/trunk/subversion/libsvn_ra_neon/util.c
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/util.c?rev=1339816&r1=1339815&r2=1339816&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/util.c Thu May 17 19:35:35 2012
@@ -246,13 +246,10 @@ end_207_element(void *baton, int state,
     case ELEM_responsedescription:
       if (b->in_propstat)
         {
-          const char *data = b->cdata->data;
-
           /* Remove leading newline added by DEBUG_CR on server */
-          if (*data == '\n')
-              ++data;
+          svn_stringbuf_strip_whitespace(b->cdata);
 
-            svn_stringbuf_set(b->propstat_description, data);
+          svn_stringbuf_set(b->propstat_description, b->cdata->data);
         }
       else
         {

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1339816&r1=1339815&r2=1339816&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Thu May 17 19:35:35 2012
@@ -844,15 +844,10 @@ end_error(svn_ra_serf__xml_parser_t *par
       /* On the server dav_error_response_tag() will add a leading
          and trailing newline if DEBUG_CR is defined in mod_dav.h,
          so remove any such characters here. */
-      apr_size_t len;
-      const char *cd = ctx->cdata->data;
-      if (*cd == '\n')
-        ++cd;
-      len = strlen(cd);
-      if (len > 0 && cd[len-1] == '\n')
-        --len;
+      svn_stringbuf_strip_whitespace(ctx->cdata);
 
-      ctx->error->message = apr_pstrmemdup(ctx->error->pool, cd, len);
+      ctx->error->message = apr_pstrmemdup(ctx->error->pool, ctx->cdata->data,
+                                           ctx->cdata->len);
       ctx->collect_cdata = FALSE;
     }
 
@@ -1148,18 +1143,12 @@ end_207(svn_ra_serf__xml_parser_t *parse
     }
   if (ctx->in_error && strcmp(name.name, "responsedescription") == 0)
     {
-      apr_size_t len = ctx->cdata->len;
-      const char *data = ctx->cdata->data;
-
       /* Remove leading newline added by DEBUG_CR on server */
-      if (*data == '\n')
-        {
-          ++data;
-          --len;
-        }
+      svn_stringbuf_strip_whitespace(ctx->cdata);
 
       ctx->collect_cdata = FALSE;
-      ctx->error->message = apr_pstrmemdup(ctx->error->pool, data, len);
+      ctx->error->message = apr_pstrmemdup(ctx->error->pool, ctx->cdata->data,
+                                           ctx->cdata->len);
       if (ctx->contains_precondition_error)
         ctx->error->apr_err = SVN_ERR_FS_PROP_BASEVALUE_MISMATCH;
       else



Mime
View raw message