pidl:: adjust s4::Python pidl_hdr() to be the same as others
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sat, 30 Nov 2019 03:30:48 +0000 (16:30 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 4 Dec 2019 05:10:31 +0000 (05:10 +0000)
The common case is for pidl_hdr() to add a "\n", which we can
easily do here, allowing this to be merged into the Pidl::Base borg.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index 161521c6e3af40c72267a7d9deb3a65bd904fd11..9ef4c6ca493e7478a2b4ff6b27f6830757d42c4e 100644 (file)
@@ -37,7 +37,7 @@ sub new($) {
 sub pidl_hdr ($$)
 {
        my $self = shift;
-       $self->{res_hdr} .= shift;
+       $self->{res_hdr} .= shift . "\n";
 }
 
 sub pidl($$)
@@ -83,7 +83,7 @@ sub Import
        foreach (@imports) {
                $_ = unmake_str($_);
                s/\.idl$//;
-               $self->pidl_hdr("#include \"librpc/gen_ndr/$_\.h\"\n");
+               $self->pidl_hdr("#include \"librpc/gen_ndr/$_\.h\"");
                $self->register_module_import("samba.dcerpc.$_");
        }
 }
@@ -395,7 +395,7 @@ sub PythonStruct($$$$$$)
                $self->pidl("");
        }
 
-       $self->pidl_hdr("static PyTypeObject $name\_Type;\n");
+       $self->pidl_hdr("static PyTypeObject $name\_Type;");
        $self->pidl("");
        my $docstring = $self->DocString($d, $name);
        my $typeobject = "$name\_Type";
@@ -926,7 +926,7 @@ sub PythonFunctionStruct($$$$)
        $self->pidl("};");
        $self->pidl("");
 
-       $self->pidl_hdr("static PyTypeObject $name\_Type;\n");
+       $self->pidl_hdr("static PyTypeObject $name\_Type;");
        $self->pidl("");
        my $docstring = $self->DocString($fn, $name);
        my $typeobject = "$name\_Type";
@@ -1357,7 +1357,7 @@ sub PythonType($$$$)
                $self->pidl("");
 
                $self->pidl("");
-               $self->pidl_hdr("static PyTypeObject $typeobject;\n");
+               $self->pidl_hdr("static PyTypeObject $typeobject;");
                $self->pidl("static PyTypeObject $typeobject = {");
                $self->indent;
                $self->pidl("PyVarObject_HEAD_INIT(NULL, 0)");
@@ -1412,7 +1412,7 @@ sub Interface($$$)
        }
 
        if (defined $interface->{PROPERTIES}->{uuid}) {
-               $self->pidl_hdr("static PyTypeObject $interface->{NAME}_InterfaceType;\n");
+               $self->pidl_hdr("static PyTypeObject $interface->{NAME}_InterfaceType;");
                $self->pidl("");
 
                my @fns = ();
@@ -1545,7 +1545,7 @@ sub Interface($$$)
                                                     ""]);
        }
 
-       $self->pidl_hdr("\n");
+       $self->pidl_hdr("");
 }
 
 sub register_module_method($$$$$)
@@ -2387,7 +2387,6 @@ static inline long long ndr_sizeof2intmax(size_t var_size)
 
        return 0;
 }
-
 ");
 
        foreach my $x (@$ndr) {
@@ -2439,7 +2438,7 @@ static inline long long ndr_sizeof2intmax(size_t var_size)
        foreach my $h (@{$self->{type_imports}}) {
                my $type_var = "$h->{'key'}\_Type";
                my $module_path = $h->{'val'};
-               $self->pidl_hdr("static PyTypeObject *$type_var;\n");
+               $self->pidl_hdr("static PyTypeObject *$type_var;");
                my $pretty_name = PrettifyTypeName($h->{'key'}, $module_path);
                my $module_var = "dep_$module_path";
                $module_var =~ s/\./_/g;