* \param value Value pointer
* \return Zero if success, otherwise a negative error code
*
- * Note: String is dynamically allocated, use free() to
- * deallocate this string.
+ * Note: The returned string is dynamically allocated, use free() to
+ * deallocate this string. (Yes, the value parameter shouldn't be marked as
+ * "const", but it's too late to fix it, sorry about that.)
*
* Known identifiers:
* NULL - return current card
* misc
*/
-static int get_value1(const char **value, struct list_head *value_list,
+static int get_value1(char **value, struct list_head *value_list,
const char *identifier);
-static int get_value3(const char **value,
+static int get_value3(char **value,
const char *identifier,
struct list_head *value_list1,
struct list_head *value_list2,
case SEQUENCE_ELEMENT_TYPE_CSET:
case SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE:
if (cdev == NULL) {
- const char *playback_ctl = NULL;
- const char *capture_ctl = NULL;
+ char *playback_ctl = NULL;
+ char *capture_ctl = NULL;
err = get_value3(&playback_ctl, "PlaybackCTL",
value_list1,
value_list2,
value_list3);
if (err < 0 && err != -ENOENT) {
- free((char *)playback_ctl);
+ free(playback_ctl);
uc_error("cdev is not defined!");
return err;
}
if (playback_ctl != NULL &&
capture_ctl != NULL &&
strcmp(playback_ctl, capture_ctl) != 0) {
- free((char *)playback_ctl);
- free((char *)capture_ctl);
+ free(playback_ctl);
+ free(capture_ctl);
uc_error("cdev is not defined!");
return -EINVAL;
}
if (playback_ctl != NULL) {
- cdev = (char *)playback_ctl;
- free((char *)capture_ctl);
+ cdev = playback_ctl;
+ free(capture_ctl);
} else
- cdev = (char *)capture_ctl;
+ cdev = capture_ctl;
}
if (ctl == NULL) {
err = open_ctl(uc_mgr, &ctl, cdev);
return err;
}
-static int get_value1(const char **value, struct list_head *value_list,
+static int get_value1(char **value, struct list_head *value_list,
const char *identifier)
{
struct ucm_value *val;
return -ENOENT;
}
-static int get_value3(const char **value,
+static int get_value3(char **value,
const char *identifier,
struct list_head *value_list1,
struct list_head *value_list2,
*/
static int get_value(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
- const char **value,
+ char **value,
const char *mod_dev_name,
const char *verb_name,
int exact)
verb = NULL;
}
- err = get_value(uc_mgr, ident, value, mod_dev, verb, exact);
+ err = get_value(uc_mgr, ident, (char **)value, mod_dev, verb,
+ exact);
if (ident != identifier)
free((void *)ident);
if (mod_dev)