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

Re: svn commit: r1663450 - /subversion/trunk/subversion/libsvn_ra_svn/editorp.c

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 3 Mar 2015 11:17:15 +0000

>>> URL: http://svn.apache.org/r1663450

>>> Log:
>>> Following up on r1658194, fix removing tokens from the tokens cache.
>>> Just passing the token to svn_hash_sets() didn't work any more.

Thinking about how to prevent a repeat of the same kind of error, defining svn_hash_sets and svn_hash_gets as functions with prototypes would result in at least a compiler warning (for typical configurations).

One way of doing this is:

Index: subversion/include/svn_hash.h
===================================================================
--- subversion/include/svn_hash.h    (revision 1663350)
+++ subversion/include/svn_hash.h    (working copy)
@@ -246,2 +246,5 @@
-#define svn_hash_gets(ht, key) \
-            apr_hash_get(ht, key, APR_HASH_KEY_STRING)
+static APR_INLINE void *
+svn_hash_gets(apr_hash_t *ht, const char *key)
+{
+  return apr_hash_get(ht, key, APR_HASH_KEY_STRING);
+}
@@ -253,2 +256,5 @@
-#define svn_hash_sets(ht, key, val) \
-            apr_hash_set(ht, key, APR_HASH_KEY_STRING, val)
+static APR_INLINE void
+svn_hash_sets(apr_hash_t *ht, const char *key, const void *val)
+{
+  apr_hash_set(ht, key, APR_HASH_KEY_STRING, val);
+}

That particular way would likely trigger 'defined but not used' warnings on some source files, with compilers where APR_INLINE is not effective.

Thoughts?

- Julian
Received on 2015-03-03 12:18:08 CET

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.