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: Thu, 10 Aug 2017 17:36:00 +0200
User-agent: NeoMutt/20170714-116-c6b71a (1.8.3)

* Paul Eggert <address@hidden> [170810 16:51]:
Thanks, a few more things (hopefully we're getting to the end now).

"missing on many platforms" lists reallocarray as missing in FreeBSD 11.1, NetBSD 8.0, and OpenBSD 5.6. But it's not missing in those versions: those are the versions it was first introduced.

I'm a little confused here. The manpage for NetBSD[1] states:
"     The reallocarray() function first appeared in OpenBSD 5.6.
    reallocarray() was redesigned in NetBSD 8 as reallocarr(3).  For compati-
    bility reasons it's available since NetBSD 8 in the _OPENBSD_SOURCE
         namespace."

This page was written in 2015. However, on netbsd.org, NetBSD 7.1 is the current latest release. Also, when exactly do we consider reallocarray being available in NetBSD since the page only states that the redesigned version, reallocarr (note the missing 'ay') is available from 8.0. I am not very familiar with the different BSDs and am unable to make much sense out of this.

Also, I've changed the line for Mac OSX to version 10.13 which is the latest version since I can't find any evidence of the function being ever available on that platform

Please fit ChangeLog entries to 79 columns if possible.

When talking about a function FOO, say just "FOO", not "FOO()". Use the latter form only when talking about calls to FOO with zero arguments.

Done

The test could be easier to read and more useful if we got rid of the 'eight' function and tried realloc_array with several different sizes. Also, there's no need to free the array. E.g.,

  size_t n;
  for (n = 2; n != 0; n <<= 1)
    if (reallocarray (NULL, (size_t) -1 / n + 1, n))
      return 1;
  return 0;


I had originally copied the test from test-calloc-gnu.c. I've updated it with the sample you provided and added another test to ensure that the correct errno is set as well.

--
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]