changeset 262:e9a7c018a952

reduce redundancy
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 04 Dec 2008 00:18:38 +0900
parents e3076b5e059d
children b2c64cd550da
files icon.c main.c
diffstat 2 files changed, 12 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- 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");
--- 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");