aboutsummaryrefslogtreecommitdiff
path: root/iconvdata/iso6937.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-13 17:54:00 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-13 17:54:00 +0000
commit2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26 (patch)
treea783a384cc0f7cfcc8225c407e8255a6c25e5816 /iconvdata/iso6937.c
parent40c0dc53b080fd3e1ace4fbe2cb79007babec6c3 (diff)
downloadglibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.tar
glibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.tar.gz
glibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.tar.bz2
glibc-2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26.zip
Update.
1998-04-13 17:40 Ulrich Drepper <drepper@cygnus.com> * iconvdata/8bit-gap.c: Simplify step data handling. * iconvdata/8bit-generic.c: Likewise. * iconvdata/big5.c: Likewise. * iconvdata/euccn.c: Likewise. * iconvdata/eucjp.c: Likewise. * iconvdata/euckr.c: Likewise. * iconvdata/euctw.c: Likewise. * iconvdata/iso6937.c: Likewise. * iconvdata/iso8859-1.c: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.c: Likewise. * iconvdata/jis0212.h: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/ksc5601.h: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/uhc.c: Likewise.
Diffstat (limited to 'iconvdata/iso6937.c')
-rw-r--r--iconvdata/iso6937.c45
1 files changed, 9 insertions, 36 deletions
diff --git a/iconvdata/iso6937.c b/iconvdata/iso6937.c
index 377eef5afc..30c3831a29 100644
--- a/iconvdata/iso6937.c
+++ b/iconvdata/iso6937.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. */
@@ -373,53 +372,29 @@ static const char from_ucs4[][2] =
};
/* Direction of the transformation. */
-enum direction
-{
- illegal,
- to_iso6937,
- from_iso6937
-};
-
-struct iso6937_data
-{
- enum direction dir;
-};
+static int to_iso6937_object;
+static int from_iso6937_object;
int
gconv_init (struct gconv_step *step)
{
/* Determine which direction. */
- struct iso6937_data *new_data;
- enum direction dir;
- int result;
-
if (strcasestr (step->from_name, "ISO_6937") != NULL)
- dir = from_iso6937;
+ step->data = &from_iso6937_object;
else if (strcasestr (step->to_name, "ISO_6937") != NULL)
- dir = to_iso6937;
+ step->data = &to_iso6937_object;
else
- dir = illegal;
-
- result = GCONV_NOCONV;
- if (dir != illegal
- && ((new_data
- = (struct iso6937_data *) malloc (sizeof (struct iso6937_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);
+ /* Nothign to do. */
}
@@ -456,15 +431,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- enum direction dir = ((struct iso6937_data *) step->data)->dir;
-
do_write = 0;
do
{
result = GCONV_OK;
- if (dir == from_iso6937)
+ if (step->data == &from_iso6937_object)
{
size_t inchars = *inbufsize;
size_t outwchars = data->outbufavail;
@@ -648,7 +621,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
if (data->is_last)
{
/* This is the last step. */
- result = (*inbufsize > (dir == from_iso6937
+ result = (*inbufsize > (step->data == &from_iso6937_object
? 0 : sizeof (wchar_t) - 1)
? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
break;