[gnome-keyring/dbus-api] [gck] Rename GckFactoryInfo to GckFactory.



commit 310456e5b7b676ab0e338bf056de95462a601948
Author: Stef Walter <stef memberwebs com>
Date:   Sat Nov 7 22:59:41 2009 +0000

    [gck] Rename GckFactoryInfo to GckFactory.
    
    Makes things cleaner, and allows us to use factory
    constants in better ways.

 pkcs11/gck/gck-authenticator.c                     |    4 ++--
 pkcs11/gck/gck-authenticator.h                     |    2 +-
 pkcs11/gck/gck-certificate.c                       |    4 ++--
 pkcs11/gck/gck-certificate.h                       |    2 +-
 pkcs11/gck/gck-factory.h                           |    8 ++++----
 pkcs11/gck/gck-module.c                            |   18 +++++++++---------
 pkcs11/gck/gck-module.h                            |    4 ++--
 pkcs11/gck/gck-private-key.c                       |    4 ++--
 pkcs11/gck/gck-private-key.h                       |    2 +-
 pkcs11/gck/gck-public-key.c                        |    4 ++--
 pkcs11/gck/gck-public-key.h                        |    2 +-
 pkcs11/gck/gck-session.c                           |    8 ++++----
 pkcs11/gck/gck-session.h                           |    2 +-
 pkcs11/gck/gck-types.h                             |    2 +-
 pkcs11/gck/tests/test-module.c                     |    2 +-
 pkcs11/secret-store/gck-secret-search.c            |    4 ++--
 pkcs11/secret-store/gck-secret-search.h            |    2 +-
 .../secret-store/tests/unit-test-secret-search.c   |    4 ++--
 pkcs11/user-store/gck-user-private-key.c           |    4 ++--
 pkcs11/user-store/gck-user-private-key.h           |    2 +-
 pkcs11/user-store/gck-user-public-key.c            |    4 ++--
 pkcs11/user-store/gck-user-public-key.h            |    2 +-
 22 files changed, 45 insertions(+), 45 deletions(-)
---
diff --git a/pkcs11/gck/gck-authenticator.c b/pkcs11/gck/gck-authenticator.c
index ef8dcb6..8f4d9b3 100644
--- a/pkcs11/gck/gck-authenticator.c
+++ b/pkcs11/gck/gck-authenticator.c
@@ -285,7 +285,7 @@ gck_authenticator_class_init (GckAuthenticatorClass *klass)
  * PUBLIC 
  */
 
-GckFactoryInfo*
+GckFactory*
 gck_authenticator_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_GNOME_AUTHENTICATOR;
@@ -294,7 +294,7 @@ gck_authenticator_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) },
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_authenticator
diff --git a/pkcs11/gck/gck-authenticator.h b/pkcs11/gck/gck-authenticator.h
index a3c8a6a..bee8d14 100644
--- a/pkcs11/gck/gck-authenticator.h
+++ b/pkcs11/gck/gck-authenticator.h
@@ -50,7 +50,7 @@ struct _GckAuthenticatorClass {
 
 GType                      gck_authenticator_get_type               (void);
 
-GckFactoryInfo*            gck_authenticator_get_factory            (void);
+GckFactory*                gck_authenticator_get_factory            (void);
 
 CK_RV                      gck_authenticator_create                 (GckObject *object,
                                                                      GckManager *manager,
diff --git a/pkcs11/gck/gck-certificate.c b/pkcs11/gck/gck-certificate.c
index a830fe3..727fa3c 100644
--- a/pkcs11/gck/gck-certificate.c
+++ b/pkcs11/gck/gck-certificate.c
@@ -754,7 +754,7 @@ gck_certificate_hash (GckCertificate *self, int hash_algo, gsize *n_hash)
 	return hash;
 }
 
-GckFactoryInfo*
+GckFactory*
 gck_certificate_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_CERTIFICATE;
@@ -765,7 +765,7 @@ gck_certificate_get_factory (void)
 		{ CKA_CERTIFICATE_TYPE, &type, sizeof (type) },
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_certificate
diff --git a/pkcs11/gck/gck-certificate.h b/pkcs11/gck/gck-certificate.h
index 3aa1e3f..8dcffad 100644
--- a/pkcs11/gck/gck-certificate.h
+++ b/pkcs11/gck/gck-certificate.h
@@ -50,7 +50,7 @@ struct _GckCertificateClass {
 
 GType                      gck_certificate_get_type               (void);
 
-GckFactoryInfo*            gck_certificate_get_factory            (void);
+GckFactory*                gck_certificate_get_factory            (void);
 
 gboolean                   gck_certificate_calc_category          (GckCertificate *self, 
                                                                    CK_ULONG* category);
diff --git a/pkcs11/gck/gck-factory.h b/pkcs11/gck/gck-factory.h
index aa8a227..54a54d9 100644
--- a/pkcs11/gck/gck-factory.h
+++ b/pkcs11/gck/gck-factory.h
@@ -28,13 +28,13 @@
 
 #include "gck-types.h"
 
-typedef void (*GckFactory) (GckSession *session, GckTransaction *transaction, 
-                            CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **object);
+typedef void (*GckFactoryFunc) (GckSession *session, GckTransaction *transaction,
+                                CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs, GckObject **object);
 
-struct _GckFactoryInfo {
+struct _GckFactory {
 	CK_ATTRIBUTE_PTR attrs;
 	CK_ULONG n_attrs;
-	GckFactory factory;
+	GckFactoryFunc func;
 };
 
 #endif /* __GCK_FACTORY_H__ */
diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gck/gck-module.c
index 10c9ed3..2f9aa0f 100644
--- a/pkcs11/gck/gck-module.c
+++ b/pkcs11/gck/gck-module.c
@@ -162,8 +162,8 @@ static void  add_transient_object    (GckModule *self, GckTransaction *transacti
 static gint
 sort_factory_by_n_attrs (gconstpointer a, gconstpointer b)
 {
-	const GckFactoryInfo *fa = a;
-	const GckFactoryInfo *fb = b;
+	const GckFactory *fa = a;
+	const GckFactory *fb = b;
 	
 	g_assert (a);
 	g_assert (b);
@@ -550,7 +550,7 @@ gck_module_init (GckModule *self)
 	                                                      gck_util_ulong_free, g_object_unref);
 	self->pv->apartments_by_id = g_hash_table_new_full (gck_util_ulong_hash, gck_util_ulong_equal,
 	                                                    gck_util_ulong_free, apartment_free);
-	self->pv->factories = g_array_new (FALSE, TRUE, sizeof (GckFactoryInfo));
+	self->pv->factories = g_array_new (FALSE, TRUE, sizeof (GckFactory));
 
 	self->pv->handle_counter = 1;
 
@@ -826,21 +826,21 @@ gck_module_remove_token_object (GckModule *self, GckTransaction *transaction, Gc
 }
 
 void
-gck_module_register_factory (GckModule *self, GckFactoryInfo *factory)
+gck_module_register_factory (GckModule *self, GckFactory *factory)
 {
 	g_return_if_fail (GCK_IS_MODULE (self));
 	g_return_if_fail (factory);
 	g_return_if_fail (factory->attrs || !factory->n_attrs);
-	g_return_if_fail (factory->factory);
+	g_return_if_fail (factory->func);
 	
 	g_array_append_val (self->pv->factories, *factory);
 	self->pv->factories_sorted = FALSE;
 }
 
-GckFactory
+GckFactory*
 gck_module_find_factory (GckModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_attrs)
 {
-	GckFactoryInfo *factory;
+	GckFactory *factory;
 	gboolean matched;
 	gulong j;
 	gsize i;
@@ -854,7 +854,7 @@ gck_module_find_factory (GckModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_att
 	}
 	
 	for (i = 0; i < self->pv->factories->len; ++i) {
-		factory = &(g_array_index (self->pv->factories, GckFactoryInfo, i));
+		factory = &(g_array_index (self->pv->factories, GckFactory, i));
 		
 		matched = TRUE;
 		for (j = 0; j < factory->n_attrs; ++j) {
@@ -865,7 +865,7 @@ gck_module_find_factory (GckModule *self, CK_ATTRIBUTE_PTR attrs, CK_ULONG n_att
 		}
 		
 		if (matched)
-			return factory->factory;
+			return factory;
 	}
 	
 	return NULL;
diff --git a/pkcs11/gck/gck-module.h b/pkcs11/gck/gck-module.h
index c374330..0923671 100644
--- a/pkcs11/gck/gck-module.h
+++ b/pkcs11/gck/gck-module.h
@@ -142,12 +142,12 @@ void                   gck_module_remove_token_object             (GckModule *se
                                                                    GckTransaction *transaction,
                                                                    GckObject *object);
 
-GckFactory             gck_module_find_factory                    (GckModule *self,
+GckFactory*            gck_module_find_factory                    (GckModule *self,
                                                                    CK_ATTRIBUTE_PTR attrs,
                                                                    CK_ULONG n_attrs);
 
 void                   gck_module_register_factory                (GckModule *self, 
-                                                                   GckFactoryInfo *factory);
+                                                                   GckFactory *factory);
 
 CK_RV                  gck_module_C_GetInfo                       (GckModule *self, 
                                                                    CK_INFO_PTR info);
diff --git a/pkcs11/gck/gck-private-key.c b/pkcs11/gck/gck-private-key.c
index 22e128b..39216c5 100644
--- a/pkcs11/gck/gck-private-key.c
+++ b/pkcs11/gck/gck-private-key.c
@@ -449,7 +449,7 @@ gck_private_key_create_sexp (GckSession *session, GckTransaction *transaction,
 	return gck_sexp_new (sexp);
 }
 
-GckFactoryInfo*
+GckFactory*
 gck_private_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
@@ -458,7 +458,7 @@ gck_private_key_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) }
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_private_key
diff --git a/pkcs11/gck/gck-private-key.h b/pkcs11/gck/gck-private-key.h
index 6f78eeb..0de653b 100644
--- a/pkcs11/gck/gck-private-key.h
+++ b/pkcs11/gck/gck-private-key.h
@@ -57,7 +57,7 @@ void                       gck_private_key_set_locked_private     (GckPrivateKey
                                                                    GckAuthenticator *auth,
                                                                    GckSexp *sexp);               
 
-GckFactoryInfo*            gck_private_key_get_factory            (void);
+GckFactory*                gck_private_key_get_factory            (void);
 
 GckSexp*                   gck_private_key_create_sexp            (GckSession *session, 
                                                                    GckTransaction *transaction, 
diff --git a/pkcs11/gck/gck-public-key.c b/pkcs11/gck/gck-public-key.c
index 68b410f..f8a28a8 100644
--- a/pkcs11/gck/gck-public-key.c
+++ b/pkcs11/gck/gck-public-key.c
@@ -341,7 +341,7 @@ gck_public_key_create_sexp (GckSession *session, GckTransaction *transaction,
 	return gck_sexp_new (sexp);
 }
 
-GckFactoryInfo*
+GckFactory*
 gck_public_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
@@ -350,7 +350,7 @@ gck_public_key_get_factory (void)
 		{ CKA_CLASS, &klass, sizeof (klass) }
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_public_key
diff --git a/pkcs11/gck/gck-public-key.h b/pkcs11/gck/gck-public-key.h
index d201a74..2210ba9 100644
--- a/pkcs11/gck/gck-public-key.h
+++ b/pkcs11/gck/gck-public-key.h
@@ -50,7 +50,7 @@ struct _GckPublicKeyClass {
 
 GType                     gck_public_key_get_type               (void);
 
-GckFactoryInfo*           gck_public_key_get_factory            (void);
+GckFactory*               gck_public_key_get_factory            (void);
 
 GckSexp*                  gck_public_key_create_sexp            (GckSession *session, 
                                                                  GckTransaction *transaction, 
diff --git a/pkcs11/gck/gck-session.c b/pkcs11/gck/gck-session.c
index 7a37f55..5167494 100644
--- a/pkcs11/gck/gck-session.c
+++ b/pkcs11/gck/gck-session.c
@@ -796,7 +796,7 @@ gck_session_for_each_authenticator (GckSession *self, GckObject *object,
 }
 
 CK_RV
-gck_session_create_object_for_factory (GckSession *self, GckFactory factory,
+gck_session_create_object_for_factory (GckSession *self, GckFactory *factory,
                                        CK_ATTRIBUTE_PTR template, CK_ULONG count,
                                        GckObject **object)
 {
@@ -809,7 +809,7 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory factory,
 	CK_RV rv;
 
 	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_GENERAL_ERROR);
-	g_return_val_if_fail (factory, CKR_GENERAL_ERROR);
+	g_return_val_if_fail (factory && factory->func, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (template || !count, CKR_GENERAL_ERROR);
 	g_return_val_if_fail (object, CKR_GENERAL_ERROR);
 
@@ -839,7 +839,7 @@ gck_session_create_object_for_factory (GckSession *self, GckFactory factory,
 
 	/* Actually create the object */
 	*object = NULL;
-	(factory) (self, transaction, attrs, n_attrs, object);
+	(factory->func) (self, transaction, attrs, n_attrs, object);
 
 	if (!gck_transaction_get_failed (transaction)) {
 		g_return_val_if_fail (*object, CKR_GENERAL_ERROR);
@@ -948,7 +948,7 @@ gck_session_C_CreateObject (GckSession* self, CK_ATTRIBUTE_PTR template,
                             CK_ULONG count, CK_OBJECT_HANDLE_PTR new_object)
 {
 	GckObject *object = NULL;
-	GckFactory factory;
+	GckFactory *factory;
 	CK_RV rv;
 
 	g_return_val_if_fail (GCK_IS_SESSION (self), CKR_SESSION_HANDLE_INVALID);
diff --git a/pkcs11/gck/gck-session.h b/pkcs11/gck/gck-session.h
index 7a841dc..7106c9e 100644
--- a/pkcs11/gck/gck-session.h
+++ b/pkcs11/gck/gck-session.h
@@ -105,7 +105,7 @@ gboolean                 gck_session_for_each_authenticator             (GckSess
                                                                          gpointer user_data);
 
 CK_RV                    gck_session_create_object_for_factory          (GckSession *self,
-                                                                         GckFactory factory,
+                                                                         GckFactory *factory,
                                                                          CK_ATTRIBUTE_PTR attrs,
                                                                          CK_ULONG n_attrs,
                                                                          GckObject **object);
diff --git a/pkcs11/gck/gck-types.h b/pkcs11/gck/gck-types.h
index 38cec60..ac06215 100644
--- a/pkcs11/gck/gck-types.h
+++ b/pkcs11/gck/gck-types.h
@@ -27,7 +27,7 @@ typedef struct _GckCertificate GckCertificate;
 typedef struct _GckCertificateKey GckCertificateKey;
 typedef struct _GckCertificateTrust GckCertificateTrust;
 typedef struct _GckKey GckKey;
-typedef struct _GckFactoryInfo GckFactoryInfo;
+typedef struct _GckFactory GckFactory;
 typedef struct _GckManager GckManager;
 typedef struct _GckModule GckModule;
 typedef struct _GckObject GckObject;
diff --git a/pkcs11/gck/tests/test-module.c b/pkcs11/gck/tests/test-module.c
index 1cd7f82..7ee9f7d 100644
--- a/pkcs11/gck/tests/test-module.c
+++ b/pkcs11/gck/tests/test-module.c
@@ -107,7 +107,7 @@ test_module_object_new (GckSession *session)
 		{ CKA_VALUE, data, n_data },
 	};
 
-	if (gck_session_create_object_for_factory (session, GCK_FACTORY_CERTIFICATE->factory,
+	if (gck_session_create_object_for_factory (session, GCK_FACTORY_CERTIFICATE,
 	                                           attrs, G_N_ELEMENTS (attrs), &object) == CKR_OK)
 		return object;
 
diff --git a/pkcs11/secret-store/gck-secret-search.c b/pkcs11/secret-store/gck-secret-search.c
index 1d23985..4fe7563 100644
--- a/pkcs11/secret-store/gck-secret-search.c
+++ b/pkcs11/secret-store/gck-secret-search.c
@@ -464,7 +464,7 @@ gck_secret_search_class_init (GckSecretSearchClass *klass)
  * PUBLIC
  */
 
-GckFactoryInfo*
+GckFactory*
 gck_secret_search_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_G_SEARCH;
@@ -475,7 +475,7 @@ gck_secret_search_get_factory (void)
 		{ CKA_TOKEN, &token, sizeof (token) },
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_search
diff --git a/pkcs11/secret-store/gck-secret-search.h b/pkcs11/secret-store/gck-secret-search.h
index fa829cf..de85303 100644
--- a/pkcs11/secret-store/gck-secret-search.h
+++ b/pkcs11/secret-store/gck-secret-search.h
@@ -45,7 +45,7 @@ struct _GckSecretSearchClass {
 
 GType                gck_secret_search_get_type        (void) G_GNUC_CONST;
 
-GckFactoryInfo*      gck_secret_search_get_factory     (void) G_GNUC_CONST;
+GckFactory*          gck_secret_search_get_factory     (void) G_GNUC_CONST;
 
 GHashTable*          gck_secret_search_get_fields      (GckSecretSearch *self);
 
diff --git a/pkcs11/secret-store/tests/unit-test-secret-search.c b/pkcs11/secret-store/tests/unit-test-secret-search.c
index 9f91a2f..2aafcb5 100644
--- a/pkcs11/secret-store/tests/unit-test-secret-search.c
+++ b/pkcs11/secret-store/tests/unit-test-secret-search.c
@@ -44,7 +44,7 @@
 
 static GckModule *module = NULL;
 static GckSession *session = NULL;
-static GckFactory factory = NULL;
+static GckFactory *factory = NULL;
 static GckSecretCollection *collection = NULL;
 static GckSecretItem *item = NULL;
 
@@ -54,7 +54,7 @@ DEFINE_SETUP(secret_search)
 
 	module = test_secret_module_initialize_and_enter ();
 	session = test_secret_module_open_session (TRUE);
-	factory = GCK_FACTORY_SECRET_SEARCH->factory;
+	factory = GCK_FACTORY_SECRET_SEARCH;
 	g_assert (factory);
 
 	collection = g_object_new (GCK_TYPE_SECRET_COLLECTION,
diff --git a/pkcs11/user-store/gck-user-private-key.c b/pkcs11/user-store/gck-user-private-key.c
index e8cf598..eb08041 100644
--- a/pkcs11/user-store/gck-user-private-key.c
+++ b/pkcs11/user-store/gck-user-private-key.c
@@ -323,7 +323,7 @@ gck_user_private_key_serializable (GckSerializableIface *iface)
  * PUBLIC 
  */
 
-GckFactoryInfo*
+GckFactory*
 gck_user_private_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PRIVATE_KEY;
@@ -334,7 +334,7 @@ gck_user_private_key_get_factory (void)
 		{ CKA_TOKEN, &token, sizeof (token) }, 
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_private_key
diff --git a/pkcs11/user-store/gck-user-private-key.h b/pkcs11/user-store/gck-user-private-key.h
index 9d101e0..82dde14 100644
--- a/pkcs11/user-store/gck-user-private-key.h
+++ b/pkcs11/user-store/gck-user-private-key.h
@@ -47,6 +47,6 @@ struct _GckUserPrivateKeyClass {
 
 GType               gck_user_private_key_get_type               (void);
 
-GckFactoryInfo*     gck_user_private_key_get_factory            (void);
+GckFactory*         gck_user_private_key_get_factory            (void);
 
 #endif /* __GCK_USER_PRIVATE_KEY_H__ */
diff --git a/pkcs11/user-store/gck-user-public-key.c b/pkcs11/user-store/gck-user-public-key.c
index 7ece187..903a801 100644
--- a/pkcs11/user-store/gck-user-public-key.c
+++ b/pkcs11/user-store/gck-user-public-key.c
@@ -180,7 +180,7 @@ gck_user_public_key_serializable (GckSerializableIface *iface)
  * PUBLIC 
  */
 
-GckFactoryInfo*
+GckFactory*
 gck_user_public_key_get_factory (void)
 {
 	static CK_OBJECT_CLASS klass = CKO_PUBLIC_KEY;
@@ -191,7 +191,7 @@ gck_user_public_key_get_factory (void)
 		{ CKA_TOKEN, &token, sizeof (token) }, 
 	};
 
-	static GckFactoryInfo factory = {
+	static GckFactory factory = {
 		attributes,
 		G_N_ELEMENTS (attributes),
 		factory_create_public_key
diff --git a/pkcs11/user-store/gck-user-public-key.h b/pkcs11/user-store/gck-user-public-key.h
index 9316c1f..0e289aa 100644
--- a/pkcs11/user-store/gck-user-public-key.h
+++ b/pkcs11/user-store/gck-user-public-key.h
@@ -44,7 +44,7 @@ struct _GckUserPublicKeyClass {
 
 GType                gck_user_public_key_get_type               (void);
 
-GckFactoryInfo*      gck_user_public_key_get_factory            (void);
+GckFactory*          gck_user_public_key_get_factory            (void);
 
 GckUserPublicKey*    gck_user_public_key_new                    (const gchar *unique);
 



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