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

issue #406 patch 2

From: Matt Kraai <kraai_at_alumni.carnegiemellon.edu>
Date: 2001-10-26 17:05:20 CEST

Howdy,

This is the second in the series of patches to fix issue #406. It
converts the argument types of svn_fs_{node,txn,revision}_prop. I
installed a new python, so I was able to verify that it passed the
entire test suite successfully.

Matt

* subversion/svnadmin/main.c

  (main): Use svn_string_t instead of svn_stringbuf_t for properties.

* subversion/include/svn_fs.h

  (svn_fs_txn_prop, svn_fs_node_prop, svn_fs_revision_prop):
  Convert propname to const char * and value_p to svn_string_t **.

* subversion/include/svn_time.h

  (svn_time_from_string): Convert timestr to svn_string_t.

  (svn_time_from_stringbuf): New.

* subversion/include/svn_xml.h

  (svn_xml_escape_string): Convert string to svn_string_t.

  (svn_xml_escape_stringbuf): New.

* subversion/libsvn_fs/proplist.c

  (svn_fs__get_prop): Convert name to const char * and value_p to
  svn_string_t **.

* subversion/libsvn_fs/proplist.h

  (svn_fs__get_prop): Convert name to const char * and value_p to
  svn_string_t **.

* subversion/libsvn_fs/txn-table.c

  (struct txn_prop_args, svn_fs_txn_prop): Convert propname to
  const char * and value_p to svn_string_t ** and update call to
  svn_fs__get_prop.

* subversion/libsvn_fs/tree.c

  (struct node_prop_args, svn_fs_node_prop): Convert propname to
  const char * and value_p to svn_string_t ** and update call to
  svn_fs__get_prop.

* subversion/libsvn_fs/rev-table.c

  (struct revision_prop_args, svn_fs_revision_prop): Convert propname to
  const char * and value_p to svn_string_t ** and update call to
  svn_fs__get_prop.

* subversion/libsvn_wc/entries.c

  (svn_wc__atts_to_entry): Use svn_time_from_stringbuf.

* subversion/libsvn_wc/questions.c

  (timestamps_equal_p): Use svn_time_from_stringbuf.

* subversion/libsvn_subr/time.c

  (svn_time_from_data): New.
  (svn_time_from_string): Accept svn_string_t, call svn_time_from_data.
  (svn_time_from_stringbuf): New.

* subversion/libsvn_subr/xml.c

  (svn_xml_escape_data_and_len): New.
  (svn_xml_escape_string): Accept svn_string_t and call
  svn_xml_escape_data_and_len.
  (svn_xml_escape_stringbuf): New.
  (svn_xml_make_open_tag_hash): Call svn_xml_escape_stringbuf.

* subversion/libsvn_ra_local/ra_plugin.c

  (get_log): Use svn_string_t for properties, char * for property names.

* subversion/svnlook/main.c

  (get_property): Change prop_value to a svn_string_t * and prop_name to
  a const char *.
  (do_log): Update call to get_property.
  (do_date): Update call to get_property.
  (do_author): Update call to get_property.

* subversion/mod_dav_svn/deadprops.c

  (get_repos_propname): Change repos_propname to a char **.
  (get_value): Change pvalue to a svn_string_t **, and update calls
  to get_repos_propname, svn_fs_txn_prop, svn_fs_revision_prop, and
  svn_fs_node_prop.
  (save_value): Update call to get_repos_propname.
  (dav_svn_db_output_value): Update call to get_value.
  (dav_svn_db_remove): Update call to get_repos_propname
  (dav_svn_db_exists): Update calls to get_repos_propname,
  svn_fs_txn_prop, svn_fs_revision_prop, and svn_fs_node_prop.
  (dav_svn_db_get_rollback): Update call to get_value.

* subversion/tests/libsvn_fs/fs-test.c

  (call_functions_with_unopened_fs): Update call to svn_fs_revision_prop.
  (revision_props): Update call to svn_fs_revision_prop.
  (transaction_props): Update call to svn_fs_txn_prop.
  (node_props): Update call to svn_fs_node_prop.
  (commit_date): Update call to svn_fs_revision_prop.

* subversion/libsvn_repos/rev_hunt.c

  (get_time): Update call to svn_fs_revision_prop.

* subversion/libsvn_delta/xml_output.c

  (output_propset): Call svn_xml_escape_stringbuf.

* subversion/libsvn_ra_dav/commit.c

  (record_prop_change): Call svn_xml_escape_stringbuf.
  (apply_log_message): Call svn_xml_escape_stringbuf.

Index: ./subversion/svnadmin/main.c
===================================================================
--- ./subversion/svnadmin/.svn/text-base/main.c Thu Oct 25 10:57:50 2001
+++ ./subversion/svnadmin/main.c Thu Oct 25 13:19:51 2001
@@ -239,15 +239,9 @@
         {
           svn_fs_txn_t *txn;
           svn_fs_root_t *this_root;
- svn_stringbuf_t *datestamp;
- svn_stringbuf_t *author;
- svn_stringbuf_t *log;
- svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
- strlen(SVN_PROP_REVISION_DATE)};
- svn_string_t auth_prop = {SVN_PROP_REVISION_AUTHOR,
- strlen(SVN_PROP_REVISION_AUTHOR)};
- svn_string_t log_prop = {SVN_PROP_REVISION_LOG,
- strlen(SVN_PROP_REVISION_LOG)};
+ svn_string_t *datestamp;
+ svn_string_t *author;
+ svn_string_t *log;
           apr_pool_t *this_pool = svn_pool_create (pool);
 
           err = svn_fs_open_txn (&txn, fs, txn_name, this_pool);
@@ -256,18 +250,20 @@
           err = svn_fs_txn_root (&this_root, txn, this_pool);
           if (err) goto error;
 
- err = svn_fs_txn_prop (&datestamp, txn, &date_prop, this_pool);
+ err = svn_fs_txn_prop (&datestamp, txn, SVN_PROP_REVISION_DATE,
+ this_pool);
           if (err) goto error;
- err = svn_fs_txn_prop (&author, txn, &auth_prop, this_pool);
+ err = svn_fs_txn_prop (&author, txn, SVN_PROP_REVISION_AUTHOR,
+ this_pool);
           if (err) goto error;
           if ((! datestamp) || (! datestamp->data))
- datestamp = svn_stringbuf_create ("", this_pool);
+ datestamp = svn_string_create ("", this_pool);
           if ((! author) || (! author->data))
- author = svn_stringbuf_create ("", this_pool);
- err = svn_fs_txn_prop (&log, txn, &log_prop, this_pool);
+ author = svn_string_create ("", this_pool);
+ err = svn_fs_txn_prop (&log, txn, SVN_PROP_REVISION_LOG, this_pool);
           if (err) goto error;
           if (! log)
- log = svn_stringbuf_create ("", this_pool);
+ log = svn_string_create ("", this_pool);
           
           printf ("Txn %s:\n", txn_name);
           printf ("Created: %s\n", datestamp->data);
@@ -312,35 +308,29 @@
       for (this = lower; this <= upper; this++)
         {
           svn_fs_root_t *this_root;
- svn_stringbuf_t *datestamp;
- svn_stringbuf_t *author;
- svn_stringbuf_t *log;
+ svn_string_t *datestamp;
+ svn_string_t *author;
+ svn_string_t *log;
           apr_pool_t *this_pool = svn_pool_create (pool);
- svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
- strlen(SVN_PROP_REVISION_DATE)};
- svn_string_t auth_prop = {SVN_PROP_REVISION_AUTHOR,
- strlen(SVN_PROP_REVISION_AUTHOR)};
- svn_string_t log_prop = {SVN_PROP_REVISION_LOG,
- strlen(SVN_PROP_REVISION_LOG)};
            
           err = svn_fs_revision_root (&this_root, fs, this, this_pool);
           if (err) goto error;
 
           err = svn_fs_revision_prop (&datestamp, fs, this,
- &date_prop, this_pool);
+ SVN_PROP_REVISION_DATE, this_pool);
           if (err) goto error;
 
           err = svn_fs_revision_prop (&author, fs, this,
- &auth_prop, this_pool);
+ SVN_PROP_REVISION_AUTHOR, this_pool);
           if (err) goto error;
           if (! author)
- author = svn_stringbuf_create ("", this_pool);
+ author = svn_string_create ("", this_pool);
 
           err = svn_fs_revision_prop (&log, fs, this,
- &log_prop, this_pool);
+ SVN_PROP_REVISION_LOG, this_pool);
           if (err) goto error;
           if (! log)
- log = svn_stringbuf_create ("", this_pool);
+ log = svn_string_create ("", this_pool);
 
 
           printf ("Revision %ld\n", (long int) this);
Index: ./subversion/include/svn_fs.h
===================================================================
--- ./subversion/include/.svn/text-base/svn_fs.h Fri Oct 26 08:12:26 2001
+++ ./subversion/include/svn_fs.h Thu Oct 25 13:15:12 2001
@@ -520,9 +520,9 @@
 /* Set *VALUE_P to the value of the property named PROPNAME on
    transaction TXN. If TXN has no property by that name, set *VALUE_P
    to zero. Allocate the result in POOL. */
-svn_error_t *svn_fs_txn_prop (svn_stringbuf_t **value_p,
+svn_error_t *svn_fs_txn_prop (svn_string_t **value_p,
                               svn_fs_txn_t *txn,
- const svn_string_t *propname,
+ const char *propname,
                               apr_pool_t *pool);
 
 
@@ -719,10 +719,10 @@
 /* Set *VALUE_P to the value of the property named PROPNAME of PATH in
    ROOT. If the node has no property by that name, set *VALUE_P to
    zero. Allocate the result in POOL. */
-svn_error_t *svn_fs_node_prop (svn_stringbuf_t **value_p,
+svn_error_t *svn_fs_node_prop (svn_string_t **value_p,
                                svn_fs_root_t *root,
                                const char *path,
- const svn_string_t *propname,
+ const char *propname,
                                apr_pool_t *pool);
    
 
@@ -1114,14 +1114,11 @@
 
 /* Set *VALUE_P to the value of the property named PROPNAME on
    revision REV in the filesystem FS. If REV has no property by that
- name, set *VALUE_P to zero. Allocate the result in POOL.
-
- ### todo (issue #406): svn_string_t, not svn_stringbuf_t. And the
- name could be const char *. */
-svn_error_t *svn_fs_revision_prop (svn_stringbuf_t **value_p,
+ name, set *VALUE_P to zero. Allocate the result in POOL. */
+svn_error_t *svn_fs_revision_prop (svn_string_t **value_p,
                                    svn_fs_t *fs,
                                    svn_revnum_t rev,
- const svn_string_t *propname,
+ const char *propname,
                                    apr_pool_t *pool);
 
 
Index: ./subversion/include/svn_time.h
===================================================================
--- ./subversion/include/.svn/text-base/svn_time.h Thu Oct 25 10:57:48 2001
+++ ./subversion/include/svn_time.h Thu Oct 25 13:46:55 2001
@@ -33,13 +33,18 @@
 
 
 /* Convert WHEN to an svn string representation allocated in POOL.
- Use svn_time_from_string() for the reverse conversion. */
+ Use svn_time_from_stringbuf() for the reverse conversion. */
 svn_stringbuf_t *svn_time_to_string (apr_time_t when, apr_pool_t *pool);
 
 
 /* Convert TIMESTR to an apr_time_t. TIMESTR should be of the form
    returned by svn_wc__time_to_string(). */
-apr_time_t svn_time_from_string (svn_stringbuf_t *timestr);
+apr_time_t svn_time_from_string (svn_string_t *timestr);
+
+
+/* Convert TIMESTR to an apr_time_t. TIMESTR should be of the form
+ returned by svn_wc__time_to_string(). */
+apr_time_t svn_time_from_stringbuf (svn_stringbuf_t *timestr);
 
 
 /* Needed by getdate.y parser */
Index: ./subversion/include/svn_xml.h
===================================================================
--- ./subversion/include/.svn/text-base/svn_xml.h Thu Oct 25 10:57:48 2001
+++ ./subversion/include/svn_xml.h Thu Oct 25 14:01:11 2001
@@ -50,8 +50,16 @@
    NULL (in which case a new string is created), or it must point to
    an existing string to append to. */
 void svn_xml_escape_string (svn_stringbuf_t **outstr,
- const svn_stringbuf_t *string,
+ const svn_string_t *string,
                             apr_pool_t *pool);
+
+/* A utility function to escape a string so that it may be used in XML
+ output as character data or as an attribute value. *outstr must be
+ NULL (in which case a new string is created), or it must point to
+ an existing string to append to. */
+void svn_xml_escape_stringbuf (svn_stringbuf_t **outstr,
+ const svn_stringbuf_t *string,
+ apr_pool_t *pool);
 
 /* Unescape an XML-escaped string. NOTE: This function recognizes
    only the following XML escape strings:
Index: ./subversion/libsvn_fs/proplist.c
===================================================================
--- ./subversion/libsvn_fs/.svn/text-base/proplist.c Fri Oct 26 08:12:27 2001
+++ ./subversion/libsvn_fs/proplist.c Thu Oct 25 14:15:44 2001
@@ -23,9 +23,9 @@
 
 
 svn_error_t *
-svn_fs__get_prop (svn_stringbuf_t **value_p,
+svn_fs__get_prop (svn_string_t **value_p,
                   skel_t *proplist,
- const svn_string_t *name,
+ const char *name,
                   apr_pool_t *pool)
 {
   skel_t *prop;
@@ -42,9 +42,9 @@
       skel_t *this_name = prop;
       skel_t *this_value = prop->next;
 
- if (svn_fs__atom_matches_string (this_name, name))
+ if (svn_fs__matches_atom (this_name, name))
         {
- *value_p = svn_stringbuf_ncreate (this_value->data,
+ *value_p = svn_string_ncreate (this_value->data,
                                          this_value->len,
                                          pool);
           return SVN_NO_ERROR;
Index: ./subversion/libsvn_fs/proplist.h
===================================================================
--- ./subversion/libsvn_fs/.svn/text-base/proplist.h Fri Oct 26 08:12:27 2001
+++ ./subversion/libsvn_fs/proplist.h Thu Oct 25 14:15:16 2001
@@ -27,13 +27,10 @@
 
 /* Get the value of the property NAME in PROPLIST, storing it in
    *VALUE_P. Do all necessary allocations in POOL. If NAME is not
- found in PROPLIST, set *VALUE_P to NULL.
-
- ### todo (issue #406): name could be const char *, value_p
- svn_string_t instead of svn_stringbuf_t. */
-svn_error_t *svn_fs__get_prop (svn_stringbuf_t **value_p,
+ found in PROPLIST, set *VALUE_P to NULL. */
+svn_error_t *svn_fs__get_prop (svn_string_t **value_p,
                                skel_t *proplist,
- const svn_string_t *name,
+ const char *name,
                                apr_pool_t *pool);
 
 /* Set *PROP_HASH to a hash table mapping const char * names to
Index: ./subversion/libsvn_fs/txn-table.c
===================================================================
--- ./subversion/libsvn_fs/.svn/text-base/txn-table.c Thu Oct 25 10:57:40 2001
+++ ./subversion/libsvn_fs/txn-table.c Thu Oct 25 14:16:09 2001
@@ -413,10 +413,10 @@
 
 
 struct txn_prop_args {
- svn_stringbuf_t **value_p;
+ svn_string_t **value_p;
   svn_fs_t *fs;
   const char *id;
- const svn_string_t *propname;
+ const char *propname;
 };
 
 
@@ -441,13 +441,13 @@
 
 
 svn_error_t *
-svn_fs_txn_prop (svn_stringbuf_t **value_p,
+svn_fs_txn_prop (svn_string_t **value_p,
                  svn_fs_txn_t *txn,
- const svn_string_t *propname,
+ const char *propname,
                  apr_pool_t *pool)
 {
   struct txn_prop_args args;
- svn_stringbuf_t *value;
+ svn_string_t *value;
   svn_fs_t *fs = svn_fs_txn_fs (txn);
 
   SVN_ERR (svn_fs__check_fs (fs));
Index: ./subversion/libsvn_fs/tree.c
===================================================================
--- ./subversion/libsvn_fs/.svn/text-base/tree.c Thu Oct 25 10:57:40 2001
+++ ./subversion/libsvn_fs/tree.c Thu Oct 25 14:16:03 2001
@@ -800,10 +800,10 @@
 
 struct node_prop_args
 {
- svn_stringbuf_t **value_p;
+ svn_string_t **value_p;
   svn_fs_root_t *root;
   const char *path;
- const svn_string_t *propname;
+ const char *propname;
 };
 
 
@@ -827,14 +827,14 @@
 
 
 svn_error_t *
-svn_fs_node_prop (svn_stringbuf_t **value_p,
+svn_fs_node_prop (svn_string_t **value_p,
                   svn_fs_root_t *root,
                   const char *path,
- const svn_string_t *propname,
+ const char *propname,
                   apr_pool_t *pool)
 {
   struct node_prop_args args;
- svn_stringbuf_t *value;
+ svn_string_t *value;
 
   args.value_p = &value;
   args.root = root;
Index: ./subversion/libsvn_fs/rev-table.c
===================================================================
--- ./subversion/libsvn_fs/.svn/text-base/rev-table.c Thu Oct 25 10:57:36 2001
+++ ./subversion/libsvn_fs/rev-table.c Thu Oct 25 14:15:54 2001
@@ -262,10 +262,10 @@
 
 
 struct revision_prop_args {
- svn_stringbuf_t **value_p;
+ svn_string_t **value_p;
   svn_fs_t *fs;
   svn_revnum_t rev;
- const svn_string_t *propname;
+ const char *propname;
 };
 
 
@@ -292,14 +292,14 @@
 
 
 svn_error_t *
-svn_fs_revision_prop (svn_stringbuf_t **value_p,
+svn_fs_revision_prop (svn_string_t **value_p,
                       svn_fs_t *fs,
                       svn_revnum_t rev,
- const svn_string_t *propname,
+ const char *propname,
                       apr_pool_t *pool)
 {
   struct revision_prop_args args;
- svn_stringbuf_t *value;
+ svn_string_t *value;
 
   SVN_ERR (svn_fs__check_fs (fs));
 
Index: ./subversion/libsvn_wc/entries.c
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/entries.c Fri Oct 26 08:12:29 2001
+++ ./subversion/libsvn_wc/entries.c Fri Oct 26 08:12:29 2001
@@ -305,7 +305,7 @@
                it. */
           }
         else
- entry->text_time = svn_time_from_string (text_timestr);
+ entry->text_time = svn_time_from_stringbuf (text_timestr);
         
         *modify_flags |= SVN_WC__ENTRY_MODIFY_TEXT_TIME;
       }
@@ -323,7 +323,7 @@
                it. */
           }
         else
- entry->prop_time = svn_time_from_string (prop_timestr);
+ entry->prop_time = svn_time_from_stringbuf (prop_timestr);
         
         *modify_flags |= SVN_WC__ENTRY_MODIFY_PROP_TIME;
       }
Index: ./subversion/libsvn_wc/questions.c
===================================================================
--- ./subversion/libsvn_wc/.svn/text-base/questions.c Fri Oct 26 08:12:33 2001
+++ ./subversion/libsvn_wc/questions.c Fri Oct 26 08:12:33 2001
@@ -176,7 +176,7 @@
     /* Put the disk timestamp through a string conversion, so it's
        at the same resolution as entry timestamps. */
     svn_stringbuf_t *tstr = svn_time_to_string (wfile_time, pool);
- wfile_time = svn_time_from_string (tstr);
+ wfile_time = svn_time_from_stringbuf (tstr);
   }
   
   if (wfile_time == entrytime)
Index: ./subversion/libsvn_subr/time.c
===================================================================
--- ./subversion/libsvn_subr/.svn/text-base/time.c Thu Oct 25 10:57:21 2001
+++ ./subversion/libsvn_subr/time.c Thu Oct 25 13:51:21 2001
@@ -119,14 +119,14 @@
    (and when they do, they can easily do the conversion). */
 
 
-apr_time_t
-svn_time_from_string (svn_stringbuf_t *tstr)
+static apr_time_t
+svn_time_from_data (const char *data)
 {
   apr_exploded_time_t exploded_time;
   char wday[4], month[4];
   apr_time_t when;
 
- sscanf (tstr->data,
+ sscanf (data,
           timestamp_format,
           wday,
           &exploded_time.tm_mday,
@@ -148,6 +148,20 @@
   apr_implode_gmt (&when, &exploded_time);
 
   return when;
+}
+
+
+apr_time_t
+svn_time_from_string (svn_string_t *tstr)
+{
+ return svn_time_from_data (tstr->data);
+}
+
+
+apr_time_t
+svn_time_from_stringbuf (svn_stringbuf_t *tstr)
+{
+ return svn_time_from_data (tstr->data);
 }
 
 
Index: ./subversion/libsvn_subr/xml.c
===================================================================
--- ./subversion/libsvn_subr/.svn/text-base/xml.c Thu Oct 25 10:57:21 2001
+++ ./subversion/libsvn_subr/xml.c Thu Oct 25 14:00:21 2001
@@ -28,12 +28,13 @@
 
 /*** XML escaping. ***/
 
-void
-svn_xml_escape_string (svn_stringbuf_t **outstr,
- const svn_stringbuf_t *string,
- apr_pool_t *pool)
+static void
+svn_xml_escape_data_and_len (svn_stringbuf_t **outstr,
+ const char *data,
+ apr_size_t len,
+ apr_pool_t *pool)
 {
- const char *start = string->data, *end = start + string->len;
+ const char *start = data, *end = start + len;
   const char *p = start, *q;
 
   if (*outstr == NULL)
@@ -73,6 +74,24 @@
 
 
 void
+svn_xml_escape_string (svn_stringbuf_t **outstr,
+ const svn_string_t *string,
+ apr_pool_t *pool)
+{
+ svn_xml_escape_data_and_len (outstr, string->data, string->len, pool);
+}
+
+
+void
+svn_xml_escape_stringbuf (svn_stringbuf_t **outstr,
+ const svn_stringbuf_t *string,
+ apr_pool_t *pool)
+{
+ svn_xml_escape_data_and_len (outstr, string->data, string->len, pool);
+}
+
+
+void
 svn_xml_unescape_string (svn_stringbuf_t **outstr,
                          const svn_stringbuf_t *string,
                          apr_pool_t *pool)
@@ -400,7 +419,7 @@
       svn_stringbuf_appendcstr (*str, "\n ");
       svn_stringbuf_appendcstr (*str, (char *) key);
       svn_stringbuf_appendcstr (*str, "=\"");
- svn_xml_escape_string (str, (svn_stringbuf_t *) val, pool);
+ svn_xml_escape_stringbuf (str, (svn_stringbuf_t *) val, pool);
       svn_stringbuf_appendcstr (*str, "\"");
     }
 
Index: ./subversion/libsvn_ra_local/ra_plugin.c
===================================================================
--- ./subversion/libsvn_ra_local/.svn/text-base/ra_plugin.c Thu Oct 25 10:57:16 2001
+++ ./subversion/libsvn_ra_local/ra_plugin.c Thu Oct 25 13:11:02 2001
@@ -370,20 +370,16 @@
        ((start >= end) ? (this_rev >= end) : (this_rev <= start));
        ((start >= end) ? this_rev-- : this_rev++))
     {
- svn_stringbuf_t *author, *date, *message;
- svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
- strlen(SVN_PROP_REVISION_DATE)};
- svn_string_t author_prop = {SVN_PROP_REVISION_AUTHOR,
- strlen(SVN_PROP_REVISION_AUTHOR)};
- svn_string_t message_prop = {SVN_PROP_REVISION_LOG,
- strlen(SVN_PROP_REVISION_LOG)};
+ svn_string_t *author, *date, *message;
 
       SVN_ERR (svn_fs_revision_prop
- (&author, sbaton->fs, this_rev, &author_prop, subpool));
+ (&author, sbaton->fs, this_rev, SVN_PROP_REVISION_AUTHOR,
+ subpool));
       SVN_ERR (svn_fs_revision_prop
- (&date, sbaton->fs, this_rev, &date_prop, subpool));
+ (&date, sbaton->fs, this_rev, SVN_PROP_REVISION_DATE, subpool));
       SVN_ERR (svn_fs_revision_prop
- (&message, sbaton->fs, this_rev, &message_prop, subpool));
+ (&message, sbaton->fs, this_rev, SVN_PROP_REVISION_LOG,
+ subpool));
 
       SVN_ERR ((*receiver) (receiver_baton,
                             NULL,
Index: ./subversion/svnlook/main.c
===================================================================
--- ./subversion/svnlook/.svn/text-base/main.c Fri Oct 26 08:12:35 2001
+++ ./subversion/svnlook/main.c Fri Oct 26 08:12:35 2001
@@ -73,9 +73,9 @@
 
 /*** Helper functions. ***/
 static svn_error_t *
-get_property (svn_stringbuf_t **prop_value,
+get_property (svn_string_t **prop_value,
               svnlook_ctxt_t *c,
- svn_string_t *prop_name,
+ const char *prop_name,
               apr_pool_t *pool)
 {
   /* Fetch transaction property... */
@@ -645,14 +645,9 @@
 static svn_error_t *
 do_log (svnlook_ctxt_t *c, svn_boolean_t print_size, apr_pool_t *pool)
 {
- svn_stringbuf_t *prop_value;
- svn_string_t prop_name;
- const char *name = SVN_PROP_REVISION_LOG;
+ svn_string_t *prop_value;
 
- prop_name.data = name;
- prop_name.len = strlen (name);
-
- SVN_ERR (get_property (&prop_value, c, &prop_name, pool));
+ SVN_ERR (get_property (&prop_value, c, SVN_PROP_REVISION_LOG, pool));
 
   if (prop_value && prop_value->data)
     {
@@ -681,14 +676,9 @@
 {
   if (c->is_revision)
     {
- svn_stringbuf_t *prop_value;
- svn_string_t prop_name;
- const char *name = SVN_PROP_REVISION_DATE;
-
- prop_name.data = name;
- prop_name.len = strlen (name);
+ svn_string_t *prop_value;
       
- SVN_ERR (get_property (&prop_value, c, &prop_name, pool));
+ SVN_ERR (get_property (&prop_value, c, SVN_PROP_REVISION_DATE, pool));
 
       if (prop_value && prop_value->data)
         {
@@ -726,14 +716,9 @@
 static svn_error_t *
 do_author (svnlook_ctxt_t *c, apr_pool_t *pool)
 {
- svn_stringbuf_t *prop_value;
- svn_string_t prop_name;
- const char *name = SVN_PROP_REVISION_AUTHOR;
-
- prop_name.data = name;
- prop_name.len = strlen (name);
+ svn_string_t *prop_value;
 
- SVN_ERR (get_property (&prop_value, c, &prop_name, pool));
+ SVN_ERR (get_property (&prop_value, c, SVN_PROP_REVISION_AUTHOR, pool));
 
   if (prop_value && prop_value->data)
     printf ("%s", prop_value->data);
Index: ./subversion/mod_dav_svn/deadprops.c
===================================================================
--- ./subversion/mod_dav_svn/.svn/text-base/deadprops.c Thu Oct 25 10:59:10 2001
+++ ./subversion/mod_dav_svn/deadprops.c Thu Oct 25 14:02:25 2001
@@ -54,33 +54,30 @@
 
 /* construct the repos-local name for the given DAV property name */
 static void get_repos_propname(dav_db *db, const dav_prop_name *name,
- svn_string_t *repos_propname)
+ char **repos_propname)
 {
   if (strcmp(name->ns, SVN_PROP_PREFIX) == 0)
     {
       /* recombine the namespace ("svn:") and the name. */
       svn_stringbuf_set(db->work, SVN_PROP_PREFIX);
       svn_stringbuf_appendcstr(db->work, name->name);
- repos_propname->data = db->work->data;
- repos_propname->len = db->work->len;
+ *repos_propname = db->work->data;
     }
   else if (strcmp(name->ns, SVN_PROP_CUSTOM_PREFIX) == 0)
     {
       /* the name of a custom prop is just the name -- no ns URI */
- repos_propname->data = name->name;
- repos_propname->len = strlen(name->name);
+ *repos_propname = name->name;
     }
   else
     {
- repos_propname->data = NULL;
- repos_propname->len = 0;
+ *repos_propname = NULL;
     }
 }
 
 static dav_error *get_value(dav_db *db, const dav_prop_name *name,
- svn_stringbuf_t **pvalue)
+ svn_string_t **pvalue)
 {
- svn_string_t propname;
+ char *propname;
   svn_error_t *serr;
 
   /* get the repos-local name */
@@ -88,7 +85,7 @@
 
   /* ### disallow arbitrary, non-SVN properties. this effectively shuts
      ### off arbitrary DeltaV clients for now. */
- if (propname.data == NULL)
+ if (propname == NULL)
     {
       /* we know these are not present. */
       *pvalue = NULL;
@@ -101,15 +98,15 @@
   if (db->resource->baselined)
     if (db->resource->type == DAV_RESOURCE_TYPE_WORKING)
       serr = svn_fs_txn_prop(pvalue, db->resource->info->root.txn,
- &propname, db->p);
+ propname, db->p);
     else
       serr = svn_fs_revision_prop(pvalue, db->resource->info->repos->fs,
                                   db->resource->info->root.rev,
- &propname, db->p);
+ propname, db->p);
   else
     serr = svn_fs_node_prop(pvalue, db->resource->info->root.root,
                             get_repos_path(db->resource->info),
- &propname, db->p);
+ propname, db->p);
   if (serr != NULL)
     return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                "could not fetch a property");
@@ -122,13 +119,16 @@
 {
   svn_string_t propname;
   svn_error_t *serr;
+ char *tpropname;
 
   /* get the repos-local name */
- get_repos_propname(db, name, &propname);
+ get_repos_propname(db, name, &tpropname);
+ propname.data = tpropname;
+ propname.len = strlen (tpropname);
 
   /* ### disallow arbitrary, non-SVN properties. this effectively shuts
      ### off arbitrary DeltaV clients for now. */
- if (propname.data == NULL)
+ if (propname == NULL)
     return dav_new_error(db->p, HTTP_CONFLICT, 0,
                          "Properties may only be defined in the "
                          SVN_PROP_PREFIX " and " SVN_PROP_CUSTOM_PREFIX
@@ -211,7 +211,7 @@
                                           dav_xmlns_info *xi,
                                           apr_text_header *phdr, int *found)
 {
- svn_stringbuf_t *propval;
+ svn_string_t *propval;
   svn_stringbuf_t *xmlsafe = NULL;
   const char *prefix;
   const char *s;
@@ -293,9 +293,12 @@
 {
   svn_string_t propname;
   svn_error_t *serr;
+ char *tpropname;
 
   /* get the repos-local name */
- get_repos_propname(db, name, &propname);
+ get_repos_propname(db, name, &tpropname);
+ propname.data = tpropname;
+ propname.len = strlen (tpropname);
 
   /* ### non-svn props aren't in our repos, so punt for now */
   if (propname.data == NULL)
@@ -321,30 +324,30 @@
 
 static int dav_svn_db_exists(dav_db *db, const dav_prop_name *name)
 {
- svn_string_t propname;
- svn_stringbuf_t *propval;
+ char *propname;
+ svn_string_t *propval;
   svn_error_t *serr;
 
   /* get the repos-local name */
   get_repos_propname(db, name, &propname);
 
   /* ### non-svn props aren't in our repos */
- if (propname.data == NULL)
+ if (propname == NULL)
     return 0;
 
   /* Working Baseline, Baseline, or (Working) Version resource */
   if (db->resource->baselined)
     if (db->resource->type == DAV_RESOURCE_TYPE_WORKING)
       serr = svn_fs_txn_prop(&propval, db->resource->info->root.txn,
- &propname, db->p);
+ propname, db->p);
     else
       serr = svn_fs_revision_prop(&propval, db->resource->info->repos->fs,
                                   db->resource->info->root.rev,
- &propname, db->p);
+ propname, db->p);
   else
     serr = svn_fs_node_prop(&propval, db->resource->info->root.root,
                             get_repos_path(db->resource->info),
- &propname, db->p);
+ propname, db->p);
 
   /* ### try and dispose of the value? */
 
@@ -428,7 +431,7 @@
 {
   dav_error *err;
   dav_deadprop_rollback *ddp;
- svn_stringbuf_t *propval;
+ svn_string_t *propval;
 
   if ((err = get_value(db, name, &propval)) != NULL)
     return err;
Index: ./subversion/tests/libsvn_fs/fs-test.c
===================================================================
--- ./subversion/tests/libsvn_fs/.svn/text-base/fs-test.c Fri Oct 26 08:12:41 2001
+++ ./subversion/tests/libsvn_fs/fs-test.c Thu Oct 25 13:47:33 2001
@@ -356,9 +356,8 @@
   }
 
   {
- svn_stringbuf_t *ignored;
- svn_string_t unused;
- err = svn_fs_revision_prop (&ignored, fs, 0, &unused, pool);
+ svn_string_t *ignored;
+ err = svn_fs_revision_prop (&ignored, fs, 0, NULL, pool);
     SVN_ERR (check_no_fs_error (err, pool));
   }
 
@@ -675,7 +674,7 @@
 {
   svn_fs_t *fs;
   apr_hash_t *proplist;
- svn_stringbuf_t *value;
+ svn_string_t *value;
   int i;
   svn_string_t s1;
   svn_string_t s2;
@@ -725,8 +724,7 @@
   SVN_ERR (svn_fs_change_rev_prop (fs, 0, &s1, NULL, pool));
 
   /* Copy a property's value into a new property. */
- SET_STR (&s1, "color");
- SVN_ERR (svn_fs_revision_prop (&value, fs, 0, &s1, pool));
+ SVN_ERR (svn_fs_revision_prop (&value, fs, 0, "color", pool));
 
   SET_STR (&s1, "flower");
   s2.data = value->data;
@@ -785,7 +783,7 @@
   svn_fs_t *fs;
   svn_fs_txn_t *txn;
   apr_hash_t *proplist;
- svn_stringbuf_t *value;
+ svn_string_t *value;
   svn_revnum_t after_rev;
   int i;
   svn_string_t s1;
@@ -838,8 +836,7 @@
   SVN_ERR (svn_fs_change_txn_prop (txn, &s1, NULL, pool));
 
   /* Copy a property's value into a new property. */
- SET_STR (&s1, "color");
- SVN_ERR (svn_fs_txn_prop (&value, txn, &s1, pool));
+ SVN_ERR (svn_fs_txn_prop (&value, txn, "color", pool));
 
   SET_STR (&s1, "flower");
   s2.data = value->data;
@@ -950,7 +947,7 @@
   svn_fs_txn_t *txn;
   svn_fs_root_t *txn_root;
   apr_hash_t *proplist;
- svn_stringbuf_t *value;
+ svn_string_t *value;
   int i;
   svn_string_t s1;
   svn_string_t s2;
@@ -1006,8 +1003,8 @@
   SVN_ERR (svn_fs_change_node_prop (txn_root, "music.txt", &s1, NULL, pool));
 
   /* Copy a property's value into a new property. */
- SET_STR (&s1, "Best Sound Designer");
- SVN_ERR (svn_fs_node_prop (&value, txn_root, "music.txt", &s1, pool));
+ SVN_ERR (svn_fs_node_prop (&value, txn_root, "music.txt",
+ "Best Sound Designer", pool));
 
   SET_STR (&s1, "Biggest Cakewalk Fanatic");
   s2.data = value->data;
@@ -4029,8 +4026,7 @@
   svn_fs_txn_t *txn;
   svn_fs_root_t *txn_root;
   svn_revnum_t rev;
- svn_string_t propname;
- svn_stringbuf_t *datestamp;
+ svn_string_t *datestamp;
   apr_time_t before_commit, at_commit, after_commit;
 
   *msg = "commit datestamps";
@@ -4054,9 +4050,8 @@
   after_commit = apr_time_now ();
 
   /* Get the datestamp of the commit. */
- propname.data = SVN_PROP_REVISION_DATE;
- propname.len = strlen (SVN_PROP_REVISION_DATE);
- SVN_ERR (svn_fs_revision_prop (&datestamp, fs, rev, &propname, pool));
+ SVN_ERR (svn_fs_revision_prop (&datestamp, fs, rev, SVN_PROP_REVISION_DATE,
+ pool));
 
   if (datestamp == NULL)
     return svn_error_create
Index: ./subversion/libsvn_repos/rev_hunt.c
===================================================================
--- ./subversion/libsvn_repos/.svn/text-base/rev_hunt.c Thu Oct 25 10:58:00 2001
+++ ./subversion/libsvn_repos/rev_hunt.c Thu Oct 25 13:47:20 2001
@@ -48,11 +48,10 @@
           svn_revnum_t rev,
           apr_pool_t *pool)
 {
- svn_stringbuf_t *date_str;
- svn_string_t date_prop = {SVN_PROP_REVISION_DATE,
- strlen(SVN_PROP_REVISION_DATE)};
+ svn_string_t *date_str;
 
- SVN_ERR (svn_fs_revision_prop (&date_str, fs, rev, &date_prop, pool));
+ SVN_ERR (svn_fs_revision_prop (&date_str, fs, rev, SVN_PROP_REVISION_DATE,
+ pool));
   if (! date_str)
     return svn_error_createf
       (SVN_ERR_FS_GENERAL, 0, NULL, pool,
Index: ./subversion/libsvn_delta/xml_output.c
===================================================================
--- ./subversion/libsvn_delta/.svn/text-base/xml_output.c Thu Oct 25 10:57:55 2001
+++ ./subversion/libsvn_delta/xml_output.c Thu Oct 25 14:02:13 2001
@@ -300,7 +300,7 @@
       svn_xml_make_open_tag (&str, pool, svn_xml_protect_pcdata,
                              SVN_DELTA__XML_TAG_SET,
                              SVN_DELTA__XML_ATTR_NAME, name, NULL);
- svn_xml_escape_string (&str, value, pool);
+ svn_xml_escape_stringbuf (&str, value, pool);
       svn_xml_make_close_tag (&str, pool, SVN_DELTA__XML_TAG_SET);
     }
   else
Index: ./subversion/libsvn_ra_dav/commit.c
===================================================================
--- ./subversion/libsvn_ra_dav/.svn/text-base/commit.c Fri Oct 26 08:12:43 2001
+++ ./subversion/libsvn_ra_dav/commit.c Fri Oct 26 08:12:43 2001
@@ -437,7 +437,7 @@
       if (r->prop_changes == NULL)
         r->prop_changes = apr_table_make(pool, 5);
 
- svn_xml_escape_string(&escaped, value, pool);
+ svn_xml_escape_stringbuf(&escaped, value, pool);
       apr_table_set(r->prop_changes, name->data, escaped->data);
     }
   else
@@ -976,9 +976,9 @@
 
   /* XML-Escape the log message. */
   xml_data = NULL; /* Required by svn_xml_escape_string. */
- svn_xml_escape_string (&xml_data,
- svn_stringbuf_create (log_msg->data, cc->ras->pool),
- cc->ras->pool);
+ svn_xml_escape_stringbuf (&xml_data,
+ svn_stringbuf_create (log_msg->data, cc->ras->pool),
+ cc->ras->pool);
   po[0].name = &log_message_prop;
   po[0].type = ne_propset;
   po[0].value = xml_data->data;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:46 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.