Skip to content

Commit e0ba7f1

Browse files
fix initializers in samples
1 parent f51e5c1 commit e0ba7f1

File tree

1 file changed

+16
-27
lines changed

1 file changed

+16
-27
lines changed

README.md

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ validate_sudoku_box(int const board[9][9], Bitset *const row_check,
7575
Bitset *const col_check, size_t const row_start,
7676
size_t const col_start)
7777
{
78-
Bitset box_check = bitset_initialize(
79-
NULL, NULL, DIGITS, DIGITS, bitset_blocks(DIGITS)
80-
);
78+
Bitset box_check
79+
= bitset_with_compound_literal(DIGITS, bitset_blocks(DIGITS));
8180
CCC_Tribool was_on = CCC_FALSE;
8281
for (size_t r = row_start; r < row_start + BOX_SIZE; ++r)
8382
{
@@ -173,9 +172,9 @@ maxint(int const a, int const b)
173172
int
174173
main(void)
175174
{
176-
Buffer const heights
177-
= buffer_initialize(((int[HCAP]){0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}), int, NULL,
178-
NULL, HCAP, HCAP);
175+
Buffer const heights = buffer_with_compound_literal(
176+
HCAP, (int[HCAP]){0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1}
177+
);
179178
int const correct_trapped = 6;
180179
int trapped = 0;
181180
int lpeak = *buffer_front_as(&heights, int);
@@ -264,7 +263,8 @@ int
264263
main(void)
265264
{
266265
/* stack array, no allocation permission, no context data, capacity 2 */
267-
Flat_doubled_ended_queue q = flat_doubled_ended_queue_initialize(int, NULL, NULL, 2, (int[2]){});
266+
Flat_doubled_ended_queue q
267+
= flat_doubled_ended_queue_with_compound_literal(2, (int[2]){});
268268
(void)push_back(&q, &(int){3});
269269
(void)push_front(&q, &(int){2});
270270
(void)push_back(&q, &(int){1}); /* Overwrite 2. */
@@ -332,15 +332,11 @@ enum : size_t
332332
int
333333
main(void)
334334
{
335-
CCC_Flat_hash_map fh = flat_hash_map_initialize(
336-
struct Key_val,
335+
CCC_Flat_hash_map fh = flat_hash_map_with_compound_literal(
337336
key,
338337
flat_hash_map_int_to_u64,
339338
flat_hash_map_id_cmp,
340-
NULL,
341-
NULL,
342-
STANDARD_FIXED_CAP,
343-
&(Standard_fixed_map){}
339+
(Standard_fixed_map){}
344340
);
345341
/* Longest sequence is 1,2,3,4,5,6,7,8,9,10 of length 10. */
346342
int const nums[] = {
@@ -423,8 +419,9 @@ main(void)
423419
{
424420
HCAP = sizeof(heap) / sizeof(*heap),
425421
};
426-
Flat_priority_queue priority_queue = flat_priority_queue_heapify_initialize(int, CCC_LES, int_cmp, NULL,
427-
NULL, HCAP, HCAP, heap);
422+
Flat_priority_queue priority_queue
423+
= flat_priority_queue_heapify_initialize(int, CCC_LES, int_cmp, NULL,
424+
NULL, HCAP, HCAP, heap);
428425
Buffer const b = flat_priority_queue_heapsort(&priority_queue, &(int){0});
429426
int const *prev = begin(&b);
430427
assert(prev != NULL);
@@ -478,14 +475,10 @@ main(void)
478475
/* stack array of 25 elements with one slot for sentinel, intrusive field
479476
named elem, key field named key, no allocation permission, key comparison
480477
function, no context data. */
481-
Array_adaptive_map s = array_adaptive_map_initialize(
482-
struct Key_val,
478+
Array_adaptive_map s = array_adaptive_map_with_compound_literal(
483479
key,
484480
Key_val_cmp,
485-
NULL,
486-
NULL,
487-
array_adaptive_map_fixed_capacity(Key_val_fixed_map),
488-
&(Key_val_fixed_map){}
481+
(Key_val_fixed_map){}
489482
);
490483
int const num_nodes = 25;
491484
/* 0, 5, 10, 15, 20, 25, 30, 35,... 120 */
@@ -557,14 +550,10 @@ main(void)
557550
{
558551
/* stack array, user defined type, key field named key, no allocation
559552
permission, key comparison function, no context data. */
560-
Array_tree_map s = array_tree_map_initialize(
561-
struct Val,
553+
Array_tree_map s = array_tree_map_with_compound_literal(
562554
key,
563555
hrmap_key_cmp,
564-
NULL,
565-
NULL,
566-
array_tree_map_fixed_capacity(Key_val_fixed_map),
567-
&(Key_val_fixed_map){}
556+
(Key_val_fixed_map){}
568557
);
569558
int const num_nodes = 25;
570559
/* 0, 5, 10, 15, 20, 25, 30, 35,... 120 */

0 commit comments

Comments
 (0)