[PATCH] pulse: Use more intuitive indexing with port infos in introspect.c.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pushed.

-- Tanu

On Fri, 2012-04-13 at 14:32 +0300, Tanu Kaskinen wrote:
> ---
>  src/pulse/introspect.c |   28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
> index 38a9d1c..6e07494 100644
> --- a/src/pulse/introspect.c
> +++ b/src/pulse/introspect.c
> @@ -204,22 +204,22 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
>                      i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
>  
>                      for (j = 0; j < i.n_ports; j++) {
> -                        if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
> -                            pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
> -                            pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
> +                        i.ports[j] = &i.ports[0][j];
> +
> +                        if (pa_tagstruct_gets(t, &i.ports[j]->name) < 0 ||
> +                            pa_tagstruct_gets(t, &i.ports[j]->description) < 0 ||
> +                            pa_tagstruct_getu32(t, &i.ports[j]->priority) < 0) {
>  
>                              goto fail;
>                          }
>  
> -                        i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
> +                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
>                          if (o->context->version >= 24) {
>                              uint32_t av;
>                              if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
>                                  goto fail;
> -                            i.ports[0][j].available = av;
> +                            i.ports[j]->available = av;
>                          }
> -
> -                        i.ports[j] = &i.ports[0][j];
>                      }
>  
>                      i.ports[j] = NULL;
> @@ -477,22 +477,22 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
>                      i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
>  
>                      for (j = 0; j < i.n_ports; j++) {
> -                        if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
> -                            pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
> -                            pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
> +                        i.ports[j] = &i.ports[0][j];
> +
> +                        if (pa_tagstruct_gets(t, &i.ports[j]->name) < 0 ||
> +                            pa_tagstruct_gets(t, &i.ports[j]->description) < 0 ||
> +                            pa_tagstruct_getu32(t, &i.ports[j]->priority) < 0) {
>  
>                              goto fail;
>                          }
>  
> -                        i.ports[0][j].available = PA_PORT_AVAILABLE_UNKNOWN;
> +                        i.ports[j]->available = PA_PORT_AVAILABLE_UNKNOWN;
>                          if (o->context->version >= 24) {
>                              uint32_t av;
>                              if (pa_tagstruct_getu32(t, &av) < 0 || av > PA_PORT_AVAILABLE_YES)
>                                  goto fail;
> -                            i.ports[0][j].available = av;
> +                            i.ports[j]->available = av;
>                          }
> -
> -                        i.ports[j] = &i.ports[0][j];
>                      }
>  
>                      i.ports[j] = NULL;




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux