common.h (487B)
1 #ifndef COMMON_H_ 2 #define COMMON_H_ 3 4 #include <assert.h> 5 #include <reading.h> 6 #include <stdint.h> 7 #include <stdio.h> 8 9 #define TN_DEFAULT_ALLOC 1 10 #define NO_SIZE (SIZE_MAX) 11 12 typedef struct _struct_tn { 13 char *name; 14 size_t size; 15 16 size_t children_alloc; 17 size_t children_n; 18 struct _struct_tn **children; 19 20 struct _struct_tn *parent; 21 } tn; 22 23 tn *parse_input(char **lines, size_t nlines); 24 void sum_sizes(tn *t); 25 void print_tree(tn *t, size_t level); 26 void tn_cleartree(tn *t); 27 28 #endif