[Spice-devel] [spice-server v2] Make various functions static

Christophe Fergeau cfergeau at redhat.com
Tue Apr 4 10:38:19 UTC 2017


On Wed, Mar 01, 2017 at 06:06:51AM -0500, Frediano Ziglio wrote:
> > 
> > - glz_enc_dictionary_reset
> > - monitors_config_new
> > - red_channel_any_blocked
> > - red_channel_no_item_being_sent
> > - red_client_get_channel
> > - reds_stream_write
> > 
> > are only used in the file where they are defined, so they can as well be
> > static.
> > 
> 
> > diff --git a/server/red-client.h b/server/red-client.h
> > index d7e9cc7..121665a 100644
> > --- a/server/red-client.h
> > +++ b/server/red-client.h
> > @@ -48,7 +48,6 @@ void red_client_destroy(RedClient *client);
> >  
> >  gboolean red_client_add_channel(RedClient *client, RedChannelClient *rcc,
> >  GError **error);
> >  void red_client_remove_channel(RedChannelClient *rcc);
> > -RedChannelClient *red_client_get_channel(RedClient *client, int type, int
> > id);
> >  
> >  MainChannelClient *red_client_get_main(RedClient *client);
> >  // main should be set once before all the other channels are created
> 
> Not sure if this can helpful... but can be made public if needed,
> I don't think is something secret.

If there are no users, I would add API to get it, the more things we
hide, the better imo. And it's indeed very easy to get it back to the
public API when needed.

> 
> > diff --git a/server/reds-stream.c b/server/reds-stream.c
> > index 471989e..15b93d3 100644
> > --- a/server/reds-stream.c
> > +++ b/server/reds-stream.c
> > @@ -99,6 +99,8 @@ struct RedsStreamPrivate {
> >      RedsState *reds;
> >  };
> >  
> > +static ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t
> > nbyte);
> > +
> >  static ssize_t stream_write_cb(RedsStream *s, const void *buf, size_t size)
> >  {
> >      return write(s->socket, buf, size);
> > @@ -214,7 +216,7 @@ bool reds_stream_write_all(RedsStream *stream, const void
> > *in_buf, size_t n)
> >  static ssize_t reds_stream_sasl_write(RedsStream *s, const void *buf, size_t
> >  nbyte);
> >  #endif
> >  
> > -ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte)
> > +static ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t
> > nbyte)
> >  {
> >      ssize_t ret;
> >  
> > diff --git a/server/reds-stream.h b/server/reds-stream.h
> > index a8d1736..d725672 100644
> > --- a/server/reds-stream.h
> > +++ b/server/reds-stream.h
> > @@ -55,7 +55,6 @@ void reds_stream_async_read(RedsStream *stream, uint8_t
> > *data, size_t size,
> >                              AsyncReadDone read_done_cb, void *opaque);
> >  void reds_stream_set_async_error_handler(RedsStream *stream,
> >                                           AsyncReadError error_handler);
> > -ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte);
> >  ssize_t reds_stream_writev(RedsStream *s, const struct iovec *iov, int
> >  iovcnt);
> 
> I think having a write and writev is fine looking at design.

Yeah makes sense to keep both in the public API even if one is not used.

Will send a fairly similar v3.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170404/9e7c5653/attachment.sig>


More information about the Spice-devel mailing list