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 16:23:22 +0200
User-agent: NeoMutt/20170714-110-e32263 (1.8.3)

Hi,

My last patch was incomplete. It did not contain the unit tests. I have attached the updated patch file.

However, it does not work and fails the test. It seems to me that I have not managed to correctly coerce stdlib.h into defining a prototype for reallocarray(). Where did I go wrong / what did I miss?

* Bruno Haible <address@hidden> [170808 14:42]:
Hi Darshit,

Thanks for the guidelines. I've written a very rudimentary version of
the module. This is a barely working version

The implementation (.c file) looks good. However, it could be formatted
in GNU style (like the rest of gnulib, with very few exceptions, e.g. fts.c).

The module name should IMO be 'reallocarray'. We use the suffix '-gnu' only
when there is ambiguity between POSIX and GNU behaviour (e.g. for getopt).

I know that this is missing:

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

And 4. A documentation file doc/glibc-functions/reallocarray.texi.

for the other two, I don't know how to write them

1. Look at m4/strsep.m4.
2. grep for strsep and STRSEP in lib/string.in.h, m4/string_h.m4, 
modules/string.
  We use the same idioms everywhere.

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.

The gnulib modules make their symbols visible unconditionally. That is, a
user that includes the gnulib module 'reallocarray' should be able to use
reallocarray() without defining _GNU_SOURCE by themselves. This is done through
an invocation of AC_USE_SYSTEM_EXTENSIONS from within m4/reallocarray.m4.

Bruno



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

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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