summaryrefslogtreecommitdiff
path: root/tests/test-reallocarray.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-08-13 10:55:55 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-08-13 11:02:40 -0700
commitaa459ef443c756c28ce883fdd7f15c98fcefc7dc (patch)
treedb7d005fd03fd7777c6e8e81d2ba38e85a674163 /tests/test-reallocarray.c
parent98756762a3337722477d2cddc9c0549609efe848 (diff)
downloadgnulib-aa459ef443c756c28ce883fdd7f15c98fcefc7dc.tar.gz
reallocarray: minor fixes
* doc/glibc-functions/reallocarray.texi: Update version numbers. * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Don't trust _cv_ contents. * modules/reallocarray (License): Change from GPL to LGPL. * tests/test-reallocarray.c (main): Fix ENOMEM typo. Indent properly and don't use tabs.
Diffstat (limited to 'tests/test-reallocarray.c')
-rw-r--r--tests/test-reallocarray.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/test-reallocarray.c b/tests/test-reallocarray.c
index 587c700015..f91ede70a3 100644
--- a/tests/test-reallocarray.c
+++ b/tests/test-reallocarray.c
@@ -26,16 +26,18 @@ int
main ()
{
size_t n;
- /* Check that reallocarray fails when requested to allocate a block of memory
- larger than SIZE_MAX bytes. */
+
+ /* Check that reallocarray fails when requested to allocate a block
+ of memory larger than SIZE_MAX bytes. */
for (n = 2; n != 0; n <<= 1)
- {
- if (reallocarray (NULL, (size_t) -1 / n + 1, n))
- return 1;
-
- /* Ensure that errno is correctly set */
- if (!errno == ENOMEM)
- return 1;
- }
+ {
+ if (reallocarray (NULL, (size_t) -1 / n + 1, n))
+ return 1;
+
+ /* Ensure that errno is correctly set. */
+ if (errno != ENOMEM)
+ return 1;
+ }
+
return 0;
}