gobjectification: 979e3104: Fix private and finalize.
sadrul at pidgin.im
sadrul at pidgin.im
Wed Jul 14 13:30:57 EDT 2010
----------------------------------------------------------------------
Revision: 979e31044227d826816a51a0eea1e47535144bc8
Parent: 99a98c9c89117dfa560d08225a443324268b5c23
Author: sadrul at pidgin.im
Date: 07/14/10 12:38:31
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/979e31044227d826816a51a0eea1e47535144bc8
Changelog:
Fix private and finalize.
Make sure finalize is chained, and use g_type_class_add_private to add
private structures to the PurpleObjects, instead of a regular 'priv'
member in the structure itself.
Changes against parent 99a98c9c89117dfa560d08225a443324268b5c23
patched libpurple/account.c
patched libpurple/account.h
patched libpurple/blist-node.c
patched libpurple/blist-node.h
patched libpurple/buddy.c
patched libpurple/buddy.h
patched libpurple/chat.c
patched libpurple/chat.h
patched libpurple/cipher/cipher.h
patched libpurple/cipher/des3cipher.c
patched libpurple/cipher/des3cipher.h
patched libpurple/cipher/descipher.c
patched libpurple/cipher/descipher.h
patched libpurple/cipher/hmaccipher.c
patched libpurple/cipher/md5hash.c
patched libpurple/cipher/md5hash.h
patched libpurple/cipher/rc4cipher.c
patched libpurple/cipher/rc4cipher.h
patched libpurple/cipher/sha1hash.c
patched libpurple/cipher/sha1hash.h
patched libpurple/cipher/sha256hash.c
patched libpurple/cipher/sha256hash.h
patched libpurple/connection.c
patched libpurple/contact.c
patched libpurple/contact.h
patched libpurple/group.c
patched libpurple/group.h
patched libpurple/pobject.c
patched libpurple/pobject.h
patched libpurple/smiley.c
patched libpurple/sound-theme.c
patched libpurple/sound-theme.h
patched libpurple/theme-loader.c
patched libpurple/theme-loader.h
patched libpurple/theme.c
patched libpurple/theme.h
-------------- next part --------------
============================================================
--- libpurple/account.c ed7a5d3a5333bc65542d50d4b04dad694038aa8e
+++ libpurple/account.c d2d7d7baddeb9a7df1992ac1cd2c9576d29e7ebf
@@ -43,6 +43,10 @@
#include "util.h"
#include "xmlnode.h"
+#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((account), PURPLE_TYPE_ACCOUNT, PurpleAccountPrivate))
+typedef struct _PurpleAccountPrivate PurpleAccountPrivate;
+
struct _PurpleAccountPrivate
{
char *username; /**< The username. */
@@ -76,9 +80,6 @@ struct _PurpleAccountPrivate
GList *status_types; /**< Status types. */
};
-#define PURPLE_ACCOUNT_GET_PRIVATE(account) \
- (G_TYPE_INSTANCE_GET_PRIVATE((account), PURPLE_TYPE_ACCOUNT, PurpleAccountPrivate))
-
/* TODO: Should use PurpleValue instead of this? What about "ui"? */
typedef struct
{
@@ -530,7 +531,7 @@ purple_account_get_property(GObject *obj
break;
case PROP_PRPL:
#warning Use _object when prpls are GObjects
- g_value_set_pointer(value, account->priv->prpl);
+ g_value_set_pointer(value, PURPLE_ACCOUNT_GET_PRIVATE(account)->prpl);
break;
case PROP_USER_INFO:
g_value_set_string(value, purple_account_get_user_info(account));
============================================================
--- libpurple/account.h 49d9e29cc3e74c8b28ac17d965575a73fd99f9ab
+++ libpurple/account.h c7332339209692884fff8f08c0fcbce0d2b71079
@@ -39,7 +39,6 @@ typedef struct _PurpleAccount PurpleAc
GType purple_account_get_gtype(void);
typedef struct _PurpleAccount PurpleAccount;
-typedef struct _PurpleAccountPrivate PurpleAccountPrivate;
typedef struct _PurpleAccountClass PurpleAccountClass;
/** @copydoc _PurpleAccountUiOps */
@@ -129,8 +128,6 @@ struct _PurpleAccount
{
PurpleObject parent;
- PurpleAccountPrivate *priv;
-
/*
* TODO: Supplementing the next two linked lists with hash tables
* should help performance a lot when these lists are long. This
============================================================
--- libpurple/connection.c b6a74a7163cecad55869fd748066630cd1aac699
+++ libpurple/connection.c 06957c17314cd959cb85243e576e3feca2e95b65
@@ -905,7 +905,6 @@ purple_connection_finalize(GObject *obj)
purple_timeout_remove(priv->disconnect_timeout);
PURPLE_DBUS_UNREGISTER_POINTER(pc);
- g_free(priv);
G_OBJECT_CLASS(parent_class)->finalize(obj);
}
============================================================
--- libpurple/cipher/cipher.h 923e44290b3d030de4f6e20c349d0c72a720696e
+++ libpurple/cipher/cipher.h 5b484b3dbde594699dbffbed6d81c181a72a9f31
@@ -41,7 +41,6 @@ typedef struct _PurpleCipher PurpleCip
#define PURPLE_CIPHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_CIPHER, PurpleCipherClass))
typedef struct _PurpleCipher PurpleCipher;
-typedef struct _PurpleCipherPriv PurpleCipherPriv;
typedef struct _PurpleCipherClass PurpleCipherClass;
#define PURPLE_TYPE_CIPHER_BATCH_MODE (purple_cipher_batch_mode_get_gtype())
@@ -57,8 +56,6 @@ struct _PurpleCipher {
struct _PurpleCipher {
GObject gparent;
- PurpleCipherPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/cipher/descipher.c 4f5ec2afa830bf45ee9bbf9ba69f0c9560856d4e
+++ libpurple/cipher/descipher.c a5897c0dbcbd4b6dbda55c2a806ad9abf003e191
@@ -20,7 +20,11 @@
/******************************************************************************
* Structs
*****************************************************************************/
-struct _PurpleDESCipherPriv
+#define PURPLE_DES_CIPHER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_DES_CIPHER, PurpleDESCipherPrivate))
+
+typedef struct _PurpleDESCipherPrivate PurpleDESCipherPrivate;
+struct _PurpleDESCipherPrivate
{
guint32 encrypt_subkeys[32];
guint32 decrypt_subkeys[32];
@@ -352,15 +356,14 @@ purple_des_cipher_set_key(PurpleCipher *
static void
purple_des_cipher_set_key(PurpleCipher *cipher, const guchar *key) {
PurpleDESCipher *des_cipher = PURPLE_DES_CIPHER(cipher);
+ PurpleDESCipherPrivate *priv = PURPLE_DES_CIPHER_GET_PRIVATE(des_cipher);
int i;
- purple_des_cipher_key_schedule(key, des_cipher->priv->encrypt_subkeys);
+ purple_des_cipher_key_schedule(key, priv->encrypt_subkeys);
for(i = 0; i < 32; i += 2) {
- des_cipher->priv->decrypt_subkeys[i] =
- des_cipher->priv->encrypt_subkeys[30 - i];
- des_cipher->priv->decrypt_subkeys[i + 1] =
- des_cipher->priv->encrypt_subkeys[31 - i];
+ priv->decrypt_subkeys[i] = priv->encrypt_subkeys[30 - i];
+ priv->decrypt_subkeys[i + 1] = priv->encrypt_subkeys[31 - i];
}
}
@@ -374,9 +377,10 @@ purple_des_cipher_ecb_crypt(PurpleDESCip
{
guint32 left, right, work;
guint32 *keys;
+ PurpleDESCipherPrivate *priv = PURPLE_DES_CIPHER_GET_PRIVATE(des_cipher);
- keys = mode ? des_cipher->priv->decrypt_subkeys :
- des_cipher->priv->encrypt_subkeys;
+ keys = mode ? priv->decrypt_subkeys :
+ priv->encrypt_subkeys;
READ_64BIT_DATA (from, left, right)
INITIAL_PERMUTATION (left, work, right)
@@ -478,11 +482,7 @@ purple_des_cipher_finalize(GObject *obj)
static void
purple_des_cipher_finalize(GObject *obj)
{
- PurpleDESCipher *des_cipher = PURPLE_DES_CIPHER(obj);
-
- memset(des_cipher->priv, 0, sizeof(des_cipher->priv));
-
- g_free(des_cipher->priv);
+ parent_class->finalize(obj);
}
static void
@@ -504,14 +504,13 @@ purple_des_cipher_class_init(PurpleDESCi
pspec = g_param_spec_string("key", "key", "key", NULL,
G_PARAM_WRITABLE);
g_object_class_install_property(obj_class, PROP_KEY, pspec);
+
+ g_type_class_add_private(klass, sizeof(PurpleDESCipherPrivate));
}
static void
purple_des_cipher_init(PurpleCipher *cipher)
{
- PurpleDESCipher *des_cipher = PURPLE_DES_CIPHER(cipher);
-
- des_cipher->priv = g_new0(PurpleDESCipherPriv, 1);
}
/******************************************************************************
============================================================
--- libpurple/cipher/descipher.h 971835032f6bd178caffecbd89f9e3da59e642df
+++ libpurple/cipher/descipher.h d94f70b16d339c155df2bc169ca33d0bfa9ed5e8
@@ -35,14 +35,11 @@ typedef struct _PurpleDESCipher Purpl
#define PURPLE_DES_CIPHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_DES_CIPHER, PurpleDESCipherClass))
typedef struct _PurpleDESCipher PurpleDESCipher;
-typedef struct _PurpleDESCipherPriv PurpleDESCipherPriv;
typedef struct _PurpleDESCipherClass PurpleDESCipherClass;
struct _PurpleDESCipher {
PurpleCipher gparent;
- PurpleDESCipherPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/cipher/md5hash.c a613ab3c5941410fa2665a9943797afcb28e6f35
+++ libpurple/cipher/md5hash.c c9cb6c476a38d1088820ff6a107db449563477c3
@@ -12,6 +12,7 @@
#if !GLIB_CHECK_VERSION(2,16,0)
#define PURPLE_MD5_HASH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MD5_HASH, PurpleMD5HashPrivate))
+typedef struct _PurpleMD5HashPriv PurpleMD5HashPriv;
#endif
/******************************************************************************
============================================================
--- libpurple/cipher/md5hash.h d3eb350270eded29b6c729946159ff6f86bd72df
+++ libpurple/cipher/md5hash.h d38e5556fdde537a1d8af6f21f31d268e96ac0e7
@@ -36,7 +36,6 @@ typedef struct _PurpleMD5Hash PurpleM
#define PURPLE_MD5_HASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MD5_HASH, PurpleMD5HashClass))
typedef struct _PurpleMD5Hash PurpleMD5Hash;
-typedef struct _PurpleMD5HashPriv PurpleMD5HashPriv;
typedef struct _PurpleMD5HashClass PurpleMD5HashClass;
struct _PurpleMD5Hash {
@@ -46,8 +45,6 @@ struct _PurpleMD5Hash {
PurpleHash parent;
#endif
- PurpleMD5HashPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/cipher/sha1hash.c 4e35b1c70466f16f94a8cd8d3e8cc91c17ec008b
+++ libpurple/cipher/sha1hash.c 05237d10475a5911c0a4d6541c4d16cac47a2381
@@ -13,6 +13,7 @@
#if !GLIB_CHECK_VERSION(2,16,0)
#define PURPLE_SHA1_HASH_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SHA1_HASH, PurpleSHA1HashPrivate))
+typedef struct _PurpleSHA1HashPriv PurpleSHA1HashPriv;
#endif
/******************************************************************************
============================================================
--- libpurple/cipher/sha1hash.h e0ec60d774d90d093434395f3066882ecbe230f8
+++ libpurple/cipher/sha1hash.h 07bbfbb34415c6a2a326680df6aa9789794d009f
@@ -36,7 +36,6 @@ typedef struct _PurpleSHA1Hash Purple
#define PURPLE_SHA1_HASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SHA1_HASH, PurpleSHA1HashClass))
typedef struct _PurpleSHA1Hash PurpleSHA1Hash;
-typedef struct _PurpleSHA1HashPriv PurpleSHA1HashPriv;
typedef struct _PurpleSHA1HashClass PurpleSHA1HashClass;
struct _PurpleSHA1Hash {
@@ -46,8 +45,6 @@ struct _PurpleSHA1Hash {
PurpleHash parent;
#endif
- PurpleSHA1HashPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/smiley.c 356a10a42ef5169d0a92038272c35774b7600321
+++ libpurple/smiley.c 787f77dbdd82c477cfcf782371f41826b621ae36
@@ -385,6 +385,8 @@ purple_smiley_finalize(GObject *obj)
PURPLE_DBUS_UNREGISTER_POINTER(smiley);
purple_smileys_save();
+
+ parent_class->finalize(obj);
}
static void
============================================================
--- libpurple/cipher/des3cipher.c 2dc0bfbbca01cb63e18a33b8e6e9016b5d2a0ad4
+++ libpurple/cipher/des3cipher.c dabc9bae57cbc4b3c336b62dd6cbb7980040712c
@@ -27,7 +27,12 @@
/******************************************************************************
* Structs
*****************************************************************************/
-struct _PurpleDES3CipherPriv
+
+#define PURPLE_DES3_CIPHER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_DES3_CIPHER, PurpleDES3CipherPrivate))
+
+typedef struct _PurpleDES3CipherPrivate PurpleDES3CipherPrivate;
+struct _PurpleDES3CipherPrivate
{
PurpleCipherBatchMode mode;
guchar iv[8];
@@ -67,10 +72,11 @@ purple_des3_cipher_set_key(PurpleCipher
purple_des3_cipher_set_key(PurpleCipher *cipher, const guchar * key)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- purple_cipher_set_key(PURPLE_CIPHER(des3_cipher->priv->key1), key + 0);
- purple_cipher_set_key(PURPLE_CIPHER(des3_cipher->priv->key2), key + 8);
- purple_cipher_set_key(PURPLE_CIPHER(des3_cipher->priv->key3), key + 16);
+ purple_cipher_set_key(PURPLE_CIPHER(priv->key1), key + 0);
+ purple_cipher_set_key(PURPLE_CIPHER(priv->key2), key + 8);
+ purple_cipher_set_key(PURPLE_CIPHER(priv->key3), key + 16);
g_object_notify(G_OBJECT(des3_cipher), "key");
}
@@ -83,13 +89,14 @@ purple_des3_cipher_ecb_encrypt(PurpleDES
int i = 0;
int tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
while (offset + 8 <= len) {
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
data + offset, output + offset, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 0);
offset += 8;
@@ -107,11 +114,11 @@ purple_des3_cipher_ecb_encrypt(PurpleDES
tmp++;
}
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 0);
}
@@ -126,18 +133,19 @@ purple_des3_cipher_cbc_encrypt(PurpleDES
int i = 0;
int tmp;
guint8 buf[8];
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- memcpy(buf, des3_cipher->priv->iv, 8);
+ memcpy(buf, priv->iv, 8);
while (offset + 8 <= len) {
for (i = 0; i < 8; i++)
buf[i] ^= data[offset + i];
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 0);
memcpy(buf, output+offset, 8);
@@ -156,11 +164,11 @@ purple_des3_cipher_cbc_encrypt(PurpleDES
tmp++;
}
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 0);
}
@@ -172,10 +180,11 @@ purple_des3_cipher_encrypt(PurpleCipher
size_t len, guchar output[], size_t *outlen)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- if (des3_cipher->priv->mode == PURPLE_CIPHER_BATCH_MODE_ECB) {
+ if (priv->mode == PURPLE_CIPHER_BATCH_MODE_ECB) {
return purple_des3_cipher_ecb_encrypt(des3_cipher, data, len, output, outlen);
- } else if (des3_cipher->priv->mode == PURPLE_CIPHER_BATCH_MODE_CBC) {
+ } else if (priv->mode == PURPLE_CIPHER_BATCH_MODE_CBC) {
return purple_des3_cipher_cbc_encrypt(des3_cipher, data, len, output, outlen);
} else {
g_return_val_if_reached(0);
@@ -192,14 +201,15 @@ purple_des3_cipher_ecb_decrypt(PurpleDES
int i = 0;
int tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
while (offset + 8 <= len) {
/* NOTE: Apply key in reverse */
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
data + offset, output + offset, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 1);
offset += 8;
@@ -217,11 +227,11 @@ purple_des3_cipher_ecb_decrypt(PurpleDES
tmp++;
}
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 1);
}
@@ -237,15 +247,16 @@ purple_des3_cipher_cbc_decrypt(PurpleDES
int tmp;
guint8 buf[8] = {0,0,0,0,0,0,0,0};
guint8 link[8];
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- memcpy(link, des3_cipher->priv->iv, 8);
+ memcpy(link, priv->iv, 8);
while (offset + 8 <= len) {
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
data + offset, output + offset, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 1);
for (i = 0; i < 8; i++)
@@ -269,11 +280,11 @@ purple_des3_cipher_cbc_decrypt(PurpleDES
tmp++;
}
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key3),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key3),
buf, output + offset, 1);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key2),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key2),
output + offset, buf, 0);
- purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(des3_cipher->priv->key1),
+ purple_des_cipher_ecb_crypt(PURPLE_DES_CIPHER(priv->key1),
buf, output + offset, 1);
for (i = 0; i < 8; i++)
@@ -288,10 +299,11 @@ purple_des3_cipher_decrypt(PurpleCipher
size_t len, guchar output[], size_t *outlen)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(cipher);
- if (des3_cipher->priv->mode == PURPLE_CIPHER_BATCH_MODE_ECB) {
+ if (priv->mode == PURPLE_CIPHER_BATCH_MODE_ECB) {
return purple_des3_cipher_ecb_decrypt(des3_cipher, data, len, output, outlen);
- } else if (des3_cipher->priv->mode == PURPLE_CIPHER_BATCH_MODE_CBC) {
+ } else if (priv->mode == PURPLE_CIPHER_BATCH_MODE_CBC) {
return purple_des3_cipher_cbc_decrypt(des3_cipher, data, len, output, outlen);
} else {
g_return_val_if_reached(0);
@@ -304,8 +316,9 @@ purple_des3_cipher_set_batch_mode(Purple
purple_des3_cipher_set_batch_mode(PurpleCipher *cipher, PurpleCipherBatchMode mode)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- des3_cipher->priv->mode = mode;
+ priv->mode = mode;
g_object_notify(G_OBJECT(des3_cipher), "batchMode");
}
@@ -314,18 +327,20 @@ purple_des3_cipher_get_batch_mode(Purple
purple_des3_cipher_get_batch_mode(PurpleCipher *cipher)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- return des3_cipher->priv->mode;
+ return priv->mode;
}
static void
purple_des3_cipher_set_iv(PurpleCipher *cipher, guchar *iv, size_t len)
{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
g_return_if_fail(len == 8);
- memcpy(des3_cipher->priv->iv, iv, len);
+ memcpy(priv->iv, iv, len);
g_object_notify(G_OBJECT(des3_cipher), "iv");
}
@@ -377,16 +392,18 @@ static void
}
static void
-purple_des3_cipher_finalize(GObject *obj) {
+purple_des3_cipher_finalize(GObject *obj)
+{
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(obj);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- g_object_unref(G_OBJECT(des3_cipher->priv->key1));
- g_object_unref(G_OBJECT(des3_cipher->priv->key2));
- g_object_unref(G_OBJECT(des3_cipher->priv->key3));
+ g_object_unref(G_OBJECT(priv->key1));
+ g_object_unref(G_OBJECT(priv->key2));
+ g_object_unref(G_OBJECT(priv->key3));
- memset(des3_cipher->priv->iv, 0, sizeof(des3_cipher->priv->iv));
+ memset(priv->iv, 0, sizeof(priv->iv));
- g_free(des3_cipher->priv);
+ parent_class->finalize(obj);
}
static void
@@ -420,17 +437,18 @@ purple_des3_cipher_class_init(PurpleDES3
pspec = g_param_spec_string("key", "key", "key", NULL,
G_PARAM_WRITABLE);
g_object_class_install_property(obj_class, PROP_KEY, pspec);
+
+ g_type_class_add_private(klass, sizeof(PurpleDES3CipherPrivate));
}
static void
purple_des3_cipher_init(PurpleCipher *cipher) {
PurpleDES3Cipher *des3_cipher = PURPLE_DES3_CIPHER(cipher);
+ PurpleDES3CipherPrivate *priv = PURPLE_DES3_CIPHER_GET_PRIVATE(des3_cipher);
- des3_cipher->priv = g_new0(PurpleDES3CipherPriv, 1);
-
- des3_cipher->priv->key1 = purple_des_cipher_new();
- des3_cipher->priv->key2 = purple_des_cipher_new();
- des3_cipher->priv->key3 = purple_des_cipher_new();
+ priv->key1 = purple_des_cipher_new();
+ priv->key2 = purple_des_cipher_new();
+ priv->key3 = purple_des_cipher_new();
}
/******************************************************************************
============================================================
--- libpurple/cipher/des3cipher.h a9dd402c95fa3f97378657bf13948c84892a1d0b
+++ libpurple/cipher/des3cipher.h 66f90e1dcd392eb5ce0bab6de8b4878c43b5848d
@@ -36,14 +36,11 @@ typedef struct _PurpleDES3Cipher Purpl
#define PURPLE_DES3_CIPHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_DES3_CIPHER, PurpleDES3CipherClass))
typedef struct _PurpleDES3Cipher PurpleDES3Cipher;
-typedef struct _PurpleDES3CipherPriv PurpleDES3CipherPriv;
typedef struct _PurpleDES3CipherClass PurpleDES3CipherClass;
struct _PurpleDES3Cipher {
PurpleCipher gparent;
- PurpleDES3CipherPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/cipher/hmaccipher.c 7718c3e4c7932b67f9849ba8c3d34efbf14bc9a8
+++ libpurple/cipher/hmaccipher.c 45135f00a30143a0fae3b5a237b765666435d0fb
@@ -236,6 +236,8 @@ purple_hmac_cipher_finalize(GObject *obj
/* reset the cipher so we don't leave any data around... */
purple_hmac_cipher_reset(cipher);
+
+ parent_class->finalize(obj);
}
static void
============================================================
--- libpurple/cipher/rc4cipher.c f24404ddc7191c7948a56016335f87f437af929e
+++ libpurple/cipher/rc4cipher.c 93b4d780598ca137d522a44233ecf3bfe661c157
@@ -24,7 +24,10 @@
/*******************************************************************************
* Structs
******************************************************************************/
-struct _PurpleRC4CipherPriv {
+#define PURPLE_RC4_CIPHER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_RC4_CIPHER, PurpleRC4CipherPrivate))
+typedef struct _PurpleRC4CipherPrivate PurpleRC4CipherPrivate;
+struct _PurpleRC4CipherPrivate {
guchar state[256];
guchar x;
guchar y;
@@ -52,20 +55,22 @@ purple_rc4_cipher_reset(PurpleCipher *ci
static void
purple_rc4_cipher_reset(PurpleCipher *cipher) {
PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
+ PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
guint i;
for(i = 0; i < 256; i++)
- rc4_cipher->priv->state[i] = i;
- rc4_cipher->priv->x = 0;
- rc4_cipher->priv->y = 0;
+ priv->state[i] = i;
+ priv->x = 0;
+ priv->y = 0;
/* default is 5 bytes (40bit key) */
- rc4_cipher->priv->key_len = 5;
+ priv->key_len = 5;
}
static void
purple_rc4_cipher_set_key (PurpleCipher *cipher, const guchar * key) {
PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
+ PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
guchar *state;
guchar temp_swap;
guchar x, y;
@@ -73,14 +78,14 @@ purple_rc4_cipher_set_key (PurpleCipher
x = 0;
y = 0;
- state = &rc4_cipher->priv->state[0];
+ state = &priv->state[0];
for(i = 0; i < 256; i++)
{
y = (key[x] + state[i] + y) % 256;
temp_swap = state[i];
state[i] = state[y];
state[y] = temp_swap;
- x = (x + 1) % rc4_cipher->priv->key_len;
+ x = (x + 1) % priv->key_len;
}
g_object_notify(G_OBJECT(rc4_cipher), "key");
@@ -91,8 +96,9 @@ purple_rc4_cipher_get_key_size (PurpleCi
purple_rc4_cipher_get_key_size (PurpleCipher *cipher)
{
PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
+ PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
- return rc4_cipher->priv->key_len;
+ return priv->key_len;
}
@@ -105,10 +111,11 @@ purple_rc4_cipher_encrypt(PurpleCipher *
guchar x, y, z;
guchar *state;
guint i;
+ PurpleRC4CipherPrivate *priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
- x = rc4_cipher->priv->x;
- y = rc4_cipher->priv->y;
- state = &rc4_cipher->priv->state[0];
+ x = priv->x;
+ y = priv->y;
+ state = &priv->state[0];
for(i = 0; i < len; i++)
{
@@ -120,8 +127,8 @@ purple_rc4_cipher_encrypt(PurpleCipher *
z = state[x] + (state[y]) % 256;
output[i] = data[i] ^ state[z];
}
- rc4_cipher->priv->x = x;
- rc4_cipher->priv->y = y;
+ priv->x = x;
+ priv->y = y;
if(outlen)
*outlen = len;
@@ -171,12 +178,11 @@ purple_rc4_cipher_finalize(GObject *obj)
static void
purple_rc4_cipher_finalize(GObject *obj) {
PurpleCipher *cipher = PURPLE_CIPHER(obj);
- PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(obj);
/* reset the cipher so we don't leave any data around... */
purple_rc4_cipher_reset(cipher);
- g_free(rc4_cipher->priv);
+ parent_class->finalize(obj);
}
static void
@@ -204,14 +210,12 @@ purple_rc4_cipher_class_init(PurpleRC4Ci
pspec = g_param_spec_string("key", "key", "key", NULL,
G_PARAM_WRITABLE);
g_object_class_install_property(obj_class, PROP_KEY, pspec);
+
+ g_type_class_add_private(klass, sizeof(PurpleRC4CipherPrivate));
}
static void
purple_rc4_cipher_init(PurpleCipher *cipher) {
- PurpleRC4Cipher *rc4_cipher = PURPLE_RC4_CIPHER(cipher);
-
- rc4_cipher->priv = g_new0(PurpleRC4CipherPriv, 1);
-
purple_rc4_cipher_reset(cipher);
}
@@ -253,9 +257,12 @@ purple_rc4_cipher_set_key_len(PurpleRC4C
purple_rc4_cipher_set_key_len(PurpleRC4Cipher *rc4_cipher,
gint key_len)
{
+ PurpleRC4CipherPrivate *priv;
+
g_return_if_fail(PURPLE_IS_RC4_CIPHER(rc4_cipher));
- rc4_cipher->priv->key_len = key_len;
+ priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
+ priv->key_len = key_len;
g_object_notify(G_OBJECT(rc4_cipher), "key_len");
}
@@ -263,7 +270,11 @@ purple_rc4_cipher_get_key_len(PurpleRC4C
gint
purple_rc4_cipher_get_key_len(PurpleRC4Cipher *rc4_cipher)
{
+ PurpleRC4CipherPrivate *priv;
+
g_return_val_if_fail(PURPLE_IS_RC4_CIPHER(rc4_cipher), 0);
- return rc4_cipher->priv->key_len;
+ priv = PURPLE_RC4_CIPHER_GET_PRIVATE(rc4_cipher);
+
+ return priv->key_len;
}
============================================================
--- libpurple/cipher/rc4cipher.h 3ad9c8fd7bc8fd22afe8070180eec70fdac29419
+++ libpurple/cipher/rc4cipher.h 4fc01a1004272b8ddfc9e47b26eafb1e28ef59dc
@@ -36,14 +36,11 @@ typedef struct _PurpleRC4Cipher Purpl
#define PURPLE_RC4_CIPHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_RC4_CIPHER, PurpleRC4CipherClass))
typedef struct _PurpleRC4Cipher PurpleRC4Cipher;
-typedef struct _PurpleRC4CipherPriv PurpleRC4CipherPriv;
typedef struct _PurpleRC4CipherClass PurpleRC4CipherClass;
struct _PurpleRC4Cipher {
PurpleCipher gparent;
- PurpleRC4CipherPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
============================================================
--- libpurple/pobject.c 3c9b16f252e48168902027d54502264883b62363
+++ libpurple/pobject.c 875d125e765040a0f9883fbf73767e50a8129efb
@@ -20,6 +20,9 @@
*/
#include "pobject.h"
+#define PURPLE_OBJECT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_OBJECT, PurpleObjectPrivate))
+
+typedef struct _PurpleObjectPrivate PurpleObjectPrivate;
struct _PurpleObjectPrivate
{
gpointer proto_data;
@@ -42,14 +45,17 @@ purple_object_dispose(GObject *obj)
purple_object_dispose(GObject *obj)
{
PurpleObject *pobj = PURPLE_OBJECT(obj);
+ PurpleObjectPrivate *priv;
+ priv = PURPLE_OBJECT_GET_PRIVATE(obj);
+
g_signal_emit(pobj, signals[SIG_DESTROYING], 0);
- if (pobj->priv->proto_data) {
+ if (priv->proto_data) {
g_warning("Purple-Object: object destroyed without unsetting the protocol data. This may lead to memory leak.\n");
}
- if (pobj->priv->ui_data) {
+ if (priv->ui_data) {
g_warning("Purple-Object: object destroyed without unsetting the ui data. This may lead to memory leak.\n");
}
@@ -92,17 +98,15 @@ purple_object_class_init(PurpleObjectCla
/* This signal should be emitted when the object has been completely destroyed.
* So the callback should not query the object for any information. */
signals[SIG_DESTROYED] = g_signal_new("destroyed", G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_ACTION, 0, NULL, NULL,
+ 0, 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
g_type_class_add_private(klass, sizeof(PurpleObjectPrivate));
}
static void
purple_object_init(GTypeInstance *instance, gpointer class)
{
- PurpleObject *pobj = PURPLE_OBJECT(instance);
- pobj->priv = G_TYPE_INSTANCE_GET_PRIVATE(pobj, PURPLE_TYPE_OBJECT, PurpleObjectPrivate);
- pobj->priv->proto_data = NULL;
}
GType purple_object_get_type(void)
@@ -133,26 +137,38 @@ void purple_object_set_protocol_data(Pur
void purple_object_set_protocol_data(PurpleObject *pobj, gpointer proto_data)
{
+ PurpleObjectPrivate *priv;
+
g_return_if_fail(pobj);
- pobj->priv->proto_data = proto_data;
+ priv = PURPLE_OBJECT_GET_PRIVATE(pobj);
+ priv->proto_data = proto_data;
}
gpointer purple_object_get_protocol_data(PurpleObject *pobj)
{
+ PurpleObjectPrivate *priv;
+
g_return_val_if_fail(pobj, NULL);
- return pobj->priv->proto_data;
+ priv = PURPLE_OBJECT_GET_PRIVATE(pobj);
+ return priv->proto_data;
}
void purple_object_set_ui_data(PurpleObject *pobj, gpointer ui_data)
{
+ PurpleObjectPrivate *priv;
+
g_return_if_fail(pobj);
- pobj->priv->ui_data = ui_data;
+ priv = PURPLE_OBJECT_GET_PRIVATE(pobj);
+ priv->ui_data = ui_data;
}
gpointer purple_object_get_ui_data(PurpleObject *pobj)
{
+ PurpleObjectPrivate *priv;
+
g_return_val_if_fail(pobj, NULL);
- return pobj->priv->ui_data;
+ priv = PURPLE_OBJECT_GET_PRIVATE(pobj);
+ return priv->ui_data;
}
int purple_object_get_int(PurpleObject *pobj, const char *prop)
============================================================
--- libpurple/pobject.h 18fe9cec069e515633b56a33dea53ecdc2b83f88
+++ libpurple/pobject.h 5df7b77dc2a8d4215e58da9ac56f36c2e716e2c6
@@ -32,13 +32,11 @@ typedef struct _PurpleObject Purp
#define PURPLE_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_OBJECT, PurpleObjectClass))
typedef struct _PurpleObject PurpleObject;
-typedef struct _PurpleObjectPrivate PurpleObjectPrivate;
typedef struct _PurpleObjectClass PurpleObjectClass;
struct _PurpleObject
{
GObject gparent;
- PurpleObjectPrivate *priv;
void (*_reserved[4])(void);
};
============================================================
--- libpurple/theme.c 562727889d220926e36d1282c0ae82e921a4dc2a
+++ libpurple/theme.c 140827aa9a443039fd0ecab36ba9bc71e755a0bd
@@ -24,8 +24,8 @@
#include "theme.h"
#include "util.h"
-#define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \
- ((PurpleThemePrivate *) ((PurpleTheme)->priv))
+#define PURPLE_THEME_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_THEME, PurpleThemePrivate))
void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
@@ -132,8 +132,6 @@ purple_theme_init(GTypeInstance *instanc
purple_theme_init(GTypeInstance *instance,
gpointer klass)
{
- PurpleTheme *theme = PURPLE_THEME(instance);
- theme->priv = g_new0(PurpleThemePrivate, 1);
}
static void
@@ -205,6 +203,8 @@ purple_theme_class_init(PurpleThemeClass
NULL,
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_IMAGE, pspec);
+
+ g_type_class_add_private(klass, sizeof(PurpleThemePrivate));
}
============================================================
--- libpurple/theme.h 5b185ced6cfecfcf6a5c7b59d346add4c85833a8
+++ libpurple/theme.h f19f99fbbca849b3ed39f56209104eef9255f132
@@ -49,7 +49,6 @@ struct _PurpleTheme
struct _PurpleTheme
{
GObject parent;
- gpointer priv;
};
struct _PurpleThemeClass
============================================================
--- libpurple/theme-loader.c d640ec7a4cfc5b9b5e06e75e2a30554967d7aaee
+++ libpurple/theme-loader.c 0e5b24cf2c9d63ffeae638de778cee8235a982c4
@@ -23,8 +23,8 @@
#include "internal.h"
#include "theme-loader.h"
-#define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \
- ((PurpleThemeLoaderPrivate *) ((PurpleThemeLoader)->priv))
+#define PURPLE_THEME_LOADER_GET_PRIVATE(loader) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((loader), PURPLE_TYPE_THEME_LOADER, PurpleThemeLoaderPrivate))
void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
@@ -89,8 +89,6 @@ purple_theme_loader_init(GTypeInstance *
purple_theme_loader_init(GTypeInstance *instance,
gpointer klass)
{
- PurpleThemeLoader *loader = PURPLE_THEME_LOADER(instance);
- loader->priv = g_new0(PurpleThemeLoaderPrivate, 1);
}
static void
@@ -123,6 +121,8 @@ purple_theme_loader_class_init(PurpleThe
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property(obj_class, PROP_TYPE, pspec);
+
+ g_type_class_add_private(klass, sizeof(PurpleThemeLoaderPrivate));
}
GType
============================================================
--- libpurple/theme-loader.h bbb30ed76a7b4a55a568e6364ac48ecac3fc6c62
+++ libpurple/theme-loader.h eb80046e3c0c90a69f86f073bdfe6841a14cf654
@@ -50,7 +50,6 @@ struct _PurpleThemeLoader
struct _PurpleThemeLoader
{
GObject parent;
- gpointer priv;
};
struct _PurpleThemeLoaderClass
============================================================
--- libpurple/sound-theme.c 832cad835b20e8d5bcd36e680644b90ef67f7cc0
+++ libpurple/sound-theme.c 0dbf5b045792c21fe934b3d169c1b26cd9e2b332
@@ -23,8 +23,8 @@
#include "internal.h"
#include "sound-theme.h"
-#define PURPLE_SOUND_THEME_GET_PRIVATE(Gobject) \
- ((PurpleSoundThemePrivate *) ((PURPLE_SOUND_THEME(Gobject))->priv))
+#define PURPLE_SOUND_THEME_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SOUND_THEME, PurpleSoundThemePrivate))
/******************************************************************************
* Structs
@@ -55,8 +55,6 @@ purple_sound_theme_init(GTypeInstance *i
{
PurpleSoundThemePrivate *priv;
- (PURPLE_SOUND_THEME(instance))->priv = g_new0(PurpleSoundThemePrivate, 1);
-
priv = PURPLE_SOUND_THEME_GET_PRIVATE(instance);
priv->sound_files = g_hash_table_new_full(g_str_hash,
@@ -83,6 +81,8 @@ purple_sound_theme_class_init(PurpleSoun
parent_class = g_type_class_peek_parent(klass);
obj_class->finalize = purple_sound_theme_finalize;
+
+ g_type_class_add_private(klass, sizeof(PurpleSoundThemePrivate));
}
GType
============================================================
--- libpurple/sound-theme.h d6e1850e4cd92ead2ac39ab8dca7ce6874f4bb60
+++ libpurple/sound-theme.h 6caadf8daa0a32eaef6fc9db533e5c02ec48f751
@@ -51,7 +51,6 @@ struct _PurpleSoundTheme
struct _PurpleSoundTheme
{
PurpleTheme parent;
- gpointer priv;
};
struct _PurpleSoundThemeClass
============================================================
--- libpurple/blist-node.c 3ea27dac196d63d8d423ec1b9f89a04410afb92a
+++ libpurple/blist-node.c c509e72c41b6fada28d6765917602119e1d22ef0
@@ -42,7 +42,11 @@ static guint signals[SIG_LAST] = { 0 };
};
static guint signals[SIG_LAST] = { 0 };
-struct _PurpleBlistNodePrivate {
+#define PURPLE_BLIST_NODE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodePrivate))
+typedef struct _PurpleBlistNodePrivate PurpleBlistNodePrivate;
+
+struct _PurpleBlistNodePrivate
+{
GHashTable *settings; /**< per-node settings; keys are
<tt>gchar *</tt>, values are
slice-allocated
@@ -798,7 +802,6 @@ purple_blist_node_init(GTypeInstance *in
purple_blist_node_init(GTypeInstance *instance, gpointer class)
{
PurpleBlistNode *node = PURPLE_BLIST_NODE(instance);
- node->priv = PURPLE_BLIST_NODE_GET_PRIVATE(node);
purple_blist_node_initialize_settings(node);
}
============================================================
--- libpurple/buddy.c 63d7501a75d043f9660e0433fee19a8288fda567
+++ libpurple/buddy.c 24af7351c14fba9ce7383993dc03f2ca7edf18ea
@@ -33,6 +33,7 @@
#include "buddy.h"
#define PURPLE_BUDDY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_BUDDY_TYPE, PurpleBuddyPrivate))
+typedef struct _PurpleBuddyPrivate PurpleBuddyPrivate;
static PurpleBlistNodeClass *parent_class = NULL;
@@ -669,10 +670,7 @@ purple_buddy_init(GTypeInstance *instanc
{
PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
PurpleBuddy *buddy = PURPLE_BUDDY(instance);
- PurpleBuddyPrivate *priv = PURPLE_BUDDY_GET_PRIVATE(buddy);
- buddy->priv = priv;
-
if (ops && ops->new_node)
ops->new_node(PURPLE_BLIST_NODE(buddy));
============================================================
--- libpurple/chat.c 29f6928b55e5784e1c8b2f763d741823408c3353
+++ libpurple/chat.c 4b870c34526854bf18d22cc9acf1d6f25876149b
@@ -31,6 +31,7 @@
#include "blist.h"
#define PURPLE_CHAT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_CHAT_TYPE, PurpleChatPrivate))
+typedef struct _PurpleChatPrivate PurpleChatPrivate;
struct _PurpleChatPrivate {
char *alias; /**< The display name of this chat. */
@@ -403,8 +404,6 @@ purple_chat_init(GTypeInstance *instance
PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
PurpleChat *chat = PURPLE_CHAT(instance);
- chat->priv = PURPLE_CHAT_GET_PRIVATE(chat);
-
if (ops != NULL && ops->new_node != NULL)
ops->new_node(PURPLE_BLIST_NODE(chat));
============================================================
--- libpurple/contact.c 6a330790a9f0ab8fbd63b0d12abd20299a6c7f01
+++ libpurple/contact.c 769befe8a3a02112beceded10a1157a8d913c6cc
@@ -31,6 +31,7 @@
#include "xmlnode.h"
#define PURPLE_CONTACT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_CONTACT_TYPE, PurpleContactPrivate))
+typedef struct _PurpleContactPrivate PurpleContactPrivate;
struct _PurpleContactPrivate {
char *alias; /**< The user-set alias of the contact */
@@ -511,7 +512,7 @@ purple_contact_init(GTypeInstance *insta
{
PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
PurpleContact *contact = PURPLE_CONTACT(instance);
- PurpleContactPrivate *priv = contact->priv = PURPLE_CONTACT_GET_PRIVATE(contact);
+ PurpleContactPrivate *priv = PURPLE_CONTACT_GET_PRIVATE(contact);
priv->totalsize = 0;
priv->currentsize = 0;
============================================================
--- libpurple/group.c 0bf1414c17e2c19dd3eec480d2e2236b0965a8a8
+++ libpurple/group.c 024e018048d92bdda0bbedd5789528e21fd57e35
@@ -31,6 +31,7 @@
#include "xmlnode.h"
#define PURPLE_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_GROUP_TYPE, PurpleGroupPrivate))
+typedef struct _PurpleGroupPrivate PurpleGroupPrivate;
static PurpleBlistNodeClass *parent_class = NULL;
============================================================
--- libpurple/blist-node.h 589f1a53393c3a8a3d94a2bea1590b5eeaf2b226
+++ libpurple/blist-node.h 162811e27f33e7c13e88e5716e008ccbe9521e92
@@ -46,7 +46,6 @@ typedef struct _PurpleBlistNode PurpleBl
/** @copydoc _PurpleBlistNode */
typedef struct _PurpleBlistNode PurpleBlistNode;
-typedef struct _PurpleBlistNodePrivate PurpleBlistNodePrivate;
typedef struct _PurpleBlistNodeClass PurpleBlistNodeClass;
#include "pobject.h"
@@ -57,9 +56,7 @@ typedef struct _PurpleBlistNodeClass Pur
#define PURPLE_BLIST_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodeClass))
#define PURPLE_IS_BLIST_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PURPLE_BLIST_NODE_TYPE))
#define PURPLE_GET_BLIST_NODE_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodeClass))
-#define PURPLE_BLIST_NODE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PURPLE_BLIST_NODE_TYPE, PurpleBlistNodePrivate))
-
/**
* A Buddy list node. This can represent a group, a buddy, or anything else.
* This is a base class for PurpleBuddy, PurpleContact, PurpleGroup, and for
@@ -70,8 +67,6 @@ struct _PurpleBlistNode {
PurpleBlistNode *next; /**< The sibling after this buddy. */
PurpleBlistNode *parent; /**< The parent of this node */
PurpleBlistNode *child; /**< The child of this node */
-
- PurpleBlistNodePrivate *priv; /**< The private members */
};
struct _PurpleBlistNodeClass {
============================================================
--- libpurple/buddy.h ba45f8636141881c89d64bc7dd042d3b4cbcb1dd
+++ libpurple/buddy.h cc4235c8a4dc9287a0af0f120052ca0b5ae42748
@@ -31,7 +31,6 @@ typedef struct _PurpleBuddy PurpleBuddy;
/** @copydoc _PurpleBuddy */
typedef struct _PurpleBuddy PurpleBuddy;
-typedef struct _PurpleBuddyPrivate PurpleBuddyPrivate;
typedef struct _PurpleBuddyClass PurpleBuddyClass;
#include "buddyicon.h"
@@ -51,7 +50,6 @@ struct _PurpleBuddy {
*/
struct _PurpleBuddy {
PurpleBlistNode node; /**< The node that this buddy inherits from */
- PurpleBuddyPrivate *priv;
};
struct _PurpleBuddyClass {
============================================================
--- libpurple/chat.h 750d6a843ce1855d2a0bd69fc173284069c8db71
+++ libpurple/chat.h 1157d083c6006a63e3ed2140986e8f7fc4376f13
@@ -30,7 +30,6 @@ typedef struct _PurpleChat PurpleChat;
/** @copydoc _PurpleChat */
typedef struct _PurpleChat PurpleChat;
-typedef struct _PurpleChatPrivate PurpleChatPrivate;
typedef struct _PurpleChatClass PurpleChatClass;
#include "blist-node.h"
@@ -50,7 +49,6 @@ struct _PurpleChat {
*/
struct _PurpleChat {
PurpleBlistNode node; /**< The node that this chat inherits from */
- PurpleChatPrivate *priv;
};
struct _PurpleChatClass {
============================================================
--- libpurple/contact.h c13d6ad0b458b179a9a01d06f8967e4c7a2a3533
+++ libpurple/contact.h 6722f41df967d59c3ca1aacb52badd5c4e992124
@@ -31,7 +31,6 @@ typedef struct _PurpleContact PurpleCont
/** @copydoc _PurpleContact */
typedef struct _PurpleContact PurpleContact;
-typedef struct _PurpleContactPrivate PurpleContactPrivate;
typedef struct _PurpleContactClass PurpleContactClass;
#include "buddy.h"
@@ -48,7 +47,6 @@ struct _PurpleContact {
*/
struct _PurpleContact {
PurpleBlistNode node; /**< The node that this contact inherits from. */
- PurpleContactPrivate *priv;
};
struct _PurpleContactClass {
============================================================
--- libpurple/group.h bf009625fefa170a2a25f8894be60cd9936eaeec
+++ libpurple/group.h 5c6036687bd12bbd1b710f8a1ea676f42f840656
@@ -31,7 +31,6 @@ typedef struct _PurpleGroup PurpleGroup;
/** @copydoc _PurpleGroup */
typedef struct _PurpleGroup PurpleGroup;
-typedef struct _PurpleGroupPrivate PurpleGroupPrivate;
typedef struct _PurpleGroupClass PurpleGroupClass;
#include "buddy.h"
@@ -51,7 +50,6 @@ struct _PurpleGroup {
*/
struct _PurpleGroup {
PurpleBlistNode node; /**< The node that this group inherits from */
- PurpleGroupPrivate *priv;
};
struct _PurpleGroupClass {
============================================================
--- libpurple/cipher/sha256hash.c ac821bf660e7932b7df7d6da2c75fb9f99a280a8
+++ libpurple/cipher/sha256hash.c b0878f35c7768d2fcb5bb68175d24dceb7680a60
@@ -19,6 +19,7 @@
* Structs
*****************************************************************************/
#if !GLIB_CHECK_VERSION(2,16,0)
+typedef struct _PurpleSHA256HashPriv PurpleSHA256HashPriv;
typedef struct {
guint32 H[8];
guint32 W[64];
============================================================
--- libpurple/cipher/sha256hash.h 9477bf230ae4a42edf08cd0e9a097cc62e8bd512
+++ libpurple/cipher/sha256hash.h 3bacf1307310221d1ce1751de7220623713117da
@@ -36,7 +36,6 @@ typedef struct _PurpleSHA256Hash Purp
#define PURPLE_SHA256_HASH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_SHA256_HASH, PurpleSHA256HashClass))
typedef struct _PurpleSHA256Hash PurpleSHA256Hash;
-typedef struct _PurpleSHA256HashPriv PurpleSHA256HashPriv;
typedef struct _PurpleSHA256HashClass PurpleSHA256HashClass;
struct _PurpleSHA256Hash {
@@ -46,8 +45,6 @@ struct _PurpleSHA256Hash {
PurpleHash parent;
#endif
- PurpleSHA256HashPriv *priv;
-
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
More information about the Commits
mailing list