Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
2000-06-16  Ulrich Drepper  <drepper@redhat.com>

	* iconv/gconv_int.h (norm_add_slashes): Optionally add given suffix.
	* iconv/gconv_open.c: Remove error handling specification from `from'
	character set name.
	* intl/loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with
	new parameter to always enable transliteration.
	* locale/localeinfo.h (LIMAGIC): Bump number because of incompatible
	change.
	(struct locale_data): Add new members use_translit and options.
	* locale/findlocale.c (_nl_find_locale): Set use_translit flag is
	character set name contained modifier TRANSLIT.
	* locale/loadlocale.c (_nl_load_locale): Initialize new use_translit
	and options fields.
	(_nl_unload_locale): Free options string if necessary.
	* wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Enable translation if
	the locale names suggested this.
	* locale/C-address.c: Add two new initialilzers to adjust data
	structure for new format.
	* locale/C-collate.c: Likewise.
	* locale/C-ctype.c: Likewise.
	* locale/C-identification.c: Likewise.
	* locale/C-measurement.c: Likewise.
	* locale/C-messages.c: Likewise.
	* locale/C-monetary.c: Likewise.
	* locale/C-name.c: Likewise.
	* locale/C-numeric.c: Likewise.
	* locale/C-paper.c: Likewise.
	* locale/C-telephone.c: Likewise.
	* locale/C-time.c: Likewise.

	* locale/setlocale.c: Add some more __builtin_expect.
  • Loading branch information
Ulrich Drepper committed Jun 16, 2000
1 parent f1d5c60 commit 323fb88
Show file tree
Hide file tree
Showing 45 changed files with 161 additions and 61 deletions.
33 changes: 33 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
2000-06-16 Ulrich Drepper <drepper@redhat.com>

* iconv/gconv_int.h (norm_add_slashes): Optionally add given suffix.
* iconv/gconv_open.c: Remove error handling specification from `from'
character set name.
* intl/loadmsgcat.c (_nl_load_domain): Call norm_add_slashes with
new parameter to always enable transliteration.
* locale/localeinfo.h (LIMAGIC): Bump number because of incompatible
change.
(struct locale_data): Add new members use_translit and options.
* locale/findlocale.c (_nl_find_locale): Set use_translit flag is
character set name contained modifier TRANSLIT.
* locale/loadlocale.c (_nl_load_locale): Initialize new use_translit
and options fields.
(_nl_unload_locale): Free options string if necessary.
* wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Enable translation if
the locale names suggested this.
* locale/C-address.c: Add two new initialilzers to adjust data
structure for new format.
* locale/C-collate.c: Likewise.
* locale/C-ctype.c: Likewise.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-messages.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-time.c: Likewise.

* locale/setlocale.c: Add some more __builtin_expect.

2000-06-15 Ulrich Drepper <drepper@redhat.com>

* iconv/gconv.h (__gconv_fct): Change type of fifth parameter to
Expand Down
11 changes: 8 additions & 3 deletions iconv/gconv_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,31 @@ extern struct gconv_module *__gconv_modules_db;

/* The gconv functions expects the name to be in upper case and complete,
including the trailing slashes if necessary. */
#define norm_add_slashes(str) \
#define norm_add_slashes(str,suffix) \
({ \
const char *cp = (str); \
char *result; \
char *tmp; \
size_t cnt = 0; \
size_t suffix_len = suffix == NULL ? 0 : strlen (suffix); \
\
while (*cp != '\0') \
if (*cp++ == '/') \
++cnt; \
\
tmp = result = alloca (cp - (str) + 3); \
tmp = result = alloca (cp - (str) + 3 + suffix_len); \
cp = (str); \
while (*cp != '\0') \
*tmp++ = _toupper (*cp++); \
if (cnt < 2) \
{ \
*tmp++ = '/'; \
if (cnt < 1) \
*tmp++ = '/'; \
{ \
*tmp++ = '/'; \
if (suffix != NULL) \
tmp = __mempcpy (tmp, suffix, suffix_len); \
} \
} \
*tmp = '\0'; \
result; \
Expand Down
25 changes: 19 additions & 6 deletions iconv/gconv_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
int res;
int conv_flags = 0;
const char *errhand;
const char *ignore;

/* Find out whether any error handling method is specified. */
errhand = strchr (toset, '/');
if (errhand != NULL)
errhand = strchr (errhand + 1, '/');
if (__builtin_expect (errhand != NULL, 1))
{
if (errhand[1] == '\0')
if (*++errhand == '\0')
errhand = NULL;
else
{
Expand All @@ -56,7 +57,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,

flags = __GCONV_IGNORE_ERRORS;

if (strcasecmp (errhand, "IGNORE") == 0)
if (__strcasecmp (errhand, "IGNORE") == 0)
{
/* Found it. This means we should ignore conversion errors. */
flags = __GCONV_IGNORE_ERRORS;
Expand All @@ -65,6 +66,18 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
}
}

/* For the source character set we ignore the error handler specification.
XXX Is this really always the best? */
ignore = strchr (fromset, '/');
if (ignore != NULL && (ignore = strchr (ignore + 1, '/')) != NULL
&& *++ignore != '\0')
{
char *newfromset = (char *) alloca (ignore - fromset + 1);

newfromset[ignore - fromset] = '\0';
fromset = memcpy (newfromset, fromset, ignore - fromset);
}

res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
if (res == __GCONV_OK)
{
Expand All @@ -78,7 +91,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
if (errhand != NULL)
{
/* Find the appropriate transliteration handling. */
if (strcasecmp (errhand, "TRANSLIT") == 0)
if (__strcasecmp (errhand, "TRANSLIT") == 0)
{
/* It's the builtin transliteration handling. We only
suport for it working on the internal encoding. */
Expand All @@ -89,7 +102,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
trans_fct = __gconv_transliterate;
/* No context, init, or end function. */
}
else if (strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
else if (__strcasecmp (errhand, "WORK AROUND A GCC BUG") == 0)
{
trans_init_fct = (__gconv_trans_init_fct) 1;
}
Expand Down Expand Up @@ -151,7 +164,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
/* Now see whether we can use the transliteration module
for this step. */
for (n = 0; n < ncsnames; ++n)
if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
{
/* Match! Now try the initializer. */
if (trans_init_fct == NULL
Expand Down Expand Up @@ -182,7 +195,7 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
/* Now see whether we can use the transliteration module
for this step. */
for (n = 0; n < ncsnames; ++n)
if (strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
if (__strcasecmp (steps[cnt].__from_name, csnames[n]) == 0)
{
/* Match! Now try the initializer. */
if (trans_init_fct == NULL
Expand Down
6 changes: 3 additions & 3 deletions iconvdata/8bit-gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct gap
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand All @@ -112,7 +112,7 @@ struct gap
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand All @@ -137,7 +137,7 @@ struct gap
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/8bit-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
6 changes: 3 additions & 3 deletions iconvdata/ansi_x3.110.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down Expand Up @@ -559,7 +559,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down Expand Up @@ -587,7 +587,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/big5.c
Original file line number Diff line number Diff line change
Expand Up @@ -8589,7 +8589,7 @@ static const char from_ucs4_tab13[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/big5hkscs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12746,7 +12746,7 @@ static const char from_ucs4_tab14[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/euc-cn.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/euc-jp.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, \
&inptr, inend, &outbuf, \
&inptr, inend, &outptr, \
irreversible)); \
if (result != __GCONV_OK) \
break; \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/euc-kr.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/euc-tw.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/gbgbk.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/gbk.c
Original file line number Diff line number Diff line change
Expand Up @@ -13456,7 +13456,7 @@ static const char __gbk_from_ucs4_tab12[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/iso-2022-cn.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ enum
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, \
&inptr, inend, &outbuf, \
&inptr, inend, &outptr, \
irreversible)); \
if (result != __GCONV_OK) \
break; \
Expand Down
4 changes: 2 additions & 2 deletions iconvdata/iso-2022-jp.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ gconv_end (struct __gconv_step *data)
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, \
&inptr, inend, &outbuf, \
&inptr, inend, &outptr, \
irreversible)); \
if (result != __GCONV_OK) \
break; \
Expand Down Expand Up @@ -894,7 +894,7 @@ gconv_end (struct __gconv_step *data)
result = DL_CALL_FCT \
(step_data->__trans.__trans_fct,\
(step, step_data, *inptrp, \
&inptr, inend, &outbuf, \
&inptr, inend, &outptr, \
irreversible)); \
if (result != __GCONV_OK) \
break; \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/iso-2022-kr.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ enum
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/iso646.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ gconv_end (struct __gconv_step *data)
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion iconvdata/iso8859-1.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
4 changes: 2 additions & 2 deletions iconvdata/iso_6937-2.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand All @@ -594,7 +594,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
4 changes: 2 additions & 2 deletions iconvdata/iso_6937.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand All @@ -571,7 +571,7 @@ static const char from_ucs4[][2] =
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, inend, \
&outbuf, irreversible)); \
&outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
4 changes: 2 additions & 2 deletions iconvdata/johab.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down Expand Up @@ -445,7 +445,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
{ \
result = DL_CALL_FCT (step_data->__trans.__trans_fct, \
(step, step_data, *inptrp, &inptr, \
inend, &outbuf, irreversible)); \
inend, &outptr, irreversible)); \
if (result != __GCONV_OK) \
break; \
} \
Expand Down
Loading

0 comments on commit 323fb88

Please sign in to comment.