pidl: Factor out generation of interface type name.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 2 Sep 2010 22:35:29 +0000 (00:35 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 2 Sep 2010 22:35:29 +0000 (00:35 +0200)
pidl/lib/Parse/Pidl/Samba4/Python.pm

index e9956d32d97eeb0d890591ecff7c29ef9487b52b..64ddf4a925e27b3ae56f8d4639d71e92f2a7b1f7 100644 (file)
@@ -712,12 +712,13 @@ sub Interface($$$)
                        $docstring = $signature;
                }
 
-               $self->pidl("static PyTypeObject $interface->{NAME}_InterfaceType = {");
+               my $if_typename = "$interface->{NAME}_InterfaceType";
+
+               $self->pidl("static PyTypeObject $if_typename = {");
                $self->indent;
                $self->pidl("PyObject_HEAD_INIT(NULL) 0,");
                $self->pidl(".tp_name = \"$basename.$interface->{NAME}\",");
                $self->pidl(".tp_basicsize = sizeof(dcerpc_InterfaceObject),");
-               $self->pidl(".tp_base = &dcerpc_InterfaceType,");
                $self->pidl(".tp_doc = $docstring,");
                $self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,");
                $self->pidl(".tp_new = interface_$interface->{NAME}_new,");
@@ -726,8 +727,8 @@ sub Interface($$$)
 
                $self->pidl("");
 
-               $self->register_module_typeobject($interface->{NAME}, "&$interface->{NAME}_InterfaceType");
-               $self->register_module_readycode(["if (!PyInterface_AddNdrRpcMethods(&$interface->{NAME}_InterfaceType, py_ndr_$interface->{NAME}\_methods))", "\treturn;", ""]);
+               $self->register_module_typeobject($interface->{NAME}, "&$if_typename");
+               $self->register_module_readycode(["if (!PyInterface_AddNdrRpcMethods(&$if_typename, py_ndr_$interface->{NAME}\_methods))", "\treturn;", ""]);
        }
 
        $self->pidl_hdr("\n");