Author: julianfoad
Date: Fri Nov 23 15:18:48 2012
New Revision: 1412911

URL: http://svn.apache.org/viewvc?rev=1412911&view=rev
Log:
Do not use non-constant initializers in struct variables, since this
violates our C'89 coding standard.  Although most compilers used for
Subversion support non-constant initializers, some do not, such as Solaris
SunPRO.  Note that GCC requires the '-pedantic' option to report this.

A previous commit of this kind was r1352068.

* subversion/libsvn_fs_fs/fs_fs.c
  (get_cached_node_revision_body, set_cached_node_revision_body,
   parse_revprop, get_revision_proplist, read_representation,
   svn_fs_fs__try_process_file_contents, svn_fs_fs__get_proplist):
    Initialize the structure fields using assignment statements.

* subversion/libsvn_repos/reporter.c
  (delta_files): Same.

* tools/client-side/svn-bench/null-log-cmd.c
  (svn_cl__null_log): Same.

* tools/server-side/fsfs-reorg.c
  (update_text): Same.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_repos/reporter.c
    subversion/trunk/tools/client-side/svn-bench/null-log-cmd.c
    subversion/trunk/tools/server-side/fsfs-reorg.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1412911&r1=1412910&r2=1412911&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Fri Nov 23 15:18:48 2012
@@ -2238,8 +2238,10 @@ get_cached_node_revision_body(node_revis
     }
   else
     {
-      pair_cache_key_t key = { svn_fs_fs__id_rev(id),
-                               svn_fs_fs__id_offset(id) };
+      pair_cache_key_t key;
+
+      key.revision = svn_fs_fs__id_rev(id);
+      key.second = svn_fs_fs__id_offset(id);
       SVN_ERR(svn_cache__get((void **) noderev_p,
                             is_cached,
                             ffd->node_revision_cache,
@@ -2265,8 +2267,10 @@ set_cached_node_revision_body(node_revis
 
   if (ffd->node_revision_cache && !svn_fs_fs__id_txn_id(id))
     {
-      pair_cache_key_t key = { svn_fs_fs__id_rev(id),
-                               svn_fs_fs__id_offset(id) };
+      pair_cache_key_t key;
+
+      key.revision = svn_fs_fs__id_rev(id);
+      key.second = svn_fs_fs__id_offset(id);
       return svn_cache__set(ffd->node_revision_cache,
                             &key,
                             noderev_p,
@@ -3529,9 +3533,11 @@ parse_revprop(apr_hash_t **properties,
   SVN_ERR(svn_hash_read2(*properties, stream, SVN_HASH_TERMINATOR, pool));
   if (has_revprop_cache(fs, pool))
     {
-      pair_cache_key_t key = {revision, generation};
       fs_fs_data_t *ffd = fs->fsap_data;
+      pair_cache_key_t key;
 
+      key.revision = revision;
+      key.second = generation;
       SVN_ERR(svn_cache__set(ffd->revprop_cache, &key, *properties,
                              scratch_pool));
     }
@@ -3831,10 +3837,11 @@ get_revision_proplist(apr_hash_t **propl
   if (has_revprop_cache(fs, pool))
     {
       svn_boolean_t is_cached;
-      pair_cache_key_t key = { rev, 0};
+      pair_cache_key_t key;
 
       SVN_ERR(read_revprop_generation(&generation, fs, pool));
 
+      key.revision = rev;
       key.second = generation;
       SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
                              ffd->revprop_cache, &key, pool));
@@ -5183,10 +5190,12 @@ read_representation(svn_stream_t **conte
   else
     {
       fs_fs_data_t *ffd = fs->fsap_data;
-      pair_cache_key_t fulltext_cache_key = {rep->revision, rep->offset};
+      pair_cache_key_t fulltext_cache_key;
       svn_filesize_t len = rep->expanded_size ? rep->expanded_size : rep->size;
       struct rep_read_baton *rb;
 
+      fulltext_cache_key.revision = rep->revision;
+      fulltext_cache_key.second = rep->offset;
       if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
           && fulltext_size_is_cachable(ffd, len))
         {
@@ -5355,14 +5364,18 @@ svn_fs_fs__try_process_file_contents(svn
   if (rep)
     {
       fs_fs_data_t *ffd = fs->fsap_data;
-      pair_cache_key_t fulltext_cache_key = {rep->revision, rep->offset};
+      pair_cache_key_t fulltext_cache_key;
 
+      fulltext_cache_key.revision = rep->revision;
+      fulltext_cache_key.second = rep->offset;
       if (ffd->fulltext_cache && SVN_IS_VALID_REVNUM(rep->revision)
           && fulltext_size_is_cachable(ffd, rep->expanded_size))
         {
-          cache_access_wrapper_baton_t wrapper_baton = {processor, baton};
+          cache_access_wrapper_baton_t wrapper_baton;
           void *dummy = NULL;
 
+          wrapper_baton.func = processor;
+          wrapper_baton.baton = baton;
           return svn_cache__get_partial(&dummy, success,
                                         ffd->fulltext_cache,
                                         &fulltext_cache_key,
@@ -5658,8 +5671,10 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
     {
       fs_fs_data_t *ffd = fs->fsap_data;
       representation_t *rep = noderev->prop_rep;
-      
-      pair_cache_key_t key = { rep->revision, rep->offset };
+      pair_cache_key_t key;
+
+      key.revision = rep->revision;
+      key.second = rep->offset;
       if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
         {
           svn_boolean_t is_cached;

Modified: subversion/trunk/subversion/libsvn_repos/reporter.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/reporter.c?rev=1412911&r1=1412910&r2=1412911&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/reporter.c (original)
+++ subversion/trunk/subversion/libsvn_repos/reporter.c Fri Nov 23 15:18:48 2012
@@ -717,11 +717,13 @@ delta_files(report_baton_t *b, void *fil
              zero-copy code. */
           if (b->zero_copy_limit > 0 && s_path == NULL)
             {
-              zero_copy_baton_t baton = { b->zero_copy_limit
-                                        , dhandler
-                                        , dbaton
-                                        , FALSE};
+              zero_copy_baton_t baton;
               svn_boolean_t called = FALSE;
+
+              baton.zero_copy_limit = b->zero_copy_limit;
+              baton.dhandler = dhandler;
+              baton.dbaton = dbaton;
+              baton.zero_copy_succeeded = FALSE;
               SVN_ERR(svn_fs_try_process_file_contents(&called,
                                                        b->t_root, t_path,
                                                        send_zero_copy_delta,

Modified: subversion/trunk/tools/client-side/svn-bench/null-log-cmd.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/svn-bench/null-log-cmd.c?rev=1412911&r1=1412910&r2=1412911&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/svn-bench/null-log-cmd.c (original)
+++ subversion/trunk/tools/client-side/svn-bench/null-log-cmd.c Fri Nov 23 
15:18:48 2012
@@ -134,7 +134,7 @@ svn_cl__null_log(apr_getopt_t *os,
   svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
   svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
   apr_array_header_t *targets;
-  struct log_receiver_baton lb = { ctx };
+  struct log_receiver_baton lb;
   const char *target;
   int i;
   apr_array_header_t *revprops;
@@ -194,6 +194,7 @@ svn_cl__null_log(apr_getopt_t *os,
         }
     }
 
+  lb.ctx = ctx;
   lb.quiet = opt_state->quiet;
 
   revprops = apr_array_make(pool, 3, sizeof(char *));

Modified: subversion/trunk/tools/server-side/fsfs-reorg.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/fsfs-reorg.c?rev=1412911&r1=1412910&r2=1412911&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/fsfs-reorg.c (original)
+++ subversion/trunk/tools/server-side/fsfs-reorg.c Fri Nov 23 15:18:48 2012
@@ -2469,8 +2469,7 @@ update_text(svn_stringbuf_t *node_rev,
   if (representation->dir)
     {
       char *newline_pos = strchr(val_pos, '\n');
-      svn_checksum_t checksum = {representation->dir->target_md5,
-                                 svn_checksum_md5};
+      svn_checksum_t checksum;
       const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_SIZE_T_FMT " 
%" 
                                       APR_SIZE_T_FMT" %" APR_SIZE_T_FMT " %s",
                                       representation->revision->revision,
@@ -2480,6 +2479,8 @@ update_text(svn_stringbuf_t *node_rev,
                                       svn_checksum_to_cstring(&checksum,
                                                               scratch_pool));
 
+      checksum.digest = representation->dir->target_md5;
+      checksum.kind = svn_checksum_md5;
       svn_stringbuf_replace(node_rev,
                             val_pos - node_rev->data, newline_pos - val_pos,
                             temp, strlen(temp));


Reply via email to