# HG changeset patch # User Yoshiki Yazawa # Date 1228317518 -32400 # Node ID e9a7c018a952620c81426bb87244e45e2b0af9d8 # Parent e3076b5e059d98cea924da7ad248ba8e9f529122 reduce redundancy diff -r e3076b5e059d -r e9a7c018a952 icon.c --- a/icon.c Wed Dec 03 22:57:03 2008 +0900 +++ b/icon.c Thu Dec 04 00:18:38 2008 +0900 @@ -66,16 +66,10 @@ /* insert icon */ switch(service) { case twitter_service: - hash = icon_hash[twitter_service]; - break; case wassr_service: - hash = icon_hash[wassr_service]; - break; case identica_service: - hash = icon_hash[identica_service]; - break; case jisko_service: - hash = icon_hash[jisko_service]; + hash = icon_hash[service]; break; default: twitter_debug("unknown service\n"); @@ -84,7 +78,6 @@ if(hash) data = (icon_data *)g_hash_table_lookup(hash, user_name); - /* in this function, we put an icon for pending marks. we should * not invalidate the icon here, otherwise it may result in * thrashing. --yaz */ @@ -115,16 +108,10 @@ switch(service) { case twitter_service: - hash = icon_hash[twitter_service]; - break; case wassr_service: - hash = icon_hash[wassr_service]; - break; case identica_service: - hash = icon_hash[identica_service]; - break; case jisko_service: - hash = icon_hash[jisko_service]; + hash = icon_hash[service]; break; default: twitter_debug("unknown service\n"); @@ -171,22 +158,22 @@ if(service == twitter_service) { data = (icon_data *)g_hash_table_lookup( - icon_hash[twitter_service], user_name); + icon_hash[service], user_name); regp_id = IMAGE_TWITTER; } else if(service == wassr_service) { data = (icon_data *)g_hash_table_lookup( - icon_hash[wassr_service], user_name); + icon_hash[service], user_name); regp_id = IMAGE_WASSR; } else if(service == identica_service) { data = (icon_data *)g_hash_table_lookup( - icon_hash[identica_service], user_name); + icon_hash[service], user_name); regp_id = IMAGE_IDENTICA; } else if(service == jisko_service) { data = (icon_data *)g_hash_table_lookup( - icon_hash[jisko_service], user_name); + icon_hash[service], user_name); regp_id = IMAGE_JISKO; } @@ -206,7 +193,8 @@ g_match_info_free(match_info); if(service == twitter_service) { - twitter_debug("fall back to twitter default icon\n"); + twitter_debug("fall back to twitter default icon: %s\n", + gotdata->user_name); url = g_strdup(TWITTER_DEFAULT_ICON_URL); } else if(service == identica_service) { @@ -356,16 +344,10 @@ switch(service) { case twitter_service: - hash = icon_hash[twitter_service]; - break; case wassr_service: - hash = icon_hash[wassr_service]; - break; case identica_service: - hash = icon_hash[identica_service]; - break; case jisko_service: - hash = icon_hash[jisko_service]; + hash = icon_hash[service]; break; default: twitter_debug("unknown service\n"); diff -r e3076b5e059d -r e9a7c018a952 main.c --- a/main.c Wed Dec 03 22:57:03 2008 +0900 +++ b/main.c Thu Dec 04 00:18:38 2008 +0900 @@ -731,16 +731,12 @@ source.id = 0; source.conv = NULL; } - hash = icon_hash[twitter_service]; + hash = icon_hash[service]; break; case wassr_service: - hash = icon_hash[wassr_service]; - break; case identica_service: - hash = icon_hash[identica_service]; - break; case jisko_service: - hash = icon_hash[jisko_service]; + hash = icon_hash[service]; break; default: twitter_debug("unknown service\n"); @@ -1021,16 +1017,10 @@ switch(service) { case twitter_service: - hash = icon_hash[twitter_service]; - break; case wassr_service: - hash = icon_hash[wassr_service]; - break; case identica_service: - hash = icon_hash[identica_service]; - break; case jisko_service: - hash = icon_hash[jisko_service]; + hash = icon_hash[service]; break; default: twitter_debug("unknown service\n");