Merge branch 'master' into mixer

This commit is contained in:
Alexandre Ratchov 2020-01-28 06:48:49 +01:00
commit 8ca224184c
4 changed files with 24 additions and 0 deletions

View File

@ -52,7 +52,9 @@ port_mio_openlist(struct port *c, unsigned int mode)
{ {
struct mio_hdl *hdl; struct mio_hdl *hdl;
struct name *n; struct name *n;
int idx;
idx = 0;
n = c->path_list; n = c->path_list;
while (1) { while (1) {
if (n == NULL) if (n == NULL)
@ -68,6 +70,7 @@ port_mio_openlist(struct port *c, unsigned int mode)
return hdl; return hdl;
} }
n = n->next; n = n->next;
idx++;
} }
return NULL; return NULL;
} }

View File

@ -93,7 +93,9 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
struct name *n; struct name *n;
struct sio_hdl *hdl; struct sio_hdl *hdl;
struct sioctl_hdl *ctlhdl; struct sioctl_hdl *ctlhdl;
int idx;
idx = 0;
n = d->path_list; n = d->path_list;
while (1) { while (1) {
if (n == NULL) if (n == NULL)
@ -118,6 +120,7 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
return hdl; return hdl;
} }
n = n->next; n = n->next;
idx++;
} }
return NULL; return NULL;
} }

View File

@ -215,3 +215,20 @@ namelist_clear(struct name **list)
xfree(n); 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;
}

View File

@ -38,6 +38,7 @@ void xfree(void *);
void namelist_add(struct name **, char *); void namelist_add(struct name **, char *);
void namelist_clear(struct name **); void namelist_clear(struct name **);
char *namelist_byindex(struct name **, unsigned int);
/* /*
* Log levels: * Log levels: