diff options
author | Abramo Bagnara <abramo@alsa-project.org> | 2001-02-05 15:44:42 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo@alsa-project.org> | 2001-02-05 15:44:42 +0000 |
commit | 5bf23ae9a1fd826533a59b603eb8d7394de6e617 (patch) | |
tree | fb1fabfc0a2d476411c741edd7896241a199b055 /src/hwdep | |
parent | a83b209df2e93743487512b4b5078eef1a7c9093 (diff) | |
download | alsa-lib-5bf23ae9a1fd826533a59b603eb8d7394de6e617.tar.gz |
Encapsulated hwdep. Converted all enums to type safety
Diffstat (limited to 'src/hwdep')
-rw-r--r-- | src/hwdep/Makefile.am | 2 | ||||
-rw-r--r-- | src/hwdep/hwdep.c | 2 | ||||
-rw-r--r-- | src/hwdep/hwdep_m4.c | 86 |
3 files changed, 88 insertions, 2 deletions
diff --git a/src/hwdep/Makefile.am b/src/hwdep/Makefile.am index 7e0f63fb..245891bc 100644 --- a/src/hwdep/Makefile.am +++ b/src/hwdep/Makefile.am @@ -1,6 +1,6 @@ EXTRA_LTLIBRARIES=libhwdep.la -libhwdep_la_SOURCES = hwdep.c +libhwdep_la_SOURCES = hwdep.c hwdep_m4.c all: libhwdep.la diff --git a/src/hwdep/hwdep.c b/src/hwdep/hwdep.c index 24e3e7a5..b1d09986 100644 --- a/src/hwdep/hwdep.c +++ b/src/hwdep/hwdep.c @@ -110,7 +110,7 @@ int snd_hwdep_block_mode(snd_hwdep_t *hwdep, int enable) return 0; } -int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info) +int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t *info) { if (!hwdep || !info) return -EINVAL; diff --git a/src/hwdep/hwdep_m4.c b/src/hwdep/hwdep_m4.c new file mode 100644 index 00000000..5d8990c4 --- /dev/null +++ b/src/hwdep/hwdep_m4.c @@ -0,0 +1,86 @@ +/* + * Hwdep - Automatically generated functions + * Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org> + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include <errno.h> +#include <assert.h> +#include "local.h" + +size_t snd_hwdep_info_sizeof() +{ + return sizeof(snd_hwdep_info_t); +} + +int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr) +{ + assert(ptr); + *ptr = malloc(sizeof(snd_hwdep_info_t)); + if (!*ptr) + return -ENOMEM; + return 0; +} + +void snd_hwdep_info_free(snd_hwdep_info_t *obj) +{ + free(obj); +} + +void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src) +{ + assert(dst && src); + *dst = *src; +} + +unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj) +{ + assert(obj); + return obj->device; +} + +int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj) +{ + assert(obj); + return obj->card; +} + +const char * snd_hwdep_info_get_id(const snd_hwdep_info_t *obj) +{ + assert(obj); + return obj->id; +} + +const char * snd_hwdep_info_get_name(const snd_hwdep_info_t *obj) +{ + assert(obj); + return obj->name; +} + +snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj) +{ + assert(obj); + return snd_int_to_enum(obj->type); +} + +void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val) +{ + assert(obj); + obj->device = val; +} + |