/soc/2013/ankitkv/gobjectification: 07cd7f1767c7: ciphers: use g...

Ankit Vani a at nevitus.org
Sat Nov 23 15:46:27 EST 2013


Changeset: 07cd7f1767c7c480e7182a728d68456267d689b5
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-11-24 02:02 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/07cd7f1767c7

Description:

ciphers: use g_object_class_install_properties instead of repeated g_object_class_install_property

diffstat:

 libpurple/ciphers/aescipher.c    |   8 +++-----
 libpurple/ciphers/des3cipher.c   |   8 +++-----
 libpurple/ciphers/descipher.c    |   5 +++--
 libpurple/ciphers/hmaccipher.c   |   4 ++--
 libpurple/ciphers/pbkdf2cipher.c |  10 +++-------
 libpurple/ciphers/rc4cipher.c    |   7 +++----
 6 files changed, 17 insertions(+), 25 deletions(-)

diffs (147 lines):

diff --git a/libpurple/ciphers/aescipher.c b/libpurple/ciphers/aescipher.c
--- a/libpurple/ciphers/aescipher.c
+++ b/libpurple/ciphers/aescipher.c
@@ -600,21 +600,19 @@ purple_aes_cipher_class_init(PurpleAESCi
 	cipher_class->get_batch_mode = purple_aes_cipher_get_batch_mode;
 	cipher_class->get_block_size = purple_aes_cipher_get_block_size;
 
+	g_type_class_add_private(klass, sizeof(PurpleAESCipherPrivate));
+
 	properties[PROP_BATCH_MODE] = g_param_spec_enum("batch-mode", "batch-mode",
 							  "batch-mode", PURPLE_TYPE_CIPHER_BATCH_MODE, 0,
 							  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_BATCH_MODE,
-							  properties[PROP_BATCH_MODE]);
 
 	properties[PROP_IV] = g_param_spec_string("iv", "iv", "iv", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_IV, properties[PROP_IV]);
 
 	properties[PROP_KEY] = g_param_spec_string("key", "key", "key", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_KEY, properties[PROP_KEY]);
 
-	g_type_class_add_private(klass, sizeof(PurpleAESCipherPrivate));
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/ciphers/des3cipher.c b/libpurple/ciphers/des3cipher.c
--- a/libpurple/ciphers/des3cipher.c
+++ b/libpurple/ciphers/des3cipher.c
@@ -464,21 +464,19 @@ purple_des3_cipher_class_init(PurpleDES3
 	cipher_class->get_batch_mode = purple_des3_cipher_get_batch_mode;
 	cipher_class->get_key_size = purple_des3_cipher_get_key_size;
 
+	g_type_class_add_private(klass, sizeof(PurpleDES3CipherPrivate));
+
 	properties[PROP_BATCH_MODE] = g_param_spec_enum("batch-mode", "batch-mode",
 							  "batch-mode", PURPLE_TYPE_CIPHER_BATCH_MODE, 0,
 							  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_BATCH_MODE,
-							  properties[PROP_BATCH_MODE]);
 
 	properties[PROP_IV] = g_param_spec_string("iv", "iv", "iv", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_IV, properties[PROP_IV]);
 
 	properties[PROP_KEY] = g_param_spec_string("key", "key", "key", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_KEY, properties[PROP_KEY]);
 
-	g_type_class_add_private(klass, sizeof(PurpleDES3CipherPrivate));
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/ciphers/descipher.c b/libpurple/ciphers/descipher.c
--- a/libpurple/ciphers/descipher.c
+++ b/libpurple/ciphers/descipher.c
@@ -537,11 +537,12 @@ purple_des_cipher_class_init(PurpleDESCi
 	cipher_class->set_key = purple_des_cipher_set_key;
 	cipher_class->get_key_size = purple_des_cipher_get_key_size;
 
+	g_type_class_add_private(klass, sizeof(PurpleDESCipherPrivate));
+
 	properties[PROP_KEY] = g_param_spec_string("key", "key", "key", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_KEY, properties[PROP_KEY]);
 
-	g_type_class_add_private(klass, sizeof(PurpleDESCipherPrivate));
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 /******************************************************************************
diff --git a/libpurple/ciphers/hmaccipher.c b/libpurple/ciphers/hmaccipher.c
--- a/libpurple/ciphers/hmaccipher.c
+++ b/libpurple/ciphers/hmaccipher.c
@@ -287,8 +287,8 @@ purple_hmac_cipher_class_init(PurpleHMAC
 								PURPLE_TYPE_HASH,
 								G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 								G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_HASH,
-								properties[PROP_HASH]);
+
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 /******************************************************************************
diff --git a/libpurple/ciphers/pbkdf2cipher.c b/libpurple/ciphers/pbkdf2cipher.c
--- a/libpurple/ciphers/pbkdf2cipher.c
+++ b/libpurple/ciphers/pbkdf2cipher.c
@@ -340,28 +340,24 @@ purple_pbkdf2_cipher_class_init(PurplePB
 	cipher_class->set_salt = purple_pbkdf2_cipher_set_salt;
 	cipher_class->set_key = purple_pbkdf2_cipher_set_key;
 
+	g_type_class_add_private(klass, sizeof(PurplePBKDF2CipherPrivate));
+
 	properties[PROP_HASH] = g_param_spec_object("hash", "hash", "hash",
 								PURPLE_TYPE_HASH,
 								G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
 								G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_HASH,
-								properties[PROP_HASH]);
 
 	properties[PROP_ITER_COUNT] = g_param_spec_uint("iter-count", "iter-count",
 								"iter-count", 0,
 								G_MAXUINT, 0, G_PARAM_READWRITE |
 								G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_ITER_COUNT,
-								properties[PROP_ITER_COUNT]);
 
 	properties[PROP_OUT_LEN] = g_param_spec_uint("out-len", "out-len",
 								"out-len", 0,
 								G_MAXUINT, 0, G_PARAM_READWRITE |
 								G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_OUT_LEN,
-								properties[PROP_OUT_LEN]);
 
-	g_type_class_add_private(klass, sizeof(PurplePBKDF2CipherPrivate));
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 static void
diff --git a/libpurple/ciphers/rc4cipher.c b/libpurple/ciphers/rc4cipher.c
--- a/libpurple/ciphers/rc4cipher.c
+++ b/libpurple/ciphers/rc4cipher.c
@@ -184,17 +184,16 @@ purple_rc4_cipher_class_init(PurpleRC4Ci
 	cipher_class->encrypt = purple_rc4_cipher_encrypt;
 	cipher_class->set_key = purple_rc4_cipher_set_key;
 
+	g_type_class_add_private(klass, sizeof(PurpleRC4CipherPrivate));
+
 	properties[PROP_KEY_LEN] = g_param_spec_int("key-len", "key-len", "key-len",
 							 G_MININT, G_MAXINT, 0,
 							 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_KEY_LEN,
-							 properties[PROP_KEY_LEN]);
 
 	properties[PROP_KEY] = g_param_spec_string("key", "key", "key", NULL,
 								G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
-	g_object_class_install_property(obj_class, PROP_KEY, properties[PROP_KEY]);
 
-	g_type_class_add_private(klass, sizeof(PurpleRC4CipherPrivate));
+	g_object_class_install_properties(obj_class, PROP_LAST, properties);
 }
 
 static void



More information about the Commits mailing list