]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 13 Apr 1998 17:54:00 +0000 (17:54 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 13 Apr 1998 17:54:00 +0000 (17:54 +0000)
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.

18 files changed:
ChangeLog
iconvdata/8bit-gap.c
iconvdata/8bit-generic.c
iconvdata/big5.c
iconvdata/euccn.c
iconvdata/eucjp.c
iconvdata/euckr.c
iconvdata/euctw.c
iconvdata/iso6937.c
iconvdata/iso8859-1.c
iconvdata/jis0208.h
iconvdata/jis0212.c
iconvdata/jis0212.h
iconvdata/johab.c
iconvdata/ksc5601.h
iconvdata/sjis.c
iconvdata/t61.c
iconvdata/uhc.c

index 978ef81d3106bb1e004cd0c9f46b0b929f52b740..fc4f3b878a864be9a331e58eef92fe0687a81939 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+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.
+
 1998-04-13 16:36  Ulrich Drepper  <drepper@cygnus.com>
 
        * manual/texinfo.texi: Updated from last version.
index 1528cb6bf7cee19abf1b9cda93dc0e5955c2c127..6c78ce5c24399f6d8948803d13ea5cb6b56bbe5c 100644 (file)
@@ -20,8 +20,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 
 
@@ -35,54 +34,30 @@ struct gap
 /* Now we can include the tables.  */
 #include TABLES
 
-/* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_8bit,
-  from_8bit
-};
-
-struct s_8bit_data
-{
-  enum direction dir;
-};
+/* We use three objects to describe the operation mode.  */
+static int from_8bit_object;
+static int to_8bit_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct s_8bit_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, NAME) != NULL)
-    dir = from_8bit;
+    step->data = &from_8bit_object;
   else if (strcasestr (step->to_name, NAME) != NULL)
-    dir = to_8bit;
+    step->data = &to_8bit_object;
   else
-    dir = illegal;
-
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct s_8bit_data *) malloc (sizeof (struct s_8bit_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.  */
 }
 
 
@@ -119,15 +94,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct s_8bit_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_8bit)
+         if (step->data == &from_8bit_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -213,7 +186,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_8bit
+             result = (*inbufsize > (step->data == &from_8bit_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 7f0bbae6b0a0114b7e08b4f88a3657cbd746df6e..52cd540fb74dd7a71e9af0d7fa48cbb0e6ac817a 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <stdlib.h>
 #include <string.h>
 
-/* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_8bit,
-  from_8bit
-};
-
-struct s_8bit_data
-{
-  enum direction dir;
-};
+/* We use three objects to describe the operation mode.  */
+static int from_8bit_object;
+static int to_8bit_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct s_8bit_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, NAME) != NULL)
-    dir = from_8bit;
+    step->data = &from_8bit_object;
   else if (strcasestr (step->to_name, NAME) != NULL)
-    dir = to_8bit;
+    step->data = &to_8bit_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct s_8bit_data *) malloc (sizeof (struct s_8bit_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -106,15 +81,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct s_8bit_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_8bit)
+         if (step->data == &from_8bit_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -191,7 +164,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_8bit
+             result = (*inbufsize > (step->data == &from_8bit_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 26ea6edc67353755748b05da0ffd46515a7aab2a..bfd14fd5bb6ef8e1ad1275452cd7cd7f964375bb 100644 (file)
@@ -19,7 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
@@ -8412,53 +8412,29 @@ static const char from_ucs4_tab13[][2] =
 
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_big5,
-  from_big5
-};
-
-struct big5_data
-{
-  enum direction dir;
-};
+static int to_big5_object;
+static int from_big5_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct big5_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "BIG5") != NULL)
-    dir = from_big5;
+    step->data = &from_big5_object;
   else if (strcasestr (step->to_name, "BIG5") != NULL)
-    dir = to_big5;
+    step->data = &to_big5_object;
   else
-    dir = illegal;
-
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct big5_data *) malloc (sizeof (struct big5_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.  */
 }
 
 
@@ -8492,15 +8468,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct big5_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_big5)
+         if (step->data == &from_big5_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -8686,7 +8660,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_big5
+             result = (*inbufsize > (step->data == &from_big5_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 108974a972709f68dfa83ed7de52ffe7482aaaeb..e8d909768b74e1f0aa3139f9540a7789690aede5 100644 (file)
 
 #include <gconv.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 #include <gb2312.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_euccn,
-  from_euccn
-};
-
-struct euccn_data
-{
-  enum direction dir;
-};
+static int to_euccn_object;
+static int from_euccn_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct euccn_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "EUC-CN") != NULL)
-    dir = from_euccn;
+    step->data = &from_euccn_object;
   else if (strcasestr (step->to_name, "EUC-CN") != NULL)
-    dir = to_euccn;
+    step->data = &to_euccn_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct euccn_data *) malloc (sizeof (struct euccn_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -109,15 +84,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct euccn_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_euccn)
+         if (step->data == &from_euccn_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -267,7 +240,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_euccn
+             result = (*inbufsize > (step->data == &from_euccn_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index caf24e27e0fc3f98aecf27bf66193b574808ca2a..4e82904c8f2d6cd30d726b7430230fa9c3505da4 100644 (file)
@@ -20,7 +20,6 @@
 
 #include <gconv.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 #include <jis0201.h>
 #include <jis0212.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_eucjp,
-  from_eucjp
-};
-
-struct eucjp_data
-{
-  enum direction dir;
-};
+static int to_eucjp_object;
+static int from_eucjp_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct eucjp_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "EUC-JP") != NULL)
-    dir = from_eucjp;
+    step->data = &from_eucjp_object;
   else if (strcasestr (step->to_name, "EUC-JP") != NULL)
-    dir = to_eucjp;
+    step->data = &to_eucjp_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct eucjp_data *) malloc (sizeof (struct eucjp_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -111,15 +86,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct eucjp_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_eucjp)
+         if (step->data == &from_eucjp_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -311,7 +284,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_eucjp
+             result = (*inbufsize > (step->data == &from_eucjp_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 62dd2c47bfd9085995bb452a46211a47ee466cf2..1dfa42dbcc8597746e8f5dfa452091c98c80df8c 100644 (file)
 #include <ksc5601.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_euckr,
-  from_euckr
-};
-
-struct euckr_data
-{
-  enum direction dir;
-};
-
+static int to_euckr_object;
+static int from_euckr_object;
 
 
 static inline void
@@ -66,36 +56,21 @@ int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct euckr_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "EUC-KR") != NULL)
-    dir = from_euckr;
+    step->data = &from_euckr_object;
   else if (strcasestr (step->to_name, "EUC-KR") != NULL)
-    dir = to_euckr;
+    step->data = &to_euckr_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct euckr_data *) malloc (sizeof (struct euckr_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -132,15 +107,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct euckr_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_euckr)
+         if (step->data == &from_euckr_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -281,7 +254,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_euckr
+             result = (*inbufsize > (step->data == &from_euckr_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 33da1ce84c81d4fa8fbd2d3352077c633403c808..f38db47946e150de3b7d74719ded28940ec62185 100644 (file)
 
 #include <gconv.h>
 #include <stdint.h>
-#include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
 #include <cns11643l1.h>
 #include <cns11643.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_euctw,
-  from_euctw
-};
-
-struct euctw_data
-{
-  enum direction dir;
-};
+static int to_euctw_object;
+static int from_euctw_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct euctw_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "EUC-TW") != NULL)
-    dir = from_euctw;
+    step->data = &from_euctw_object;
   else if (strcasestr (step->to_name, "EUC-TW") != NULL)
-    dir = to_euctw;
+    step->data = &to_euctw_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct euctw_data *) malloc (sizeof (struct euctw_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -110,15 +85,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct euctw_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_euctw)
+         if (step->data == &from_euctw_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -307,7 +280,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_euctw
+             result = (*inbufsize > (step->data == &from_euctw_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 377eef5afc27af2a2feb86af723abc3be6f38309..30c3831a29de2d1ce55200e77e1f1dee3a4d2a87 100644 (file)
@@ -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;
index cdeb526d7a3d34ef6dd6b66325718faef3751620..ab69c4d1a4c72216aa485721c75dfa6be94d8d11 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <stdlib.h>
 #include <string.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_iso88591,
-  from_iso88591
-};
-
-struct iso88591_data
-{
-  enum direction dir;
-};
+static int to_iso88591_object;
+static int from_iso88591_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct iso88591_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "ISO-8859-1") != NULL)
-    dir = from_iso88591;
+    step->data = &from_iso88591_object;
   else if (strcasestr (step->to_name, "ISO-8859-1") != NULL)
-    dir = to_iso88591;
+    step->data = &to_iso88591_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct iso88591_data *) malloc (sizeof (struct iso88591_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -106,15 +81,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct iso88591_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_iso88591)
+         if (step->data == &from_iso88591_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -184,7 +157,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_iso88591
+             result = (*inbufsize > (step->data == &from_iso88591_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 9c90cf9071bd6ef8f47e094ce23fe149d5c74a7d..94d27642c632a0cfdea4256df1d0007123b60924 100644 (file)
@@ -22,7 +22,7 @@
 #define _JIS0208_H     1
 
 #include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
 
 /* Conversion table.  */
 extern const uint16_t jis0208_to_ucs[];
index e9e1313553f76604cdc92dc88987846eaa275723..7484c5e84c64fcad4e0322acdb0b54e55ec45a9c 100644 (file)
@@ -1,5 +1,5 @@
 /* Mapping tables for JIS0212 handling.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -18,7 +18,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#include <inttypes.h>
+#include <stdint.h>
 #include <wchar.h>
 
 #include <jis0212.h>
index 7d9e9ac23bf352dbcad8e3b696344ac2fdde737f..cf5d919109fed5599f373d136838695533ec3aab 100644 (file)
@@ -22,7 +22,7 @@
 #define _JIS0212_H     1
 
 #include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
 
 
 /* Struct for table with indeces in mapping table.  */
index bde56ce1d33f35235a99cc2a9482970815512141..51b235c924e4df497fe4ca5b8d82eca3166145db 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <wchar.h>
 #include <ksc5601.h>
 
 /* Direction of the transformation.  */
-enum direction
-  {
-    illegal,
-    to_johab,
-    from_johab
-  };
-
-struct johab_data
-  {
-    enum direction dir;
-  };
+static int to_johab_object;
+static int from_johab_object;
 
 /* The table for Bit pattern to Hangul Jamo
    5 bits each are used to encode
@@ -242,36 +232,21 @@ int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct johab_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "JOHAB") != NULL)
-    dir = from_johab;
+    step->data = &from_johab_object;
   else if (strcasestr (step->to_name, "JOHAB") != NULL)
-    dir = to_johab;
+    step->data = &to_johab_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct johab_data *) malloc (sizeof (struct johab_data)))
-         != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -308,15 +283,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct johab_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_johab)
+         if (step->data == &from_johab_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -517,7 +490,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_johab
+             result = (*inbufsize > (step->data == &from_johab_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 0b649c70a1460754d7e4382d5650b38b666b6e91..0d86c7b2539638b2ef2776b14590a134e9e5919d 100644 (file)
@@ -25,7 +25,7 @@
 #define KSC5601_SYMBOL  986
 
 #include <gconv.h>
-#include <inttypes.h>
+#include <stdint.h>
 
 /* Conversion table.  */
 extern const uint16_t ksc5601_hangul_to_ucs[KSC5601_HANGUL];
index b1320c11041cbf8c4b3ecb638624b87465b550f3..7a81c017e9b3ce92a0f80d2166c7991b05d7b276 100644 (file)
@@ -19,8 +19,7 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <wchar.h>
 
@@ -3983,53 +3982,29 @@ static const char from_ucs4_cjk[32657][2] =
 
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_sjis,
-  from_sjis
-};
-
-struct sjis_data
-{
-  enum direction dir;
-};
+static int to_sjis_object;
+static int from_sjis_object;
 
 
 int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct sjis_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "SJIS") != NULL)
-    dir = from_sjis;
+    step->data = &from_sjis_object;
   else if (strcasestr (step->to_name, "SJIS") != NULL)
-    dir = to_sjis;
+    step->data = &to_sjis_object;
   else
-    dir = illegal;
-
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct sjis_data *) malloc (sizeof (struct sjis_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.  */
 }
 
 
@@ -4063,15 +4038,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct sjis_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_sjis)
+         if (step->data == &from_sjis_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -4236,7 +4209,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_sjis
+             result = (*inbufsize > (step->data == &from_sjis_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;
index 7d4314dfd27505223e989185aeaa25bc5af6c70d..d532438bf9dd7451f5d93fef218270b8e9f09a3c 100644 (file)
@@ -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;
index 9e5f0092650105d43be85ee0bca48e402ac158d5..c1d5a40d8e61df74c7c70d6d9ed480f4406ab8e0 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include <gconv.h>
-#include <inttypes.h>
-#include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <wchar.h>
 #include <ksc5601.h>
 
 /* Direction of the transformation.  */
-enum direction
-{
-  illegal,
-  to_uhc,
-  from_uhc
-};
+static int to_uhc_object;
+static int from_uhc_object;
 
-struct uhc_data
-{
-  enum direction dir;
-};
 
 /*
 egrep \
@@ -2626,35 +2617,21 @@ int
 gconv_init (struct gconv_step *step)
 {
   /* Determine which direction.  */
-  struct uhc_data *new_data;
-  enum direction dir;
-  int result;
-
   if (strcasestr (step->from_name, "UHC") != NULL)
-    dir = from_uhc;
+    step->data = &from_uhc_object;
   else if (strcasestr (step->to_name, "UHC") != NULL)
-    dir = to_uhc;
+    step->data = &to_uhc_object;
   else
-    dir = illegal;
+    return GCONV_NOCONV;
 
-  result = GCONV_NOCONV;
-  if (dir != illegal
-      && ((new_data
-          = (struct uhc_data *) malloc (sizeof (struct uhc_data))) != NULL))
-    {
-      new_data->dir = dir;
-      step->data = new_data;
-      result = GCONV_OK;
-    }
-
-  return result;
+  return GCONV_OK;
 }
 
 
 void
 gconv_end (struct gconv_step *data)
 {
-  free (data->data);
+  /* Nothing to do.  */
 }
 
 
@@ -2691,15 +2668,13 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
     }
   else
     {
-      enum direction dir = ((struct uhc_data *) step->data)->dir;
-
       do_write = 0;
 
       do
        {
          result = GCONV_OK;
 
-         if (dir == from_uhc)
+         if (step->data == &from_uhc_object)
            {
              size_t inchars = *inbufsize;
              size_t outwchars = data->outbufavail;
@@ -2869,7 +2844,7 @@ gconv (struct gconv_step *step, struct gconv_step_data *data,
          if (data->is_last)
            {
              /* This is the last step.  */
-             result = (*inbufsize > (dir == from_uhc
+             result = (*inbufsize > (step->data == &from_uhc_object
                                      ? 0 : sizeof (wchar_t) - 1)
                        ? GCONV_FULL_OUTPUT : GCONV_EMPTY_INPUT);
              break;