diff options
Diffstat (limited to 'iconvdata/t61.c')
-rw-r--r-- | iconvdata/t61.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/iconvdata/t61.c b/iconvdata/t61.c index 7d4314d..d532438 100644 --- a/iconvdata/t61.c +++ b/iconvdata/t61.c @@ -19,7 +19,6 @@ Boston, MA 02111-1307, USA. */ #include <gconv.h> -#include <stdlib.h> #include <string.h> /* Data taken from the WG15 tables. */ @@ -364,53 +363,29 @@ static const char from_ucs4[][2] = }; /* Direction of the transformation. */ -enum direction -{ - illegal, - to_t61, - from_t61 -}; - -struct t61_data -{ - enum direction dir; -}; +static int to_t61_object; +static int from_t61_object; int gconv_init (struct gconv_step *step) { /* Determine which direction. */ - struct t61_data *new_data; - enum direction dir; - int result; - if (strcasestr (step->from_name, "T.61") != NULL) - dir = from_t61; + step->data = &from_t61_object; else if (strcasestr (step->to_name, "T.61") != NULL) - dir = to_t61; + step->data = &to_t61_object; else - dir = illegal; - - result = GCONV_NOCONV; - if (dir != illegal - && ((new_data - = (struct t61_data *) malloc (sizeof (struct t61_data))) - != NULL)) - { - new_data->dir = dir; - step->data = new_data; - result = GCONV_OK; - } + return GCONV_NOCONV; - return result; + return GCONV_OK; } void gconv_end (struct gconv_step *data) { - free (data->data); + /* Nothing to do. */ } @@ -447,15 +422,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data, } else { - enum direction dir = ((struct t61_data *) step->data)->dir; - do_write = 0; do { result = GCONV_OK; - if (dir == from_t61) + if (step->data == &from_t61_object) { size_t inchars = *inbufsize; size_t outwchars = data->outbufavail; @@ -597,7 +570,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data, if (data->is_last) { /* This is the last step. */ - result = (*inbufsize > (dir == from_t61 + result = (*inbufsize > (step->data == &from_t61_object ? 0 : sizeof (wchar_t) - 1) ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT); break; |