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: Bruno Haible
Subject: Re: Feature Request: Implement glibc reallocarray() function
Date: Tue, 08 Aug 2017 12:45:28 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-83-generic; KDE/5.18.0; x86_64; ; )

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




reply via email to

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