Author: iratqq
Date: Tue Jan  6 08:21:43 2009
New Revision: 5704

Modified:
   trunk/emacs/candidate.c
   trunk/emacs/context.c
   trunk/emacs/encoding.c
   trunk/emacs/helper-message.c
   trunk/emacs/helper-message.h
   trunk/emacs/preedit.c
   trunk/emacs/prop.c
   trunk/emacs/uim-el-helper-agent.c

Log:
* emacs/helper-message.h:
  - Include uim/uim.h

* emacs/candidate.c (create_candidate, new_candidate):
* emacs/context.c (switch_context_im_all)
  (create_uim_agent_context, new_uim_agent_context):
* emacs/encoding.c (new_im_encoding):
* emacs/helper-message.c (helper_message_encode)
  (helper_message_decode):
* emacs/preedit.c (create_preedit, add_preedit):
* emacs/prop.c (create_prop):
* emacs/uim-el-helper-agent.c (main):
  - Use uim_malloc().


Modified: trunk/emacs/candidate.c
==============================================================================
--- trunk/emacs/candidate.c     (original)
+++ trunk/emacs/candidate.c     Tue Jan  6 08:21:43 2009
@@ -41,7 +41,7 @@
 {
   candidate_info *cand;

-  cand = (candidate_info *)malloc(sizeof(candidate_info));
+  cand = uim_malloc(sizeof(candidate_info));
   cand->valid = 0;

   return cand;
@@ -61,7 +61,7 @@
   cand->disp_limit = limit;
   cand->num = num;

-  cand->cand_array = (candidate *)malloc(sizeof(candidate) * num);
+  cand->cand_array = uim_malloc(sizeof(candidate) * num);

   /* get candidates from context */
   for (i = 0; i < num; i ++) {

Modified: trunk/emacs/context.c
==============================================================================
--- trunk/emacs/context.c       (original)
+++ trunk/emacs/context.c       Tue Jan  6 08:21:43 2009
@@ -148,7 +148,7 @@
   update_default_engine(im);

   /* check focus state when change IM of current application */
-  quot_im_name = (char *)malloc(strlen(im) + 2);
+  quot_im_name = uim_malloc(strlen(im) + 2);
   quot_im_name[0] = '\'';
   quot_im_name[1] = '\0';
   strcat(quot_im_name, im);
@@ -217,7 +217,7 @@

   debug_printf(DEBUG_NOTE, "create_uim_agent_context\n");

-  ret = (uim_agent_context *)malloc(sizeof(uim_agent_context));
+  ret = uim_malloc(sizeof(uim_agent_context));

   if (encoding) {
        ret->encoding = strdup(encoding);
@@ -255,7 +255,7 @@

   debug_printf(DEBUG_NOTE, "add_uim_agent_context(%d)\n", id);

-  ptr = (uim_agent_context_list *)malloc(sizeof(uim_agent_context_list));
+  ptr = uim_malloc(sizeof(uim_agent_context_list));

   ptr->agent_context = create_uim_agent_context(encoding);
   ptr->next = NULL;

Modified: trunk/emacs/encoding.c
==============================================================================
--- trunk/emacs/encoding.c      (original)
+++ trunk/emacs/encoding.c      Tue Jan  6 08:21:43 2009
@@ -64,7 +64,7 @@
 im_encoding *
 new_im_encoding(const char *im, const char *encoding)
 {
-  im_encoding *im_enc = (im_encoding *)malloc(sizeof(im_encoding));
+  im_encoding *im_enc = uim_malloc(sizeof(im_encoding));

   debug_printf(DEBUG_NOTE, "new_im_encoding\n");


Modified: trunk/emacs/helper-message.c
==============================================================================
--- trunk/emacs/helper-message.c        (original)
+++ trunk/emacs/helper-message.c        Tue Jan  6 08:21:43 2009
@@ -51,7 +51,7 @@
   if (src) length = strlen(src);

   /* 24bit -> 32bit */
-  outbuf = (char *)malloc((length + 2) / 3 * 4 + 1);
+  outbuf = uim_malloc((length + 2) / 3 * 4 + 1);

   ob = outbuf;

@@ -98,8 +98,8 @@
   char *outbuf, *ob;

   if (src) length = strlen(src);
-
-  outbuf = (char *)malloc(length / 4 * 3 + 1);
+
+  outbuf = uim_malloc(length / 4 * 3 + 1);

   ob = outbuf;


Modified: trunk/emacs/helper-message.h
==============================================================================
--- trunk/emacs/helper-message.h        (original)
+++ trunk/emacs/helper-message.h        Tue Jan  6 08:21:43 2009
@@ -43,6 +43,8 @@
 #include <stdlib.h>
 #include <string.h>

+#include <uim/uim.h>
+
 #include "output.h"

 void helper_send_message(const char *message);

Modified: trunk/emacs/preedit.c
==============================================================================
--- trunk/emacs/preedit.c       (original)
+++ trunk/emacs/preedit.c       Tue Jan  6 08:21:43 2009
@@ -40,7 +40,7 @@
 create_preedit()
 {
   preedit *pe;
-  pe = (preedit *)malloc(sizeof(preedit));
+  pe = uim_malloc(sizeof(preedit));
   pe->valid = 0;
   pe->head = pe->tail = NULL;

@@ -54,7 +54,7 @@

   pe->valid = 1;

-  pb = (preedit_buffer *)malloc(sizeof(preedit_buffer));
+  pb = uim_malloc(sizeof(preedit_buffer));

   if (pe->head == NULL) {
        pe->head = pb;

Modified: trunk/emacs/prop.c
==============================================================================
--- trunk/emacs/prop.c  (original)
+++ trunk/emacs/prop.c  Tue Jan  6 08:21:43 2009
@@ -41,7 +41,7 @@
 {
   property *prop;

-  prop = (property *)malloc(sizeof(property));
+  prop = uim_malloc(sizeof(property));

   prop->valid = 0;


Modified: trunk/emacs/uim-el-helper-agent.c
==============================================================================
--- trunk/emacs/uim-el-helper-agent.c   (original)
+++ trunk/emacs/uim-el-helper-agent.c   Tue Jan  6 08:21:43 2009
@@ -276,7 +276,7 @@
   a_printf("OK\n");

   cmdbuf_len = DEFAULT_MESSAGE_SIZE;
-  cmdbuf = (char *)malloc(cmdbuf_len);
+  cmdbuf = uim_malloc(cmdbuf_len);
   cmdbuf[0] = '\0';

   while (1) {

Reply via email to