rgbkrk / libvirt-go

[DEPRECATED] Go bindings for libvirt
https://github.com/libvirt/libvirt-go
MIT License
166 stars 50 forks source link

Promote goCallbackId to a C long #89

Closed vincentbernat closed 8 years ago

vincentbernat commented 8 years ago

On x86-64, GoInt is 64bit, therefore using int for goCallbackId introduces a truncation. It is therefore safer to use a type that is as large as expected. We cannot use something larger as on 32bit arch, long long is bigger than void. From a C perspective, this is something safe as sizeof(long) == sizeof(void ) on almost all archs.

The cast to void* is modified to be symmetric and safe. The unmodified long is stored inside the pointer and is retrieved unmodified.

cc @jonasfj @hinesmr @rgbkrk as this relates to #69.

rgbkrk commented 8 years ago

Quite sensible and this doesn't change any public APIs. Thank you.