[Spice-devel] [spice-server 2/3] channel: Remove red_channel_client_disconnect_if_pending_send()

Christophe Fergeau cfergeau at redhat.com
Mon Sep 4 07:03:43 UTC 2017


On Fri, Sep 01, 2017 at 06:19:16AM -0400, Frediano Ziglio wrote:
> > 
> > There is exactly one user in RedChannel, and this can be reimplemented
> > using already public RedChannelClient API. No need for an extra
> > function.
> > 
> 
> Actually you are removing a function and adding another.

I'm removing a public function, and replacing it with a static one. I
can indeed be more specific in the log.

> 
> > +        RedChannelClient *rcc = RED_CHANNEL_CLIENT(it->data);
> > +        if (red_channel_client_is_blocked(rcc) ||
> > !red_channel_client_pipe_is_empty(rcc)) {
> > +            red_channel_client_disconnect(rcc);
> > +        } else {
> > +            spice_assert(red_channel_client_no_item_being_sent(rcc));
> > +        }
> > +    }
> > +}
> > +
> 
> Basically you inlined red_channel_client_disconnect_if_pending_send.
> 
> So basically a RedChannel function which calls lot (4) of RedChannelClient
> functions. Well... not a regression but I don't see the gain.
> If you are afraid of a public function maybe an header to shared private
> communication between RedChannel and RedChannelClient is an idea.
> If you are afraid of object size and you want the function to be inlined
> I would push for LTO or have a single module compilation.

Having a public function that differs from
red_channel_client_disconnect() in unclear ways (not documented, not
great name, ...) which is only used once only makes red-channel-client.h
more complicated than it should.
So this really is a "clean up red-channel-client.h API" commit.

Christophe


More information about the Spice-devel mailing list