summaryrefslogtreecommitdiff
path: root/src/control/hcontrol.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2003-07-27 20:20:26 +0000
committerJaroslav Kysela <perex@perex.cz>2003-07-27 20:20:26 +0000
commit92093ae0fee0790c23d501125c553aad638a4ccf (patch)
tree10955f6872822acb1d1f471d32cc4ead86d0c2d9 /src/control/hcontrol.c
parent6a543d8e20239a16ba4cd48837c894a08313bc54 (diff)
Added snd_hctl_open_ctl() function.
alisp massive extensions and tested ALSA function bindings.
Diffstat (limited to 'src/control/hcontrol.c')
-rw-r--r--src/control/hcontrol.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c
index 7c1cd7ba..889bde5c 100644
--- a/src/control/hcontrol.c
+++ b/src/control/hcontrol.c
@@ -69,18 +69,32 @@ static int snd_hctl_compare_default(const snd_hctl_elem_t *c1,
*/
int snd_hctl_open(snd_hctl_t **hctlp, const char *name, int mode)
{
- snd_hctl_t *hctl;
snd_ctl_t *ctl;
int err;
- assert(hctlp);
- *hctlp = NULL;
if ((err = snd_ctl_open(&ctl, name, mode)) < 0)
return err;
- if ((hctl = (snd_hctl_t *)calloc(1, sizeof(snd_hctl_t))) == NULL) {
+ err = snd_hctl_open_ctl(hctlp, ctl);
+ if (err < 0)
snd_ctl_close(ctl);
+ return err;
+}
+
+/**
+ * \brief Opens an HCTL
+ * \param hctlp Returned HCTL handle
+ * \param ctl underlying CTL handle
+ * \return 0 on success otherwise a negative error code
+ */
+int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl)
+{
+ snd_hctl_t *hctl;
+ int err;
+
+ assert(hctlp);
+ *hctlp = NULL;
+ if ((hctl = (snd_hctl_t *)calloc(1, sizeof(snd_hctl_t))) == NULL)
return -ENOMEM;
- }
INIT_LIST_HEAD(&hctl->elems);
hctl->ctl = ctl;
*hctlp = hctl;