[uim-commit] r204 - trunk/uim

tkng@freedesktop.org tkng@freedesktop.org
Sun Jan 9 16:36:37 PST 2005


Author: tkng
Date: 2005-01-09 16:36:34 -0800 (Sun, 09 Jan 2005)
New Revision: 204

Modified:
   trunk/uim/skk-dic.c
Log:
* uim/skk-dic.c: Fixed warnings.
 - All NIL was replaced with uim_scm_null_list().
 - (skk_dic_open), (find_cand_array_lisp), (skk_get_nth_candidate),
   (skk_commit_candidate): Added const qualifiers.

Now left warning is only two, they are related on reverse(); If we could
fix this, we can split skk-dic.c from libuim. This will reduce the size
of libuim about 20KB.


Modified: trunk/uim/skk-dic.c
===================================================================
--- trunk/uim/skk-dic.c	2005-01-10 00:14:37 UTC (rev 203)
+++ trunk/uim/skk-dic.c	2005-01-10 00:36:34 UTC (rev 204)
@@ -341,11 +341,10 @@
 static uim_lisp
 skk_dic_open(uim_lisp fn_)
 {
-  char *fn = uim_scm_c_str(fn_);
+  const char *fn = uim_scm_refer_c_str(fn_);
   if (!skk_dic) {
     skk_dic = open_dic(fn);
   }
-  free(fn);
   return uim_scm_f();
 }
 
@@ -672,12 +671,12 @@
 {
   char o;
   const char *hs;
-  char *okuri = NULL;
+  const char *okuri = NULL;
   struct skk_cand_array *ca;
 
   hs = uim_scm_refer_c_str(head_);
   if (okuri_ != uim_scm_f()) {
-    okuri = uim_scm_c_str(okuri_);
+    okuri = uim_scm_refer_c_str(okuri_);
   }
   if (okuri_head_ == uim_scm_f()) {
     o = 0;
@@ -687,7 +686,6 @@
   }
 
   ca = find_cand_array(skk_dic, hs, o, okuri, create_if_not_found);
-  free(okuri);
   return ca;
 }
 
@@ -712,7 +710,7 @@
   int prev_is_num = 0;
   int i, numlen = 0, start = 0;
   char *numstr = NULL;
-  uim_lisp lst = NIL;
+  uim_lisp lst = uim_scm_null_list();
 
   str = uim_scm_refer_c_str(head_);
   len = strlen(str);
@@ -1059,8 +1057,9 @@
   char *str;
   int prev_is_num = 0;
   int i, j, len, newlen;
+  uim_lisp result;
 
-  str = uim_scm_refer_c_str(head_);
+  str = uim_scm_c_str(head_);
   len = strlen(str);
   newlen = len;
 
@@ -1078,7 +1077,9 @@
       prev_is_num = 0;
     }
   }
-  return uim_scm_make_str(str);
+  result = uim_scm_make_str(str);
+  free(str);
+  return result;
 }
 
 static char *
@@ -1123,11 +1124,12 @@
   struct skk_cand_array *ca, *subca;
   int i, j, k = 0;
   char *cands = NULL;
-  char *p, *numstr;
+  char *p;
+  const char *numstr;
   int method_place = 0;
   int sublen, newlen;
   int mark;
-  uim_lisp str_ = NIL;
+  uim_lisp str_ = uim_scm_null_list();
 
   n = uim_scm_c_int(nth_);
   ca = find_cand_array_lisp(head_, okuri_head_, okuri_, 0);
@@ -1440,7 +1442,7 @@
   int i, j, k = 0;
   int nr_cands = 0;
   uim_lisp numstr_;
-  char *numstr;
+  const char *numstr;
   int method_place = 0;
 
   nth = uim_scm_c_int(nth_);
@@ -1465,7 +1467,7 @@
 	    if (k == nth) {
 	      str = ca->cands[i];
 	      /* reorder sub candidate */
-	      skk_commit_candidate(numstr_, uim_scm_f(), uim_scm_f(), uim_scm_make_int(j), NIL);
+	      skk_commit_candidate(numstr_, uim_scm_f(), uim_scm_f(), uim_scm_make_int(j), uim_scm_null_list());
 	      break;
 	    }
 	    k++;



More information about the Uim-commit mailing list