2007-07-12 Mike Kestner <mkestner@novell.com>

* generator/StructBase.cs : use typeof to pass type to PtrToStruct
	to avoid an instantiation and method call.  Duh.

svn path=/trunk/gtk-sharp/; revision=81907
This commit is contained in:
Mike Kestner 2007-07-12 21:23:47 +00:00
parent b1bb3f9056
commit ce3db510d7
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,9 @@
2007-07-03 Mike Kestner <mkestner@novell.com>
2007-07-12 Mike Kestner <mkestner@novell.com>
* generator/StructBase.cs : use typeof to pass type to PtrToStruct
to avoid an instantiation and method call. Duh.
2007-07-10 Mike Kestner <mkestner@novell.com>
* generator/ImportSignature.cs : use Parameter.NativeSignature
prop and refactor out some GError handling.

View File

@ -190,12 +190,9 @@ namespace GtkSharp.Generation {
sw.WriteLine();
if (!DisableNew) {
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {");
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {");
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero)");
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t\t{0} self = new {0}();", QualifiedName);
sw.WriteLine ("\t\t\tself = ({0}) Marshal.PtrToStructure (raw, self.GetType ());", QualifiedName);
sw.WriteLine ("\t\t\treturn self;");
sw.WriteLine ("\t\t\treturn ({0}) Marshal.PtrToStructure (raw, typeof ({0}));", QualifiedName);
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}