summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-28 16:25:05 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-28 10:33:01 -0600
commit66fbdaac0b988f7a2681e96213e90174acd96c98 (patch)
treea1cb9c99bee0a2bb78db10bbab090df4845405ed /source4
parentc2d16f46a373d8c3f6ca38cfd982c4cf0858250d (diff)
downloadsamba-66fbdaac0b988f7a2681e96213e90174acd96c98.tar.gz
samba-66fbdaac0b988f7a2681e96213e90174acd96c98.tar.bz2
samba-66fbdaac0b988f7a2681e96213e90174acd96c98.zip
r26620: python: Allow not specifying event contexts, in which case a new context is used.
(This used to be commit 73c0b1c89763ba61451f3d2a602163090780c56f)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/events/events.i8
-rw-r--r--source4/lib/events/events.py8
-rw-r--r--source4/lib/events/events_wrap.c36
3 files changed, 51 insertions, 1 deletions
diff --git a/source4/lib/events/events.i b/source4/lib/events/events.i
index e2f3b788cb..4b4d265e10 100644
--- a/source4/lib/events/events.i
+++ b/source4/lib/events/events.i
@@ -22,8 +22,16 @@
%{
#include "lib/events/events.h"
+typedef struct event_context event_context;
%}
+%talloctype(event_context);
+typedef struct event_context {} event_context;
+
+%typemap(default,noblock=1) struct event_context * {
+ $1 = event_context_init(NULL);
+}
+
struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
%typemap(default,noblock=1) struct event_context * {
diff --git a/source4/lib/events/events.py b/source4/lib/events/events.py
index 1e41e2d7e7..19494c60b3 100644
--- a/source4/lib/events/events.py
+++ b/source4/lib/events/events.py
@@ -57,6 +57,14 @@ def _swig_setattr_nondynamic_method(set):
return set_attr
+class event_context(object):
+ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
+ def __init__(self): raise AttributeError, "No constructor defined"
+ __repr__ = _swig_repr
+ __swig_destroy__ = _events.delete_event_context
+event_context_swigregister = _events.event_context_swigregister
+event_context_swigregister(event_context)
+
event_context_init = _events.event_context_init
event_context_init_byname = _events.event_context_init_byname
event_backend_list = _events.event_backend_list
diff --git a/source4/lib/events/events_wrap.c b/source4/lib/events/events_wrap.c
index c3eef44882..4a0685971e 100644
--- a/source4/lib/events/events_wrap.c
+++ b/source4/lib/events/events_wrap.c
@@ -2502,7 +2502,9 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0};
#include "lib/events/events.h"
+typedef struct event_context event_context;
+SWIGINTERN void delete_event_context(event_context *self){ talloc_free(self); }
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
@@ -2574,6 +2576,36 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
#ifdef __cplusplus
extern "C" {
#endif
+SWIGINTERN PyObject *_wrap_delete_event_context(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ event_context *arg1 = (event_context *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject *swig_obj[1] ;
+
+ if (!args) SWIG_fail;
+ swig_obj[0] = args;
+ res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_event_context, SWIG_POINTER_DISOWN | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_event_context" "', argument " "1"" of type '" "event_context *""'");
+ }
+ arg1 = (event_context *)(argp1);
+ delete_event_context(arg1);
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *event_context_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *obj;
+ if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_event_context, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+}
+
SWIGINTERN PyObject *_wrap_event_context_init(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
@@ -2635,6 +2667,8 @@ fail:
static PyMethodDef SwigMethods[] = {
+ { (char *)"delete_event_context", (PyCFunction)_wrap_delete_event_context, METH_O, NULL},
+ { (char *)"event_context_swigregister", event_context_swigregister, METH_VARARGS, NULL},
{ (char *)"event_context_init", (PyCFunction)_wrap_event_context_init, METH_NOARGS, NULL},
{ (char *)"event_context_init_byname", (PyCFunction) _wrap_event_context_init_byname, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"event_backend_list", (PyCFunction)_wrap_event_backend_list, METH_NOARGS, NULL},
@@ -2646,7 +2680,7 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event_context *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {