[gcr] gck: Remove gck_attributes_add_owned()



commit e38c5779624e1f5db2169964664c0748e7908990
Author: Stef Walter <stefw collabora co uk>
Date:   Wed Dec 21 09:45:12 2011 +0100

    gck: Remove gck_attributes_add_owned()
    
     * And make gck_attributes_add_attribute() handle owned attributes
     * Unowned attributes should be done with gck_attributes_add_data()
     * This change to ABI cleans things up before API is released as stable

 docs/reference/gck/gck-sections.txt |    1 -
 gck/gck-attributes.c                |   33 ++++++---------------------------
 gck/gck.h                           |    3 ---
 gck/gck.symbols                     |    1 -
 gck/tests/test-gck-attributes.c     |    2 +-
 gcr/gcr-pkcs11-importer.c           |    2 +-
 gcr/gcr-subject-public-key.c        |    2 +-
 gcr/tests/test-subject-public-key.c |    2 +-
 8 files changed, 10 insertions(+), 36 deletions(-)
---
diff --git a/docs/reference/gck/gck-sections.txt b/docs/reference/gck/gck-sections.txt
index 4c6fced..e9a03db 100644
--- a/docs/reference/gck/gck-sections.txt
+++ b/docs/reference/gck/gck-sections.txt
@@ -71,7 +71,6 @@ gck_builder_set_empty
 gck_builder_add_invalid
 gck_builder_set_invalid
 gck_builder_add_attribute
-gck_builder_add_owned
 gck_builder_add_all
 gck_builder_set_all
 gck_builder_add_except
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index ea8c6f3..5c86f31 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -832,40 +832,19 @@ gck_builder_set_string (GckBuilder *builder,
  * @builder: the builder
  * @attr: the attribute to add
  *
- * Add a copy of the attribute to the builder. The attribute is added
- * unconditionally whether or not an attribute with the same type already
- * exists on the builder.
- *
- * The memory in the attribute is copied.
- */
-void
-gck_builder_add_attribute (GckBuilder *builder,
-                           const GckAttribute *attr)
-{
-	g_return_if_fail (builder != NULL);
-	g_return_if_fail (attr != NULL);
-
-	gck_builder_add_data (builder, attr->type, attr->value, attr->length);
-}
-
-/**
- * gck_builder_add_owned:
- * @builder: the builder
- * @attr: the attribute to add
- *
  * Add an attribute to the builder. The attribute is added unconditionally whether
  * or not an attribute with the same type already exists on the builder.
  *
- * The @attr attribute must already be owned by a #GckAttributes or #GckBuilder.
- * If you call this function on an arbitrary #GckAttribute that is not owned
- * it will result in undefined behavior.
+ * The @attr attribute must have been created or owned by the Gck library.
+ * If you call this function on an arbitrary #GckAttribute that is allocated on
+ * the stack or elsewhere, then this will result in undefined behavior.
  *
  * As an optimization, the attribute memory value is automatically shared
  * between the attribute and the builder.
  */
 void
-gck_builder_add_owned (GckBuilder *builder,
-                       const GckAttribute *attr)
+gck_builder_add_attribute (GckBuilder *builder,
+                           const GckAttribute *attr)
 {
 	g_return_if_fail (builder != NULL);
 	g_return_if_fail (attr != NULL);
@@ -2932,7 +2911,7 @@ gck_attributes_add (GckAttributes *attrs,
  *
  * #GckAttributes are now immutable. This method no longer does anything.
  *
- * Deprecated: 3.4: Use gck_builder_add_data() instead.
+ * Deprecated: 3.4: Use gck_builder_set_data() instead.
  **/
 void
 gck_attributes_set (GckAttributes *attrs,
diff --git a/gck/gck.h b/gck/gck.h
index da3814f..565b368 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -252,9 +252,6 @@ void                 gck_builder_add_string                 (GckBuilder *builder
 void                 gck_builder_add_attribute              (GckBuilder *builder,
                                                              const GckAttribute *attr);
 
-void                 gck_builder_add_owned                  (GckBuilder *builder,
-                                                             const GckAttribute *attr);
-
 void                 gck_builder_add_all                    (GckBuilder *builder,
                                                              GckAttributes *attrs);
 
diff --git a/gck/gck.symbols b/gck/gck.symbols
index 1664f94..1f095cd 100644
--- a/gck/gck.symbols
+++ b/gck/gck.symbols
@@ -74,7 +74,6 @@ gck_builder_add_exceptv
 gck_builder_add_invalid
 gck_builder_add_only
 gck_builder_add_onlyv
-gck_builder_add_owned
 gck_builder_add_string
 gck_builder_add_ulong
 gck_builder_clear
diff --git a/gck/tests/test-gck-attributes.c b/gck/tests/test-gck-attributes.c
index a825435..04ae70e 100644
--- a/gck/tests/test-gck-attributes.c
+++ b/gck/tests/test-gck-attributes.c
@@ -1096,7 +1096,7 @@ test_builder_add_from (void)
 	attrs = gck_builder_end (&builder);
 
 	for (i = 0; i < gck_attributes_count (attrs); i++)
-		gck_builder_add_owned (&two, gck_attributes_at (attrs, i));
+		gck_builder_add_attribute (&two, gck_attributes_at (attrs, i));
 
 	gck_attributes_unref (attrs);
 	attrs = gck_builder_end (&two);
diff --git a/gcr/gcr-pkcs11-importer.c b/gcr/gcr-pkcs11-importer.c
index 0f87fe1..977279a 100644
--- a/gcr/gcr-pkcs11-importer.c
+++ b/gcr/gcr-pkcs11-importer.c
@@ -241,7 +241,7 @@ supplement_with_attributes (GckBuilder *builder,
 	for (i = 0; i < gck_attributes_count (supplements); i++) {
 		supplement = gck_attributes_at (supplements, i);
 		if (!gck_attribute_is_invalid (supplement) && supplement->length != 0)
-			gck_builder_add_owned (builder, supplement);
+			gck_builder_add_attribute (builder, supplement);
 	}
 }
 
diff --git a/gcr/gcr-subject-public-key.c b/gcr/gcr-subject-public-key.c
index b1e3a1a..5244039 100644
--- a/gcr/gcr-subject-public-key.c
+++ b/gcr/gcr-subject-public-key.c
@@ -205,7 +205,7 @@ lookup_public_key (GckObject *object,
 	}
 
 	gck_builder_add_ulong (&builder, CKA_CLASS, CKO_PUBLIC_KEY);
-	gck_builder_add_owned (&builder, id);
+	gck_builder_add_attribute (&builder, id);
 	gck_attributes_unref (attrs);
 
 	session = gck_object_get_session (object);
diff --git a/gcr/tests/test-subject-public-key.c b/gcr/tests/test-subject-public-key.c
index e8273ef..0f2e301 100644
--- a/gcr/tests/test-subject-public-key.c
+++ b/gcr/tests/test-subject-public-key.c
@@ -557,7 +557,7 @@ perform_load_partial (TestLoading *test,
 	guint i;
 
 	for (i = 0; i < gck_attributes_count (attributes); i += 2)
-		gck_builder_add_owned (&builder, gck_attributes_at (attributes, i));
+		gck_builder_add_attribute (&builder, gck_attributes_at (attributes, i));
 	partial = gck_attributes_ref_sink (gck_builder_end (&builder));
 
 	object = g_object_new (mock_object_get_type (),



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