Change Details
eeshow/kicad/ext.c |
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
| 87 | |
| 88 | |
| 89 | struct file_names *clone_file_names(const struct file_names *fn) |
| 90 | { |
| 91 | struct file_names *new; |
| 92 | unsigned i; |
| 93 | |
| 94 | new = alloc_type(struct file_names); |
| 95 | new->pro = fn && fn->pro ? stralloc(fn->pro) : NULL; |
| 96 | new->sch = fn && fn->sch ? stralloc(fn->sch) : NULL; |
| 97 | new->pl = fn && fn->pl ? stralloc(fn->pl) : NULL; |
| 98 | new->n_libs = fn ? fn->n_libs : 0; |
| 99 | if (!fn) { |
| 100 | new->libs = NULL; |
| 101 | return new; |
| 102 | } |
| 103 | new->libs = alloc_type_n(const char *, fn->n_libs); |
| 104 | for (i = 0; i != fn->n_libs; i++) |
| 105 | new->libs[i] = stralloc(fn->libs[i]); |
| 106 | return new; |
| 107 | } |
| 108 | |
| 109 | |
| 110 | void free_file_names(struct file_names *fn) |
| 111 | { |
| 112 | unsigned i; |
| 113 | |
| 114 | free((void *) fn->pro); |
| 115 | free((void *) fn->sch); |
| 116 | free((void *) fn->pl); |
| 117 | for (i = 0; i != fn->n_libs; i++) |
| 118 | free((void *) fn->libs[i]); |
| 119 | free(fn->libs); |
| 120 | } |
eeshow/kicad/ext.h |
35 | 35 | enum ext identify(const char *path); |
36 | 36 | void classify_files(struct file_names *fn, char *const *args, |
37 | 37 | unsigned n_args); |
| 38 | struct file_names *clone_file_names(const struct file_names *fn); |
| 39 | void free_file_names(struct file_names *fn); |
38 | 40 | |
39 | 41 | #endif /* !KICAD_EXT_H */ |
Download the corresponding diff file