[uim-commit] r598 - trunk/uim
ekato at freedesktop.org
ekato at freedesktop.org
Mon Feb 7 06:21:48 PST 2005
Author: ekato
Date: 2005-02-07 06:21:45 -0800 (Mon, 07 Feb 2005)
New Revision: 598
Modified:
trunk/uim/skk-dic.c
Log:
* uim/skk-dic.c (push_back_candidate_to_array) : Do not call
realloc() with a NULL pointer, call malloc() instead.
Modified: trunk/uim/skk-dic.c
===================================================================
--- trunk/uim/skk-dic.c 2005-02-07 13:10:05 UTC (rev 597)
+++ trunk/uim/skk-dic.c 2005-02-07 14:21:45 UTC (rev 598)
@@ -400,7 +400,7 @@
sizeof(struct skk_cand_array) * sl->nr_cand_array);
ca = &sl->cands[sl->nr_cand_array - 1];
ca->is_used = 0;
- ca->cands = 0;
+ ca->cands = NULL;
ca->nr_cands = 0;
ca->nr_real_cands = 0;
ca->okuri = strdup(okuri);
@@ -412,7 +412,10 @@
push_back_candidate_to_array(struct skk_cand_array *ca, char *cand)
{
ca->nr_cands++;
- ca->cands = realloc(ca->cands, sizeof(char *) * ca->nr_cands);
+ if (ca->cands)
+ ca->cands = realloc(ca->cands, sizeof(char *) * ca->nr_cands);
+ else
+ ca->cands = malloc(sizeof(char *));
ca->cands[ca->nr_cands - 1] = strdup(cand);
}
More information about the Uim-commit
mailing list