Last change
on this file since 2036 was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
817 bytes
|
Line | |
---|
1 | #include <mcheck.h>
|
---|
2 | #include <obstack.h>
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <stdlib.h>
|
---|
5 |
|
---|
6 |
|
---|
7 | int
|
---|
8 | main (void)
|
---|
9 | {
|
---|
10 | struct obstack ob;
|
---|
11 | int n;
|
---|
12 |
|
---|
13 | mcheck_pedantic (NULL);
|
---|
14 |
|
---|
15 | #define obstack_chunk_alloc malloc
|
---|
16 | #define obstack_chunk_free free
|
---|
17 |
|
---|
18 | obstack_init (&ob);
|
---|
19 |
|
---|
20 | for (n = 0; n < 40000; ++n)
|
---|
21 | {
|
---|
22 | mcheck_check_all ();
|
---|
23 | obstack_printf (&ob, "%.*s%05d", 1 + n % 7, "foobarbaz", n);
|
---|
24 | if (n % 777 == 0)
|
---|
25 | obstack_finish (&ob);
|
---|
26 | }
|
---|
27 |
|
---|
28 | /* Another loop where we finish all objects, each of size 1. This will
|
---|
29 | manage to call `obstack_print' with all possible positions inside
|
---|
30 | an obstack chunk. */
|
---|
31 | for (n = 0; n < 40000; ++n)
|
---|
32 | {
|
---|
33 | mcheck_check_all ();
|
---|
34 | obstack_printf (&ob, "%c", 'a' + n % 26);
|
---|
35 | obstack_finish (&ob);
|
---|
36 | }
|
---|
37 |
|
---|
38 | /* And a final check. */
|
---|
39 | mcheck_check_all ();
|
---|
40 |
|
---|
41 | return 0;
|
---|
42 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.