[gcr/nielsdg/remove-gcr-comparable] gcr: Drop the GcrComparable interface
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr/nielsdg/remove-gcr-comparable] gcr: Drop the GcrComparable interface
- Date: Fri, 15 Jul 2022 11:13:40 +0000 (UTC)
commit 7ea633f385545e46a329e42d535abb23991c6bd5
Author: Niels De Graef <nielsdegraef gmail com>
Date: Fri Jul 15 13:11:24 2022 +0200
gcr: Drop the GcrComparable interface
We aren't using it for anything nor is anybody create a custom
comparable interface. Applications that want to do sorting problably
have a better idea on how they want to sort things (and might want to
deal with it differently, like extending `GtkSorter` for example)
gcr/Gcr-4.metadata | 2 -
gcr/gcr-certificate.c | 72 +----------------------------
gcr/gcr-certificate.h | 9 ----
gcr/gcr-comparable.c | 106 -------------------------------------------
gcr/gcr-comparable.h | 49 --------------------
gcr/gcr-pkcs11-certificate.c | 1 -
gcr/gcr-simple-certificate.c | 2 -
gcr/meson.build | 2 -
gcr/test-certificate-chain.c | 1 -
9 files changed, 1 insertion(+), 243 deletions(-)
---
diff --git a/gcr/Gcr-4.metadata b/gcr/Gcr-4.metadata
index c7647fb5..ab4b8584 100644
--- a/gcr/Gcr-4.metadata
+++ b/gcr/Gcr-4.metadata
@@ -6,5 +6,3 @@ Certificate
.subject_name nullable=true
.issuer_name nullable=true
.expiry_date nullable=true
-Comparable
- .memcmp skip=false
diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c
index f0d6d66a..fc2d9e09 100644
--- a/gcr/gcr-certificate.c
+++ b/gcr/gcr-certificate.c
@@ -21,7 +21,6 @@
#include "gcr-certificate.h"
#include "gcr-certificate-extensions.h"
-#include "gcr-comparable.h"
#include "gcr-internal.h"
#include "gcr-subject-public-key.h"
@@ -54,10 +53,6 @@
* You can use a mixin to implement these properties if desired. See the
* gcr_certificate_mixin_class_init() and gcr_certificate_mixin_get_property()
* functions.
- *
- * All certificates are comparable. If implementing a #GcrCertificate, you can
- * use GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE() to implement the #GcrComparable
- * interface.
*/
/**
@@ -243,50 +238,12 @@ gcr_certificate_default_init (GcrCertificateIface *iface)
typedef GcrCertificateIface GcrCertificateInterface;
-G_DEFINE_INTERFACE (GcrCertificate, gcr_certificate, GCR_TYPE_COMPARABLE);
+G_DEFINE_INTERFACE (GcrCertificate, gcr_certificate, G_TYPE_OBJECT);
/* -----------------------------------------------------------------------------
* PUBLIC
*/
-/**
- * gcr_certificate_compare:
- * @first: (nullable): the certificate to compare
- * @other: (nullable): the certificate to compare against
- *
- * Compare one certificate against another. If the certificates are equal
- * then zero is returned. If one certificate is %NULL or not a certificate,
- * then a non-zero value is returned.
- *
- * The return value is useful in a stable sort, but has no user logical
- * meaning.
- *
- * Returns: zero if the certificates match, non-zero otherwise.
- */
-gint
-gcr_certificate_compare (GcrComparable *first, GcrComparable *other)
-{
- gconstpointer data1, data2;
- gsize size1, size2;
-
- if (!GCR_IS_CERTIFICATE (first))
- first = NULL;
- if (!GCR_IS_CERTIFICATE (other))
- other = NULL;
-
- if (first == other)
- return TRUE;
- if (!first)
- return 1;
- if (!other)
- return -1;
-
- data1 = gcr_certificate_get_der_data (GCR_CERTIFICATE (first), &size1);
- data2 = gcr_certificate_get_der_data (GCR_CERTIFICATE (other), &size2);
-
- return gcr_comparable_memcmp (data1, size1, data2, size2);
-}
-
/**
* gcr_certificate_get_der_data: (virtual get_der_data)
@@ -903,19 +860,6 @@ gcr_certificate_get_basic_constraints (GcrCertificate *self,
* MIXIN
*/
-/**
- * GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE:
- *
- * Implement the GcrComparable interface. Use this macro like this:
- *
- * <informalexample><programlisting>
- * G_DEFINE_TYPE_WITH_CODE (MyCertificate, my_certificate, G_TYPE_OBJECT,
- * GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ();
- * G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, my_certificate_iface_init);
- * );
- * </programlisting></informalexample>
- */
-
/**
* gcr_certificate_mixin_emit_notify:
* @self: the #GcrCertificate
@@ -938,20 +882,6 @@ gcr_certificate_mixin_emit_notify (GcrCertificate *self)
g_object_notify (obj, "expiry-date");
}
-/**
- * gcr_certificate_mixin_comparable_init: (skip)
- * @iface: The interface
- *
- * Initialize a #GcrComparableIface to compare the current certificate.
- * In general it's easier to use the GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE()
- * macro instead of this function.
- */
-void
-gcr_certificate_mixin_comparable_init (GcrComparableInterface *iface)
-{
- iface->compare = gcr_certificate_compare;
-}
-
/**
* gcr_certificate_mixin_class_init: (skip)
* @object_class: The GObjectClass for this class
diff --git a/gcr/gcr-certificate.h b/gcr/gcr-certificate.h
index 9f7a1f26..f0df3726 100644
--- a/gcr/gcr-certificate.h
+++ b/gcr/gcr-certificate.h
@@ -25,7 +25,6 @@
#endif
#include "gcr-types.h"
-#include "gcr-comparable.h"
#include <glib-object.h>
#include <gio/gio.h>
@@ -72,9 +71,6 @@ GType gcr_certificate_get_type (void);
const guint8 * gcr_certificate_get_der_data (GcrCertificate *self,
gsize *n_data);
-gint gcr_certificate_compare (GcrComparable *first,
- GcrComparable *other);
-
gchar * gcr_certificate_get_issuer_name (GcrCertificate *self);
gchar* gcr_certificate_get_issuer_cn (GcrCertificate *self);
@@ -124,13 +120,8 @@ gboolean gcr_certificate_get_basic_constraints (GcrCertificate *self
gboolean *is_ca,
gint *path_len);
-#define GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE() \
- G_IMPLEMENT_INTERFACE (GCR_TYPE_COMPARABLE, gcr_certificate_mixin_comparable_init)
-
void gcr_certificate_mixin_emit_notify (GcrCertificate *self);
-void gcr_certificate_mixin_comparable_init (GcrComparableInterface *iface);
-
void gcr_certificate_mixin_class_init (GObjectClass *object_class);
void gcr_certificate_mixin_get_property (GObject *obj,
diff --git a/gcr/gcr-pkcs11-certificate.c b/gcr/gcr-pkcs11-certificate.c
index db35abaf..8c19dca3 100644
--- a/gcr/gcr-pkcs11-certificate.c
+++ b/gcr/gcr-pkcs11-certificate.c
@@ -56,7 +56,6 @@ struct _GcrPkcs11CertificatePrivate {
static void gcr_certificate_iface (GcrCertificateIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrPkcs11Certificate, gcr_pkcs11_certificate, GCK_TYPE_OBJECT,
G_ADD_PRIVATE (GcrPkcs11Certificate);
- GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ();
G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, gcr_certificate_iface);
);
diff --git a/gcr/gcr-simple-certificate.c b/gcr/gcr-simple-certificate.c
index 59bf633a..65de22f8 100644
--- a/gcr/gcr-simple-certificate.c
+++ b/gcr/gcr-simple-certificate.c
@@ -20,7 +20,6 @@
#include "config.h"
#include "gcr-certificate.h"
-#include "gcr-comparable.h"
#include "gcr-internal.h"
#include "gcr-simple-certificate.h"
@@ -45,7 +44,6 @@ static void gcr_simple_certificate_iface_init (GcrCertificateIface *iface);
G_DEFINE_TYPE_WITH_CODE (GcrSimpleCertificate, gcr_simple_certificate, G_TYPE_OBJECT,
G_ADD_PRIVATE (GcrSimpleCertificate);
- GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ();
G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, gcr_simple_certificate_iface_init);
);
diff --git a/gcr/meson.build b/gcr/meson.build
index 414e5c2b..6a1dd747 100644
--- a/gcr/meson.build
+++ b/gcr/meson.build
@@ -5,7 +5,6 @@ gcr_public_sources = files(
'gcr-certificate.c',
'gcr-certificate-chain.c',
'gcr-certificate-request.c',
- 'gcr-comparable.c',
'gcr-fingerprint.c',
'gcr-importer.c',
'gcr-import-interaction.c',
@@ -45,7 +44,6 @@ gcr_headers = files(
'gcr-certificate.h',
'gcr-certificate-chain.h',
'gcr-certificate-request.h',
- 'gcr-comparable.h',
'gcr-fingerprint.h',
'gcr-importer.h',
'gcr-import-interaction.h',
diff --git a/gcr/test-certificate-chain.c b/gcr/test-certificate-chain.c
index 0d8d07f5..1b5ebf0d 100644
--- a/gcr/test-certificate-chain.c
+++ b/gcr/test-certificate-chain.c
@@ -62,7 +62,6 @@ typedef struct _MockCertificateClass {
static void mock_certificate_iface (GcrCertificateIface *iface);
G_DEFINE_TYPE_WITH_CODE (MockCertificate, mock_certificate, G_TYPE_OBJECT,
- GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ();
G_IMPLEMENT_INTERFACE (GCR_TYPE_CERTIFICATE, mock_certificate_iface);
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]