aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv_open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-04 07:25:25 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-04 07:25:25 +0000
commit0d9f67937f0c9329c35c2c0d15848ab8316dc520 (patch)
treeee2b01470306f95f731e268aab1c0712f9e9d50c /iconv/gconv_open.c
parente62c19f12cfc377ac9ce7c037713ead5dc6b57d9 (diff)
downloadglibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.tar
glibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.tar.gz
glibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.tar.bz2
glibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.zip
Update.
1998-04-03 23:17 Ulrich Drepper <drepper@cygnus.com> * 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.
Diffstat (limited to 'iconv/gconv_open.c')
-rw-r--r--iconv/gconv_open.c34
1 files changed, 10 insertions, 24 deletions
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);
}