[SCM] Samba Shared Repository - branch master updated - 998d58819201954a78eb123d6f9d2bc0c6bd579c

Jelmer Vernooij jelmer at samba.org
Tue Dec 23 02:26:20 GMT 2008


The branch, master has been updated
       via  998d58819201954a78eb123d6f9d2bc0c6bd579c (commit)
      from  619f32018389ed0b04ae35683352c3b69832d5d7 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 998d58819201954a78eb123d6f9d2bc0c6bd579c
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Dec 23 03:24:39 2008 +0100

    python/tevent: Remove use of pytalloc.h.

-----------------------------------------------------------------------

Summary of changes:
 lib/tevent/pytevent.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 4f18c87..54f6799 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -19,9 +19,13 @@
 #include <Python.h>
 #include <tevent.h>
 #include <stdbool.h>
-#include <../talloc/pytalloc.h>
 #include <tevent_util.h>
 
+typedef struct {
+	PyObject_HEAD
+	struct event_context *ev_ctx;
+} PyEventContextObject;
+
 PyAPI_DATA(PyTypeObject) PyEventContext;
 
 static PyObject *py_set_default_backend(PyObject *self, PyObject *args)
@@ -62,6 +66,7 @@ static PyObject *py_event_ctx_new(PyTypeObject *type, PyObject *args, PyObject *
     const char *kwnames[] = { "name", NULL };
     char *name = NULL;
     struct event_context *ev_ctx;
+    PyEventContextObject *ret;
     if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", (char **)kwnames, &name))
         return NULL;
 
@@ -70,17 +75,19 @@ static PyObject *py_event_ctx_new(PyTypeObject *type, PyObject *args, PyObject *
     else
         ev_ctx = event_context_init_byname(NULL, name);
 
-    return py_talloc_import(&PyEventContext, ev_ctx);
+    ret = (PyEventContextObject *)type->tp_alloc(type, 0);
+    ret->ev_ctx = ev_ctx;
+    return (PyObject *)ret;
 }
 
-static PyObject *py_event_ctx_loop_once(py_talloc_Object *self)
+static PyObject *py_event_ctx_loop_once(PyEventContextObject *self)
 {
-    return PyInt_FromLong(event_loop_once(self->ptr));
+    return PyInt_FromLong(event_loop_once(self->ev_ctx));
 }
 
-static PyObject *py_event_ctx_loop_wait(py_talloc_Object *self)
+static PyObject *py_event_ctx_loop_wait(PyEventContextObject *self)
 {
-    return PyInt_FromLong(event_loop_wait(self->ptr));
+    return PyInt_FromLong(event_loop_wait(self->ev_ctx));
 }
 
 static PyMethodDef py_event_ctx_methods[] = {
@@ -91,11 +98,17 @@ static PyMethodDef py_event_ctx_methods[] = {
     { NULL }
 };
 
+static void py_event_ctx_dealloc(PyEventContextObject * self)
+{
+	talloc_free(self->ev_ctx);
+	self->ob_type->tp_free(self);
+}
+
 PyTypeObject PyEventContext = {
     .tp_name = "EventContext",
     .tp_methods = py_event_ctx_methods,
-    .tp_basicsize = sizeof(py_talloc_Object),
-    .tp_dealloc = py_talloc_dealloc,
+    .tp_basicsize = sizeof(PyEventContextObject),
+    .tp_dealloc = (destructor)py_event_ctx_dealloc,
     .tp_flags = Py_TPFLAGS_DEFAULT,
     .tp_new = py_event_ctx_new,
 };


-- 
Samba Shared Repository


More information about the samba-cvs mailing list