Rev 1075: Hide more symbols. in file:///data/jelmer/bzr-svn/cext/

Jelmer Vernooij jelmer at samba.org
Wed Jun 4 21:55:19 BST 2008


At file:///data/jelmer/bzr-svn/cext/

------------------------------------------------------------
revno: 1075
revision-id: jelmer at samba.org-20080604205519-t9a8098tq8g2cvwk
parent: jelmer at samba.org-20080604194638-00j62ks3frpi8tjz
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: cext
timestamp: Wed 2008-06-04 22:55:19 +0200
message:
  Hide more symbols.
modified:
  client.c                       client.pyx-20080313235339-wbyjbw2namuiql8f-1
  editor.c                       editor.c-20080602191336-frj7az1sdk13o1tw-1
  editor.h                       editor.h-20080602191336-frj7az1sdk13o1tw-2
  ra.c                           ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
  util.c                         util.c-20080531154025-s8ef6ej9tytsnkkw-1
  util.h                         util.h-20080531154025-s8ef6ej9tytsnkkw-2
  wc.c                           wc.pyx-20080313142018-10l8l23vha2j9e6b-1
=== modified file 'client.c'
--- a/client.c	2008-06-03 08:13:55 +0000
+++ b/client.c	2008-06-04 20:55:19 +0000
@@ -99,6 +99,7 @@
 		return py_svn_error();
 
     ret = PyObject_CallFunction(baton, "O", py_commit_items);
+	Py_DECREF(py_commit_items);
 	if (ret == NULL)
 		return py_svn_error();
     if (PyTuple_Check(ret)) {
@@ -114,6 +115,7 @@
     if (py_tmp_file != Py_None) {
         *tmp_file = PyString_AsString(py_tmp_file);
     }
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -568,7 +570,6 @@
     .tp_methods = client_methods,
     .tp_dealloc = client_dealloc,
     .tp_new = client_new,
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 	.tp_getset = client_getset
 };
 

=== modified file 'editor.c'
--- a/editor.c	2008-06-03 11:15:10 +0000
+++ b/editor.c	2008-06-04 20:55:19 +0000
@@ -48,6 +48,7 @@
 {
 	EditorObject *editor = (EditorObject *)self;
 	apr_pool_destroy(editor->pool);
+	PyObject_Del(self);
 }
 
 
@@ -112,7 +113,7 @@
 	PyObject_HEAD_INIT(&PyType_Type) 0,
 	.tp_name = "ra.FileEditor",
 	.tp_methods = py_file_editor_methods,
-	.tp_dealloc = py_editor_dealloc,
+	.tp_dealloc = PyObject_Del,
 };
 
 static PyObject *py_dir_editor_delete_entry(PyObject *self, PyObject *args)
@@ -277,7 +278,7 @@
 	PyObject_HEAD_INIT(&PyType_Type) 0,
 	.tp_name = "ra.DirEditor",
 	.tp_methods = py_dir_editor_methods,
-	.tp_dealloc = py_editor_dealloc,
+	.tp_dealloc = PyObject_Del,
 };
 
 static PyObject *py_editor_set_target_revision(PyObject *self, PyObject *args)

=== modified file 'editor.h'
--- a/editor.h	2008-06-03 05:32:05 +0000
+++ b/editor.h	2008-06-04 20:55:19 +0000
@@ -20,6 +20,8 @@
 #ifndef _BZR_SVN_EDITOR_H_
 #define _BZR_SVN_EDITOR_H_
 
+#pragma GCC visibility push(hidden)
+
 PyAPI_DATA(PyTypeObject) DirectoryEditor_Type;
 PyAPI_DATA(PyTypeObject) FileEditor_Type;
 PyAPI_DATA(PyTypeObject) Editor_Type;
@@ -32,4 +34,6 @@
 	void *txdelta_baton;
 } TxDeltaWindowHandlerObject;
 
+#pragma GCC visibility pop
+
 #endif /* _BZR_SVN_EDITOR_H_ */

=== modified file 'ra.c'
--- a/ra.c	2008-06-04 15:55:45 +0000
+++ b/ra.c	2008-06-04 20:55:19 +0000
@@ -42,7 +42,7 @@
     PyObject *providers;
 } AuthObject;
 
-svn_error_t *py_commit_callback(const svn_commit_info_t *commit_info, void *baton, apr_pool_t *pool)
+static svn_error_t *py_commit_callback(const svn_commit_info_t *commit_info, void *baton, apr_pool_t *pool)
 {
 	PyObject *fn = (PyObject *)baton, *ret;
 
@@ -51,37 +51,44 @@
 								commit_info->author);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
 	return NULL;
 }
 
-PyObject *pyify_lock(const svn_lock_t *lock)
+static PyObject *pyify_lock(const svn_lock_t *lock)
 {
     Py_RETURN_NONE; /* FIXME */
 }
 
-svn_error_t *py_lock_func (void *baton, const char *path, int do_lock, 
+static svn_error_t *py_lock_func (void *baton, const char *path, int do_lock, 
                            const svn_lock_t *lock, svn_error_t *ra_err, 
                            apr_pool_t *pool)
 {
-    PyObject *py_ra_err = Py_None, *ret;
+    PyObject *py_ra_err = Py_None, *ret, *py_lock;
     if (ra_err != NULL) {
         py_ra_err = PyErr_NewSubversionException(ra_err);
 	}
+	py_lock = pyify_lock(lock);
     ret = PyObject_CallFunction((PyObject *)baton, "zbOO", path, do_lock, 
-						  pyify_lock(lock), py_ra_err);
+						  py_lock, py_ra_err);
+	Py_DECREF(py_lock);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
 	return NULL;
 }
 
-void py_progress_func(apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool)
+static void py_progress_func(apr_off_t progress, apr_off_t total, void *baton, apr_pool_t *pool)
 {
-    PyObject *fn = (PyObject *)baton;
+    PyObject *fn = (PyObject *)baton, *ret;
     if (fn == Py_None) {
         return;
 	}
-	PyObject_CallFunction(fn, "ll", progress, total);
+	ret = PyObject_CallFunction(fn, "ll", progress, total);
 	/* TODO: What to do with exceptions raised here ? */
+	if (ret == NULL)
+		return;
+	Py_DECREF(ret);
 }
 
 #define RA_UNBUSY(pool, ra) ra->busy = false;
@@ -194,7 +201,6 @@
 	.tp_name = "ra.Reporter",
 	.tp_methods = reporter_methods,
 	.tp_dealloc = reporter_dealloc,
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 };
 
 /**
@@ -202,7 +208,7 @@
  *
  * :return: tuple with major, minor, patch version number and tag.
  */
-PyObject *version(PyObject *self)
+static PyObject *version(PyObject *self)
 {
     const svn_version_t *ver = svn_ra_version();
     return Py_BuildValue("(iiis)", ver->major, ver->minor, 
@@ -216,6 +222,7 @@
 	ret = PyObject_CallMethod(self, "set_target_revision", "l", target_revision);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -226,7 +233,6 @@
     ret = PyObject_CallMethod(self, "open_root", "l", base_revision);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *root_baton = (void *)ret;
     return NULL;
 }
@@ -237,6 +243,7 @@
 	ret = PyObject_CallMethod(self, "delete_entry", "sl", path, revision);
 	if (ret == NULL)
 		return py_svn_error();
+    Py_DECREF(ret);
     return NULL;
 }
 
@@ -251,19 +258,17 @@
 	}
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *child_baton = (void *)ret;
     return NULL;
 }
 
-svn_error_t *py_cb_editor_open_directory(const char *path, void *parent_baton, long base_revision, apr_pool_t *pool, void **child_baton)
+static svn_error_t *py_cb_editor_open_directory(const char *path, void *parent_baton, long base_revision, apr_pool_t *pool, void **child_baton)
 {
     PyObject *self = (PyObject *)parent_baton, *ret;
     *child_baton = NULL;
     ret = PyObject_CallMethod(self, "open_directory", "sl", path, base_revision);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *child_baton = (void *)ret;
     return NULL;
 }
@@ -274,6 +279,7 @@
 	ret = PyObject_CallMethod(self, "change_prop", "sz#", name, value->data, value->len);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -281,9 +287,10 @@
 {
     PyObject *self = (PyObject *)dir_baton, *ret;
     ret = PyObject_CallMethod(self, "close", "");
+    Py_DECREF(self);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_DECREF(self);
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -293,6 +300,7 @@
 	ret = PyObject_CallMethod(self, "absent_directory", "s", path);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -307,7 +315,6 @@
 	}
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *file_baton = (void *)ret;
     return NULL;
 }
@@ -318,7 +325,6 @@
     ret = PyObject_CallMethod(self, "open_file", "sl", path, base_revision);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *file_baton = (void *)ret;
     return NULL;
 }
@@ -351,8 +357,10 @@
 	py_window = Py_BuildValue("((LIIiOO))", window->sview_offset, window->sview_len, window->tview_len, 
 								window->src_ops, ops, py_new_data);
 	ret = PyObject_CallFunction(fn, "O", py_window);
+	Py_DECREF(py_window);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -363,7 +371,6 @@
 	ret = PyObject_CallMethod(self, "apply_textdelta", "z", base_checksum);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_INCREF(ret);
     *handler_baton = (void *)ret;
     *handler = py_txdelta_window_handler;
     return NULL;
@@ -376,6 +383,7 @@
 							  value->data, value->len);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -388,9 +396,10 @@
 	} else {
 		ret = PyObject_CallMethod(self, "close", "s", text_checksum);
 	}
+    Py_DECREF(self);
 	if (ret == NULL)
 		return py_svn_error();
-    Py_DECREF(self);
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -400,6 +409,7 @@
 	ret = PyObject_CallMethod(self, "absent_file", "s", path);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -407,8 +417,10 @@
 {
     PyObject *self = (PyObject *)edit_baton, *ret;
 	ret = PyObject_CallMethod(self, "close", "");
+	Py_DECREF(self);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -416,12 +428,14 @@
 {
     PyObject *self = (PyObject *)edit_baton, *ret;
 	ret = PyObject_CallMethod(self, "abort", "");
+	Py_DECREF(self);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
-svn_delta_editor_t py_editor = {
+static const svn_delta_editor_t py_editor = {
 	.set_target_revision = py_cb_editor_set_target_revision,
 	.open_root = py_cb_editor_open_root,
 	.delete_entry = py_cb_editor_delete_entry,
@@ -442,14 +456,18 @@
 
 static svn_error_t *py_file_rev_handler(void *baton, const char *path, svn_revnum_t rev, apr_hash_t *rev_props, svn_txdelta_window_handler_t *delta_handler, void **delta_baton, apr_array_header_t *prop_diffs, apr_pool_t *pool)
 {
-    PyObject *fn = (PyObject *)baton, *ret;
+    PyObject *fn = (PyObject *)baton, *ret, *py_rev_props;
 
+	py_rev_props = prop_hash_to_dict(rev_props);
+	if (py_rev_props == NULL)
+		return py_svn_error();
 
 	/* FIXME: delta handler */
-	ret = PyObject_CallFunction(fn, "slO", path, rev, 
-								prop_hash_to_dict(rev_props));
+	ret = PyObject_CallFunction(fn, "slO", path, rev, py_rev_props);
+	Py_DECREF(py_rev_props);
 	if (ret == NULL)
 		return py_svn_error();
+	Py_DECREF(ret);
     return NULL;
 }
 
@@ -533,14 +551,16 @@
 	config_hash = apr_hash_make(ret->pool);
 	if (PyDict_Check(config)) {
 		while (PyDict_Next(config, &idx, &key, &value)) {
-			apr_hash_set(config_hash, PyString_AsString(key), 
-						 PyString_Size(key), PyString_AsString(value));
+			apr_hash_set(config_hash, apr_pstrdup(ret->pool, PyString_AsString(key)), 
+						 PyString_Size(key), apr_pstrdup(ret->pool, PyString_AsString(value)));
 		}
 	} else if (config != Py_None) {
 		PyErr_SetString(PyExc_TypeError, "Expected dictionary for config");
+		apr_pool_destroy(ret->pool);
+		PyObject_Del(ret);
 		return NULL;
 	}
-	if (!check_error(svn_ra_open2(&ret->ra, url, 
+	if (!check_error(svn_ra_open2(&ret->ra, apr_pstrdup(ret->pool, url), 
 								  callbacks2, ret, config_hash, ret->pool))) {
 		apr_pool_destroy(ret->pool);
 		PyObject_Del(ret);
@@ -1257,7 +1277,6 @@
 	.tp_repr = ra_repr,
 	.tp_methods = ra_methods,
 	.tp_members = ra_members,
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 };
 
 typedef struct { 
@@ -1278,7 +1297,6 @@
 	.tp_name = "ra.AuthProvider",
 	.tp_basicsize = sizeof(AuthProviderObject),
 	.tp_dealloc = auth_provider_dealloc,
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 };
 
 static PyObject *auth_init(PyTypeObject *type, PyObject *args, PyObject *kwargs)

=== modified file 'util.c'
--- a/util.c	2008-06-04 15:55:45 +0000
+++ b/util.c	2008-06-04 20:55:19 +0000
@@ -227,14 +227,6 @@
 	return NULL;
 }
 
-svn_stream_t *string_stream(apr_pool_t *pool, PyObject *text)
-{
-    svn_stringbuf_t *buf;
-    buf = svn_stringbuf_ncreate(PyString_AsString(text), 
-								PyString_Size(text), pool);
-    return svn_stream_from_stringbuf(buf, pool);
-}
-
 svn_stream_t *new_py_stream(apr_pool_t *pool, PyObject *py)
 {
     svn_stream_t *stream;

=== modified file 'util.h'
--- a/util.h	2008-06-03 05:32:05 +0000
+++ b/util.h	2008-06-04 20:55:19 +0000
@@ -20,6 +20,8 @@
 #ifndef _BZR_SVN_UTIL_H_
 #define _BZR_SVN_UTIL_H_
 
+#pragma GCC visibility push(hidden)
+
 __attribute__((warn_unused_result)) apr_pool_t *Pool(void);
 __attribute__((warn_unused_result)) bool check_error(svn_error_t *error);
 bool string_list_to_apr_array(apr_pool_t *pool, PyObject *l, apr_array_header_t **);
@@ -43,5 +45,6 @@
 PyObject *PyErr_NewSubversionException(svn_error_t *error);
 svn_error_t *py_cancel_func(void *cancel_baton);
 
+#pragma GCC visibility pop
 
 #endif /* _BZR_SVN_UTIL_H_ */

=== modified file 'wc.c'
--- a/wc.c	2008-06-03 08:13:55 +0000
+++ b/wc.c	2008-06-04 20:55:19 +0000
@@ -85,7 +85,7 @@
     return NULL;
 }
 
-svn_ra_reporter2_t py_ra_reporter = {
+static const svn_ra_reporter2_t py_ra_reporter = {
 	.finish_report = py_ra_report_finish,
 	.abort_report = py_ra_report_abort,
 	.link_path = py_ra_report_link_path,
@@ -152,7 +152,6 @@
 	PyObject_HEAD_INIT(&PyType_Type) 0,
 	.tp_name = "wc.Entry",
 	.tp_basicsize = sizeof(EntryObject),
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 	.tp_dealloc = entry_dealloc,
 	.tp_members = entry_members,
 };
@@ -551,7 +550,6 @@
 	.tp_name = "wc.WorkingCopy",
 	.tp_basicsize = sizeof(AdmObject),
 	.tp_new = adm_init,
-	.tp_flags = Py_TPFLAGS_HAVE_GC,
 	.tp_dealloc = adm_dealloc,
 	.tp_methods = adm_methods,
 };




More information about the bazaar-commits mailing list