Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perl_alloc() wants zeroed memory so should use calloc()
The previous code 1) allocated memory with PerlMem_malloc() 2) passed the pointer to S_init_tls_and_interp() 3) called Zero() or ZeroD() 4) optionally invoked INIT_TRACK_MEMPOOL() 5) returned the pointer ZeroD() and Zero() are equivalent, apart from the return value of the expression. The layers of functions and macros obscured what what was actually happening, and what the ordering dependencies are: * S_init_tls_and_interp() uses only the address of the pointer * Zero() zeros the memory * Only INIT_TRACK_MEMPOOL() touches the contents * all the "memory wrap" macros inside the other macros can't "trigger" Hence the order of Zero() and S_init_tls_and_interp() can be swapped, at which point Zero() immediately follows malloc(), meaning that the two should be be replaced with calloc(). This simplifies the function considerably.
- Loading branch information