mirror of
https://github.com/github/semantic.git
synced 2024-12-27 00:44:57 +03:00
Read data with getline.
This commit is contained in:
parent
ef121e4bb1
commit
f2b52a0620
@ -9,9 +9,9 @@ extension TSInput {
|
||||
self.init(
|
||||
payload: file,
|
||||
read_fn: { (payload: UnsafeMutablePointer<Void>, bytesRead: UnsafeMutablePointer<Int>) -> UnsafePointer<Int8> in
|
||||
let result = UnsafePointer<Int8>(fgets(nil, 100, UnsafeMutablePointer<FILE>(payload)))
|
||||
bytesRead.memory = Int(strlen(result))
|
||||
return result
|
||||
var string: UnsafeMutablePointer<Int8> = nil
|
||||
bytesRead.memory = getline(&string, nil, UnsafeMutablePointer<FILE>(payload))
|
||||
return UnsafePointer<Int8>(string)
|
||||
},
|
||||
seek_fn: { (payload: UnsafeMutablePointer<Void>, position: TSLength) -> Int32 in
|
||||
fseek(UnsafeMutablePointer<FILE>(payload), position.bytes, SEEK_CUR)
|
||||
|
Loading…
Reference in New Issue
Block a user