[gcr] Make gcr oids work between ui and base libraries
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] Make gcr oids work between ui and base libraries
- Date: Thu, 14 Feb 2013 15:23:37 +0000 (UTC)
commit 546f1550daef8e15de8f2ee4f6f8dba7668fc93d
Author: Gabor Adam Toth <tg tgbit net>
Date: Fri Jan 25 20:08:01 2013 +0100
Make gcr oids work between ui and base libraries
https://bugzilla.gnome.org/show_bug.cgi?id=693591
gcr/gcr-certificate-extensions.c | 2 --
gcr/gcr-certificate-request.c | 2 --
gcr/gcr-certificate.c | 2 --
gcr/gcr-mkoids | 30 +++++++++++++++++-------------
gcr/gcr-parser.c | 2 --
gcr/gcr-subject-public-key.c | 4 ----
ui/gcr-certificate-renderer.c | 2 --
ui/gcr-certificate-request-renderer.c | 2 --
8 files changed, 17 insertions(+), 29 deletions(-)
---
diff --git a/gcr/gcr-certificate-extensions.c b/gcr/gcr-certificate-extensions.c
index 6b8033c..e1856a7 100644
--- a/gcr/gcr-certificate-extensions.c
+++ b/gcr/gcr-certificate-extensions.c
@@ -269,8 +269,6 @@ _gcr_certificate_extension_subject_alt_name (GBytes *data)
GcrGeneralName general;
GNode *choice;
- _gcr_oids_init ();
-
asn = egg_asn1x_create_and_decode (pkix_asn1_tab, "SubjectAltName", data);
if (asn == NULL)
return NULL;
diff --git a/gcr/gcr-certificate-request.c b/gcr/gcr-certificate-request.c
index 686ed06..d772ac9 100644
--- a/gcr/gcr-certificate-request.c
+++ b/gcr/gcr-certificate-request.c
@@ -195,8 +195,6 @@ gcr_certificate_request_class_init (GcrCertificateRequestClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- _gcr_oids_init ();
-
gobject_class->constructed = gcr_certificate_request_constructed;
gobject_class->finalize = gcr_certificate_request_finalize;
gobject_class->set_property = gcr_certificate_request_set_property;
diff --git a/gcr/gcr-certificate.c b/gcr/gcr-certificate.c
index 1327108..caaa819 100644
--- a/gcr/gcr-certificate.c
+++ b/gcr/gcr-certificate.c
@@ -249,8 +249,6 @@ gcr_certificate_default_init (GcrCertificateIface *iface)
static volatile gsize initialized = 0;
if (g_once_init_enter (&initialized)) {
- _gcr_oids_init ();
-
CERTIFICATE_INFO = g_quark_from_static_string ("_gcr_certificate_certificate_info");
g_object_interface_install_property (iface,
diff --git a/gcr/gcr-mkoids b/gcr/gcr-mkoids
index 47d1095..b0eb5c4 100644
--- a/gcr/gcr-mkoids
+++ b/gcr/gcr-mkoids
@@ -11,11 +11,13 @@ generate_header ()
echo "#ifndef ${UPPER}_OIDS_"
echo "#define ${UPPER}_OIDS_"
echo ""
- echo "void _${LOWER}_oids_init (void);"
while read name oid; do
if [ -n "$name" ]; then
- echo "GQuark ${UPPER}_OID_${name};"
+ lname=$(echo "$name" | tr '[:upper:]' '[:lower:]')
+ echo "GQuark _${LOWER}_oid_${lname}_get_quark (void) G_GNUC_CONST;"
+ echo "#define ${UPPER}_OID_${name} _${LOWER}_oid_${lname}_get_quark ()"
+ echo ""
fi
done
@@ -30,21 +32,23 @@ generate_source ()
echo "#include \"$HEADER\""
echo ""
- echo "void"
- echo "_${LOWER}_oids_init (void)"
- echo "{"
- echo " static volatile gsize initialized = 0;"
- echo " if (g_once_init_enter (&initialized)) {"
-
while read name oid; do
if [ -n "$name" ]; then
- echo " ${UPPER}_OID_${name} = g_quark_from_static_string (\"${oid}\");"
+ lname=$(echo "$name" | tr '[:upper:]' '[:lower:]')
+ echo "GQuark"
+ echo "_${LOWER}_oid_${lname}_get_quark (void)"
+ echo "{"
+ echo " static volatile gsize inited = 0;"
+ echo " static GQuark quark = 0;"
+ echo " if (g_once_init_enter (&inited)) {"
+ echo " quark = g_quark_from_static_string (\"${oid}\");"
+ echo " g_once_init_leave (&inited, 1);"
+ echo " }"
+ echo " return quark;"
+ echo "}"
+ echo ""
fi
done
-
- echo " g_once_init_leave (&initialized, 1);"
- echo " }"
- echo "}"
}
UPPER="PREFIX"
diff --git a/gcr/gcr-parser.c b/gcr/gcr-parser.c
index 4e1f31e..594e66a 100644
--- a/gcr/gcr-parser.c
+++ b/gcr/gcr-parser.c
@@ -185,8 +185,6 @@ init_quarks (void)
{
static volatile gsize quarks_inited = 0;
- _gcr_oids_init ();
-
if (g_once_init_enter (&quarks_inited)) {
#define QUARK(name, value) \
diff --git a/gcr/gcr-subject-public-key.c b/gcr/gcr-subject-public-key.c
index 46c8d42..7896531 100644
--- a/gcr/gcr-subject-public-key.c
+++ b/gcr/gcr-subject-public-key.c
@@ -530,8 +530,6 @@ rsa_subject_public_key_from_attributes (GckAttributes *attrs,
GBytes *key;
GBytes *usg;
- _gcr_oids_init ();
-
modulus = gck_attributes_find (attrs, CKA_MODULUS);
exponent = gck_attributes_find (attrs, CKA_PUBLIC_EXPONENT);
if (modulus == NULL || gck_attribute_is_invalid (modulus) ||
@@ -624,8 +622,6 @@ dsa_subject_public_key_from_attributes (GckAttributes *attrs,
GNode *key_asn, *params_asn;
GBytes *key;
- _gcr_oids_init ();
-
p = gck_attributes_find (attrs, CKA_PRIME);
q = gck_attributes_find (attrs, CKA_SUBPRIME);
g = gck_attributes_find (attrs, CKA_BASE);
diff --git a/ui/gcr-certificate-renderer.c b/ui/gcr-certificate-renderer.c
index 1c06345..e730357 100644
--- a/ui/gcr-certificate-renderer.c
+++ b/ui/gcr-certificate-renderer.c
@@ -420,8 +420,6 @@ gcr_certificate_renderer_class_init (GcrCertificateRendererClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GckBuilder builder = GCK_BUILDER_INIT;
- _gcr_oids_init ();
-
gcr_certificate_renderer_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (GcrCertificateRendererPrivate));
diff --git a/ui/gcr-certificate-request-renderer.c b/ui/gcr-certificate-request-renderer.c
index 1985346..5d72da1 100644
--- a/ui/gcr-certificate-request-renderer.c
+++ b/ui/gcr-certificate-request-renderer.c
@@ -171,8 +171,6 @@ _gcr_certificate_request_renderer_class_init (GcrCertificateRequestRendererClass
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GckBuilder builder = GCK_BUILDER_INIT;
- _gcr_oids_init ();
-
g_type_class_add_private (klass, sizeof (GcrCertificateRequestRendererPrivate));
gobject_class->finalize = _gcr_certificate_request_renderer_finalize;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]