/soc/2013/ankitkv/gobjectification: 9abd15d6da07: Removed 'get_n...

Ankit Vani a at nevitus.org
Mon Sep 23 05:22:12 EDT 2013


Changeset: 9abd15d6da07f36108786e23bb4d20d9b2411451
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-23 14:41 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/9abd15d6da07

Description:

Removed 'get_name' from PurpleCipher

diffstat:

 libpurple/cipher.c                      |  41 +++++++++++---------------------
 libpurple/cipher.h                      |  12 ---------
 libpurple/ciphers/aescipher.c           |   7 -----
 libpurple/ciphers/des3cipher.c          |   7 -----
 libpurple/ciphers/descipher.c           |   7 -----
 libpurple/ciphers/hmaccipher.c          |   7 -----
 libpurple/ciphers/md4hash.c             |   7 -----
 libpurple/ciphers/md5hash.c             |   7 -----
 libpurple/ciphers/pbkdf2cipher.c        |   7 -----
 libpurple/ciphers/rc4cipher.c           |   7 -----
 libpurple/ciphers/sha1hash.c            |   7 -----
 libpurple/ciphers/sha256hash.c          |   7 -----
 libpurple/plugins/perl/common/Cipher.xs |   4 ---
 13 files changed, 14 insertions(+), 113 deletions(-)

diffs (truncated from 432 to 300 lines):

diff --git a/libpurple/cipher.c b/libpurple/cipher.c
--- a/libpurple/cipher.c
+++ b/libpurple/cipher.c
@@ -25,19 +25,6 @@
 /******************************************************************************
  * PurpleCipher API
  *****************************************************************************/
-const gchar *
-purple_cipher_get_name(PurpleCipher *cipher) {
-	PurpleCipherClass *klass = NULL;
-
-	g_return_val_if_fail(cipher, NULL);
-	g_return_val_if_fail(PURPLE_IS_CIPHER(cipher), NULL);
-
-	klass = PURPLE_CIPHER_GET_CLASS(cipher);
-	g_return_val_if_fail(klass->get_name, NULL);
-
-	return klass->get_name(cipher);
-}
-
 GType
 purple_cipher_get_type(void) {
 	static GType type = 0;
@@ -77,7 +64,7 @@ purple_cipher_reset(PurpleCipher *cipher
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"reset method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 void
@@ -93,7 +80,7 @@ purple_cipher_reset_state(PurpleCipher *
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"reset_state method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 void
@@ -111,7 +98,7 @@ purple_cipher_set_iv(PurpleCipher *ciphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"set_iv method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 void
@@ -129,7 +116,7 @@ purple_cipher_append(PurpleCipher *ciphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"append method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 gboolean
@@ -146,7 +133,7 @@ purple_cipher_digest(PurpleCipher *ciphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"digest method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return FALSE;
 }
@@ -193,7 +180,7 @@ purple_cipher_get_digest_size(PurpleCiph
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"get_digest_size method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return FALSE;
 }
@@ -216,7 +203,7 @@ purple_cipher_encrypt(PurpleCipher *ciph
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"encrypt method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return -1;
 }
@@ -238,7 +225,7 @@ purple_cipher_decrypt(PurpleCipher *ciph
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"decrypt method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return -1;
 }
@@ -256,7 +243,7 @@ purple_cipher_set_salt(PurpleCipher *cip
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"set_salt method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 void
@@ -272,7 +259,7 @@ purple_cipher_set_key(PurpleCipher *ciph
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"set_key method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 size_t
@@ -288,7 +275,7 @@ purple_cipher_get_key_size(PurpleCipher 
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"get_key_size method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return -1;
 }
@@ -308,7 +295,7 @@ purple_cipher_set_batch_mode(PurpleCiphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"set_batch_mode method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 }
 
 PurpleCipherBatchMode
@@ -325,7 +312,7 @@ purple_cipher_get_batch_mode(PurpleCiphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"get_batch_mode method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return -1;
 }
@@ -344,7 +331,7 @@ purple_cipher_get_block_size(PurpleCiphe
 	else
 		purple_debug_warning("cipher", "the %s cipher does not implement the "
 						"get_block_size method\n",
-						klass->get_name ? klass->get_name(cipher) : "");
+						g_type_name(G_TYPE_FROM_INSTANCE(cipher)));
 
 	return -1;
 }
diff --git a/libpurple/cipher.h b/libpurple/cipher.h
--- a/libpurple/cipher.h
+++ b/libpurple/cipher.h
@@ -116,9 +116,6 @@ struct _PurpleCipherClass {
 	/** The get block size function */
 	size_t (*get_block_size)(PurpleCipher *cipher);
 
-	/** The get cipher name function */
-	const gchar* (*get_name)(PurpleCipher *cipher);
-
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
 	void (*_purple_reserved3)(void);
@@ -138,15 +135,6 @@ G_BEGIN_DECLS
 GType purple_cipher_get_type(void);
 
 /**
- * Gets a cipher's name
- *
- * @param cipher The cipher
- *
- * @return The cipher's name
- */
-const gchar *purple_cipher_get_name(PurpleCipher *cipher);
-
-/**
  * Resets a cipher to it's default value
  * @note If you have set an IV you will have to set it after resetting
  *
diff --git a/libpurple/ciphers/aescipher.c b/libpurple/ciphers/aescipher.c
--- a/libpurple/ciphers/aescipher.c
+++ b/libpurple/ciphers/aescipher.c
@@ -528,12 +528,6 @@ purple_aes_cipher_get_block_size(PurpleC
 	return PURPLE_AES_BLOCK_SIZE;
 }
 
-static const gchar*
-purple_aes_cipher_get_name(PurpleCipher *cipher)
-{
-	return "aes";
-}
-
 /******************************************************************************
  * Object Stuff
  *****************************************************************************/
@@ -599,7 +593,6 @@ purple_aes_cipher_class_init(PurpleAESCi
 	cipher_class->set_batch_mode = purple_aes_cipher_set_batch_mode;
 	cipher_class->get_batch_mode = purple_aes_cipher_get_batch_mode;
 	cipher_class->get_block_size = purple_aes_cipher_get_block_size;
-	cipher_class->get_name = purple_aes_cipher_get_name;
 
 	pspec = g_param_spec_enum("batch_mode", "batch_mode", "batch_mode",
 							  PURPLE_TYPE_CIPHER_BATCH_MODE, 0,
diff --git a/libpurple/ciphers/des3cipher.c b/libpurple/ciphers/des3cipher.c
--- a/libpurple/ciphers/des3cipher.c
+++ b/libpurple/ciphers/des3cipher.c
@@ -379,12 +379,6 @@ purple_des3_cipher_set_iv(PurpleCipher *
 	g_object_notify(G_OBJECT(des3_cipher), "iv");
 }
 
-static const gchar*
-purple_des3_cipher_get_name(PurpleCipher *cipher)
-{
-	return "des3";
-}
-
 /******************************************************************************
  * Object Stuff
  *****************************************************************************/
@@ -466,7 +460,6 @@ purple_des3_cipher_class_init(PurpleDES3
 	cipher_class->set_batch_mode = purple_des3_cipher_set_batch_mode;
 	cipher_class->get_batch_mode = purple_des3_cipher_get_batch_mode;
 	cipher_class->get_key_size = purple_des3_cipher_get_key_size;
-	cipher_class->get_name = purple_des3_cipher_get_name;
 
 	pspec = g_param_spec_enum("batch_mode", "batch_mode", "batch_mode",
 							  PURPLE_TYPE_CIPHER_BATCH_MODE, 0,
diff --git a/libpurple/ciphers/descipher.c b/libpurple/ciphers/descipher.c
--- a/libpurple/ciphers/descipher.c
+++ b/libpurple/ciphers/descipher.c
@@ -498,12 +498,6 @@ purple_des_cipher_decrypt(PurpleCipher *
 	return out_len;
 }
 
-static const gchar*
-purple_des_cipher_get_name(PurpleCipher *cipher)
-{
-	return "des";
-}
-
 /******************************************************************************
  * Object Stuff
  *****************************************************************************/
@@ -539,7 +533,6 @@ purple_des_cipher_class_init(PurpleDESCi
 	cipher_class->decrypt = purple_des_cipher_decrypt;
 	cipher_class->set_key = purple_des_cipher_set_key;
 	cipher_class->get_key_size = purple_des_cipher_get_key_size;
-	cipher_class->get_name = purple_des_cipher_get_name;
 
 	pspec = g_param_spec_string("key", "key", "key", NULL,
 								G_PARAM_WRITABLE);
diff --git a/libpurple/ciphers/hmaccipher.c b/libpurple/ciphers/hmaccipher.c
--- a/libpurple/ciphers/hmaccipher.c
+++ b/libpurple/ciphers/hmaccipher.c
@@ -207,12 +207,6 @@ purple_hmac_cipher_get_block_size(Purple
 	return purple_hash_get_block_size(priv->hash);
 }
 
-static const gchar*
-purple_hmac_cipher_get_name(PurpleCipher *cipher)
-{
-	return "hmac";
-}
-
 /******************************************************************************
  * Object Stuff
  *****************************************************************************/
@@ -284,7 +278,6 @@ purple_hmac_cipher_class_init(PurpleHMAC
 	cipher_class->get_digest_size = purple_hmac_cipher_get_digest_size;
 	cipher_class->set_key = purple_hmac_cipher_set_key;
 	cipher_class->get_block_size = purple_hmac_cipher_get_block_size;
-	cipher_class->get_name = purple_hmac_cipher_get_name;
 
 	pspec = g_param_spec_object("hash", "hash", "hash", PURPLE_TYPE_HASH,
 								G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
diff --git a/libpurple/ciphers/md4hash.c b/libpurple/ciphers/md4hash.c
--- a/libpurple/ciphers/md4hash.c
+++ b/libpurple/ciphers/md4hash.c
@@ -256,12 +256,6 @@ purple_md4_hash_get_block_size(PurpleHas
 	return 64;
 }
 
-static const gchar*
-purple_md4_hash_get_name(PurpleHash *hash)
-{
-	return "md4";
-}
-
 /******************************************************************************
  * Object Stuff
  *****************************************************************************/
@@ -279,7 +273,6 @@ purple_md4_hash_class_init(PurpleMD4Hash
 	hash_class->digest = purple_md4_hash_digest;
 	hash_class->get_digest_size = purple_md4_hash_get_digest_size;
 	hash_class->get_block_size = purple_md4_hash_get_block_size;
-	hash_class->get_name = purple_md4_hash_get_name;
 }
 
 /******************************************************************************
diff --git a/libpurple/ciphers/md5hash.c b/libpurple/ciphers/md5hash.c
--- a/libpurple/ciphers/md5hash.c



More information about the Commits mailing list