From 0d9f67937f0c9329c35c2c0d15848ab8316dc520 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 4 Apr 1998 07:25:25 +0000 Subject: Update. 1998-04-03 23:17 Ulrich Drepper * iconv/gconv.c: Rewrite of the low-level of gconv. * iconv/gconv.h: Likewise. * iconv/gconv_builtin.h: Likewise. * iconv/gconv_close.c: Likewise. * iconv/gconv_db.: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_open.c: Likewise. * iconv/gconv_simple.c: Likewise. * iconvdata/8bit-gap.c: Adapt for rewrite. * iconvdata/8bit-generic.c: Likewise. * iconvdata/euckr.c: Likewise. * iconvdata/iso646.c: Likewise. * iconvdata/iso6937.c: Likewise. * iconvdata/iso8859-1.c: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/uhc.c: Likewise. --- iconv/gconv_open.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'iconv/gconv_open.c') diff --git a/iconv/gconv_open.c b/iconv/gconv_open.c index ea7b3653af..d82dcfee48 100644 --- a/iconv/gconv_open.c +++ b/iconv/gconv_open.c @@ -65,25 +65,18 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle) buffer. Signal this to the initializer. */ data[cnt].is_last = cnt == nsteps - 1; - if (steps[cnt].init_fct != NULL) - { - res = (steps[cnt].init_fct) (&steps[cnt], &data[cnt]); - if (res != GCONV_OK) - break; - } + /* We use the `mbstate_t' member in DATA. */ + data[cnt].statep = &data[cnt].__state; - if (!data[cnt].is_last && data[cnt].outbuf == NULL) + /* Allocate the buffer. */ + data[cnt].outbufsize = GCONV_DEFAULT_BUFSIZE; + data[cnt].outbuf = (char *) malloc (data[cnt].outbufsize); + if (data[cnt].outbuf == NULL) { - data[cnt].outbufsize = GCONV_DEFAULT_BUFSIZE; - data[cnt].outbuf = - (char *) malloc (data[cnt].outbufsize); - if (data[cnt].outbuf == NULL) - { - res = GCONV_NOMEM; - break; - } - data[cnt].outbufavail = 0; + res = GCONV_NOMEM; + break; } + data[cnt].outbufavail = 0; } } } @@ -99,14 +92,7 @@ __gconv_open (const char *toset, const char *fromset, gconv_t *handle) if (result->data != NULL) { while (cnt-- > 0) - if (steps[cnt].end_fct != NULL) - (*steps[cnt].end_fct) (&result->data[cnt]); - else - { - free (result->data[cnt].outbuf); - if (result->data[cnt].data != NULL) - free (result->data[cnt].data); - } + free (result->data[cnt].outbuf); free (result->data); } -- cgit v1.2.3