Author: stefan2
Date: Sat May 18 20:51:48 2013
New Revision: 1484181
URL: http://svn.apache.org/r1484181
Log:
Revert the remainder of 1483532 and replace it with a much safer /
simpler solution.
Suggested by: julianfoad
* subversion/include/svn_hash.h
(svn_hash_gets,
svn_hash_sets): calculate key length statically when possible
(svn_hash_gets_fixed_key,
svn_hash_sets_fixed_key): drop
* subversion/libsvn_fs_fs/tree.c
(crawl_directory_dag_for_mergeinfo): switch back to svn_hash_gets /
svn_hash_sets
* subversion/libsvn_ra_svn/client.c
(ra_svn_log): same
* subversion/libsvn_repos/log.c
(fill_log_entry): same
* subversion/libsvn_repos/rev_hunt.c
(svn_repos_get_committed_info): same
* subversion/libsvn_subr/compat.c
(svn_compat_log_revprops_clear, svn_compat_log_revprops_out): same
Modified:
subversion/trunk/subversion/include/svn_hash.h
subversion/trunk/subversion/libsvn_fs_fs/tree.c
subversion/trunk/subversion/libsvn_ra_svn/client.c
subversion/trunk/subversion/libsvn_repos/log.c
subversion/trunk/subversion/libsvn_repos/rev_hunt.c
subversion/trunk/subversion/libsvn_subr/compat.c
Modified: subversion/trunk/subversion/include/svn_hash.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_hash.h?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_hash.h (original)
+++ subversion/trunk/subversion/include/svn_hash.h Sat May 18 20:51:48 2013
@@ -245,30 +245,14 @@ svn_hash_from_cstring_keys(apr_hash_t **
* @since New in 1.8.
*/
#define svn_hash_gets(ht, key) \
- apr_hash_get(ht, key, APR_HASH_KEY_STRING)
+ apr_hash_get(ht, key, strlen(key))
/** Shortcut for apr_hash_set() with a const char * key.
*
* @since New in 1.8.
*/
#define svn_hash_sets(ht, key, val) \
- apr_hash_set(ht, key, APR_HASH_KEY_STRING, val)
-
-/** Shortcut for apr_hash_get() with a fixed-size char[] key.
- * @note Do NOT use this with pointer types like const char*.
- *
- * @since New in 1.9.
- */
-#define svn_hash_gets_fixed_key(ht, key) \
- apr_hash_get(ht, key, sizeof(key)-1)
-
-/** Shortcut for apr_hash_get() with a fixed-size char[] key.
- * @note Do NOT use this with pointer types like const char*.
- *
- * @since New in 1.9.
- */
-#define svn_hash_sets_fixed_key(ht, key, val) \
- apr_hash_set(ht, key, sizeof(key)-1, val)
+ apr_hash_set(ht, key, strlen(key), val)
/** @} */
Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Sat May 18 20:51:48 2013
@@ -3783,8 +3783,7 @@ crawl_directory_dag_for_mergeinfo(svn_fs
svn_error_t *err;
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, kid_dag, iterpool));
- mergeinfo_string = svn_hash_gets_fixed_key(proplist,
- SVN_PROP_MERGEINFO);
+ mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
if (!mergeinfo_string)
{
svn_string_t *idstr = svn_fs_fs__id_unparse(dirent->id,
iterpool);
Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Sat May 18 20:51:48 2013
@@ -1624,14 +1624,14 @@ static svn_error_t *ra_svn_log(svn_ra_se
{
/* Caller requested all revprops; set author/date/log. */
if (author)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_AUTHOR, author);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_AUTHOR, author);
if (date)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_DATE, date);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_DATE, date);
if (message)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_LOG, message);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_LOG, message);
}
else
{
@@ -1640,14 +1640,14 @@ static svn_error_t *ra_svn_log(svn_ra_se
{
name = APR_ARRAY_IDX(revprops, i, char *);
if (author && strcmp(name, SVN_PROP_REVISION_AUTHOR) == 0)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_AUTHOR, author);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_AUTHOR, author);
if (date && strcmp(name, SVN_PROP_REVISION_DATE) == 0)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_DATE, date);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_DATE, date);
if (message && strcmp(name, SVN_PROP_REVISION_LOG) == 0)
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_LOG, message);
+ svn_hash_sets(log_entry->revprops,
+ SVN_PROP_REVISION_LOG, message);
}
}
SVN_ERR(receiver(receiver_baton, log_entry, iterpool));
Modified: subversion/trunk/subversion/libsvn_repos/log.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/log.c (original)
+++ subversion/trunk/subversion/libsvn_repos/log.c Sat May 18 20:51:48 2013
@@ -1084,14 +1084,10 @@ fill_log_entry(svn_log_entry_t *log_entr
{
/* ... but we can only return author/date. */
log_entry->revprops = svn_hash__make(pool);
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_AUTHOR,
- svn_hash_gets_fixed_key(r_props,
- SVN_PROP_REVISION_AUTHOR));
- svn_hash_sets_fixed_key(log_entry->revprops,
- SVN_PROP_REVISION_DATE,
- svn_hash_gets_fixed_key(r_props,
- SVN_PROP_REVISION_DATE));
+ svn_hash_sets(log_entry->revprops, SVN_PROP_REVISION_AUTHOR,
+ svn_hash_gets(r_props, SVN_PROP_REVISION_AUTHOR));
+ svn_hash_sets(log_entry->revprops, SVN_PROP_REVISION_DATE,
+ svn_hash_gets(r_props, SVN_PROP_REVISION_DATE));
}
else
/* ... so return all we got. */
Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/rev_hunt.c?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Sat May 18 20:51:48 2013
@@ -171,8 +171,8 @@ svn_repos_get_committed_info(svn_revnum_
SVN_ERR(svn_fs_revision_proplist(&revprops, fs, *committed_rev, pool));
/* Extract date and author from these revprops. */
- committed_date_s = svn_hash_gets_fixed_key(revprops, SVN_PROP_REVISION_DATE);
- last_author_s = svn_hash_gets_fixed_key(revprops, SVN_PROP_REVISION_AUTHOR);
+ committed_date_s = svn_hash_gets(revprops, SVN_PROP_REVISION_DATE);
+ last_author_s = svn_hash_gets(revprops, SVN_PROP_REVISION_AUTHOR);
*committed_date = committed_date_s ? committed_date_s->data : NULL;
*last_author = last_author_s ? last_author_s->data : NULL;
Modified: subversion/trunk/subversion/libsvn_subr/compat.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/compat.c?rev=1484181&r1=1484180&r2=1484181&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/compat.c (original)
+++ subversion/trunk/subversion/libsvn_subr/compat.c Sat May 18 20:51:48 2013
@@ -76,9 +76,9 @@ svn_compat_log_revprops_clear(apr_hash_t
{
if (revprops)
{
- svn_hash_sets_fixed_key(revprops, SVN_PROP_REVISION_AUTHOR, NULL);
- svn_hash_sets_fixed_key(revprops, SVN_PROP_REVISION_DATE, NULL);
- svn_hash_sets_fixed_key(revprops, SVN_PROP_REVISION_LOG, NULL);
+ svn_hash_sets(revprops, SVN_PROP_REVISION_AUTHOR, NULL);
+ svn_hash_sets(revprops, SVN_PROP_REVISION_DATE, NULL);
+ svn_hash_sets(revprops, SVN_PROP_REVISION_LOG, NULL);
}
}
@@ -103,14 +103,11 @@ svn_compat_log_revprops_out(const char *
*author = *date = *message = NULL;
if (revprops)
{
- if ((author_s = svn_hash_gets_fixed_key(revprops,
- SVN_PROP_REVISION_AUTHOR)))
+ if ((author_s = svn_hash_gets(revprops, SVN_PROP_REVISION_AUTHOR)))
*author = author_s->data;
- if ((date_s = svn_hash_gets_fixed_key(revprops,
- SVN_PROP_REVISION_DATE)))
+ if ((date_s = svn_hash_gets(revprops, SVN_PROP_REVISION_DATE)))
*date = date_s->data;
- if ((message_s = svn_hash_gets_fixed_key(revprops,
- SVN_PROP_REVISION_LOG)))
+ if ((message_s = svn_hash_gets(revprops, SVN_PROP_REVISION_LOG)))
*message = message_s->data;
}
}