Revision: 6459
Author: nogu.dev
Date: Sun Jun 20 00:04:11 2010
Log: * gtk/uim-cand-win-tbl-gtk.c
  - (uim_cand_win_tbl_gtk_dispose):
    Remove redundant NULL check before g_free().
* fep/callbacks.c
  - (commit_cb, free_preedit): Remove redundant NULL check before free().
* fep/draw.c
  - (erase_preedit, set_line2width): Ditto.
* gtk/compose.c
  - (parse_compose_line): Ditto.
* gtk/gtk-im-uim.c
  - (im_uim_create_cand_win_gtk): Ditto.
* gtk/uim-cand-win-tbl-gtk.c
  - (init_labelchar_table): Ditto.
* helper/dict-word.c
  - (word_append): Ditto.
* qt/immodule-quiminputcontext_compose.cpp
  - (QUimInputContext::parse_compose_line): Ditto.
* qt4/immodule/quiminputcontext_compose.cpp
  - (QUimInputContext::parse_compose_line): Ditto.
* replace/bsd-poll.c
  - (poll): Ditto.
* xim/compose.cpp
  - (XimIM::parse_compose_line): Ditto.
* xim/convdisp.cpp
  - (ConvdispOs::compose_preedit_array): Ditto.
* xim/ximic.cpp
  - (icxatr::getSize): Ditto.
* xim/ximim.cpp
  - (XimIM_impl::changeContext, XimIM::FreeComposeTree,
    XimIM::get_encoding): Ditto.
* xim/ximserver.cpp
  - (XimServer::getIMLang): Ditto.
http://code.google.com/p/uim/source/detail?r=6459

Modified:
 /trunk/fep/callbacks.c
 /trunk/fep/draw.c
 /trunk/gtk/compose.c
 /trunk/gtk/gtk-im-uim.c
 /trunk/gtk/uim-cand-win-tbl-gtk.c
 /trunk/helper/dict-word.c
 /trunk/qt/immodule-quiminputcontext_compose.cpp
 /trunk/qt4/immodule/quiminputcontext_compose.cpp
 /trunk/replace/bsd-poll.c
 /trunk/xim/compose.cpp
 /trunk/xim/convdisp.cpp
 /trunk/xim/ximic.cpp
 /trunk/xim/ximim.cpp
 /trunk/xim/ximserver.cpp

=======================================
--- /trunk/fep/callbacks.c      Thu Jun 10 02:15:41 2010
+++ /trunk/fep/callbacks.c      Sun Jun 20 00:04:11 2010
@@ -468,9 +468,7 @@
 static void clear_cb(void *ptr)
 {
   start_callbacks();
-  if (s_preedit != NULL) {
-    free_preedit(s_preedit);
-  }
+  free_preedit(s_preedit);
   s_preedit = create_preedit();
   s_preedit->cursor = UNDEFINED;
   debug2(("clear_cb()\n"));
@@ -710,9 +708,7 @@
   for (i = 0; i < p->nr_psegs; i++) {
     free(p->pseg[i].str);
   }
-  if (p->pseg != NULL) {
-    free(p->pseg);
-  }
+  free(p->pseg);
   free(p);
 }

=======================================
--- /trunk/fep/draw.c   Sun Apr  4 20:35:54 2010
+++ /trunk/fep/draw.c   Sun Jun 20 00:04:11 2010
@@ -973,9 +973,7 @@
 {
   s_prev_preedit_lines = s_preedit_lines;
   s_preedit_lines = 1;
-  if (s_prev_line2width != NULL) {
-    free(s_prev_line2width);
-  }
+  free(s_prev_line2width);
   s_prev_line2width = s_line2width;
   s_line2width = uim_malloc(sizeof(int));
   s_line2width[0] = s_head.col;
@@ -988,9 +986,7 @@
   int line_width = s_head.col;
   int lineno = 0;

-  if (s_prev_line2width != NULL) {
-    free(s_prev_line2width);
-  }
+  free(s_prev_line2width);
   s_prev_line2width = s_line2width;
   s_prev_preedit_lines = s_preedit_lines;
   s_line2width = uim_malloc(sizeof(int));
=======================================
--- /trunk/gtk/compose.c        Sun Apr  4 20:35:54 2010
+++ /trunk/gtk/compose.c        Sun Jun 20 00:04:11 2010
@@ -653,11 +653,9 @@
        }
     }

-    if (p->mb != NULL)
-       free(p->mb);
+    free(p->mb);
     p->mb = rhs_string_mb;
-    if (p->utf8 != NULL)
-       free(p->utf8);
+    free(p->utf8);
     p->utf8 = rhs_string_utf8;
     p->ks = rhs_keysym;
     return n;
=======================================
--- /trunk/gtk/gtk-im-uim.c     Sun Jun 13 00:54:35 2010
+++ /trunk/gtk/gtk-im-uim.c     Sun Jun 20 00:04:11 2010
@@ -1403,9 +1403,7 @@
   } else {
     cwin = uim_cand_win_gtk_new();
   }
-  if (candwinprog) {
-    free(candwinprog);
-  }
+  free(candwinprog);
   return cwin;
 }

=======================================
--- /trunk/gtk/uim-cand-win-tbl-gtk.c   Sat Jun 19 00:27:33 2010
+++ /trunk/gtk/uim-cand-win-tbl-gtk.c   Sun Jun 20 00:04:11 2010
@@ -227,9 +227,7 @@
   }
   ary0 = ary = (uim_lisp *)uim_scm_list2array(list, &len, NULL);
   if (ary == NULL || len <= 0) {
-    if (ary0) {
-      free(ary0);
-    }
+    free(ary0);
     return default_tbl_cell2label;
   }
   table = (gchar *)g_malloc0(TABLE_NR_CELLS);
@@ -307,10 +305,8 @@
   if (ctblwin->buttons) {
     guint i;
     for (i = 0; i < ctblwin->buttons->len; i++) {
-      if (ctblwin->buttons->pdata[i]) {
-        g_free(ctblwin->buttons->pdata[i]);
-        /* GtkButton is destroyed by container */
-      }
+      g_free(ctblwin->buttons->pdata[i]);
+      /* GtkButton is destroyed by container */
     }
     g_ptr_array_free(ctblwin->buttons, TRUE);
     ctblwin->buttons = NULL;
=======================================
--- /trunk/helper/dict-word.c   Sun Apr  4 20:35:54 2010
+++ /trunk/helper/dict-word.c   Sun Jun 20 00:04:11 2010
@@ -103,18 +103,12 @@
 void word_free_list(uim_word *head) {
     uim_word *pos, *pos_prev;
     for (pos = head; pos != NULL; ) {
-       if (pos->charset != NULL)
-           free(pos->charset);
-       if (pos->phon != NULL)
-           free(pos->phon);
-       if (pos->desc != NULL)
-           free(pos->desc);
-       if (pos->cclass_code != NULL)
-           free(pos->cclass_code);
-       if (pos->cclass_native != NULL)
-           free(pos->cclass_native);
-       if (pos->annotation != NULL)
-           free(pos->annotation);
+        free(pos->charset);
+        free(pos->phon);
+        free(pos->desc);
+        free(pos->cclass_code);
+        free(pos->cclass_native);
+        free(pos->annotation);

        pos_prev = pos;
        pos = pos->next;
=======================================
--- /trunk/qt/immodule-quiminputcontext_compose.cpp     Sun Jun 13 18:59:57 2010
+++ /trunk/qt/immodule-quiminputcontext_compose.cpp     Sun Jun 20 00:04:11 2010
@@ -800,11 +800,9 @@
        }
     }

-    if (p->mb != NULL)
-       free(p->mb);
+    free(p->mb);
     p->mb = rhs_string_mb;
-    if (p->utf8 != NULL)
-       free(p->utf8);
+    free(p->utf8);
     p->utf8 = rhs_string_utf8;
     p->ks = rhs_keysym;
     return n;
=======================================
--- /trunk/qt4/immodule/quiminputcontext_compose.cpp Sun Jun 13 18:59:57 2010 +++ /trunk/qt4/immodule/quiminputcontext_compose.cpp Sun Jun 20 00:04:11 2010
@@ -803,11 +803,9 @@
         }
     }

-    if (p->mb != 0)
-        free(p->mb);
+    free(p->mb);
     p->mb = rhs_string_mb;
-    if (p->utf8 != 0)
-        free(p->utf8);
+    free(p->utf8);
     {
         QTextCodec *codec = QTextCodec::codecForLocale();
         QString qs = codec->toUnicode(rhs_string_mb);
=======================================
--- /trunk/replace/bsd-poll.c   Mon Feb  2 01:28:28 2009
+++ /trunk/replace/bsd-poll.c   Sun Jun 20 00:04:11 2010
@@ -105,12 +105,9 @@
        }

 out:
-       if (readfds != NULL)
-               free(readfds);
-       if (writefds != NULL)
-               free(writefds);
-       if (exceptfds != NULL)
-               free(exceptfds);
+       free(readfds);
+       free(writefds);
+       free(exceptfds);
        if (ret == -1)
                errno = saved_errno;
        return ret;
=======================================
--- /trunk/xim/compose.cpp      Sun Apr  4 20:35:54 2010
+++ /trunk/xim/compose.cpp      Sun Jun 20 00:04:11 2010
@@ -637,11 +637,9 @@
        }
     }

-    if (p->mb != NULL)
-       free(p->mb);
+    free(p->mb);
     p->mb = rhs_string_mb;
-    if (p->utf8 != NULL)
-       free(p->utf8);
+    free(p->utf8);
     p->utf8 = rhs_string_utf8;
     p->ks = rhs_keysym;
     return n;
=======================================
--- /trunk/xim/convdisp.cpp     Sun Apr  4 20:35:54 2010
+++ /trunk/xim/convdisp.cpp     Sun Jun 20 00:04:11 2010
@@ -1664,8 +1664,7 @@
     for (i = 0; i < len; i++) {
        t->pushC8(0); // PADDING
     }
-    if (c)
-       free(c);
+    free(c);
 }

 void ConvdispOs::compose_feedback_array(TxPacket *t)
=======================================
--- /trunk/xim/ximic.cpp        Sun Apr  4 20:35:54 2010
+++ /trunk/xim/ximic.cpp        Sun Jun 20 00:04:11 2010
@@ -329,8 +329,7 @@

 void icxatr::set_locale_name(const char *locale)
 {
-    if (m_locale)
-       free(m_locale);
+    free(m_locale);
     m_locale = strdup(locale);
 }

=======================================
--- /trunk/xim/ximim.cpp        Sun Apr  4 20:35:54 2010
+++ /trunk/xim/ximim.cpp        Sun Jun 20 00:04:11 2010
@@ -157,8 +157,7 @@
     for (i = m_ics.begin(); i != m_ics.end(); ++i) {
        (*i).second->changeContext(engine);
     }
-    if (mEngineName)
-       free(mEngineName);
+    free(mEngineName);
     mEngineName = strdup(engine);
 }

@@ -422,8 +421,7 @@

 void XimIM::set_encoding(const char *encoding)
 {
-    if (mEncoding)
-       free(mEncoding);
+    free(mEncoding);
     mEncoding = strdup(encoding);

     // set iconv environment
@@ -453,8 +451,7 @@

 void XimIM::set_lang_region(const char *lang_and_region)
 {
-    if (mLangRegion)
-       free(mLangRegion);
+    free(mLangRegion);
     mLangRegion = strdup(lang_and_region);
 }

=======================================
--- /trunk/xim/ximserver.cpp    Sun Jun 13 00:54:35 2010
+++ /trunk/xim/ximserver.cpp    Sun Jun 20 00:04:11 2010
@@ -303,8 +303,7 @@

 void XimServer::set_im(const char *engine)
 {
-    if (mIMName)
-       free(mIMName);
+    free(mIMName);

     mIMName = strdup(engine);
     mIMLang = get_im_lang_from_engine(engine);

Reply via email to