]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsactl: change format of comment node in state file
authorClemens Ladisch <clemens@ladisch.de>
Wed, 26 May 2010 08:28:11 +0000 (10:28 +0200)
committerClemens Ladisch <clemens@ladisch.de>
Wed, 26 May 2010 08:28:11 +0000 (10:28 +0200)
Make the comment node a separate node in the state file (join=0), and
move it after the other fields of the respective control.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
alsactl/state.c

index 538fa82f9976ee797e281683d4cb810c160d0e27..01b1cd6bbaea70e351ed650f1a4e0080e814f286 100644 (file)
@@ -266,9 +266,9 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                error("snd_config_compound_add: %s", snd_strerror(err));
                return err;
        }
-       err = snd_config_compound_add(control, "comment", 1, &comment);
+       err = snd_config_make_compound(&comment, "comment", 0);
        if (err < 0) {
-               error("snd_config_compound_add: %s", snd_strerror(err));
+               error("snd_config_make_compound: %s", snd_strerror(err));
                return err;
        }
 
@@ -432,7 +432,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                        error("snd_config_string_add: %s", snd_strerror(err));
                        return err;
                }
-               return 0;
+               goto finish;
        }
        default:
                break;
@@ -446,21 +446,21 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                                error("snd_config_string_add: %s", snd_strerror(err));
                                return err;
                        }
-                       return 0;
+                       goto finish;
                case SND_CTL_ELEM_TYPE_INTEGER:
                        err = snd_config_integer_add(control, "value", snd_ctl_elem_value_get_integer(ctl, 0));
                        if (err < 0) {
                                error("snd_config_integer_add: %s", snd_strerror(err));
                                return err;
                        }
-                       return 0;
+                       goto finish;
                case SND_CTL_ELEM_TYPE_INTEGER64:
                        err = snd_config_integer64_add(control, "value", snd_ctl_elem_value_get_integer64(ctl, 0));
                        if (err < 0) {
                                error("snd_config_integer64_add: %s", snd_strerror(err));
                                return err;
                        }
-                       return 0;
+                       goto finish;
                case SND_CTL_ELEM_TYPE_ENUMERATED:
                {
                        unsigned int v = snd_ctl_elem_value_get_enumerated(ctl, 0);
@@ -475,7 +475,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                        }
                        if (err < 0)
                                error("snd_config add: %s", snd_strerror(err));
-                       return 0;
+                       goto finish;
                }
                default:
                        error("Unknown control type: %d\n", type);
@@ -540,6 +540,12 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t
                return -EINVAL;
        }
        
+finish:
+       err = snd_config_add(control, comment);
+       if (err < 0) {
+               error("snd_config_add: %s", snd_strerror(err));
+               return err;
+       }
        return 0;
 }