Minor point: calloc is required to check for overflow. The standard was clarified such that if it’s not possible for all indices up to nmemb to be valid, calloc must return null.
Thanks for the correction! It’s really appreciated.
I credited you as “tedu” in the acknowledgments. Let me know if you’d prefer to not be mentioned, or be mentioned with a different name/alias.