* iconvdata/iso646.c (gconv_init): Return correct error value if we
	run out of memory.
	* iconvdata/iso-2022-jp.c: Likewise.
This commit is contained in:
Ulrich Drepper 1998-12-17 12:10:58 +00:00
parent c7ec9d75a7
commit 0937645101
4 changed files with 58 additions and 47 deletions

View File

@ -1,5 +1,9 @@
1998-12-17 Ulrich Drepper <drepper@cygnus.com> 1998-12-17 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/iso646.c (gconv_init): Return correct error value if we
run out of memory.
* iconvdata/iso-2022-jp.c: Likewise.
* iconv/gconv_db.c (gen_steps): Respect error return value from * iconv/gconv_db.c (gen_steps): Respect error return value from
init functions and abort. init functions and abort.

View File

@ -1,4 +1,4 @@
/* Skeleton for a converison module. /* Skeleton for a conversion module.
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.

View File

@ -132,10 +132,13 @@ gconv_init (struct gconv_step *step)
} }
result = GCONV_NOCONV; result = GCONV_NOCONV;
if (dir != illegal_dir if (dir != illegal_dir)
&& ((new_data {
= (struct iso2022jp_data *) malloc (sizeof (struct iso2022jp_data))) new_data
!= NULL)) = (struct iso2022jp_data *) malloc (sizeof (struct iso2022jp_data));
result = GCONV_NOMEM;
if (new_data != NULL)
{ {
new_data->dir = dir; new_data->dir = dir;
new_data->var = var; new_data->var = var;
@ -161,6 +164,7 @@ gconv_init (struct gconv_step *step)
result = GCONV_OK; result = GCONV_OK;
} }
}
return result; return result;
} }

View File

@ -106,7 +106,7 @@ static const char *names[] =
[HU] = "MSZ_7795.3//", [HU] = "MSZ_7795.3//",
[CU] = "NC_NC00-10//", [CU] = "NC_NC00-10//",
[FR] = "NF_Z_62-010//", [FR] = "NF_Z_62-010//",
[FR1] = "NF_Z_62-010_1973//", /* Note the we don't have the parenthesis [FR1] = "NF_Z_62-010_1973//", /* Note that we don't have the parenthesis
in the name. */ in the name. */
[NO] = "NS_4551-1//", [NO] = "NS_4551-1//",
[NO2] = "NS_4551-2//", [NO2] = "NS_4551-2//",
@ -145,10 +145,12 @@ gconv_init (struct gconv_step *step)
} }
result = GCONV_NOCONV; result = GCONV_NOCONV;
if (dir != illegal_dir if (dir != illegal_dir)
&& ((new_data {
= (struct iso646_data *) malloc (sizeof (struct iso646_data))) new_data = (struct iso646_data *) malloc (sizeof (struct iso646_data));
!= NULL))
result = GCONV_NOMEM;
if (new_data != NULL)
{ {
new_data->dir = dir; new_data->dir = dir;
new_data->var = var; new_data->var = var;
@ -173,6 +175,7 @@ gconv_init (struct gconv_step *step)
result = GCONV_OK; result = GCONV_OK;
} }
}
return result; return result;
} }