diff options
Diffstat (limited to 'src/dictionary.c')
-rw-r--r-- | src/dictionary.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/dictionary.c b/src/dictionary.c index b7baf05..2b995d4 100644 --- a/src/dictionary.c +++ b/src/dictionary.c @@ -49,6 +49,5 @@ struct dictionary * dictionary_new (enum dictionary_id id, enum dictionary_type type) { - struct dictionary *mp = xmalloc (sizeof mp[0]); - memset (mp, 0, sizeof mp[0]); + struct dictionary *mp = grecs_zalloc (sizeof mp[0]); mp->id = id; mp->type = type; @@ -93,4 +92,6 @@ dictionary_close (struct dictionary *dict, void *handle) { struct dictionary_descr *mp = dictionary_tab + dict->type; + if (mp->free) + mp->free (dict, handle); if (!mp->close) return 0; @@ -187,5 +188,5 @@ dictionary_copy_result (struct dictionary *dict, const char *res, size_t size) { dict->result_size = size + 1; - dict->result = x2realloc (dict->result, &dict->result_size); + dict->result = grecs_realloc (dict->result, dict->result_size); } memcpy (dict->result, res, size); @@ -207,5 +208,5 @@ dictionary_quote_string (struct dictionary *dict, void *handle, if (!input) { - *poutput = xmalloc (1); + *poutput = grecs_malloc (1); (*poutput)[0] = 0; *psize = 1; @@ -217,5 +218,5 @@ dictionary_quote_string (struct dictionary *dict, void *handle, size = wordsplit_c_quoted_length (input, 0, "e); - output = xmalloc (size + 1); + output = grecs_malloc (size + 1); wordsplit_c_quote_copy (output, input, 0); output[size] = 0; |