Memory functions improvements: Make style homogeneous.

`try_malloc` was changed in 8bb2c2c0742c57150655e18cf8418a758cebdce8 to
avoid a warning when size is 0.

Code style was also improved on suggestion by @aktau.
This just applies the same style improvements to other similar
functions, to keep code homogeneous.
Is it safe to change the allocation parameters if we use `FUNC_ATTR_ALLOC_SIZE_PROD(1, 2)`?