You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/02/07 23:53:49 UTC

svn commit: r1241682 - /subversion/trunk/subversion/bindings/swig/core.i

Author: stsp
Date: Tue Feb  7 22:53:48 2012
New Revision: 1241682

URL: http://svn.apache.org/viewvc?rev=1241682&view=rev
Log:
The conditional around the declaration of
svn_auth_set_gnome_keyring_unlock_prompt_func (introduced in r1241585)
was not functioning properly, it prevented the bindings from being
generated on all platforms instead of just those without gnome-keyring
support.

This is because the swig preprocessor did not have the needed #defines
available at the point where the function was declared. The reason the
conditional does work for the implementation, is that the implementation
is ignored by swig and included only in the core.c file, and that some
other include (presumably) makes svn_auth.h available.

To fix this, we move the declaration of the function to below the
include of svn_auth.h. While we here, also merge the declaration and
implementation using the swig %inline keyword.

* core.i
  (svn_auth_set_gnome_keyring_unlock_prompt_func): Merge declaration with
    implementation and move both below the include of svn_auth.h.

Patch by: Matthijs Kooijman <ma...@stdin.nl>

Modified:
    subversion/trunk/subversion/bindings/swig/core.i

Modified: subversion/trunk/subversion/bindings/swig/core.i
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/core.i?rev=1241682&r1=1241681&r2=1241682&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/core.i (original)
+++ subversion/trunk/subversion/bindings/swig/core.i Tue Feb  7 22:53:48 2012
@@ -698,33 +698,6 @@ svn_swig_pl_set_current_pool (apr_pool_t
 %authprompt_callback_typemap(ssl_server_trust)
 %authprompt_callback_typemap(ssl_client_cert)
 %authprompt_callback_typemap(ssl_client_cert_pw)
-
-%{
-#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC
-/* Helper function to set the gnome-keyring unlock prompt function. This
- * C function accepts an auth baton, a function and a prompt baton, but
- * the below callback_typemap uses both the function and the prompt
- * baton, so the resulting binding has just two arguments: The auth
- * baton and the prompt function.
- * The prompt function should again have two arguments: The keyring name
- * (string) and a pool (except for the ruby version, which doesn't have
- * the pool argument). It should return the entered password (string).
- * This binding generated for this function generates a reference to the
- * prompt function that was passed into this. The caller should store
- * that reference somewhere, to prevent the function from being garbage
- * collected...
- */
-static void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab,
-                                                          svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func,
-                                                          void *prompt_baton) {
-    svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
-                           prompt_func);
-    svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
-                           prompt_baton);
-}
-#endif
-%}
-
 %authprompt_callback_typemap(gnome_keyring_unlock)
 
 /* -----------------------------------------------------------------------
@@ -792,16 +765,6 @@ static void svn_auth_set_gnome_keyring_u
 %include svn_pools_h.swg
 %include svn_version_h.swg
 
-%{
-#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC
-/* This is the function defined above */
-void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab,
-                                                   svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func,
-                                                   void *prompt_baton);
-#endif
-%}
-
-
 /* The constant SVN_PROP_REVISION_ALL_PROPS is a C fragment, not a single
    data value, so the SWIG parser will raise a 305 warning if we don't
    suppress it. */
@@ -819,6 +782,34 @@ void svn_auth_set_gnome_keyring_unlock_p
 %include svn_mergeinfo_h.swg
 %include svn_io_h.swg
 
+
+
+#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC
+%inline %{
+/* Helper function to set the gnome-keyring unlock prompt function. This
+ * C function accepts an auth baton, a function and a prompt baton, but
+ * the below callback_typemap uses both the function and the prompt
+ * baton, so the resulting binding has just two arguments: The auth
+ * baton and the prompt function.
+ * The prompt function should again have two arguments: The keyring name
+ * (string) and a pool (except for the ruby version, which doesn't have
+ * the pool argument). It should return the entered password (string).
+ * This binding generated for this function generates a reference to the
+ * prompt function that was passed into this. The caller should store
+ * that reference somewhere, to prevent the function from being garbage
+ * collected...
+ */
+static void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab,
+                                                          svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func,
+                                                          void *prompt_baton) {
+    svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
+                           prompt_func);
+    svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
+                           prompt_baton);
+}
+%}
+#endif
+
 #if defined(SWIGPERL) || defined(SWIGRUBY)
 %include svn_md5_h.swg
 #endif