Bug 872577 - Using default resolution for free() instead of libc. r=nfroyd

--HG--
extra : rebase_source : 70884bd2b27ebf7c9ec2273e495808a655283c49
This commit is contained in:
David Rajchenbach-Teller 2013-08-13 16:04:40 +02:00
parent 2d3fb3fa56
commit ed9c8a89a4

View File

@ -228,10 +228,25 @@
return fd.dispose();
};
UnixFile.free =
libc.declare("free", ctypes.default_abi,
/*return*/ ctypes.void_t,
/*ptr*/ ctypes.voidptr_t);
{
// Symbol free() is special.
// We override the definition of free() on several platforms.
let default_lib = null;
try {
// On platforms for which we override free(), nspr defines
// a special library name "a.out" that will resolve to the
// correct implementation free().
default_lib = ctypes.open("a.out");
} catch (ex) {
// On other platforms, well, use the regular version of free.
default_lib = libc;
}
UnixFile.free =
default_lib.declare("free", ctypes.default_abi,
/*return*/ ctypes.void_t,
/*ptr*/ ctypes.voidptr_t);
}
// Other functions
UnixFile.access =