subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1396744 - in /subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf: ra_serf.h xml.c
Date Wed, 10 Oct 2012 19:07:58 GMT
Author: cmpilato
Date: Wed Oct 10 19:07:58 2012
New Revision: 1396744

URL: http://svn.apache.org/viewvc?rev=1396744&view=rev
Log:
On the 'http-dynamic-prop-namespaces' branch:  add a helper API.

* subversion/libsvn_ra_serf/ra_serf.h,
* subversion/libsvn_ra_serf/xml.c
  (svn_ra_serf__add_open_tag_attrs_buckets): New function.

Modified:
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/ra_serf.h
    subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/xml.c

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/ra_serf.h?rev=1396744&r1=1396743&r2=1396744&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/ra_serf.h Wed
Oct 10 19:07:58 2012
@@ -995,6 +995,18 @@ svn_ra_serf__add_open_tag_buckets(serf_b
                                   ...);
 
 /*
+ * Add the appropriate serf buckets to AGG_BUCKET representing xml tag open
+ * with name TAG and attributes ATTRS.  XML-escape attributes as necessary.
+ *
+ * The bucket will be allocated from BKT_ALLOC.
+ */
+void
+svn_ra_serf__add_open_tag_attrs_buckets(serf_bucket_t *agg_bucket,
+                                        serf_bucket_alloc_t *bkt_alloc,
+                                        const char *tag,
+                                        apr_hash_t *attrs);
+
+/*
  * Add the appropriate serf buckets to AGG_BUCKET representing xml tag close
  * with name TAG.
  *

Modified: subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/xml.c?rev=1396744&r1=1396743&r2=1396744&view=diff
==============================================================================
--- subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/xml.c Wed Oct
10 19:07:58 2012
@@ -270,6 +270,49 @@ svn_ra_serf__add_open_tag_buckets(serf_b
 }
 
 void
+svn_ra_serf__add_open_tag_attrs_buckets(serf_bucket_t *agg_bucket,
+                                        serf_bucket_alloc_t *bkt_alloc,
+                                        const char *tag,
+                                        apr_hash_t *attrs)
+{
+  apr_hash_index_t *hi;
+  serf_bucket_t *tmp;
+
+  tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<", 1, bkt_alloc);
+  serf_bucket_aggregate_append(agg_bucket, tmp);
+
+  tmp = SERF_BUCKET_SIMPLE_STRING(tag, bkt_alloc);
+  serf_bucket_aggregate_append(agg_bucket, tmp);
+
+  for (hi = apr_hash_first(NULL, attrs); hi; hi = apr_hash_next(hi))
+    {
+      const void *key;
+      apr_size_t klen;
+      void *val;
+
+      apr_hash_this(hi, &key, &klen, &val);
+
+      tmp = SERF_BUCKET_SIMPLE_STRING_LEN(" ", 1, bkt_alloc);
+      serf_bucket_aggregate_append(agg_bucket, tmp);
+
+      tmp = SERF_BUCKET_SIMPLE_STRING_LEN(key, klen, bkt_alloc);
+      serf_bucket_aggregate_append(agg_bucket, tmp);
+
+      tmp = SERF_BUCKET_SIMPLE_STRING_LEN("=\"", 2, bkt_alloc);
+      serf_bucket_aggregate_append(agg_bucket, tmp);
+
+      tmp = SERF_BUCKET_SIMPLE_STRING(val, bkt_alloc);
+      serf_bucket_aggregate_append(agg_bucket, tmp);
+
+      tmp = SERF_BUCKET_SIMPLE_STRING_LEN("\"", 1, bkt_alloc);
+      serf_bucket_aggregate_append(agg_bucket, tmp);
+    }
+
+  tmp = SERF_BUCKET_SIMPLE_STRING_LEN(">", 1, bkt_alloc);
+  serf_bucket_aggregate_append(agg_bucket, tmp);
+}
+
+void
 svn_ra_serf__add_close_tag_buckets(serf_bucket_t *agg_bucket,
                                    serf_bucket_alloc_t *bkt_alloc,
                                    const char *tag)



Mime
View raw message