| 26 | #include "hamlib/rig.h" |
| 27 | |
| 28 | struct ext_list *alloc_init_ext(const struct confparams *cfp) |
| 29 | { |
| 30 | struct ext_list *elp; |
| 31 | int i, nb_ext; |
| 32 | |
| 33 | if (cfp == NULL) |
| 34 | { |
| 35 | return NULL; |
| 36 | } |
| 37 | |
| 38 | for (nb_ext = 0; !RIG_IS_EXT_END(cfp[nb_ext]); nb_ext++) |
| 39 | ; |
| 40 | |
| 41 | elp = calloc((nb_ext + 1), sizeof(struct ext_list)); |
| 42 | |
| 43 | if (!elp) |
| 44 | { |
| 45 | return NULL; |
| 46 | } |
| 47 | |
| 48 | for (i = 0; !RIG_IS_EXT_END(cfp[i]); i++) |
| 49 | { |
| 50 | elp[i].token = cfp[i].token; |
| 51 | /* value reset already by calloc */ |
| 52 | } |
| 53 | |
| 54 | /* last token in array is set to 0 by calloc */ |
| 55 | |
| 56 | return elp; |
| 57 | } |
| 58 | |
| 59 | struct ext_list *find_ext(struct ext_list *elp, hamlib_token_t token) |
| 60 | { |
no outgoing calls
no test coverage detected