use ref instead of unsafe pointer stuff

This commit is contained in:
Doug MacEachern 2004-09-22 17:48:21 +00:00
parent ab39e15dbe
commit 6c7fccda29
2 changed files with 3 additions and 6 deletions

View File

@ -25,7 +25,6 @@
<mkdir dir="${build.dir}"/>
<csc target="library" debug="${debug}"
unsafe="true"
output="${sigarsharp}">
<sources>
<include name="src/Sigar.cs"/>

View File

@ -34,16 +34,14 @@ namespace Hyperic.Sigar {
internal HandleRef sigar;
[DllImport(LIBSIGAR)]
unsafe private static extern int sigar_open(IntPtr *sigar);
private static extern int sigar_open(ref IntPtr sigar);
[DllImport(LIBSIGAR)]
private static extern int sigar_close(IntPtr sigar);
public Sigar() {
IntPtr handle;
unsafe { //&pointers are considered "unsafe"
sigar_open(&handle);
}
IntPtr handle = IntPtr.Zero;
sigar_open(ref handle);
this.sigar = new HandleRef(this, handle);
}