mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out e69aaae67541 (bug 1197941) for being worse than the disease
CLOSED TREE
This commit is contained in:
parent
1fb916fd46
commit
92999cd6dd
@ -158,21 +158,21 @@ function cLibrary()
|
||||
fopen: lib.declare("fopen", ctypes.default_abi, ctypes.void_t.ptr, ctypes.char.ptr, ctypes.char.ptr),
|
||||
getline: lib.declare("getline", ctypes.default_abi, ctypes.ssize_t, ctypes.char.ptr.ptr, ctypes.size_t.ptr, ctypes.void_t.ptr),
|
||||
fclose: lib.declare("fopen", ctypes.default_abi, ctypes.int, ctypes.void_t.ptr),
|
||||
free: lib.declare("free", ctypes.default_abi, ctypes.void_t.ptr),
|
||||
setvbuf: lib.declare("setvbuf", ctypes.default_abi, ctypes.int, ctypes.void_t.ptr, ctypes.char.ptr, ctypes.int, ctypes.size_t),
|
||||
};
|
||||
}
|
||||
|
||||
function* readFileLines_gen(filename)
|
||||
{
|
||||
var libc = cLibrary();
|
||||
var linebuf = ctypes.char.ptr();
|
||||
var bufsize = ctypes.size_t(0);
|
||||
var fp = libc.fopen(filename, "r");
|
||||
if (fp.isNull())
|
||||
throw "Unable to open '" + filename + "'"
|
||||
var libc = cLibrary();
|
||||
var linebuf = ctypes.char.array(4096)();
|
||||
var bufsize = ctypes.size_t(4096);
|
||||
var fp = libc.fopen(filename, "r");
|
||||
if (fp.isNull())
|
||||
throw "Unable to open '" + filename + "'"
|
||||
|
||||
while (libc.getline(linebuf.address(), bufsize.address(), fp) > 0)
|
||||
yield linebuf.readString();
|
||||
libc.fclose(fp);
|
||||
libc.free(ctypes.void_t.ptr(linebuf));
|
||||
var bufp = ctypes.char.ptr(linebuf.addressOfElement(0));
|
||||
while (libc.getline(bufp.address(), bufsize.address(), fp) > 0)
|
||||
yield bufp.readString();
|
||||
libc.fclose(fp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user