diff options
author | conklin <conklin@FreeBSD.org> | 1993-07-30 20:16:53 +0000 |
---|---|---|
committer | conklin <conklin@FreeBSD.org> | 1993-07-30 20:16:53 +0000 |
commit | 5e0c8d9ee2600d5f7d5c710e34249ae51db60ba7 (patch) | |
tree | e01cf2a5cc6062467dbb628a7beef06eaa39845d /gnu/lib/libregex/test/malloc-test.c | |
parent | 605993f7be3eb2154f219e29b739c6d76f373405 (diff) | |
download | FreeBSD-src-5e0c8d9ee2600d5f7d5c710e34249ae51db60ba7.zip FreeBSD-src-5e0c8d9ee2600d5f7d5c710e34249ae51db60ba7.tar.gz |
GNU Regex 0.12
Diffstat (limited to 'gnu/lib/libregex/test/malloc-test.c')
-rw-r--r-- | gnu/lib/libregex/test/malloc-test.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gnu/lib/libregex/test/malloc-test.c b/gnu/lib/libregex/test/malloc-test.c new file mode 100644 index 0000000..7e27a15 --- /dev/null +++ b/gnu/lib/libregex/test/malloc-test.c @@ -0,0 +1,47 @@ + + +typedef struct { + unsigned *bits; + unsigned size; +} bits_list_type; + +#define BYTEWIDTH 8 +#define NULL 0 + +#define BITS_BLOCK_SIZE (sizeof (unsigned) * BYTEWIDTH) +#define BITS_BLOCK(position) ((position) / BITS_BLOCK_SIZE) +#define BITS_MASK(position) (1 << ((position) % BITS_BLOCK_SIZE)) + +static unsigned +init_bits_list (bits_list_ptr) + bits_list_type *bits_list_ptr; +{ + bits_list_ptr->bits = NULL; + bits_list_ptr->bits = (unsigned *) malloc (sizeof (unsigned)); + + if (bits_list_ptr->bits == NULL) + return 0; + + bits_list_ptr->bits[0] = (unsigned)0; + bits_list_ptr->size = BITS_BLOCK_SIZE; + + return 1; +} + + +main() +{ + bits_list_type dummy; + bits_list_type dummy_1; + bits_list_type dummy_2; + bits_list_type dummy_3; + + init_bits_list (&dummy); +printf("init 1\n"); + init_bits_list (&dummy_1); +printf("init 2\n"); + init_bits_list (&dummy_2); +printf("init 3\n"); + init_bits_list (&dummy_3); +printf("init 4\n"); +} |