Author: iratqq
Date: Sat Jan 17 09:56:51 2009
New Revision: 5738
Modified:
trunk/fep/callbacks.c
trunk/fep/draw.c
trunk/fep/escseq.c
trunk/fep/str.c
trunk/fep/uim-fep.c
Log:
* fep/callbacks.c (activate_cb, pushback_cb, dup_preedit)
(make_page_strs, set_candidate):
* fep/str.c (str2wcstr, byte2width, byte2width2, tab2space):
* fep/uim-fep.c (main, get_winsize):
* fep/draw.c (set_line2width, start_preedit, erase_preedit):
* fep/escseq.c (set_attr, put_erase, cut_padding):
- Use uim_malloc().
Modified: trunk/fep/callbacks.c
==============================================================================
--- trunk/fep/callbacks.c (original)
+++ trunk/fep/callbacks.c Sat Jan 17 09:56:51 2009
@@ -380,7 +380,7 @@
s_candidate.nr = nr;
s_candidate.limit = display_limit;
s_candidate.page = 0;
- s_candidate.cand_col = malloc(nr * sizeof(int));
+ s_candidate.cand_col = uim_malloc(nr * sizeof(int));
make_page_strs();
}
@@ -498,7 +498,7 @@
int *rval = width2byte2(str, 1);
int first_char_byte = rval[0];
int first_char_width = rval[1];
- char *first_char = malloc(first_char_byte + 1);
+ char *first_char = uim_malloc(first_char_byte + 1);
strlcpy(first_char, str, first_char_byte + 1);
cursor = FALSE;
pushback_cb(NULL, attr - UPreeditAttr_Reverse, first_char);
@@ -676,7 +676,7 @@
*/
struct preedit_tag *create_preedit(void)
{
- struct preedit_tag *p = malloc(sizeof(struct preedit_tag));
+ struct preedit_tag *p = uim_malloc(sizeof(struct preedit_tag));
p->nr_psegs = 0;
p->width = 0;
p->cursor = 0;
@@ -710,7 +710,7 @@
int i;
struct preedit_tag *dup_p = create_preedit();
*dup_p = *p;
- dup_p->pseg = malloc(sizeof(struct preedit_segment_tag) * (p->nr_psegs));
+ dup_p->pseg = uim_malloc(sizeof(struct preedit_segment_tag) *
(p->nr_psegs));
for (i = 0; i < p->nr_psegs; i++) {
dup_p->pseg[i].attr = p->pseg[i].attr;
dup_p->pseg[i].str = strdup(p->pseg[i].str);
@@ -755,7 +755,7 @@
int cand_label_width = strwidth(cand_str_label);
int cand_width = cand_label_width + strlen(":") +
strwidth(cand_str_cand) + strlen(" ");
int cand_byte = strlen(cand_str_label) + strlen(":") +
strlen(cand_str_cand) + strlen(" ");
- char *cand_str = malloc(cand_byte + 1);
+ char *cand_str = uim_malloc(cand_byte + 1);
if (g_opt.ddskk) {
index_width = strlen("[xxxx ]") + numwidth(s_candidate.nr - index -
1);
@@ -838,7 +838,7 @@
s_candidate.index_col[s_candidate.nr_pages] = UNDEFINED;
} else {
int index_byte = index_width + 2/* utf-8 */;
- char *index_str = malloc(index_byte + 1);
+ char *index_str = uim_malloc(index_byte + 1);
int i;
if (g_opt.ddskk) {
sprintf(index_str, "[%s %d]", s_nokori_str, s_candidate.nr -
index - 1);
@@ -955,7 +955,7 @@
/* ���ߤθ���Υ���ǥå������� */
int cand_index_width = numwidth(s_candidate.index + 1);
int i;
- s_index_str = malloc(right_edge_cand_index_width + 1);
+ s_index_str = uim_malloc(right_edge_cand_index_width + 1);
for (i = 0; i < right_edge_cand_index_width - cand_index_width; i++) {
s_index_str[i] = ' ';
}
Modified: trunk/fep/draw.c
==============================================================================
--- trunk/fep/draw.c (original)
+++ trunk/fep/draw.c Sat Jan 17 09:56:51 2009
@@ -266,7 +266,7 @@
}
}
debug2(("s_head.row = %d s_head.col = %d\n", s_head.row, s_head.col));
- s_line2width = malloc(sizeof(int));
+ s_line2width = uim_malloc(sizeof(int));
s_line2width[0] = s_head.col;
s_preedit_lines = 1;
}
@@ -976,7 +976,7 @@
free(s_prev_line2width);
}
s_prev_line2width = s_line2width;
- s_line2width = malloc(sizeof(int));
+ s_line2width = uim_malloc(sizeof(int));
s_line2width[0] = s_head.col;
erase_prev_preedit();
}
@@ -992,7 +992,7 @@
}
s_prev_line2width = s_line2width;
s_prev_preedit_lines = s_preedit_lines;
- s_line2width = malloc(sizeof(int));
+ s_line2width = uim_malloc(sizeof(int));
s_preedit_lines = 1;
for (i = 0; i < preedit->nr_psegs; i++) {
Modified: trunk/fep/escseq.c
==============================================================================
--- trunk/fep/escseq.c (original)
+++ trunk/fep/escseq.c Sat Jan 17 09:56:51 2009
@@ -856,7 +856,7 @@
/* s_escseq_buf �ˤ�'\0'�ϴޤޤ�ʤ� */
int escseq_buf_len = strlen(s_escseq_buf);
must_free = TRUE;
- free_str = str = malloc(escseq_buf_len + len + 1);
+ free_str = str = uim_malloc(escseq_buf_len + len + 1);
memcpy((char *)str, s_escseq_buf, escseq_buf_len);
memcpy((char *)str + escseq_buf_len, tmp_str, len);
((char *)str)[escseq_buf_len + len] = '\0';
@@ -869,7 +869,7 @@
str++;
if (str == end) {
int escseq_buf_len = end - start;
- s_escseq_buf = malloc(escseq_buf_len + 1);
+ s_escseq_buf = uim_malloc(escseq_buf_len + 1);
memcpy(s_escseq_buf, start, escseq_buf_len);
s_escseq_buf[escseq_buf_len] = '\0';
}
@@ -877,7 +877,7 @@
else if (str[0] == '[') {
int nr_params = 1;
/* ^[[1;2;3��1, 2, 3������� */
- int *params = malloc(sizeof(int));
+ int *params = uim_malloc(sizeof(int));
params[0] = 0;
str++;
@@ -900,7 +900,7 @@
if (str == end) {
int escseq_buf_len = end - start;
- s_escseq_buf = malloc(escseq_buf_len + 1);
+ s_escseq_buf = uim_malloc(escseq_buf_len + 1);
memcpy(s_escseq_buf, start, escseq_buf_len);
s_escseq_buf[escseq_buf_len] = '\0';
}
@@ -1056,7 +1056,7 @@
return;
}
- spaces = malloc(n + 1);
+ spaces = uim_malloc(n + 1);
for (i = 0; i < n; i++) {
spaces[i] = ' ';
}
@@ -1200,7 +1200,7 @@
if (escseq == NULL) {
return NULL;
}
- cut_str = malloc(strlen(escseq) + 1);
+ cut_str = uim_malloc(strlen(escseq) + 1);
for (i = 0, j = 0; escseq[i] != '\0';) {
if (escseq[i] == '$' && escseq[i + 1] == '<') {
int i2 = i + 1;
Modified: trunk/fep/str.c
==============================================================================
--- trunk/fep/str.c (original)
+++ trunk/fep/str.c Sat Jan 17 09:56:51 2009
@@ -128,7 +128,7 @@
return 0;
}
- *wcstr = malloc(sizeof(wchar_t) * (str_byte + 1));
+ *wcstr = uim_malloc(sizeof(wchar_t) * (str_byte + 1));
nr_wchars = mbstowcs(*wcstr, str, str_byte);
assert((size_t)nr_wchars != (size_t)-1);
(*wcstr)[str_byte] = 0;
@@ -292,7 +292,7 @@
n = str_byte;
}
- wcstr = malloc(sizeof(wchar_t) * str_byte);
+ wcstr = uim_malloc(sizeof(wchar_t) * str_byte);
save_str = str;
@@ -402,7 +402,7 @@
n = str_byte;
}
- wcstr = malloc(sizeof(wchar_t) * str_byte);
+ wcstr = uim_malloc(sizeof(wchar_t) * str_byte);
save_str = str;
@@ -768,7 +768,7 @@
}
}
- spacestr = malloc((tabstr_len - tabcount) + (TAB_WIDTH * tabcount) + 1);
+ spacestr = uim_malloc((tabstr_len - tabcount) + (TAB_WIDTH * tabcount) +
1);
for (i = 0, j = 0; i < tabstr_len + 1; i++, j++) {
if (tabstr[i] == '\t') {
Modified: trunk/fep/uim-fep.c
==============================================================================
--- trunk/fep/uim-fep.c (original)
+++ trunk/fep/uim-fep.c Sat Jan 17 09:56:51 2009
@@ -228,7 +228,7 @@
int main(int argc, char **argv)
{
/* command will be execed on pty */
- const char **command = malloc(sizeof(const char *) * (argc + 1));
+ const char **command = uim_malloc(sizeof(const char *) * (argc + 1));
char *engine;
char *sock_path = NULL; /* Socket for backtick */
int gnu_screen = FALSE;
@@ -1025,7 +1025,7 @@
*/
static struct winsize *get_winsize(void)
{
- struct winsize *win = malloc(sizeof(struct winsize));
+ struct winsize *win = uim_malloc(sizeof(struct winsize));
ioctl(g_win_in, TIOCGWINSZ, win);
if (g_opt.status_type == LASTLINE) {
win->ws_row--;