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