Re: [libvirt-glib][PATCH 2/2] gobject: Introduce gvir_connection_get_version

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

 



On Tue, Sep 11, 2012 at 07:42:42PM +0200, Michal Privoznik wrote:
> +gboolean
> +gvir_connection_get_version(GVirConnection *conn,
> +                            gulong *version,
> +                            GError **err)

gulong gvir_connection_get_version(GVirConnection *conn, GError **error)
would feel more natural here as errors can be reported through the GError.

> +{
> +    GVirConnectionPrivate *priv;
> +    virConnectPtr vconn = NULL;
> +    gboolean ret = FALSE;
> +
> +    g_return_val_if_fail(GVIR_IS_CONNECTION(conn), FALSE);

Same comment as in the previous patch, I'd add a
 g_return_val_if_fail(err == NULL || *err == NULL, 0);

> +
> +    priv = conn->priv;
> +    g_mutex_lock(priv->lock);
> +    if (!priv->conn) {
> +        g_set_error_literal(err, GVIR_CONNECTION_ERROR, 0,
> +                            "Connection is not open");
> +        g_mutex_unlock(priv->lock);
> +        goto cleanup;
> +    }
> +
> +    vconn = priv->conn;
> +    /* Stop another thread closing the connection just at the minute */
> +    virConnectRef(vconn);
> +    g_mutex_unlock(priv->lock);
> +
> +    if ( virConnectGetVersion(priv->conn, version) < 0) {

extra space before 'virConnectGetVersion'

Looks good otherwise.

Christophe

Attachment: pgpY9SAD6t2VP.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]