[Gluster-devel] regarding mem_0filled, iov_0filled and memdup

Niels de Vos ndevos at redhat.com
Fri May 22 11:42:46 UTC 2015


On Fri, May 22, 2015 at 09:57:17AM +0530, Pranith Kumar Karampuri wrote:
> hi,
>    These functions return 0 when 0filled and non-zero value when not
> 0filled. This is quite unintuitive as people think that it should return
> _gf_true when 0filled and false when it is not 0filled. This comes up as bug
> in reviews quite a few times, so decided may be it is better to change the
> api itself. What do you say?

Oh, yes, I would like that! The function names mem_0filled() and
iov_0filled() suggest that they return _gf_true when the contents is all
0's. If the logic is the other way around, it surely confuses me.

>    Along the same lines is memdup. It is a function in common-utils which
> does GF_CALLOC, so the memory needs to be freed with GF_FREE. But since it
> sounds so much like standard api, I have seen people do free instead of
> GF_FREE. May be it is better to change it to gf_memdup?

Yeah, +1 for renaming memdup() to gf_memdup().

Thanks,
Niels


More information about the Gluster-devel mailing list