basho-labs / riak-c-client

Riak C Client
Apache License 2.0
20 stars 8 forks source link

Simplify the riak_binary #41

Closed hazen closed 10 years ago

hazen commented 10 years ago

This struct and its supporting functions developed organically over the creation of the API. It had two flavors: deep and shallow copies. The naming was inconsistent and because sometimes pointers did not point to memory which it owned, the user had to be careful which version to call to free memory.

This refactor makes the interface much simpler and the data is copied by default. I found though the refactoring exercise that there are places where a shallow-copied binary is probably more efficient. A managed flag was added along the way, too, to determine who should free the payload.

bookshelfdave commented 10 years ago

the changes seem reasonable, but I'm going to have to give it another read later

bookshelfdave commented 10 years ago

this PR seems fine, it might be nice to have more info regarding the managed flag. I suppose that's a documentation issue for later. +1