diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-10-25 15:36:03 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2007-10-25 15:36:03 +0200 |
commit | 68e5771a6f7a2aae2dbd02a097719bcd25c6f307 (patch) | |
tree | 6f676c0499069159e3cfdd3f6ee9bfaabd630b21 | |
parent | 9eb272c753e2d376be87433b2428f69c24a4bccb (diff) |
Remove assert from header files
Putting assert in the public macros isn't good idea at all.
Let's get rid of them.
Also, clean up snd*_alloca() functions to use a helper macro
instead of copy and paste.
-rw-r--r-- | include/asoundlib-head.h | 1 | ||||
-rw-r--r-- | include/control.h | 12 | ||||
-rw-r--r-- | include/global.h | 3 | ||||
-rw-r--r-- | include/hwdep.h | 6 | ||||
-rw-r--r-- | include/instr.h | 8 | ||||
-rw-r--r-- | include/mixer.h | 4 | ||||
-rw-r--r-- | include/pcm.h | 14 | ||||
-rw-r--r-- | include/rawmidi.h | 6 | ||||
-rw-r--r-- | include/seq.h | 31 | ||||
-rw-r--r-- | include/timer.h | 10 | ||||
-rw-r--r-- | src/mixer/simple_none.c | 1 |
11 files changed, 43 insertions, 53 deletions
diff --git a/include/asoundlib-head.h b/include/asoundlib-head.h index 20c8a68d..b4087def 100644 --- a/include/asoundlib-head.h +++ b/include/asoundlib-head.h @@ -33,7 +33,6 @@ #include <stdlib.h> #include <string.h> #include <fcntl.h> -#include <assert.h> #include <endian.h> #include <sys/poll.h> #include <errno.h> diff --git a/include/control.h b/include/control.h index e61362d0..8860294b 100644 --- a/include/control.h +++ b/include/control.h @@ -279,7 +279,7 @@ size_t snd_ctl_elem_id_sizeof(void); * \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_elem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_id_t *) alloca(snd_ctl_elem_id_sizeof()); memset(*ptr, 0, snd_ctl_elem_id_sizeof()); } while (0) +#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id) int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr); void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj); void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj); @@ -302,7 +302,7 @@ size_t snd_ctl_card_info_sizeof(void); * \brief allocate an invalid #snd_ctl_card_info_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_card_info_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_card_info_t *) alloca(snd_ctl_card_info_sizeof()); memset(*ptr, 0, snd_ctl_card_info_sizeof()); } while (0) +#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info) int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr); void snd_ctl_card_info_free(snd_ctl_card_info_t *obj); void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj); @@ -320,7 +320,7 @@ size_t snd_ctl_event_sizeof(void); * \brief allocate an invalid #snd_ctl_event_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_event_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_event_t *) alloca(snd_ctl_event_sizeof()); memset(*ptr, 0, snd_ctl_event_sizeof()); } while (0) +#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event) int snd_ctl_event_malloc(snd_ctl_event_t **ptr); void snd_ctl_event_free(snd_ctl_event_t *obj); void snd_ctl_event_clear(snd_ctl_event_t *obj); @@ -332,7 +332,7 @@ size_t snd_ctl_elem_list_sizeof(void); * \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_elem_list_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_list_t *) alloca(snd_ctl_elem_list_sizeof()); memset(*ptr, 0, snd_ctl_elem_list_sizeof()); } while (0) +#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list) int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr); void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj); void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj); @@ -353,7 +353,7 @@ size_t snd_ctl_elem_info_sizeof(void); * \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_elem_info_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_info_t *) alloca(snd_ctl_elem_info_sizeof()); memset(*ptr, 0, snd_ctl_elem_info_sizeof()); } while (0) +#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info) int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr); void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj); void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj); @@ -408,7 +408,7 @@ size_t snd_ctl_elem_value_sizeof(void); * \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca * \param ptr returned pointer */ -#define snd_ctl_elem_value_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_value_t *) alloca(snd_ctl_elem_value_sizeof()); memset(*ptr, 0, snd_ctl_elem_value_sizeof()); } while (0) +#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value) int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr); void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj); void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj); diff --git a/include/global.h b/include/global.h index f388e4b5..3e3680fb 100644 --- a/include/global.h +++ b/include/global.h @@ -102,6 +102,9 @@ void *snd_dlsym(void *handle, const char *name, const char *version); int snd_dlclose(void *handle); +/** \brief alloca helper macro. */ +#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0) + /** * \brief Internal structure for an async notification client handler. * diff --git a/include/hwdep.h b/include/hwdep.h index 6ff1e902..ab12822c 100644 --- a/include/hwdep.h +++ b/include/hwdep.h @@ -108,7 +108,7 @@ ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size); size_t snd_hwdep_info_sizeof(void); /** allocate #snd_hwdep_info_t container on stack */ -#define snd_hwdep_info_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_info_t *) alloca(snd_hwdep_info_sizeof()); memset(*ptr, 0, snd_hwdep_info_sizeof()); } while (0) +#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info) int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr); void snd_hwdep_info_free(snd_hwdep_info_t *obj); void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src); @@ -122,7 +122,7 @@ void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val); size_t snd_hwdep_dsp_status_sizeof(void); /** allocate #snd_hwdep_dsp_status_t container on stack */ -#define snd_hwdep_dsp_status_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_dsp_status_t *) alloca(snd_hwdep_dsp_status_sizeof()); memset(*ptr, 0, snd_hwdep_dsp_status_sizeof()); } while (0) +#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status) int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr); void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj); void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src); @@ -135,7 +135,7 @@ unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *o size_t snd_hwdep_dsp_image_sizeof(void); /** allocate #snd_hwdep_dsp_image_t container on stack */ -#define snd_hwdep_dsp_image_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_dsp_image_t *) alloca(snd_hwdep_dsp_image_sizeof()); memset(*ptr, 0, snd_hwdep_dsp_image_sizeof()); } while (0) +#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image) int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr); void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj); void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src); diff --git a/include/instr.h b/include/instr.h index aac6f667..b4232d30 100644 --- a/include/instr.h +++ b/include/instr.h @@ -44,12 +44,8 @@ extern "C" { typedef struct _snd_instr_header snd_instr_header_t; size_t snd_instr_header_sizeof(void); -#define snd_instr_header_alloca(ptr) \ -do {\ - assert(ptr);\ - *ptr = (snd_instr_header_t *)alloca(snd_instr_header_sizeof());\ - memset(*ptr, 0, snd_instr_header_sizeof());\ -} while (0) /**< allocate instrument header on stack */ +/** allocate instrument header on stack */ +#define snd_instr_header_alloca(ptr) __snd_alloca(ptr, snd_instr_header) int snd_instr_header_malloc(snd_instr_header_t **ptr, size_t len); void snd_instr_header_free(snd_instr_header_t *ptr); void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *src); diff --git a/include/mixer.h b/include/mixer.h index 41297787..ac46b121 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -146,7 +146,7 @@ size_t snd_mixer_class_sizeof(void); * \brief allocate an invalid #snd_mixer_class_t using standard alloca * \param ptr returned pointer */ -#define snd_mixer_class_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_class_t *) alloca(snd_mixer_class_sizeof()); memset(*ptr, 0, snd_mixer_class_sizeof()); } while (0) +#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class) int snd_mixer_class_malloc(snd_mixer_class_t **ptr); void snd_mixer_class_free(snd_mixer_class_t *obj); void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src); @@ -294,7 +294,7 @@ size_t snd_mixer_selem_id_sizeof(void); * \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca * \param ptr returned pointer */ -#define snd_mixer_selem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_selem_id_t *) alloca(snd_mixer_selem_id_sizeof()); memset(*ptr, 0, snd_mixer_selem_id_sizeof()); } while (0) +#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id) int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr); void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj); void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src); diff --git a/include/pcm.h b/include/pcm.h index db9fca35..268a902e 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -470,7 +470,7 @@ size_t snd_pcm_info_sizeof(void); * \brief allocate an invalid #snd_pcm_info_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_info_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); } while (0) +#define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info) int snd_pcm_info_malloc(snd_pcm_info_t **ptr); void snd_pcm_info_free(snd_pcm_info_t *obj); void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src); @@ -548,7 +548,7 @@ size_t snd_pcm_hw_params_sizeof(void); * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); } while (0) +#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params) int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr); void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj); void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src); @@ -699,7 +699,7 @@ size_t snd_pcm_sw_params_sizeof(void); * \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0) +#define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params) int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr); void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj); void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src); @@ -747,7 +747,7 @@ size_t snd_pcm_access_mask_sizeof(void); * \brief allocate an empty #snd_pcm_access_mask_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_access_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_access_mask_t *) alloca(snd_pcm_access_mask_sizeof()); memset(*ptr, 0, snd_pcm_access_mask_sizeof()); } while (0) +#define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask) int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr); void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj); void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src); @@ -772,7 +772,7 @@ size_t snd_pcm_format_mask_sizeof(void); * \brief allocate an empty #snd_pcm_format_mask_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_format_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_format_mask_t *) alloca(snd_pcm_format_mask_sizeof()); memset(*ptr, 0, snd_pcm_format_mask_sizeof()); } while (0) +#define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask) int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr); void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj); void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src); @@ -797,7 +797,7 @@ size_t snd_pcm_subformat_mask_sizeof(void); * \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_subformat_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_subformat_mask_t *) alloca(snd_pcm_subformat_mask_sizeof()); memset(*ptr, 0, snd_pcm_subformat_mask_sizeof()); } while (0) +#define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask) int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr); void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj); void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src); @@ -822,7 +822,7 @@ size_t snd_pcm_status_sizeof(void); * \brief allocate an invalid #snd_pcm_status_t using standard alloca * \param ptr returned pointer */ -#define snd_pcm_status_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); memset(*ptr, 0, snd_pcm_status_sizeof()); } while (0) +#define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status) int snd_pcm_status_malloc(snd_pcm_status_t **ptr); void snd_pcm_status_free(snd_pcm_status_t *obj); void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src); diff --git a/include/rawmidi.h b/include/rawmidi.h index c7517aa2..1d8fd562 100644 --- a/include/rawmidi.h +++ b/include/rawmidi.h @@ -93,7 +93,7 @@ size_t snd_rawmidi_info_sizeof(void); * \brief allocate an invalid #snd_rawmidi_info_t using standard alloca * \param ptr returned pointer */ -#define snd_rawmidi_info_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_info_t *) alloca(snd_rawmidi_info_sizeof()); memset(*ptr, 0, snd_rawmidi_info_sizeof()); } while (0) +#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info) int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr); void snd_rawmidi_info_free(snd_rawmidi_info_t *obj); void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src); @@ -116,7 +116,7 @@ size_t snd_rawmidi_params_sizeof(void); * \brief allocate an invalid #snd_rawmidi_params_t using standard alloca * \param ptr returned pointer */ -#define snd_rawmidi_params_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_params_t *) alloca(snd_rawmidi_params_sizeof()); memset(*ptr, 0, snd_rawmidi_params_sizeof()); } while (0) +#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params) int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr); void snd_rawmidi_params_free(snd_rawmidi_params_t *obj); void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src); @@ -133,7 +133,7 @@ size_t snd_rawmidi_status_sizeof(void); * \brief allocate an invalid #snd_rawmidi_status_t using standard alloca * \param ptr returned pointer */ -#define snd_rawmidi_status_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_status_t *) alloca(snd_rawmidi_status_sizeof()); memset(*ptr, 0, snd_rawmidi_status_sizeof()); } while (0) +#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status) int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr); void snd_rawmidi_status_free(snd_rawmidi_status_t *obj); void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src); diff --git a/include/seq.h b/include/seq.h index 94ea711a..397a73c5 100644 --- a/include/seq.h +++ b/include/seq.h @@ -46,15 +46,6 @@ extern "C" { /** Sequencer handle */ typedef struct _snd_seq snd_seq_t; -#ifndef DOC_HIDDEN -#define SND_ALLOCA(type,ptr) \ -do {\ - assert(ptr);\ - *ptr = (type##_t *)alloca(type##_sizeof());\ - memset(*ptr, 0, type##_sizeof());\ -} while (0) -#endif - /** * sequencer opening stream types */ @@ -106,7 +97,7 @@ typedef struct _snd_seq_system_info snd_seq_system_info_t; size_t snd_seq_system_info_sizeof(void); /** allocate a #snd_seq_system_info_t container on stack */ #define snd_seq_system_info_alloca(ptr) \ - SND_ALLOCA(snd_seq_system_info, ptr) + __snd_alloca(ptr, snd_seq_system_info) int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr); void snd_seq_system_info_free(snd_seq_system_info_t *ptr); void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src); @@ -142,7 +133,7 @@ typedef enum snd_seq_client_type { size_t snd_seq_client_info_sizeof(void); /** allocate a #snd_seq_client_info_t container on stack */ #define snd_seq_client_info_alloca(ptr) \ - SND_ALLOCA(snd_seq_client_info, ptr) + __snd_alloca(ptr, snd_seq_client_info) int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr); void snd_seq_client_info_free(snd_seq_client_info_t *ptr); void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src); @@ -176,7 +167,7 @@ typedef struct _snd_seq_client_pool snd_seq_client_pool_t; size_t snd_seq_client_pool_sizeof(void); /** allocate a #snd_seq_client_pool_t container on stack */ #define snd_seq_client_pool_alloca(ptr) \ - SND_ALLOCA(snd_seq_client_pool, ptr) + __snd_alloca(ptr, snd_seq_client_pool) int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr); void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr); void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src); @@ -265,7 +256,7 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t; size_t snd_seq_port_info_sizeof(void); /** allocate a #snd_seq_port_info_t container on stack */ #define snd_seq_port_info_alloca(ptr) \ - SND_ALLOCA(snd_seq_port_info, ptr) + __snd_alloca(ptr, snd_seq_port_info) int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr); void snd_seq_port_info_free(snd_seq_port_info_t *ptr); void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src); @@ -323,7 +314,7 @@ typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t; size_t snd_seq_port_subscribe_sizeof(void); /** allocate a #snd_seq_port_subscribe_t container on stack */ #define snd_seq_port_subscribe_alloca(ptr) \ - SND_ALLOCA(snd_seq_port_subscribe, ptr) + __snd_alloca(ptr, snd_seq_port_subscribe) int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr); void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr); void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src); @@ -361,7 +352,7 @@ typedef enum { size_t snd_seq_query_subscribe_sizeof(void); /** allocate a #snd_seq_query_subscribe_t container on stack */ #define snd_seq_query_subscribe_alloca(ptr) \ - SND_ALLOCA(snd_seq_query_subscribe, ptr) + __snd_alloca(ptr, snd_seq_query_subscribe) int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr); void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr); void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src); @@ -411,7 +402,7 @@ typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t; size_t snd_seq_queue_info_sizeof(void); /** allocate a #snd_seq_queue_info_t container on stack */ #define snd_seq_queue_info_alloca(ptr) \ - SND_ALLOCA(snd_seq_queue_info, ptr) + __snd_alloca(ptr, snd_seq_queue_info) int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr); void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr); void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src); @@ -443,7 +434,7 @@ int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used); size_t snd_seq_queue_status_sizeof(void); /** allocate a #snd_seq_queue_status_t container on stack */ #define snd_seq_queue_status_alloca(ptr) \ - SND_ALLOCA(snd_seq_queue_status, ptr) + __snd_alloca(ptr, snd_seq_queue_status) int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr); void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr); void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src); @@ -461,7 +452,7 @@ int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *s size_t snd_seq_queue_tempo_sizeof(void); /** allocate a #snd_seq_queue_tempo_t container on stack */ #define snd_seq_queue_tempo_alloca(ptr) \ - SND_ALLOCA(snd_seq_queue_tempo, ptr) + __snd_alloca(ptr, snd_seq_queue_tempo) int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr); void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr); void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src); @@ -492,7 +483,7 @@ typedef enum { size_t snd_seq_queue_timer_sizeof(void); /** allocate a #snd_seq_queue_timer_t container on stack */ #define snd_seq_queue_timer_alloca(ptr) \ - SND_ALLOCA(snd_seq_queue_timer, ptr) + __snd_alloca(ptr, snd_seq_queue_timer) int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr); void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr); void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src); @@ -551,7 +542,7 @@ typedef struct _snd_seq_remove_events snd_seq_remove_events_t; size_t snd_seq_remove_events_sizeof(void); /** allocate a #snd_seq_remove_events_t container on stack */ #define snd_seq_remove_events_alloca(ptr) \ - SND_ALLOCA(snd_seq_remove_events, ptr) + __snd_alloca(ptr, snd_seq_remove_events) int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr); void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr); void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src); diff --git a/include/timer.h b/include/timer.h index ef6a18de..4d06e31f 100644 --- a/include/timer.h +++ b/include/timer.h @@ -164,7 +164,7 @@ ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size); size_t snd_timer_id_sizeof(void); /** allocate #snd_timer_id_t container on stack */ -#define snd_timer_id_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_id_t *) alloca(snd_timer_id_sizeof()); memset(*ptr, 0, snd_timer_id_sizeof()); } while (0) +#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id) int snd_timer_id_malloc(snd_timer_id_t **ptr); void snd_timer_id_free(snd_timer_id_t *obj); void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src); @@ -182,7 +182,7 @@ int snd_timer_id_get_subdevice(snd_timer_id_t *id); size_t snd_timer_ginfo_sizeof(void); /** allocate #snd_timer_ginfo_t container on stack */ -#define snd_timer_ginfo_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_ginfo_t *) alloca(snd_timer_ginfo_sizeof()); memset(*ptr, 0, snd_timer_ginfo_sizeof()); } while (0) +#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo) int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr); void snd_timer_ginfo_free(snd_timer_ginfo_t *obj); void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src); @@ -200,7 +200,7 @@ unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj); size_t snd_timer_info_sizeof(void); /** allocate #snd_timer_info_t container on stack */ -#define snd_timer_info_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_info_t *) alloca(snd_timer_info_sizeof()); memset(*ptr, 0, snd_timer_info_sizeof()); } while (0) +#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info) int snd_timer_info_malloc(snd_timer_info_t **ptr); void snd_timer_info_free(snd_timer_info_t *obj); void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src); @@ -213,7 +213,7 @@ long snd_timer_info_get_resolution(snd_timer_info_t * info); size_t snd_timer_params_sizeof(void); /** allocate #snd_timer_params_t container on stack */ -#define snd_timer_params_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_params_t *) alloca(snd_timer_params_sizeof()); memset(*ptr, 0, snd_timer_params_sizeof()); } while (0) +#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params) int snd_timer_params_malloc(snd_timer_params_t **ptr); void snd_timer_params_free(snd_timer_params_t *obj); void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src); @@ -233,7 +233,7 @@ unsigned int snd_timer_params_get_filter(snd_timer_params_t * params); size_t snd_timer_status_sizeof(void); /** allocate #snd_timer_status_t container on stack */ -#define snd_timer_status_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_status_t *) alloca(snd_timer_status_sizeof()); memset(*ptr, 0, snd_timer_status_sizeof()); } while (0) +#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status) int snd_timer_status_malloc(snd_timer_status_t **ptr); void snd_timer_status_free(snd_timer_status_t *obj); void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src); diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c index 7e7af7b5..6b015af1 100644 --- a/src/mixer/simple_none.c +++ b/src/mixer/simple_none.c @@ -35,6 +35,7 @@ #include <string.h> #include <fcntl.h> #include <sys/ioctl.h> +#include <assert.h> #include <math.h> #include <alsa/asoundlib.h> #include "mixer_simple.h" |