[evolution-data-server] Add camel_cert_unref().



commit 88e817dd7179c93de5eafe3bbcbe219bbe91b47b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Sep 22 10:30:26 2013 -0400

    Add camel_cert_unref().
    
    Replaces camel_certdb_cert_unref(); removes the CamelCertDB argument.

 camel/camel-certdb.c                    |   19 ++++++++-----------
 camel/camel-certdb.h                    |    2 +-
 camel/camel-tcp-stream-ssl.c            |    2 +-
 docs/reference/camel/camel-sections.txt |    2 +-
 4 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/camel/camel-certdb.c b/camel/camel-certdb.c
index 59db3f9..e0bd961 100644
--- a/camel/camel-certdb.c
+++ b/camel/camel-certdb.c
@@ -279,9 +279,8 @@ certdb_cert_load (CamelCertDB *certdb,
 
        return cert;
 
- error:
-
-       camel_certdb_cert_unref (certdb, cert);
+error:
+       camel_cert_unref (cert);
 
        return NULL;
 }
@@ -536,10 +535,10 @@ camel_certdb_put (CamelCertDB *certdb,
 
        /* Replace an existing entry with the same hostname. */
        old_cert = g_hash_table_lookup (certdb->cert_hash, key);
-       if (old_cert) {
+       if (old_cert != NULL) {
                g_hash_table_remove (certdb->cert_hash, key);
                g_ptr_array_remove (certdb->certs, old_cert);
-               camel_certdb_cert_unref (certdb, old_cert);
+               camel_cert_unref (old_cert);
        }
 
        camel_cert_ref (cert);
@@ -573,10 +572,10 @@ camel_certdb_remove_host (CamelCertDB *certdb,
 
        key = certdb_key_new (hostname, fingerprint);
        cert = g_hash_table_lookup (certdb->cert_hash, key);
-       if (cert) {
+       if (cert != NULL) {
                g_hash_table_remove (certdb->cert_hash, key);
                g_ptr_array_remove (certdb->certs, cert);
-               camel_certdb_cert_unref (certdb, cert);
+               camel_cert_unref (cert);
 
                certdb->flags |= CAMEL_CERTDB_DIRTY;
        }
@@ -607,10 +606,8 @@ camel_cert_ref (CamelCert *cert)
 }
 
 void
-camel_certdb_cert_unref (CamelCertDB *certdb,
-                         CamelCert *cert)
+camel_cert_unref (CamelCert *cert)
 {
-       g_return_if_fail (CAMEL_IS_CERTDB (certdb));
        g_return_if_fail (cert != NULL);
        g_return_if_fail (cert->refcount > 0);
 
@@ -648,7 +645,7 @@ camel_certdb_clear (CamelCertDB *certdb)
        g_hash_table_foreach_remove (certdb->cert_hash, cert_remove, NULL);
        for (i = 0; i < certdb->certs->len; i++) {
                cert = (CamelCert *) certdb->certs->pdata[i];
-               camel_certdb_cert_unref (certdb, cert);
+               camel_cert_unref (cert);
        }
 
        certdb->saved_certs = 0;
diff --git a/camel/camel-certdb.h b/camel/camel-certdb.h
index 276994c..e2f5f74 100644
--- a/camel/camel-certdb.h
+++ b/camel/camel-certdb.h
@@ -141,7 +141,7 @@ void camel_certdb_remove_host (CamelCertDB *certdb, const gchar *hostname, const
 
 CamelCert *camel_cert_new (void);
 void camel_cert_ref (CamelCert *cert);
-void camel_certdb_cert_unref (CamelCertDB *certdb, CamelCert *cert);
+void camel_cert_unref (CamelCert *cert);
 
 void camel_certdb_clear (CamelCertDB *certdb);
 
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 946a0fd..4ac2317 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -532,7 +532,7 @@ ssl_bad_cert (gpointer data,
                accept = ccert->trust != CAMEL_CERT_TRUST_NEVER;
        }
 
-       camel_certdb_cert_unref (certdb, ccert);
+       camel_cert_unref (ccert);
        camel_certdb_save (certdb);
        g_object_unref (certdb);
 
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 5f1de3c..44a9705 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -97,7 +97,7 @@ camel_certdb_put
 camel_certdb_remove_host
 camel_cert_new
 camel_cert_ref
-camel_certdb_cert_unref
+camel_cert_unref
 camel_certdb_clear
 camel_cert_get_string
 camel_cert_set_string


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