Remove some unneeded definitions of NULL.
[dragonfly.git] / gnu / lib / libregex / test / malloc-test.c
blob3d51e463d7d8c338f86b7a7e680ab6c811b4decc
1 /* $DragonFly: src/gnu/lib/libregex/test/malloc-test.c,v 1.2 2008/06/05 18:01:49 swildner Exp $ */
3 typedef struct {
4 unsigned *bits;
5 unsigned size;
6 } bits_list_type;
8 #define BYTEWIDTH 8
10 #define BITS_BLOCK_SIZE (sizeof (unsigned) * BYTEWIDTH)
11 #define BITS_BLOCK(position) ((position) / BITS_BLOCK_SIZE)
12 #define BITS_MASK(position) (1 << ((position) % BITS_BLOCK_SIZE))
14 static unsigned
15 init_bits_list (bits_list_ptr)
16 bits_list_type *bits_list_ptr;
18 bits_list_ptr->bits = NULL;
19 bits_list_ptr->bits = (unsigned *) malloc (sizeof (unsigned));
21 if (bits_list_ptr->bits == NULL)
22 return 0;
24 bits_list_ptr->bits[0] = (unsigned)0;
25 bits_list_ptr->size = BITS_BLOCK_SIZE;
27 return 1;
31 main()
33 bits_list_type dummy;
34 bits_list_type dummy_1;
35 bits_list_type dummy_2;
36 bits_list_type dummy_3;
38 init_bits_list (&dummy);
39 printf("init 1\n");
40 init_bits_list (&dummy_1);
41 printf("init 2\n");
42 init_bits_list (&dummy_2);
43 printf("init 3\n");
44 init_bits_list (&dummy_3);
45 printf("init 4\n");