subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1133361 - in /subversion/trunk/subversion/svn: cl.h info-cmd.c status.c util.c
Date Wed, 08 Jun 2011 11:56:58 GMT
Author: julianfoad
Date: Wed Jun  8 11:56:58 2011
New Revision: 1133361

URL: http://svn.apache.org/viewvc?rev=1133361&view=rev
Log:
Factor out a function for printing lock info in XML.

* subversion/svn/cl.h,
  subversion/svn/util.c
  (svn_cl__print_xml_lock): New function, factored out from ...

* subversion/svn/info-cmd.c
  (print_info_xml): ... here ...

* subversion/svn/status.c
  (svn_cl__print_status_xml): ... and here (twice).

Modified:
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/info-cmd.c
    subversion/trunk/subversion/svn/status.c
    subversion/trunk/subversion/svn/util.c

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1133361&r1=1133360&r2=1133361&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Wed Jun  8 11:56:58 2011
@@ -450,6 +450,13 @@ svn_cl__print_xml_commit(svn_stringbuf_t
                          const char *date,
                          apr_pool_t *pool);
 
+/* Output an XML "<lock>" element describing LOCK to *OUTSTR.  If *OUTSTR is
+   NULL, allocate it first from POOL, otherwise append to it. */
+void
+svn_cl__print_xml_lock(svn_stringbuf_t **outstr,
+                       const svn_lock_t *lock,
+                       apr_pool_t *pool);
+
 /* Do the following things that are commonly required before accessing revision
    properties.  Ensure that REVISION is specified explicitly and is not
    relative to a working-copy item.  Ensure that exactly one target is

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1133361&r1=1133360&r2=1133361&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Wed Jun  8 11:56:58 2011
@@ -244,32 +244,7 @@ print_info_xml(void *baton,
     }
 
   if (info->lock)
-    {
-      /* "<lock>" */
-      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);
-
-      /* "<token> xx </token>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "token", info->lock->token);
-
-      /* "<owner> xx </owner>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "owner", info->lock->owner);
-
-      /* "<comment ...> xxxx </comment>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "comment", info->lock->comment);
-
-      /* "<created> xx </created>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "created",
-                               svn_time_to_cstring
-                               (info->lock->creation_date, pool));
-
-      /* "<expires> xx </expires>" */
-      svn_cl__xml_tagged_cdata(&sb, pool, "expires",
-                               svn_time_to_cstring
-                               (info->lock->expiration_date, pool));
-
-      /* "</lock>" */
-      svn_xml_make_close_tag(&sb, pool, "lock");
-    }
+    svn_cl__print_xml_lock(&sb, info->lock, pool);
 
   /* "</entry>" */
   svn_xml_make_close_tag(&sb, pool, "entry");

Modified: subversion/trunk/subversion/svn/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/status.c?rev=1133361&r1=1133360&r2=1133361&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/status.c (original)
+++ subversion/trunk/subversion/svn/status.c Wed Jun  8 11:56:58 2011
@@ -361,22 +361,7 @@ svn_cl__print_status_xml(const char *pat
     }
 
   if (status->lock)
-    {
-      svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);
-
-      svn_cl__xml_tagged_cdata(&sb, pool, "token", status->lock->token);
-
-      svn_cl__xml_tagged_cdata(&sb, pool, "owner", status->lock->owner);
-
-      svn_cl__xml_tagged_cdata(&sb, pool, "comment",
-                               status->lock->comment);
-
-      svn_cl__xml_tagged_cdata(&sb, pool, "created",
-                               svn_time_to_cstring
-                               (status->lock->creation_date, pool));
-
-      svn_xml_make_close_tag(&sb, pool, "lock");
-    }
+    svn_cl__print_xml_lock(&sb, status->lock, pool);
 
   svn_xml_make_close_tag(&sb, pool, "wc-status");
 
@@ -390,33 +375,8 @@ svn_cl__print_status_xml(const char *pat
                             generate_status_desc(status->repos_prop_status),
                             NULL);
       if (status->repos_lock)
-        {
-          svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "lock", NULL);
-
-          svn_cl__xml_tagged_cdata(&sb, pool, "token",
-                                   status->repos_lock->token);
-
-          svn_cl__xml_tagged_cdata(&sb, pool, "owner",
-                                   status->repos_lock->owner);
-
-          svn_cl__xml_tagged_cdata(&sb, pool, "comment",
-                                   status->repos_lock->comment);
-
-          svn_cl__xml_tagged_cdata(&sb, pool, "created",
-                                   svn_time_to_cstring
-                                   (status->repos_lock->creation_date,
-                                    pool));
-
-          if (status->repos_lock->expiration_date != 0)
-            {
-              svn_cl__xml_tagged_cdata(&sb, pool, "expires",
-                                       svn_time_to_cstring
-                                       (status->repos_lock->expiration_date,
-                                        pool));
-            }
+        svn_cl__print_xml_lock(&sb, status->repos_lock, pool);
 
-          svn_xml_make_close_tag(&sb, pool, "lock");
-        }
       svn_xml_make_close_tag(&sb, pool, "repos-status");
     }
 

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=1133361&r1=1133360&r2=1133361&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Wed Jun  8 11:56:58 2011
@@ -1012,6 +1012,37 @@ svn_cl__print_xml_commit(svn_stringbuf_t
 }
 
 
+void
+svn_cl__print_xml_lock(svn_stringbuf_t **sb,
+                       const svn_lock_t *lock,
+                       apr_pool_t *pool)
+{
+  /* "<lock>" */
+  svn_xml_make_open_tag(sb, pool, svn_xml_normal, "lock", NULL);
+
+  /* "<token>xx</token>" */
+  svn_cl__xml_tagged_cdata(sb, pool, "token", lock->token);
+
+  /* "<owner>xx</owner>" */
+  svn_cl__xml_tagged_cdata(sb, pool, "owner", lock->owner);
+
+  /* "<comment>xx</comment>" */
+  svn_cl__xml_tagged_cdata(sb, pool, "comment", lock->comment);
+
+  /* "<created>xx</created>" */
+  svn_cl__xml_tagged_cdata(sb, pool, "created",
+                           svn_time_to_cstring(lock->creation_date, pool));
+
+  /* "<expires>xx</expires>" */
+  if (lock->expiration_date != 0)
+    svn_cl__xml_tagged_cdata(sb, pool, "expires",
+                             svn_time_to_cstring(lock->expiration_date, pool));
+
+  /* "</lock>" */
+  svn_xml_make_close_tag(sb, pool, "lock");
+}
+
+
 svn_error_t *
 svn_cl__xml_print_header(const char *tagname,
                          apr_pool_t *pool)



Mime
View raw message