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

Re: [libvirt] [PATCH libvirt-glib 4/5] Cleanup streams coding style violations



ACK

On Mon, Nov 28, 2011 at 01:13:47PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange redhat com>
> 
> ---
>  libvirt-gobject/libvirt-gobject-input-stream.c  |   39 ++++++++++---------
>  libvirt-gobject/libvirt-gobject-input-stream.h  |   27 +++++--------
>  libvirt-gobject/libvirt-gobject-output-stream.c |   16 ++++----
>  libvirt-gobject/libvirt-gobject-output-stream.h |   27 +++++--------
>  libvirt-gobject/libvirt-gobject-stream.c        |   47 ++++++++++++++++-------
>  libvirt-gobject/libvirt-gobject-stream.h        |   24 +++++++++--
>  6 files changed, 102 insertions(+), 78 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-input-stream.c b/libvirt-gobject/libvirt-gobject-input-stream.c
> index 39459c4..06ea716 100644
> --- a/libvirt-gobject/libvirt-gobject-input-stream.c
> +++ b/libvirt-gobject/libvirt-gobject-input-stream.c
> @@ -54,9 +54,9 @@ struct _GVirInputStreamPrivate
>      gsize count;
>  };
>  
> -static void gvir_input_stream_get_property(GObject    *object,
> -                                           guint       prop_id,
> -                                           GValue     *value,
> +static void gvir_input_stream_get_property(GObject *object,
> +                                           guint prop_id,
> +                                           GValue *value,
>                                             GParamSpec *pspec)
>  {
>      GVirInputStream *stream = GVIR_INPUT_STREAM(object);
> @@ -71,10 +71,10 @@ static void gvir_input_stream_get_property(GObject    *object,
>      }
>  }
>  
> -static void gvir_input_stream_set_property(GObject      *object,
> -                                           guint         prop_id,
> +static void gvir_input_stream_set_property(GObject *object,
> +                                           guint prop_id,
>                                             const GValue *value,
> -                                           GParamSpec   *pspec)
> +                                           GParamSpec *pspec)
>  {
>      GVirInputStream *stream = GVIR_INPUT_STREAM(object);
>  
> @@ -100,8 +100,9 @@ static void gvir_input_stream_finalize(GObject *object)
>  }
>  
>  static void
> -gvir_input_stream_read_ready (G_GNUC_UNUSED virStreamPtr st,
> -                              int events, void *opaque)
> +gvir_input_stream_read_ready(virStreamPtr st G_GNUC_UNUSED,
> +                             int events,
> +                             void *opaque)
>  {
>      GVirInputStream *stream = GVIR_INPUT_STREAM(opaque);
>      GVirInputStreamPrivate *priv = stream->priv;
> @@ -139,13 +140,13 @@ gvir_input_stream_read_ready (G_GNUC_UNUSED virStreamPtr st,
>      return;
>  }
>  
> -static void gvir_input_stream_read_async(GInputStream        *stream,
> -                                         void                *buffer,
> -                                         gsize                count,
> -                                         G_GNUC_UNUSED int    io_priority,
> -                                         GCancellable        *cancellable,
> -                                         GAsyncReadyCallback  callback,
> -                                         gpointer             user_data)
> +static void gvir_input_stream_read_async(GInputStream *stream,
> +                                         void *buffer,
> +                                         gsize count,
> +                                         int io_priority G_GNUC_UNUSED,
> +                                         GCancellable *cancellable,
> +                                         GAsyncReadyCallback callback,
> +                                         gpointer user_data)
>  {
>      GVirInputStream *input_stream = GVIR_INPUT_STREAM(stream);
>      virStreamPtr handle;
> @@ -180,9 +181,9 @@ end:
>  }
>  
>  
> -static gssize gvir_input_stream_read_finish(GInputStream  *stream,
> -                                            GAsyncResult  *result,
> -                                            G_GNUC_UNUSED GError **error)
> +static gssize gvir_input_stream_read_finish(GInputStream *stream,
> +                                            GAsyncResult *result,
> +                                            GError **error G_GNUC_UNUSED)
>  {
>      GVirInputStream *input_stream = GVIR_INPUT_STREAM(stream);
>      GSimpleAsyncResult *simple;
> @@ -233,7 +234,7 @@ static void gvir_input_stream_init(GVirInputStream *stream)
>      stream->priv = G_TYPE_INSTANCE_GET_PRIVATE(stream, GVIR_TYPE_INPUT_STREAM, GVirInputStreamPrivate);
>  }
>  
> -GVirInputStream* _gvir_input_stream_new(GVirStream *stream)
> +GVirInputStream *_gvir_input_stream_new(GVirStream *stream)
>  {
>      return GVIR_INPUT_STREAM(g_object_new(GVIR_TYPE_INPUT_STREAM, "stream", stream, NULL));
>  }
> diff --git a/libvirt-gobject/libvirt-gobject-input-stream.h b/libvirt-gobject/libvirt-gobject-input-stream.h
> index e8002b9..3c9b4b8 100644
> --- a/libvirt-gobject/libvirt-gobject-input-stream.h
> +++ b/libvirt-gobject/libvirt-gobject-input-stream.h
> @@ -33,21 +33,16 @@
>  
>  G_BEGIN_DECLS
>  
> -#define GVIR_TYPE_INPUT_STREAM                          (_gvir_input_stream_get_type ())
> -#define GVIR_INPUT_STREAM(inst)                         (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
> -                                                         GVIR_TYPE_INPUT_STREAM, GVirInputStream))
> -#define GVIR_INPUT_STREAM_CLASS(class)                  (G_TYPE_CHECK_CLASS_CAST ((class), \
> -                                                         GVIR_TYPE_INPUT_STREAM, GVirInputStreamClass))
> -#define GVIR_IS_INPUT_STREAM(inst)                      (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
> -                                                         GVIR_TYPE_INPUT_STREAM))
> -#define GVIR_IS_INPUT_STREAM_CLASS(class)               (G_TYPE_CHECK_CLASS_TYPE ((class), \
> -                                                         GVIR_TYPE_INPUT_STREAM))
> -#define GVIR_INPUT_STREAM_GET_CLASS(inst)               (G_TYPE_INSTANCE_GET_CLASS ((inst), \
> -                                                         GVIR_TYPE_INPUT_STREAM, GVirInputStreamClass))
> +#define GVIR_TYPE_INPUT_STREAM            (_gvir_input_stream_get_type ())
> +#define GVIR_INPUT_STREAM(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), GVIR_TYPE_INPUT_STREAM, GVirInputStream))
> +#define GVIR_INPUT_STREAM_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), GVIR_TYPE_INPUT_STREAM, GVirInputStreamClass))
> +#define GVIR_IS_INPUT_STREAM(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GVIR_TYPE_INPUT_STREAM))
> +#define GVIR_IS_INPUT_STREAM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GVIR_TYPE_INPUT_STREAM))
> +#define GVIR_INPUT_STREAM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GVIR_TYPE_INPUT_STREAM, GVirInputStreamClass))
>  
> -typedef struct _GVirInputStreamPrivate                   GVirInputStreamPrivate;
> -typedef struct _GVirInputStreamClass                     GVirInputStreamClass;
> -typedef struct _GVirInputStream                          GVirInputStream;
> +typedef struct _GVirInputStreamPrivate GVirInputStreamPrivate;
> +typedef struct _GVirInputStreamClass GVirInputStreamClass;
> +typedef struct _GVirInputStream  GVirInputStream;
>  
>  struct _GVirInputStreamClass
>  {
> @@ -60,8 +55,8 @@ struct _GVirInputStream
>      GVirInputStreamPrivate *priv;
>  };
>  
> -GType                _gvir_input_stream_get_type                 (void) G_GNUC_CONST;
> -GVirInputStream *    _gvir_input_stream_new                      (GVirStream *stream);
> +GType _gvir_input_stream_get_type(void) G_GNUC_CONST;
> +GVirInputStream *_gvir_input_stream_new(GVirStream *stream);
>  
>  G_END_DECLS
>  
> diff --git a/libvirt-gobject/libvirt-gobject-output-stream.c b/libvirt-gobject/libvirt-gobject-output-stream.c
> index 30ee519..74eddc5 100644
> --- a/libvirt-gobject/libvirt-gobject-output-stream.c
> +++ b/libvirt-gobject/libvirt-gobject-output-stream.c
> @@ -54,9 +54,9 @@ struct _GVirOutputStreamPrivate
>      gsize count;
>  };
>  
> -static void gvir_output_stream_get_property(GObject    *object,
> -                                            guint       prop_id,
> -                                            GValue     *value,
> +static void gvir_output_stream_get_property(GObject *object,
> +                                            guint prop_id,
> +                                            GValue *value,
>                                              GParamSpec *pspec)
>  {
>      GVirOutputStream *stream = GVIR_OUTPUT_STREAM(object);
> @@ -71,10 +71,10 @@ static void gvir_output_stream_get_property(GObject    *object,
>      }
>  }
>  
> -static void gvir_output_stream_set_property(GObject      *object,
> -                                            guint         prop_id,
> +static void gvir_output_stream_set_property(GObject *object,
> +                                            guint prop_id,
>                                              const GValue *value,
> -                                            GParamSpec   *pspec)
> +                                            GParamSpec *pspec)
>  {
>      GVirOutputStream *stream = GVIR_OUTPUT_STREAM(object);
>  
> @@ -181,8 +181,8 @@ end:
>  }
>  
>  
> -static gssize gvir_output_stream_write_finish(GOutputStream  *stream,
> -                                              GAsyncResult  *result,
> +static gssize gvir_output_stream_write_finish(GOutputStream *stream,
> +                                              GAsyncResult *result,
>                                                GError **error G_GNUC_UNUSED)
>  {
>      GVirOutputStream *output_stream = GVIR_OUTPUT_STREAM(stream);
> diff --git a/libvirt-gobject/libvirt-gobject-output-stream.h b/libvirt-gobject/libvirt-gobject-output-stream.h
> index 0ca0053..dd1d651 100644
> --- a/libvirt-gobject/libvirt-gobject-output-stream.h
> +++ b/libvirt-gobject/libvirt-gobject-output-stream.h
> @@ -33,21 +33,16 @@
>  
>  G_BEGIN_DECLS
>  
> -#define GVIR_TYPE_OUTPUT_STREAM                          (_gvir_output_stream_get_type ())
> -#define GVIR_OUTPUT_STREAM(inst)                         (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
> -                                                         GVIR_TYPE_OUTPUT_STREAM, GVirOutputStream))
> -#define GVIR_OUTPUT_STREAM_CLASS(class)                  (G_TYPE_CHECK_CLASS_CAST ((class), \
> -                                                         GVIR_TYPE_OUTPUT_STREAM, GVirOutputStreamClass))
> -#define GVIR_IS_OUTPUT_STREAM(inst)                      (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
> -                                                         GVIR_TYPE_OUTPUT_STREAM))
> -#define GVIR_IS_OUTPUT_STREAM_CLASS(class)               (G_TYPE_CHECK_CLASS_TYPE ((class), \
> -                                                         GVIR_TYPE_OUTPUT_STREAM))
> -#define GVIR_OUTPUT_STREAM_GET_CLASS(inst)               (G_TYPE_INSTANCE_GET_CLASS ((inst), \
> -                                                         GVIR_TYPE_OUTPUT_STREAM, GVirOutputStreamClass))
> +#define GVIR_TYPE_OUTPUT_STREAM            (_gvir_output_stream_get_type ())
> +#define GVIR_OUTPUT_STREAM(inst)           (G_TYPE_CHECK_INSTANCE_CAST ((inst), GVIR_TYPE_OUTPUT_STREAM, GVirOutputStream))
> +#define GVIR_OUTPUT_STREAM_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), GVIR_TYPE_OUTPUT_STREAM, GVirOutputStreamClass))
> +#define GVIR_IS_OUTPUT_STREAM(inst)        (G_TYPE_CHECK_INSTANCE_TYPE ((inst), GVIR_TYPE_OUTPUT_STREAM))
> +#define GVIR_IS_OUTPUT_STREAM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GVIR_TYPE_OUTPUT_STREAM))
> +#define GVIR_OUTPUT_STREAM_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GVIR_TYPE_OUTPUT_STREAM, GVirOutputStreamClass))
>  
> -typedef struct _GVirOutputStreamPrivate                   GVirOutputStreamPrivate;
> -typedef struct _GVirOutputStreamClass                     GVirOutputStreamClass;
> -typedef struct _GVirOutputStream                          GVirOutputStream;
> +typedef struct _GVirOutputStreamPrivate GVirOutputStreamPrivate;
> +typedef struct _GVirOutputStreamClass GVirOutputStreamClass;
> +typedef struct _GVirOutputStream GVirOutputStream;
>  
>  struct _GVirOutputStreamClass
>  {
> @@ -60,8 +55,8 @@ struct _GVirOutputStream
>      GVirOutputStreamPrivate *priv;
>  };
>  
> -GType                _gvir_output_stream_get_type                 (void) G_GNUC_CONST;
> -GVirOutputStream *   _gvir_output_stream_new                      (GVirStream *stream);
> +GType _gvir_output_stream_get_type(void) G_GNUC_CONST;
> +GVirOutputStream *_gvir_output_stream_new(GVirStream *stream);
>  
>  G_END_DECLS
>  
> diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
> index 03b2c84..8cd3cef 100644
> --- a/libvirt-gobject/libvirt-gobject-stream.c
> +++ b/libvirt-gobject/libvirt-gobject-stream.c
> @@ -102,7 +102,8 @@ static GOutputStream* gvir_stream_get_output_stream(GIOStream *io_stream)
>  
>  
>  static gboolean gvir_stream_close(GIOStream *io_stream,
> -                                  GCancellable *cancellable, G_GNUC_UNUSED GError **error)
> +                                  GCancellable *cancellable,
> +                                  G_GNUC_UNUSED GError **error)
>  {
>      GVirStream *self = GVIR_STREAM(io_stream);
>  
> @@ -116,8 +117,10 @@ static gboolean gvir_stream_close(GIOStream *io_stream,
>  }
>  
>  
> -static void gvir_stream_close_async(GIOStream *stream, G_GNUC_UNUSED int io_priority,
> -                                    GCancellable *cancellable, GAsyncReadyCallback callback,
> +static void gvir_stream_close_async(GIOStream *stream,
> +                                    int io_priority G_GNUC_UNUSED,
> +                                    GCancellable *cancellable,
> +                                    GAsyncReadyCallback callback,
>                                      gpointer user_data)
>  {
>      GSimpleAsyncResult *res;
> @@ -146,9 +149,9 @@ static void gvir_stream_close_async(GIOStream *stream, G_GNUC_UNUSED int io_prio
>  
>  
>  static gboolean
> -gvir_stream_close_finish(G_GNUC_UNUSED GIOStream *stream,
> -                         G_GNUC_UNUSED GAsyncResult *result,
> -                         G_GNUC_UNUSED GError **error)
> +gvir_stream_close_finish(GIOStream *stream G_GNUC_UNUSED,
> +                         GAsyncResult *result G_GNUC_UNUSED,
> +                         GError **error G_GNUC_UNUSED)
>  {
>      return TRUE;
>  }
> @@ -301,8 +304,11 @@ G_DEFINE_BOXED_TYPE(GVirStreamHandle, gvir_stream_handle,
>   * Returns: Number of bytes read, or 0 if the end of stream reached,
>   * or -1 on error.
>   */
> -gssize gvir_stream_receive(GVirStream *self, gchar *buffer, gsize size,
> -                           GCancellable *cancellable, GError **error)
> +gssize gvir_stream_receive(GVirStream *self,
> +                           gchar *buffer,
> +                           gsize size,
> +                           GCancellable *cancellable,
> +                           GError **error)
>  {
>      int got;
>  
> @@ -332,7 +338,9 @@ struct stream_sink_helper {
>  
>  static int
>  stream_sink(virStreamPtr st G_GNUC_UNUSED,
> -            const char *bytes, size_t nbytes, void *opaque)
> +            const char *bytes,
> +            size_t nbytes,
> +            void *opaque)
>  {
>    struct stream_sink_helper *helper = opaque;
>  
> @@ -351,7 +359,10 @@ stream_sink(virStreamPtr st G_GNUC_UNUSED,
>   * to virStreamRecv, for apps that do blocking-I/o.
>   */
>  gssize
> -gvir_stream_receive_all(GVirStream *self, GVirStreamSinkFunc func, gpointer user_data, GError **err)
> +gvir_stream_receive_all(GVirStream *self,
> +                        GVirStreamSinkFunc func,
> +                        gpointer user_data,
> +                        GError **err)
>  {
>      struct stream_sink_helper helper = {
>          .self = self,
> @@ -397,8 +408,11 @@ gvir_stream_receive_all(GVirStream *self, GVirStreamSinkFunc func, gpointer user
>   * Returns: Number of bytes read, or 0 if the end of stream reached,
>   * or -1 on error.
>   */
> -gssize gvir_stream_send(GVirStream *self, const gchar *buffer, gsize size,
> -                        GCancellable *cancellable, GError **error)
> +gssize gvir_stream_send(GVirStream *self,
> +                        const gchar *buffer,
> +                        gsize size,
> +                        GCancellable *cancellable,
> +                        GError **error)
>  {
>      int got;
>  
> @@ -428,7 +442,9 @@ struct stream_source_helper {
>  
>  static int
>  stream_source(virStreamPtr st G_GNUC_UNUSED,
> -              char *bytes, size_t nbytes, void *opaque)
> +              char *bytes,
> +              size_t nbytes,
> +              void *opaque)
>  {
>    struct stream_source_helper *helper = opaque;
>  
> @@ -447,7 +463,10 @@ stream_source(virStreamPtr st G_GNUC_UNUSED,
>   * to virStreamRecv, for apps that do blocking-I/o.
>   */
>  gssize
> -gvir_stream_send_all(GVirStream *self, GVirStreamSourceFunc func, gpointer user_data, GError **err)
> +gvir_stream_send_all(GVirStream *self,
> +                     GVirStreamSourceFunc func,
> +                     gpointer user_data,
> +                     GError **err)
>  {
>      struct stream_source_helper helper = {
>          .self = self,
> diff --git a/libvirt-gobject/libvirt-gobject-stream.h b/libvirt-gobject/libvirt-gobject-stream.h
> index e0004b2..2719ff3 100644
> --- a/libvirt-gobject/libvirt-gobject-stream.h
> +++ b/libvirt-gobject/libvirt-gobject-stream.h
> @@ -110,11 +110,25 @@ gint gvir_stream_add_watch(GVirStream *stream,
>                             gpointer opaque,
>                             GDestroyNotify notify);
>  
> -gssize gvir_stream_receive_all(GVirStream *stream, GVirStreamSinkFunc func, gpointer user_data, GError **error);
> -gssize gvir_stream_receive(GVirStream *stream, gchar *buffer, gsize size, GCancellable *cancellable, GError **error);
> -
> -gssize gvir_stream_send_all(GVirStream *stream, GVirStreamSourceFunc func, gpointer user_data, GError **error);
> -gssize gvir_stream_send(GVirStream *stream, const gchar *buffer, gsize size, GCancellable *cancellable, GError **error);
> +gssize gvir_stream_receive_all(GVirStream *stream,
> +                               GVirStreamSinkFunc func,
> +                               gpointer user_data,
> +                               GError **error);
> +gssize gvir_stream_receive(GVirStream *stream,
> +                           gchar *buffer,
> +                           gsize size,
> +                           GCancellable *cancellable,
> +                           GError **error);
> +
> +gssize gvir_stream_send_all(GVirStream *stream,
> +                            GVirStreamSourceFunc func,
> +                            gpointer user_data,
> +                            GError **error);
> +gssize gvir_stream_send(GVirStream *stream,
> +                        const gchar *buffer,
> +                        gsize size,
> +                        GCancellable *cancellable,
> +                        GError **error);
>  
>  G_END_DECLS
>  
> -- 
> 1.7.6.4
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpPa2MFk6Wsu.pgp
Description: PGP signature


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