Date:2016-08-23 03:18:46 (7 years 3 months ago)
Author:Werner Almesberger
Commit:e46f8382f32dcb45d213bfe4c5734a68cc074dac
Message:eeshow/kicad/ext.c (clone_file_names, free_file_names): manage set of names

Files: eeshow/kicad/ext.c (1 diff)
eeshow/kicad/ext.h (1 diff)

Change Details

eeshow/kicad/ext.c
8484        }
8585    }
8686}
87
88
89struct 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
110void 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
3535enum ext identify(const char *path);
3636void classify_files(struct file_names *fn, char *const *args,
3737    unsigned n_args);
38struct file_names *clone_file_names(const struct file_names *fn);
39void free_file_names(struct file_names *fn);
3840
3941#endif /* !KICAD_EXT_H */

Archive Download the corresponding diff file

Branches:
master



interactive