1414#include <derive-c/algorithm/hash/combine.h>
1515
1616#include <derive-c/alloc/std.h>
17- #include <derive-c/core/ prelude.h>
17+ #include <derive-c/prelude.h>
1818#include <derive-c/utils/for.h>
1919
2020#define KEY uint32_t
2323#define NAME id_to_name
2424#include <derive-c/container/map/decomposed/template.h>
2525
26- void print_map (id_to_name const * map ) {
26+ static void print_map (id_to_name const * map ) {
2727 printf ("Map has items:\n" );
2828 size_t pos = 0 ;
2929 DC_FOR_CONST (id_to_name , map , iter , entry ) {
@@ -32,7 +32,7 @@ void print_map(id_to_name const* map) {
3232 }
3333}
3434
35- void id_to_name_example () {
35+ static void id_to_name_example () {
3636 printf ("Id to Name Map Example:\n" );
3737 id_to_name map = id_to_name_new (stdalloc_get_ref ());
3838
@@ -59,34 +59,34 @@ struct report_id {
5959 uint32_t section ;
6060};
6161
62- void report_id_debug (struct report_id const * self , dc_debug_fmt fmt , FILE * stream ) {
62+ static void report_id_debug (struct report_id const * self , dc_debug_fmt fmt , FILE * stream ) {
6363 (void )fmt ;
6464 fprintf (stream , " report_id@%p { name: \"%s\", section: %d}" , self , self -> name , self -> section );
6565}
6666
67- bool report_id_equality (struct report_id const * report_1 , struct report_id const * report_2 ) {
67+ static bool report_id_equality (struct report_id const * report_1 , struct report_id const * report_2 ) {
6868 return strcmp (report_1 -> name , report_2 -> name ) == 0 && report_1 -> section == report_2 -> section ;
6969}
7070
71- size_t report_id_hash (struct report_id const * report_id ) {
71+ static size_t report_id_hash (struct report_id const * report_id ) {
7272 return dc_hash_combine (dc_murmur_hash_string (report_id -> name ),
7373 uint32_t_hash_id (& report_id -> section ));
7474}
7575
76- void report_id_delete (struct report_id * self ) { free (self -> name ); }
76+ static void report_id_delete (struct report_id * self ) { free (self -> name ); }
7777
7878struct report {
7979 char * description ;
8080 int value ;
8181};
8282
83- void report_debug (struct report const * self , dc_debug_fmt fmt , FILE * stream ) {
83+ static void report_debug (struct report const * self , dc_debug_fmt fmt , FILE * stream ) {
8484 (void )fmt ;
8585 fprintf (stream , " report@%p { description: \"%s\", value: %d}" , self , self -> description ,
8686 self -> value );
8787}
8888
89- void report_delete (struct report * self ) { free (self -> description ); }
89+ static void report_delete (struct report * self ) { free (self -> description ); }
9090
9191#define KEY struct report_id
9292#define KEY_EQ report_id_equality
@@ -99,7 +99,7 @@ void report_delete(struct report* self) { free(self->description); }
9999#define NAME report_map
100100#include <derive-c/container/map/decomposed/template.h>
101101
102- void report_map_example () {
102+ static void report_map_example () {
103103 printf ("Report Map Example:\n" );
104104 report_map map = report_map_new (stdalloc_get_ref ());
105105
@@ -136,16 +136,16 @@ struct fixed_string {
136136 char value [4 ];
137137};
138138
139- void fixed_string_debug (struct fixed_string const * self , dc_debug_fmt fmt , FILE * stream ) {
139+ static void fixed_string_debug (struct fixed_string const * self , dc_debug_fmt fmt , FILE * stream ) {
140140 (void )fmt ;
141141 fprintf (stream , "fixed_string@%p { value: \"%.*s\" }" , self , 4 , self -> value );
142142}
143143
144- bool fixed_string_eq (struct fixed_string const * str1 , struct fixed_string const * str2 ) {
144+ static bool fixed_string_eq (struct fixed_string const * str1 , struct fixed_string const * str2 ) {
145145 return memcmp (str1 -> value , str2 -> value , sizeof (str1 -> value )) == 0 ;
146146}
147147
148- size_t fixed_string_hash (struct fixed_string const * str ) {
148+ static size_t fixed_string_hash (struct fixed_string const * str ) {
149149 return dc_murmur_hash_string_4 (str -> value );
150150}
151151
@@ -157,7 +157,7 @@ size_t fixed_string_hash(struct fixed_string const* str) {
157157#define NAME fixed_string_map
158158#include <derive-c/container/map/decomposed/template.h>
159159
160- void fixed_string_example () {
160+ static void fixed_string_example () {
161161 printf ("Fixed Strings Example:\n" );
162162 fixed_string_map map = fixed_string_map_new (stdalloc_get_ref ());
163163
0 commit comments