[Spice-devel] [PATCH spice-gtk v2] spice-channel: Factor out code for storing caps
Victor Toso
victortoso at redhat.com
Mon Jul 3 07:48:35 UTC 2017
Hi,
On Fri, Jun 30, 2017 at 12:12:06PM +0200, Christophe Fergeau wrote:
> On Fri, Jun 30, 2017 at 10:37:36AM +0200, Victor Toso wrote:
> > Hi,
> >
> > On Fri, Jun 30, 2017 at 10:14:27AM +0200, Pavel Grunt wrote:
> > > Signed-off-by: Pavel Grunt <pgrunt at redhat.com>
> > > ---
> > > v2 per Christophe's suggestion:
> > > use GArray as parameter
> > > ---
> > > src/spice-channel.c | 34 ++++++++++++++++++++--------------
> > > 1 file changed, 20 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/src/spice-channel.c b/src/spice-channel.c
> > > index b8cf19c..4c3db9d 100644
> > > --- a/src/spice-channel.c
> > > +++ b/src/spice-channel.c
> > > @@ -1884,11 +1884,25 @@ cleanup:
> > > #endif /* HAVE_SASL */
> > >
> > > /* coroutine context */
> > > +static void store_caps(const uint8_t *caps_src, const GArray *caps_dst)
> > > +{
> > > + uint32_t *caps;
> > > + guint i;
> > > +
> > > + caps = &g_array_index(caps_dst, uint32_t, 0);
> > > + memcpy(caps, caps_src, caps_dst->len * sizeof(uint32_t));
> > > + for (i = 0; i < caps_dst->len; i++, caps++) {
> > > + *caps = GUINT32_FROM_LE(*caps);
> > > + SPICE_DEBUG("\t%u:0x%X", i, *caps);
> > > + }
> > > +}
> >
> > Yes, better
>
> I don't think we'll be able to know from the debug message whether it's
> a channel or common cap though. Maybe add a const char *debug_prefix to
> the call now that you dropped a few args?
>
> Christophe
From that debug alone, you are right but Pavel has added a debug prior
the function call:
CHANNEL_DEBUG(channel, "got remote common caps:");
store_caps(...);
That should be enough, no?
Cheers,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170703/dce2f2f2/attachment.sig>
More information about the Spice-devel
mailing list