Commit c69bbbcc authored by Lysander Trischler's avatar Lysander Trischler
Browse files

Remove commented out code and document stuff

parent 0ae3b3b7
......@@ -78,21 +78,17 @@ func parse_file(input *C.char, twter *C.struct_twter) (*C.struct_twt_file, *C.ch
return nil, C.CString(err.Error())
}
ptr := C.malloc(C.sizeof_struct_twt_file)
twtfile := (*C.struct_twt_file)(ptr)
twtfile := (*C.struct_twt_file)(C.malloc(C.sizeof_struct_twt_file))
twtfile.twter = convertTwter(file.Twter())
// twtsptr := C.malloc(C.size_t(len(file.Twts())) * C.sizeof_struct_twt)
// create a C array exactly big enough to hold all the twts
twtsPtr := C.malloc(C.size_t(len(file.Twts())) * C.size_t(unsafe.Sizeof(uintptr(0))))
// convert the C array to a Go array so we can index it
a := (*[arraySize]*C.struct_twt)(twtsPtr)
// convert the C array to a Go array which is still backed by the C array
// so we can index it and copy all the twts into it
twts := (*[arraySize]*C.struct_twt)(twtsPtr)
for i, twt := range file.Twts() {
// a[i].twter = convertTwter(twt.Twter())
// a[i].created = C.CString(twt.Created().Format(time.RFC3339))
// a[i].hash = C.CString(twt.Hash())
a[i] = convertTwt(twt)
twts[i] = convertTwt(twt)
}
twtfile.twts = (*C.struct_twt)(twtsPtr)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment