soc.2008.masterpassword: 0ae2a72f: These macros just mask what's going on h...

qulogic at pidgin.im qulogic at pidgin.im
Mon Nov 7 02:36:57 EST 2011


----------------------------------------------------------------------
Revision: 0ae2a72f44dab889ee4a2c5664f0ca15fe484ae8
Parent:   762ed6c6d0c4ad53dbe0a69c8e733327faa3cacd
Author:   qulogic at pidgin.im
Date:     11/06/11 01:08:21
Branch:   im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/0ae2a72f44dab889ee4a2c5664f0ca15fe484ae8

Changelog: 

These macros just mask what's going on here.

Changes against parent 762ed6c6d0c4ad53dbe0a69c8e733327faa3cacd

  patched  libpurple/plugins/keyrings/internalkeyring.c

-------------- next part --------------
============================================================
--- libpurple/plugins/keyrings/internalkeyring.c	532614a7dd605bf9eb925196b9a88d7b1ddca318
+++ libpurple/plugins/keyrings/internalkeyring.c	a0b1029bfac9042dbbaa68298106961e479f48d9
@@ -50,10 +50,6 @@
 #define	INTERNALKEYRING_AUTHOR      "Scrouaf (scrouaf[at]soc.pidgin.im)"
 #define INTERNALKEYRING_ID          PURPLE_DEFAULT_KEYRING
 
-#define GET_PASSWORD(account) \
-	g_hash_table_lookup (internal_keyring_passwords, account)
-#define SET_PASSWORD(account, password) \
-	g_hash_table_replace(internal_keyring_passwords, account, password)
 #define ACTIVATE()\
 	if (internal_keyring_is_active == FALSE)\
 		internal_keyring_open();
@@ -88,7 +84,7 @@ internal_keyring_read(PurpleAccount *acc
 		purple_account_get_username(account),
 		purple_account_get_protocol_id(account));
 
-	password = GET_PASSWORD(account);
+	password = g_hash_table_lookup(internal_keyring_passwords, account);
 
 	if (password != NULL) {
 		if (cb != NULL)
@@ -108,8 +104,6 @@ internal_keyring_save(PurpleAccount *acc
                       PurpleKeyringSaveCallback cb,
                       gpointer data)
 {
-	gchar *copy;
-
 	ACTIVATE();
 
 	if (password == NULL || *password == '\0') {
@@ -119,8 +113,7 @@ internal_keyring_save(PurpleAccount *acc
 			purple_account_get_username(account),
 			purple_account_get_protocol_id(account));
 	} else {
-		copy = g_strdup(password);
-		SET_PASSWORD((void *)account, copy);	/* cast prevents warning because account is const */
+		g_hash_table_replace(internal_keyring_passwords, account, g_strdup(password));
 		purple_debug_info("keyring-internal",
 			"Updated password for account %s (%s).\n",
 			purple_account_get_username(account),
@@ -148,8 +141,6 @@ internal_keyring_import_password(PurpleA
                                  const char *data,
                                  GError **error)
 {
-	gchar *copy;
-
 	ACTIVATE();
 
 	purple_debug_info("keyring-internal", "Importing password.\n");
@@ -158,8 +149,7 @@ internal_keyring_import_password(PurpleA
 	    data != NULL &&
 	    (mode == NULL || g_strcmp0(mode, "cleartext") == 0)) {
 
-		copy = g_strdup(data);
-		SET_PASSWORD(account, copy);
+		g_hash_table_replace(internal_keyring_passwords, account, g_strdup(data));
 		return TRUE;
 
 	} else {
@@ -184,7 +174,7 @@ internal_keyring_export_password(PurpleA
 
 	purple_debug_info("keyring-internal", "Exporting password.\n");
 
-	password = GET_PASSWORD(account);
+	password = g_hash_table_lookup(internal_keyring_passwords, account);
 
 	if (password == NULL) {
 		return FALSE;


More information about the Commits mailing list