1 /* Copyright (C) 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
27 /* Number of samples per size. */
37 for (i
= 0; i
< N
; ++i
)
41 ptrs
[i
] = (char *) calloc (1, size
);
46 for (j
= 0; j
< size
; ++j
)
48 if (ptrs
[i
][j
] != '\0')
49 error (EXIT_FAILURE
, 0,
50 "byte not cleared (size %d, element %d, byte %d)",
67 for (i
= 0; i
< N
; ++i
)
70 int n
= 1 + random () % 10;
71 int elem
= 1 + random () % 100;
74 ptrs
[i
] = (char *) calloc (n
, elem
);
79 for (j
= 0; j
< size
; ++j
)
81 if (ptrs
[i
][j
] != '\0')
82 error (EXIT_FAILURE
, 0,
83 "byte not cleared (size %d, element %d, byte %d)",
97 /* We are allocating blocks with `calloc' and check whether every
98 block is completely cleared. We first try this for some fixed
99 times and then with random size. */