Author: yamakenz
Date: Mon Aug 13 10:10:31 2007
New Revision: 4848

Modified:
   trunk/uim/m17nlib.c
   trunk/uim/prime.c

Log:
* uim/m17nlib.c
  - (unused_ic_id, pushback_input_method, convert_mtext2str,
    fill_new_candidates): Add fatal error handlings

* uim/prime.c
  - (prime_get_ud_path, prime_send_command, prime_lib_init): Add fatal
    error handlings
  - (prime_read_msg_from_ud): Remove unneeded cast


Modified: trunk/uim/m17nlib.c
==============================================================================
--- trunk/uim/m17nlib.c (original)
+++ trunk/uim/m17nlib.c Mon Aug 13 10:10:31 2007
@@ -86,7 +86,8 @@
       return i;
   }
 
-  ic_array = realloc(ic_array, sizeof(struct ic_) * (nr_input_contexts + 1));
+  ic_array = uim_realloc(ic_array,
+                        sizeof(struct ic_) * (nr_input_contexts + 1));
   ic_array[nr_input_contexts].mic = NULL;
   nr_input_contexts++;
 
@@ -103,10 +104,11 @@
   else
     lang = lib_lang;
 
-  im_array = realloc(im_array, sizeof(struct im_) * (nr_input_methods + 1));
+  im_array = uim_realloc(im_array,
+                        sizeof(struct im_) * (nr_input_methods + 1));
   im_array[nr_input_methods].im = im;
-  im_array[nr_input_methods].name = strdup(name);
-  im_array[nr_input_methods].lang = strdup(lang);
+  im_array[nr_input_methods].name = uim_strdup(name);
+  im_array[nr_input_methods].lang = uim_strdup(lang);
 
   nr_input_methods++;
 }
@@ -238,7 +240,7 @@
   mconv_encode(converter, mtext);
   buffer_for_converter[converter->nbytes] = 0;
 
-  return strdup(buffer_for_converter);
+  return uim_strdup(buffer_for_converter);
 }
 
 static uim_lisp
@@ -748,7 +750,7 @@
   old_cands_free(ic_array[id].old_candidates);
   ic_array[id].old_candidates = ic_array[id].new_candidates;
 
-  new_cands = malloc (cands_num * sizeof(char *) + 2);
+  new_cands = uim_malloc(cands_num * sizeof(char *) + 2);
 
   if (mplist_key(group) == Mtext) {
     for (i = 0; mplist_key(group) != Mnil; group = mplist_next(group)) {

Modified: trunk/uim/prime.c
==============================================================================
--- trunk/uim/prime.c   (original)
+++ trunk/uim/prime.c   Mon Aug 13 10:10:31 2007
@@ -136,7 +136,7 @@
     return NULL;
 
   len = strlen(home) + strlen("/.uim.d");
-  path = (char *)malloc(len + 1);
+  path = uim_malloc(len + 1);
   snprintf(path, len + 1, "%s/.uim.d", home);
   if (!check_dir(path)) {
     free(path);
@@ -144,7 +144,7 @@
   }
 
   len += strlen("/socket");
-  path = (char *)realloc(path, len + 1);
+  path = uim_realloc(path, len + 1);
   strlcat(path, "/socket", len + 1);
   if (!check_dir(path)) {
     free(path);
@@ -152,7 +152,7 @@
   }
 
   len += strlen("/uim-prime");
-  path = (char *)realloc(path, len + 1);
+  path = uim_realloc(path, len + 1);
   strlcat(path, "/uim-prime", len + 1);
 
   return path;
@@ -194,7 +194,7 @@
       clear_prime_fd();
       return NULL;
     }
-    read_buf = (char *)realloc(read_buf, strlen(read_buf) + strlen(buf) + 1);
+    read_buf = realloc(read_buf, strlen(read_buf) + strlen(buf) + 1);
     if (!read_buf)
       return NULL;
     strcat(read_buf, buf);
@@ -235,7 +235,7 @@
       return uim_scm_make_str("error\n\t\n\n");
   } else {
     int len = strlen(str);
-    char *buf = malloc(len + 2);
+    char *buf = uim_malloc(len + 2);
     snprintf(buf, len + 2,"%s\n", str);
     result = uim_ipc_send_command(&prime_pid, &primer, &primew, prime_command,
                                  buf);
@@ -270,7 +270,7 @@
     if (prime_fd == -1) {
       unlink(prime_ud_path);
       len = strlen("-u ") + strlen(prime_ud_path) + 1;
-      option = malloc(len);
+      option = uim_malloc(len);
       snprintf(option, len, "-u %s", prime_ud_path);
       prime_pid = uim_ipc_open_command_with_option(prime_pid, &primer, &primew,
                                                   prime_command, option);

Reply via email to