← Back to team overview

subvertpy-users team mailing list archive

[PATCH 3 of 4] _ra: fix compilation using GCC 4.0 on Mac OS X

 

# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@xxxxxxxxx>
# Date 1279989838 -7200
# Node ID 14c2e61bc98f1654c242a24f05fa2d5fb68273af
# Parent  cfa0b33468379f54102479cdc636a6eddfe8676c
_ra: fix compilation using GCC 4.0 on Mac OS X.

The get_platform_specific_client_providers() function could reference
get_keychain_simple_provider() before its decleration. This did work
when using Apple GCC 4.0, the default compiler on Mac OS X
10.5. Moving the function to follow the decleration allows the
compilation to succeed.

diff --git a/subvertpy/_ra.c b/subvertpy/_ra.c
--- a/subvertpy/_ra.c
+++ b/subvertpy/_ra.c
@@ -3002,78 +3002,6 @@ static PyObject *get_ssl_client_cert_pw_
 	return (PyObject *)auth;
 }
 
-static PyObject *get_platform_specific_client_providers(PyObject *self)
-{
-#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 6
-	/* svn_auth_get_platform_specific_client_providers() allocates all the
-	 * providers in a single pool, so we can't use it :/ */
-	const char *provider_names[] = {
-		"gnome_keyring", "keychain", "kwallet", "windows", NULL,
-	};
-	const char *provider_types[] = {
-		"simple", "ssl_client_cert_pw", "ssl_server_trust", NULL,
-	};
-	PyObject *pylist = PyList_New(0);
-	int i, j;
-
-	for (i = 0; provider_names[i] != NULL; i++) {
-		for (j = 0; provider_types[j] != NULL; j++) {
-			svn_auth_provider_object_t *c_provider = NULL;
-			apr_pool_t *pool = Pool(NULL);
-
-			if (pool == NULL)
-				continue;
-
-			RUN_SVN(svn_auth_get_platform_specific_provider(&c_provider,
-															provider_names[i],
-															provider_types[j],
-															pool));
-
-			AuthProviderObject *auth = PyObject_New(AuthProviderObject,
-													&AuthProvider_Type);
-
-			if (c_provider == NULL || auth == NULL) {
-				apr_pool_destroy(pool);
-				continue;
-			}
-
-			auth->pool = pool;
-			auth->provider = c_provider;
-
-			PyList_Append(pylist, (PyObject *)auth);
-		}
-	}
-
-	return pylist;
-#else
-	PyObject *pylist = PyList_New(0);
-	PyObject *provider = NULL;
-
-#if defined(WIN32)
-	provider = get_windows_simple_provider(self);
-	if (provider == NULL)
-		return NULL;
-	PyList_Append(pylist, provider);
-
-#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 5
-	provider = get_windows_ssl_server_trust_provider(self);
-	if (provider == NULL)
-		return NULL;
-	PyList_Append(pylist, provider);
-#endif /* 1.5 */
-#endif /* WIN32 */
-
-#if defined(SVN_KEYCHAIN_PROVIDER_AVAILABLE)
-	provider = get_keychain_simple_provider(self);
-	if (provider == NULL)
-		return NULL;
-	PyList_Append(pylist, provider);
-#endif
-
-	return pylist;
-#endif
-}
-
 static PyObject *print_modules(PyObject *self)
 {
 	svn_stringbuf_t *stringbuf;
@@ -3134,6 +3062,78 @@ static PyObject *get_keychain_simple_pro
 }
 #endif
 
+static PyObject *get_platform_specific_client_providers(PyObject *self)
+{
+#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 6
+	/* svn_auth_get_platform_specific_client_providers() allocates all the
+	 * providers in a single pool, so we can't use it :/ */
+	const char *provider_names[] = {
+		"gnome_keyring", "keychain", "kwallet", "windows", NULL,
+	};
+	const char *provider_types[] = {
+		"simple", "ssl_client_cert_pw", "ssl_server_trust", NULL,
+	};
+	PyObject *pylist = PyList_New(0);
+	int i, j;
+
+	for (i = 0; provider_names[i] != NULL; i++) {
+		for (j = 0; provider_types[j] != NULL; j++) {
+			svn_auth_provider_object_t *c_provider = NULL;
+			apr_pool_t *pool = Pool(NULL);
+
+			if (pool == NULL)
+				continue;
+
+			RUN_SVN(svn_auth_get_platform_specific_provider(&c_provider,
+															provider_names[i],
+															provider_types[j],
+															pool));
+
+			AuthProviderObject *auth = PyObject_New(AuthProviderObject,
+													&AuthProvider_Type);
+
+			if (c_provider == NULL || auth == NULL) {
+				apr_pool_destroy(pool);
+				continue;
+			}
+
+			auth->pool = pool;
+			auth->provider = c_provider;
+
+			PyList_Append(pylist, (PyObject *)auth);
+		}
+	}
+
+	return pylist;
+#else
+	PyObject *pylist = PyList_New(0);
+	PyObject *provider = NULL;
+
+#if defined(WIN32)
+	provider = get_windows_simple_provider(self);
+	if (provider == NULL)
+		return NULL;
+	PyList_Append(pylist, provider);
+
+#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 5
+	provider = get_windows_ssl_server_trust_provider(self);
+	if (provider == NULL)
+		return NULL;
+	PyList_Append(pylist, provider);
+#endif /* 1.5 */
+#endif /* WIN32 */
+
+#if defined(SVN_KEYCHAIN_PROVIDER_AVAILABLE)
+	provider = get_keychain_simple_provider(self);
+	if (provider == NULL)
+		return NULL;
+	PyList_Append(pylist, provider);
+#endif
+
+	return pylist;
+#endif
+}
+
 static PyMethodDef ra_module_methods[] = {
 	{ "version", (PyCFunction)version, METH_NOARGS, 
 		"version() -> (major, minor, micro, tag)\n"



References