subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1563534 - in /subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs: cached_data.c cached_data.h fs_fs.h temp_serializer.c temp_serializer.h transaction.c util.h
Date Sun, 02 Feb 2014 00:58:12 GMT
Author: brane
Date: Sun Feb  2 00:58:12 2014
New Revision: 1563534

URL: http://svn.apache.org/r1563534
Log:
On the fsfs-ucsnorm branch: Made a few style and documentation tweaks.
No functional changes.

* subversion/libsvn_fs_fs/fs_fs.h (svn_fs_fs__normalize):
   Move prototype from here ...   
* subversion/libsvn_fs_fs/util.h (svn_fs_fs__normalize): ... to here.

* subversion/libsvn_fs_fs/cached_data.h
  (svn_fs_fs__find_dir_entry, svn_fs_fs__rep_contents_dir_entry):
   Rename the 'name' parameter to 'key' and document its semantics.
* subversion/libsvn_fs_fs/cached_data.c
  (sorted): Rename the 'name' parameter to 'key'.
  (compare_dirent_key): Renamed from compare_dirent_name, and rename
   the 'name' parameter to 'key'
  (svn_fs_fs__find_dir_entry): Rename the 'name' parameter to 'key'
   and update the call to compare_dirent_key.
  (svn_fs_fs__rep_contents_dir_entry): Rename the 'name' parameter to 'key';
   to avoid name clashes, rename the 'key' local variable to 'cache_key'.

* subversion/libsvn_fs_fs/temp_serializer.h (replace_baton_t):
   Rename the 'name' field to 'key' and document its semantics.
* subversion/libsvn_fs_fs/temp_serializer.c
  (find_entry): Revert to pre-setting the '*found' output argument to
   avoid starting another flamewar about braces around single-statement
   conditional blocks.
  (svn_fs_fs__replace_dir_entry, slowly_replace_dir_entry):
   Update the references to replace_baton_t::key.
* subversion/libsvn_fs_fs/transaction.c
  (svn_fs_fs__set_entry): Update the references to replace_baton_t::key.
   Remove a couple of empty lines that crept into r1562172.

Modified:
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/fs_fs.h
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.c
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.h
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c
    subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/util.h

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.c Sun Feb  2 00:58:12
2014
@@ -1920,7 +1920,7 @@ svn_fs_fs__get_file_delta_stream(svn_txd
 }
 
 /* Return TRUE when all svn_fs_fs__dirent_t* in ENTRIES are already sorted
-   by their respective name. */
+   by their respective key. */
 static svn_boolean_t
 sorted(apr_array_header_t *entries)
 {
@@ -1946,7 +1946,7 @@ compare_dirents(const void *a, const voi
 
 /* Compare the key of the dirents given in **A with the C string in *B. */
 static int
-compare_dirent_name(const void *a, const void *b)
+compare_dirent_key(const void *a, const void *b)
 {
   const svn_fs_fs__dirent_t *lhs = *((const svn_fs_fs__dirent_t * const *) a);
   const char *rhs = b;
@@ -2198,11 +2198,11 @@ svn_fs_fs__rep_contents_dir(apr_array_he
 
 svn_fs_fs__dirent_t *
 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
-                          const char *name,
+                          const char *key,
                           int *hint)
 {
   svn_fs_fs__dirent_t **result
-    = svn_sort__array_lookup(entries, name, hint, compare_dirent_name);
+    = svn_sort__array_lookup(entries, key, hint, compare_dirent_key);
   return result ? *result : NULL;
 }
 
@@ -2210,7 +2210,7 @@ svn_error_t *
 svn_fs_fs__rep_contents_dir_entry(svn_fs_fs__dirent_t **dirent,
                                   svn_fs_t *fs,
                                   node_revision_t *noderev,
-                                  const char *name,
+                                  const char *key,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool)
 {
@@ -2218,8 +2218,8 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs
 
   /* find the cache we may use */
   pair_cache_key_t pair_key = { 0 };
-  const void *key;
-  svn_cache__t *cache = locate_dir_cache(fs, &key, &pair_key, noderev,
+  const void *cache_key;
+  svn_cache__t *cache = locate_dir_cache(fs, &cache_key, &pair_key, noderev,
                                          scratch_pool);
   if (cache)
     {
@@ -2227,9 +2227,9 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs
       SVN_ERR(svn_cache__get_partial((void **)dirent,
                                      &found,
                                      cache,
-                                     key,
+                                     cache_key,
                                      svn_fs_fs__extract_dir_entry,
-                                     (void*)name,
+                                     (void*)key,
                                      result_pool));
     }
 
@@ -2246,7 +2246,7 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs
                                           scratch_pool, scratch_pool));
 
       /* find desired entry and return a copy in POOL, if found */
-      entry = svn_fs_fs__find_dir_entry(entries, name, NULL);
+      entry = svn_fs_fs__find_dir_entry(entries, key, NULL);
       if (entry)
         {
           svn_fs_dirent_t *dirent_copy;

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/cached_data.h Sun Feb  2 00:58:12
2014
@@ -112,26 +112,32 @@ svn_fs_fs__rep_contents_dir(apr_array_he
                             apr_pool_t *result_pool,
                             apr_pool_t *scratch_pool);
 
-/* Return the directory entry from ENTRIES that matches NAME.  If no such
+/* Return the directory entry from ENTRIES that matches KEY.  If no such
    entry exists, return NULL.  If HINT is not NULL, set *HINT to the array
    index of the entry returned.  Successive calls in a linear scan scenario
-   will be faster called with the same HINT variable. */
-/* UCSNORM TODO: NAME must always be the (normalized) entry key. */
+   will be faster called with the same HINT variable.
+
+   Note: When normalized lookups are enabled, KEY must be the
+         normalized form of the entry name; otherwise, it should be
+         the original form of the entry name. */
 svn_fs_fs__dirent_t *
 svn_fs_fs__find_dir_entry(apr_array_header_t *entries,
-                          const char *name,
+                          const char *key,
                           int *hint);
 
-/* Set *DIRENT to the entry identified by NAME in the directory given
+/* Set *DIRENT to the entry identified by KEY in the directory given
    by NODEREV in filesystem FS.  If no such entry exits, *DIRENT will
    be NULL. The returned object is allocated in RESULT_POOL; SCRATCH_POOL
-   used for temporary allocations. */
-/* UCSNORM TODO: NAME must always be the (normalized) entry key. */
+   used for temporary allocations.
+
+   Note: When normalized lookups are enabled, KEY must be the
+         normalized form of the entry name; otherwise, it should be
+         the original form of the entry name. */
 svn_error_t *
 svn_fs_fs__rep_contents_dir_entry(svn_fs_fs__dirent_t **dirent,
                                   svn_fs_t *fs,
                                   node_revision_t *noderev,
-                                  const char *name,
+                                  const char *key,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/fs_fs.h?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/fs_fs.h Sun Feb  2 00:58:12 2014
@@ -212,8 +212,4 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
 void
 svn_fs_fs__reset_txn_caches(svn_fs_t *fs);
 
-/* Set *NORMSTR to a normalized form of STR, allocated from POOL. */
-svn_error_t *
-svn_fs_fs__normalize(const char **normstr, const char *str, apr_pool_t *pool);
-
 #endif /* SVN_LIBSVN_FS__FS_FS_H */

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.c?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.c Sun Feb  2
00:58:12 2014
@@ -802,9 +802,8 @@ find_entry(svn_fs_fs__dirent_t **entries
     }
 
   /* check whether we actually found a match */
-  if (lower >= count)
-    *found = FALSE;
-  else
+  *found = FALSE;
+  if (lower < count)
     {
       const svn_fs_fs__dirent_t *entry =
         svn_temp_deserializer__ptr(entries, (const void *const *)&entries[lower]);
@@ -901,7 +900,7 @@ slowly_replace_dir_entry(void **data,
                                              dir_data->len,
                                              pool));
 
-  entry = svn_fs_fs__find_dir_entry(dir, replace_baton->name, &idx);
+  entry = svn_fs_fs__find_dir_entry(dir, replace_baton->key, &idx);
 
   /* Replacement or removal? */
   if (replace_baton->new_entry)
@@ -955,7 +954,7 @@ svn_fs_fs__replace_dir_entry(void **data
                                (const void *const *)&dir_data->lengths);
 
   /* binary search for the desired entry by name */
-  pos = find_entry(entries, replace_baton->name, dir_data->count, &found);
+  pos = find_entry(entries, replace_baton->key, dir_data->count, &found);
 
   /* handle entry removal (if found at all) */
   if (replace_baton->new_entry == NULL)

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.h?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/temp_serializer.h Sun Feb  2
00:58:12 2014
@@ -209,9 +209,12 @@ svn_fs_fs__extract_dir_entry(void **out,
  */
 typedef struct replace_baton_t
 {
-  /** Name of the directory entry to modify.
-      When normalized lookup is enabled, this name must be normalized. */
-  const char *name;
+  /** The key of the directory entry to modify.
+
+   Note: When normalized lookups are enabled, this must be the
+         normalized form of the entry name; otherwise, it should be
+         the original form of the entry name. */
+  const char *key;
 
   /** directory entry to insert instead */
   svn_fs_fs__dirent_t *new_entry;

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/transaction.c Sun Feb  2 00:58:12
2014
@@ -1533,8 +1533,6 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
         svn_fs_fs__id_unparse(parent_noderev->id, subpool)->data;
       replace_baton_t baton;
 
-
-
       if (id)
         {
           baton.new_entry = apr_pcalloc(subpool, sizeof(*baton.new_entry));
@@ -1544,14 +1542,14 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
           SVN_ERR(svn_fs_fs__set_dirent_key(baton.new_entry,
                                             normalized_lookup,
                                             subpool, subpool));
-          baton.name = baton.new_entry->key;
+          baton.key = baton.new_entry->key;
         }
       else
         {
           if (normalized_lookup)
-            SVN_ERR(svn_fs_fs__normalize(&baton.name, name, subpool));
+            SVN_ERR(svn_fs_fs__normalize(&baton.key, name, subpool));
           else
-            baton.name = name;
+            baton.key = name;
           baton.new_entry = NULL;
         }
 

Modified: subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/util.h?rev=1563534&r1=1563533&r2=1563534&view=diff
==============================================================================
--- subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/fsfs-ucsnorm/subversion/libsvn_fs_fs/util.h Sun Feb  2 00:58:12 2014
@@ -389,4 +389,8 @@ svn_fs_fs__use_log_addressing(svn_fs_t *
 svn_boolean_t
 svn_fs_fs__supports_move(svn_fs_t *fs);
 
+/* Set *NORMSTR to a normalized form of STR, allocated from POOL. */
+svn_error_t *
+svn_fs_fs__normalize(const char **normstr, const char *str, apr_pool_t *pool);
+
 #endif



Mime
View raw message