Hi Darshit, > Glibc 2.26 introduced the reallocarray() function which acts as a safe > realloc counterpart to calloc(). ... If others here agree, I'd like to see > this > function within in gnulib.
Yes, a portable replacement of this function belongs in gnulib. It falls both in the categories "Enhancements of ISO C or POSIX functions" and "Portable general use facilities" of the gnulib scope [1]. > If someone will willing to help me out / give me pointers on what would > be required to implement this within gnulib, I will happily port the > code from glibc to gnulib and submit a completed patch. Nice! Thanks. You can start out by looking at the implementation of module 'strsep' or by reading the chapter "Writing modules" [2]. Bruno [1] https://www.gnu.org/software/gnulib/manual/html_node/Various-Kinds-of-Modules.html [2] https://www.gnu.org/software/gnulib/manual/html_node/Writing-modules.html