You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/03/04 12:33:05 UTC
svn commit: r1663940 - in /subversion/trunk/subversion: include/svn_hash.h
libsvn_subr/hash.c
Author: julianfoad
Date: Wed Mar 4 11:33:05 2015
New Revision: 1663940
URL: http://svn.apache.org/r1663940
Log:
Change the way we declare the svn_hash__gets/sets private functions, to
match the way svn_error__locate is defined.
This hides the private function's declaration from code during non-debug
builds to ensure we are not accidentally calling it directly, while still
allowing the declaration to be seen while compiling the definition.
* subversion/include/svn_hash.h
(SVN_HASH__GETS_SETS): New macro, defined when SVN_DEBUG is defined.
(svn_hash__gets,
svn_hash__sets): Declare only when SVN_HASH__GETS_SETS is defined.
(svn_hash_gets,
svn_hash_sets): Use the forwarding-through-a-function version when
SVN_HASH__GETS_SETS is defined, rather than (directly) when SVN_DEBUG is
defined.
* subversion/libsvn_subr/hash.c
Define SVN_HASH__GETS_SETS before including svn_hash.h.
Modified:
subversion/trunk/subversion/include/svn_hash.h
subversion/trunk/subversion/libsvn_subr/hash.c
Modified: subversion/trunk/subversion/include/svn_hash.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_hash.h?rev=1663940&r1=1663939&r2=1663940&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_hash.h (original)
+++ subversion/trunk/subversion/include/svn_hash.h Wed Mar 4 11:33:05 2015
@@ -239,20 +239,23 @@ svn_hash_from_cstring_keys(apr_hash_t **
const apr_array_header_t *keys,
apr_pool_t *pool);
-/* In debug builds, the svn_hash_gets and svn_hash_sets macros forward their
- * parameters through these functions in order to gain type checking for the
- * 'key' parameter which the basic apr_hash_* APIs declare only as 'void *'.
+/* For the Subversion developers, this #define makes the svn_hash_gets and
+ * svn_hash_sets macros forward their parameters through functions in order to
+ * gain type checking for the 'key' parameter which the basic apr_hash_* APIs
+ * declare only as 'void *'.
*/
+#ifdef SVN_DEBUG
+#define SVN_HASH__GETS_SETS
+#endif
+
+#ifdef SVN_HASH__GETS_SETS
void *
svn_hash__gets(apr_hash_t *ht, const char *key);
-void
-svn_hash__sets(apr_hash_t *ht, const char *key, const void *value);
/** Shortcut for apr_hash_get() with a const char * key.
*
* @since New in 1.8.
*/
-#ifdef SVN_DEBUG
#define svn_hash_gets(ht, key) \
svn_hash__gets(ht, key)
#else
@@ -260,11 +263,14 @@ svn_hash__sets(apr_hash_t *ht, const cha
apr_hash_get(ht, key, APR_HASH_KEY_STRING)
#endif
+#ifdef SVN_HASH__GETS_SETS
+void
+svn_hash__sets(apr_hash_t *ht, const char *key, const void *value);
+
/** Shortcut for apr_hash_set() with a const char * key.
*
* @since New in 1.8.
*/
-#ifdef SVN_DEBUG
#define svn_hash_sets(ht, key, val) \
svn_hash__sets(ht, key, val)
#else
Modified: subversion/trunk/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/hash.c?rev=1663940&r1=1663939&r2=1663940&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/hash.c (original)
+++ subversion/trunk/subversion/libsvn_subr/hash.c Wed Mar 4 11:33:05 2015
@@ -31,10 +31,14 @@
#include <apr_hash.h>
#include <apr_file_io.h>
+#ifndef SVN_HASH__GETS_SETS
+#define SVN_HASH__GETS_SETS
+#endif
+#include "svn_hash.h"
+
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
-#include "svn_hash.h"
#include "svn_sorts.h"
#include "svn_io.h"
#include "svn_pools.h"
@@ -45,7 +49,6 @@
#include "svn_private_config.h"
-
/*