=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/utils.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/sndiod/utils.c 2020/01/23 05:40:09 1.7 --- src/usr.bin/sndiod/utils.c 2021/11/01 14:43:25 1.8 *************** *** 1,4 **** ! /* $OpenBSD: utils.c,v 1.7 2020/01/23 05:40:09 ratchov Exp $ */ /* * Copyright (c) 2003-2012 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: utils.c,v 1.8 2021/11/01 14:43:25 ratchov Exp $ */ /* * Copyright (c) 2003-2012 Alexandre Ratchov * *************** *** 187,234 **** p = xmalloc(size); memcpy(p, s, size); return p; - } - - /* - * copy and append the given string to the name list - */ - void - namelist_add(struct name **list, char *str) - { - struct name *n; - size_t size; - - size = strlen(str) + 1; - n = xmalloc(sizeof(struct name) + size); - memcpy(n->str, str, size); - n->next = *list; - *list = n; - } - - void - namelist_clear(struct name **list) - { - struct name *n; - - while ((n = *list) != NULL) { - *list = n->next; - xfree(n); - } - } - - char * - namelist_byindex(struct name **list, unsigned int idx) - { - struct name *n; - - n = *list; - while (1) { - if (n == NULL) - return NULL; - if (idx == 0) - break; - n = n->next; - idx--; - } - return n->str; } --- 187,190 ----