bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature Request: Implement glibc reallocarray() function


From: Darshit Shah
Subject: Re: Feature Request: Implement glibc reallocarray() function
Date: Tue, 8 Aug 2017 11:43:08 +0200
User-agent: NeoMutt/20170714-110-e32263 (1.8.3)

Hi Bruno,

Thanks for the guidelines. I've written a very rudimentary version of the module. This is a barely working version, but I do not know what else I require to complete the module. I know that this is missing:

1. An autoconf check
2. A way for reallocarray() to be defined within <stdlib.h>
3. Unit tests

Of these, I think I can write the unit tests without much trouble, but for the other two, I don't know how to write them

The glibc version is implemented behind the feature macro, _GNU_SOURCE. I am not sure how that should be implemented into the module in gnulib.

* Bruno Haible <address@hidden> [170808 10:19]:
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



--
Thanking You,
Darshit Shah
PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6

Attachment: 0001-Add-new-module-reallocarray-gnu.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]