[issue21233] Add *Calloc functions to CPython memory allocation API
STINNER Victor
report at bugs.python.org
Tue Apr 29 22:59:54 CEST 2014
STINNER Victor added the comment:
Patch version 6:
- I renamed "int zero" parameter to "int use_calloc" and move the new parameter at the first position to avoid confusion with nelem. For example, _PyObject_Alloc(ctx, 1, nbytes, 0) becomes _PyObject_Alloc(0, ctx, 1, nbytes). It also more logical to put it in the first position. In bytesobject.c, I leaved it at the parameter at the end since its meaning is different (fill bytes with zero or not) IMO.
- I removed my hack (premature optimization) "assert(nelem == 1); ... malloc(elsize);" and replaced it with a less surprising "... malloc(nelem * elsize);"
Stefan & Charles-François: I hope that the patch looks better to you.
----------
Added file: http://bugs.python.org/file35097/calloc-6.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21233>
_______________________________________
More information about the Python-bugs-list
mailing list