mirror of https://github.com/ericonr/sndio.git
Merge branch 'master' into mixer
This commit is contained in:
commit
8ca224184c
|
@ -52,7 +52,9 @@ port_mio_openlist(struct port *c, unsigned int mode)
|
|||
{
|
||||
struct mio_hdl *hdl;
|
||||
struct name *n;
|
||||
int idx;
|
||||
|
||||
idx = 0;
|
||||
n = c->path_list;
|
||||
while (1) {
|
||||
if (n == NULL)
|
||||
|
@ -68,6 +70,7 @@ port_mio_openlist(struct port *c, unsigned int mode)
|
|||
return hdl;
|
||||
}
|
||||
n = n->next;
|
||||
idx++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,9 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
|
|||
struct name *n;
|
||||
struct sio_hdl *hdl;
|
||||
struct sioctl_hdl *ctlhdl;
|
||||
int idx;
|
||||
|
||||
idx = 0;
|
||||
n = d->path_list;
|
||||
while (1) {
|
||||
if (n == NULL)
|
||||
|
@ -118,6 +120,7 @@ dev_sio_openlist(struct dev *d, unsigned int mode, struct sioctl_hdl **rctlhdl)
|
|||
return hdl;
|
||||
}
|
||||
n = n->next;
|
||||
idx++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -215,3 +215,20 @@ namelist_clear(struct name **list)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ void xfree(void *);
|
|||
|
||||
void namelist_add(struct name **, char *);
|
||||
void namelist_clear(struct name **);
|
||||
char *namelist_byindex(struct name **, unsigned int);
|
||||
|
||||
/*
|
||||
* Log levels:
|
||||
|
|
Loading…
Reference in New Issue