Author: mkestner
Date: 2007-07-12 17:23:47 -0400 (Thu, 12 Jul 2007)
New Revision: 81907
Modified:
trunk/gtk-sharp/ChangeLog
trunk/gtk-sharp/generator/StructBase.cs
Log:
2007-07-12 Mike Kestner <[EMAIL PROTECTED]>
* generator/StructBase.cs : use typeof to pass type to PtrToStruct
to avoid an instantiation and method call. Duh.
Modified: trunk/gtk-sharp/ChangeLog
===================================================================
--- trunk/gtk-sharp/ChangeLog 2007-07-12 21:14:28 UTC (rev 81906)
+++ trunk/gtk-sharp/ChangeLog 2007-07-12 21:23:47 UTC (rev 81907)
@@ -1,5 +1,10 @@
-2007-07-03 Mike Kestner <[EMAIL PROTECTED]>
+2007-07-12 Mike Kestner <[EMAIL PROTECTED]>
+ * generator/StructBase.cs : use typeof to pass type to PtrToStruct
+ to avoid an instantiation and method call. Duh.
+
+2007-07-10 Mike Kestner <[EMAIL PROTECTED]>
+
* generator/ImportSignature.cs : use Parameter.NativeSignature
prop and refactor out some GError handling.
* generator/MethodBody.cs : Refactor logic into Parameters.
Modified: trunk/gtk-sharp/generator/StructBase.cs
===================================================================
--- trunk/gtk-sharp/generator/StructBase.cs 2007-07-12 21:14:28 UTC (rev
81906)
+++ trunk/gtk-sharp/generator/StructBase.cs 2007-07-12 21:23:47 UTC (rev
81907)
@@ -190,12 +190,9 @@
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 ();
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches