gck: Make the gck_attributes_to_string() function public
authorStef Walter <stefw@collabora.co.uk>
Wed, 30 Nov 2011 08:29:56 +0000 (09:29 +0100)
committerStef Walter <stefw@collabora.co.uk>
Wed, 30 Nov 2011 08:47:51 +0000 (09:47 +0100)
 * Used for debugging and logging

docs/reference/gck/gck-sections.txt
gck/gck-attributes.c
gck/gck-enumerator.c
gck/gck-private.h
gck/gck-session.c
gck/gck.h
gck/gck.symbols

index 3fbeba8..afb4d24 100644 (file)
@@ -63,6 +63,7 @@ gck_attributes_count
 gck_attributes_ref
 gck_attributes_unref
 gck_attributes_contains
+gck_attributes_to_string
 gck_attributes_dump
 gck_attributes_new_full
 GCK_TYPE_ATTRIBUTES
index b0d2738..e3f244d 100644 (file)
@@ -1975,8 +1975,19 @@ _gck_format_attributes (GString *output,
        g_string_append (output, " ]");
 }
 
+/**
+ * gck_attributes_to_string:
+ * attrs: the attributes
+ *
+ * Print out attributes to a string in aform that's useful for debugging
+ * or logging.
+ *
+ * The format of the string returned may change in the future.
+ *
+ * Returns: a newly allocated string
+ */
 gchar *
-_gck_attributes_format (GckAttributes *attrs)
+gck_attributes_to_string (GckAttributes *attrs)
 {
        GString *output = g_string_sized_new (128);
        _gck_format_attributes (output, attrs);
index dc3f2f2..5ebec47 100644 (file)
@@ -436,7 +436,7 @@ state_find (GckEnumeratorState *args,
        if (args->match->attributes) {
                attrs = _gck_attributes_commit_out (args->match->attributes, &n_attrs);
                if (_gck_debugging) {
-                       gchar *string = _gck_attributes_format (args->match->attributes);
+                       gchar *string = gck_attributes_to_string (args->match->attributes);
                        _gck_debug ("finding objects matching: %s", string);
                        g_free (string);
                }
@@ -539,7 +539,7 @@ state_results (GckEnumeratorState *args,
 
                if (GCK_IS_GET_ATTRIBUTE_RV_OK (rv)) {
                        if (_gck_debugging) {
-                               gchar *string = _gck_attributes_format (attrs);
+                               gchar *string = gck_attributes_to_string (attrs);
                                _gck_debug ("retrieved attributes for object %lu: %s",
                                            result->handle, string);
                                g_free (string);
@@ -699,7 +699,7 @@ created_enumerator (GckUriData *uri_data,
 {
        if (_gck_debugging) {
                gchar *attrs, *uri;
-               attrs = uri_data->attributes ? _gck_attributes_format (uri_data->attributes) : NULL;
+               attrs = uri_data->attributes ? gck_attributes_to_string (uri_data->attributes) : NULL;
                uri = uri_data ? gck_uri_build (uri_data, GCK_URI_FOR_TOKEN | GCK_URI_FOR_MODULE) : NULL;
                _gck_debug ("for = %s, tokens = %s, objects = %s", type, uri, attrs);
                g_free (attrs);
index 5e265fe..3926fe1 100644 (file)
@@ -52,8 +52,6 @@ CK_ATTRIBUTE_PTR    _gck_attributes_commit_in              (GckAttributes *attrs
 CK_ATTRIBUTE_PTR    _gck_attributes_commit_out             (GckAttributes *attrs,
                                                              CK_ULONG_PTR n_attrs);
 
-gchar *             _gck_attributes_format                 (GckAttributes *attrs);
-
 /* ----------------------------------------------------------------------------
  * MISC
  */
index fa62af1..50681bb 100644 (file)
@@ -1387,7 +1387,7 @@ perform_create_object (CreateObject *args)
                                                  &args->object);
 
        if (_gck_debugging) {
-               gchar *string = _gck_attributes_format (args->attrs);
+               gchar *string = gck_attributes_to_string (args->attrs);
                if (rv == CKR_OK)
                        _gck_debug ("created object: %s", string);
                else
@@ -1511,7 +1511,7 @@ perform_find_objects (FindObjects *args)
        CK_RV rv;
 
        if (_gck_debugging) {
-               gchar *string = _gck_attributes_format (args->attrs);
+               gchar *string = gck_attributes_to_string (args->attrs);
                _gck_debug ("matching: %s", string);
                g_free (string);
        }
index 041dcc3..44ff840 100644 (file)
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -290,6 +290,8 @@ GckAttributes *     gck_attributes_dup                      (GckAttributes *attr
 
 void                gck_attributes_dump                     (GckAttributes *attrs);
 
+gchar *             gck_attributes_to_string                (GckAttributes *attrs);
+
 /* -------------------------------------------------------------------------
  * FORWARDS
  */
index 7e87aa1..d3aef3e 100644 (file)
@@ -60,6 +60,7 @@ gck_attributes_set_boolean
 gck_attributes_set_date
 gck_attributes_set_string
 gck_attributes_set_ulong
+gck_attributes_to_string
 gck_attributes_unref
 gck_enumerator_get_chained
 gck_enumerator_get_interaction