/soc/2013/ankitkv/gobjectification: 8456350bb6fd: Removed class_...

Ankit Vani a at nevitus.org
Mon Sep 30 18:05:10 EDT 2013


Changeset: 8456350bb6fda51a4f1d23a67ede7bcee88fb902
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-01 02:51 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/8456350bb6fd

Description:

Removed class_init and get_name from PurpleHash

diffstat:

 libpurple/hash.c |  43 ++++++++-----------------------------------
 libpurple/hash.h |  12 ------------
 2 files changed, 8 insertions(+), 47 deletions(-)

diffs (140 lines):

diff --git a/libpurple/hash.c b/libpurple/hash.c
--- a/libpurple/hash.c
+++ b/libpurple/hash.c
@@ -23,35 +23,8 @@
 #include "debug.h"
 
 /******************************************************************************
- * Object Stuff
- *****************************************************************************/
-static void
-purple_hash_class_init(PurpleHashClass *klass) {
-	klass->reset = NULL;
-	klass->reset_state = NULL;
-	klass->append = NULL;
-	klass->digest = NULL;
-	klass->get_digest_size = NULL;
-	klass->get_block_size = NULL;
-	klass->get_name = NULL;
-}
-
-/******************************************************************************
  * PurpleHash API
  *****************************************************************************/
-const gchar *
-purple_hash_get_name(PurpleHash *hash) {
-	PurpleHashClass *klass = NULL;
-
-	g_return_val_if_fail(hash, NULL);
-	g_return_val_if_fail(PURPLE_IS_HASH(hash), NULL);
-
-	klass = PURPLE_HASH_GET_CLASS(hash);
-	g_return_val_if_fail(klass->get_name, NULL);
-
-	return klass->get_name(hash);
-}
-
 GType
 purple_hash_get_type(void) {
 	static GType type = 0;
@@ -61,7 +34,7 @@ purple_hash_get_type(void) {
 			sizeof(PurpleHashClass),
 			NULL,
 			NULL,
-			(GClassInitFunc)purple_hash_class_init,
+			NULL,
 			NULL,
 			NULL,
 			sizeof(PurpleHash),
@@ -99,7 +72,7 @@ purple_hash_reset(PurpleHash *hash) {
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"reset method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 }
 
 /**
@@ -122,7 +95,7 @@ purple_hash_reset_state(PurpleHash *hash
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"reset_state method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 }
 
 /**
@@ -148,7 +121,7 @@ purple_hash_append(PurpleHash *hash, con
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"append method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 }
 
 /**
@@ -176,7 +149,7 @@ purple_hash_digest(PurpleHash *hash, guc
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"digest method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 
 	return FALSE;
 }
@@ -200,7 +173,7 @@ purple_hash_digest_to_str(PurpleHash *ha
 	gint n = 0;
 	size_t digest_size;
 
-	g_return_val_if_fail(hash, FALSE);
+	g_return_val_if_fail(PURPLE_IS_HASH(hash), FALSE);
 	g_return_val_if_fail(digest_s, FALSE);
 
 	digest_size = purple_hash_get_digest_size(hash);
@@ -235,7 +208,7 @@ purple_hash_get_digest_size(PurpleHash *
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"get_digest_size method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 
 	return FALSE;
 }
@@ -262,7 +235,7 @@ purple_hash_get_block_size(PurpleHash *h
 	else
 		purple_debug_warning("hash", "the %s hash does not implement the "
 						"get_block_size method\n",
-						klass->get_name ? klass->get_name(hash) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(hash)));
 
 	return -1;
 }
diff --git a/libpurple/hash.h b/libpurple/hash.h
--- a/libpurple/hash.h
+++ b/libpurple/hash.h
@@ -80,9 +80,6 @@ struct _PurpleHashClass {
 	/** The get block size function */
 	size_t (*get_block_size)(PurpleHash *hash);
 
-	/** The get hash name function */
-	const gchar* (*get_name)(PurpleHash *hash);
-
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
 	void (*_purple_reserved3)(void);
@@ -102,15 +99,6 @@ G_BEGIN_DECLS
 GType purple_hash_get_type(void);
 
 /**
- * Gets a hash's name
- *
- * @param hash The hash
- *
- * @return The hash's name
- */
-const gchar *purple_hash_get_name(PurpleHash *hash);
-
-/**
  * Resets a hash to it's default value
  * @note If you have set an IV you will have to set it after resetting
  *



More information about the Commits mailing list