* [PATCH] Remove unused PREDEFINED_CLASSES code
@ 2015-05-12 7:50 Marko Myllynen
2015-05-13 10:12 ` Ondřej Bílka
2015-06-03 16:25 ` Marko Myllynen
0 siblings, 2 replies; 4+ messages in thread
From: Marko Myllynen @ 2015-05-12 7:50 UTC (permalink / raw)
To: GNU C Library
Hi,
AFAICS PREDEFINED_CLASSES is never defined thus the code is unused. It would seem that the code is related to LO_LTYPE which was discussed in the past but there are no any recent references:
http://pubs.opengroup.org/onlinepubs/9638399/loltype.htm
Patch below, compiles and passes make check.
2015-05-12 Marko Myllynen <myllynen@redhat.com>
* locale/C-ctype.c (PREDEFINED_CLASSES): Remove.
* locale/programs/ld-ctype.c: Likewise.
---
locale/C-ctype.c | 17 +--------
locale/programs/ld-ctype.c | 81 ++-----------------------------------------
2 files changed, 6 insertions(+), 92 deletions(-)
diff --git a/locale/C-ctype.c b/locale/C-ctype.c
index 7c616d8..aa5f19f 100644
--- a/locale/C-ctype.c
+++ b/locale/C-ctype.c
@@ -569,22 +569,9 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
{ .string = NULL },
/* _NL_CTYPE_CLASS_NAMES */
{ .string = "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
- "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0"
-#ifdef PREDEFINED_CLASSES
- "left_to_right\0" "right_to_left\0" "num_terminator\0"
- "num_separator\0" "segment_separator\0" "block_separator\0"
- "direction_control\0" "sym_swap_layout\0" "char_shape_selector\0"
- "num_shape_selector\0" "non_spacing\0" "non_spacing_level3\0"
- "r_connect\0" "no_connect\0" "no_connect-space\0"
- "vowel_connect\0"
-#endif
- },
+ "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" },
/* _NL_CTYPE_MAP_NAMES */
- { .string = "toupper\0" "tolower\0"
-#ifdef PREDEFINED_CLASSES
- "tosymmetric\0"
-#endif
- },
+ { .string = "toupper\0" "tolower\0" },
/* _NL_CTYPE_WIDTH */
{ .string = (const char *) _nl_C_LC_CTYPE_width.header },
/* _NL_CTYPE_MB_CUR_MAX */
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index e8690f3..3f464ef 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -43,15 +43,6 @@
#include <assert.h>
-#ifdef PREDEFINED_CLASSES
-/* These are the extra bits not in wctype.h since these are not preallocated
- classes. */
-# define _ISwspecial1 (1 << 29)
-# define _ISwspecial2 (1 << 30)
-# define _ISwspecial3 (1 << 31)
-#endif
-
-
/* The bit used for representing a special class. */
#define BITPOS(class) ((class) - tok_upper)
#define BIT(class) (_ISbit (BITPOS (class)))
@@ -337,26 +328,6 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
ctype_class_new (lr, ctype, "cntrl");
ctype_class_new (lr, ctype, "punct");
ctype_class_new (lr, ctype, "alnum");
-#ifdef PREDEFINED_CLASSES
- /* The following are extensions from ISO 14652. */
- ctype_class_new (lr, ctype, "left_to_right");
- ctype_class_new (lr, ctype, "right_to_left");
- ctype_class_new (lr, ctype, "num_terminator");
- ctype_class_new (lr, ctype, "num_separator");
- ctype_class_new (lr, ctype, "segment_separator");
- ctype_class_new (lr, ctype, "block_separator");
- ctype_class_new (lr, ctype, "direction_control");
- ctype_class_new (lr, ctype, "sym_swap_layout");
- ctype_class_new (lr, ctype, "char_shape_selector");
- ctype_class_new (lr, ctype, "num_shape_selector");
- ctype_class_new (lr, ctype, "non_spacing");
- ctype_class_new (lr, ctype, "non_spacing_level3");
- ctype_class_new (lr, ctype, "normal_connect");
- ctype_class_new (lr, ctype, "r_connect");
- ctype_class_new (lr, ctype, "no_connect");
- ctype_class_new (lr, ctype, "no_connect-space");
- ctype_class_new (lr, ctype, "vowel_connect");
-#endif
ctype->class_collection_max = charmap->mb_cur_max == 1 ? 256 : 512;
ctype->class_collection
@@ -368,18 +339,13 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
ctype->last_map_idx = MAX_NR_CHARMAP;
ctype_map_new (lr, ctype, "toupper", charmap);
ctype_map_new (lr, ctype, "tolower", charmap);
-#ifdef PREDEFINED_CLASSES
- ctype_map_new (lr, ctype, "tosymmetric", charmap);
-#endif
/* Fill first 256 entries in `toXXX' arrays. */
for (cnt = 0; cnt < 256; ++cnt)
{
ctype->map_collection[0][cnt] = cnt;
ctype->map_collection[1][cnt] = cnt;
-#ifdef PREDEFINED_CLASSES
- ctype->map_collection[2][cnt] = cnt;
-#endif
+
ctype->map256_collection[0][cnt] = cnt;
ctype->map256_collection[1][cnt] = cnt;
}
@@ -2269,24 +2235,10 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
break;
if (cnt >= ctype->nr_charclass)
{
-#ifdef PREDEFINED_CLASSES
- if (now->val.str.lenmb == 8
- && memcmp ("special1", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial1;
- else if (now->val.str.lenmb == 8
- && memcmp ("special2", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial2;
- else if (now->val.str.lenmb == 8
- && memcmp ("special3", now->val.str.startmb, 8) == 0)
- class_bit = _ISwspecial3;
- else
-#endif
- {
- /* OK, it's a new class. */
- ctype_class_new (ldfile, ctype, now->val.str.startmb);
+ /* OK, it's a new class. */
+ ctype_class_new (ldfile, ctype, now->val.str.startmb);
- class_bit = _ISwbit (ctype->nr_charclass - 1);
- }
+ class_bit = _ISwbit (ctype->nr_charclass - 1);
}
else
{
@@ -2874,31 +2826,6 @@ previous definition was here")));
free (now->val.str.startmb);
goto read_mapping;
}
-#ifdef PREDEFINED_CLASSES
- if (strcmp (now->val.str.startmb, "special1") == 0)
- {
- class_bit = _ISwspecial1;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "special2") == 0)
- {
- class_bit = _ISwspecial2;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "special3") == 0)
- {
- class_bit = _ISwspecial3;
- free (now->val.str.startmb);
- goto read_charclass;
- }
- if (strcmp (now->val.str.startmb, "tosymmetric") == 0)
- {
- mapidx = 2;
- goto read_mapping;
- }
-#endif
break;
case tok_end:
--
1.7.1
Thanks,
--
Marko Myllynen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove unused PREDEFINED_CLASSES code
2015-05-12 7:50 [PATCH] Remove unused PREDEFINED_CLASSES code Marko Myllynen
@ 2015-05-13 10:12 ` Ondřej Bílka
2015-06-03 16:25 ` Marko Myllynen
1 sibling, 0 replies; 4+ messages in thread
From: Ondřej Bílka @ 2015-05-13 10:12 UTC (permalink / raw)
To: Marko Myllynen; +Cc: GNU C Library
On Tue, May 12, 2015 at 10:50:28AM +0300, Marko Myllynen wrote:
> Hi,
>
> AFAICS PREDEFINED_CLASSES is never defined thus the code is unused. It would seem that the code is related to LO_LTYPE which was discussed in the past but there are no any recent references:
>
> http://pubs.opengroup.org/onlinepubs/9638399/loltype.htm
>
> Patch below, compiles and passes make check.
>
ok for me.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove unused PREDEFINED_CLASSES code
2015-05-12 7:50 [PATCH] Remove unused PREDEFINED_CLASSES code Marko Myllynen
2015-05-13 10:12 ` Ondřej Bílka
@ 2015-06-03 16:25 ` Marko Myllynen
2015-06-03 17:54 ` Siddhesh Poyarekar
1 sibling, 1 reply; 4+ messages in thread
From: Marko Myllynen @ 2015-06-03 16:25 UTC (permalink / raw)
To: libc-alpha
Hi,
OndÅej acked this on 2015-05-13, could someone please check it in?
Thanks,
On 2015-05-12 10:50, Marko Myllynen wrote:
> Hi,
>
> AFAICS PREDEFINED_CLASSES is never defined thus the code is unused. It would seem that the code is related to LO_LTYPE which was discussed in the past but there are no any recent references:
>
> http://pubs.opengroup.org/onlinepubs/9638399/loltype.htm
>
> Patch below, compiles and passes make check.
>
>
> 2015-05-12 Marko Myllynen <myllynen@redhat.com>
>
> * locale/C-ctype.c (PREDEFINED_CLASSES): Remove.
> * locale/programs/ld-ctype.c: Likewise.
>
> ---
> locale/C-ctype.c | 17 +--------
> locale/programs/ld-ctype.c | 81 ++-----------------------------------------
> 2 files changed, 6 insertions(+), 92 deletions(-)
>
> diff --git a/locale/C-ctype.c b/locale/C-ctype.c
> index 7c616d8..aa5f19f 100644
> --- a/locale/C-ctype.c
> +++ b/locale/C-ctype.c
> @@ -569,22 +569,9 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
> { .string = NULL },
> /* _NL_CTYPE_CLASS_NAMES */
> { .string = "upper\0" "lower\0" "alpha\0" "digit\0" "xdigit\0" "space\0"
> - "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0"
> -#ifdef PREDEFINED_CLASSES
> - "left_to_right\0" "right_to_left\0" "num_terminator\0"
> - "num_separator\0" "segment_separator\0" "block_separator\0"
> - "direction_control\0" "sym_swap_layout\0" "char_shape_selector\0"
> - "num_shape_selector\0" "non_spacing\0" "non_spacing_level3\0"
> - "r_connect\0" "no_connect\0" "no_connect-space\0"
> - "vowel_connect\0"
> -#endif
> - },
> + "print\0" "graph\0" "blank\0" "cntrl\0" "punct\0" "alnum\0" },
> /* _NL_CTYPE_MAP_NAMES */
> - { .string = "toupper\0" "tolower\0"
> -#ifdef PREDEFINED_CLASSES
> - "tosymmetric\0"
> -#endif
> - },
> + { .string = "toupper\0" "tolower\0" },
> /* _NL_CTYPE_WIDTH */
> { .string = (const char *) _nl_C_LC_CTYPE_width.header },
> /* _NL_CTYPE_MB_CUR_MAX */
> diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
> index e8690f3..3f464ef 100644
> --- a/locale/programs/ld-ctype.c
> +++ b/locale/programs/ld-ctype.c
> @@ -43,15 +43,6 @@
> #include <assert.h>
>
>
> -#ifdef PREDEFINED_CLASSES
> -/* These are the extra bits not in wctype.h since these are not preallocated
> - classes. */
> -# define _ISwspecial1 (1 << 29)
> -# define _ISwspecial2 (1 << 30)
> -# define _ISwspecial3 (1 << 31)
> -#endif
> -
> -
> /* The bit used for representing a special class. */
> #define BITPOS(class) ((class) - tok_upper)
> #define BIT(class) (_ISbit (BITPOS (class)))
> @@ -337,26 +328,6 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
> ctype_class_new (lr, ctype, "cntrl");
> ctype_class_new (lr, ctype, "punct");
> ctype_class_new (lr, ctype, "alnum");
> -#ifdef PREDEFINED_CLASSES
> - /* The following are extensions from ISO 14652. */
> - ctype_class_new (lr, ctype, "left_to_right");
> - ctype_class_new (lr, ctype, "right_to_left");
> - ctype_class_new (lr, ctype, "num_terminator");
> - ctype_class_new (lr, ctype, "num_separator");
> - ctype_class_new (lr, ctype, "segment_separator");
> - ctype_class_new (lr, ctype, "block_separator");
> - ctype_class_new (lr, ctype, "direction_control");
> - ctype_class_new (lr, ctype, "sym_swap_layout");
> - ctype_class_new (lr, ctype, "char_shape_selector");
> - ctype_class_new (lr, ctype, "num_shape_selector");
> - ctype_class_new (lr, ctype, "non_spacing");
> - ctype_class_new (lr, ctype, "non_spacing_level3");
> - ctype_class_new (lr, ctype, "normal_connect");
> - ctype_class_new (lr, ctype, "r_connect");
> - ctype_class_new (lr, ctype, "no_connect");
> - ctype_class_new (lr, ctype, "no_connect-space");
> - ctype_class_new (lr, ctype, "vowel_connect");
> -#endif
>
> ctype->class_collection_max = charmap->mb_cur_max == 1 ? 256 : 512;
> ctype->class_collection
> @@ -368,18 +339,13 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale,
> ctype->last_map_idx = MAX_NR_CHARMAP;
> ctype_map_new (lr, ctype, "toupper", charmap);
> ctype_map_new (lr, ctype, "tolower", charmap);
> -#ifdef PREDEFINED_CLASSES
> - ctype_map_new (lr, ctype, "tosymmetric", charmap);
> -#endif
>
> /* Fill first 256 entries in `toXXX' arrays. */
> for (cnt = 0; cnt < 256; ++cnt)
> {
> ctype->map_collection[0][cnt] = cnt;
> ctype->map_collection[1][cnt] = cnt;
> -#ifdef PREDEFINED_CLASSES
> - ctype->map_collection[2][cnt] = cnt;
> -#endif
> +
> ctype->map256_collection[0][cnt] = cnt;
> ctype->map256_collection[1][cnt] = cnt;
> }
> @@ -2269,24 +2235,10 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
> break;
> if (cnt >= ctype->nr_charclass)
> {
> -#ifdef PREDEFINED_CLASSES
> - if (now->val.str.lenmb == 8
> - && memcmp ("special1", now->val.str.startmb, 8) == 0)
> - class_bit = _ISwspecial1;
> - else if (now->val.str.lenmb == 8
> - && memcmp ("special2", now->val.str.startmb, 8) == 0)
> - class_bit = _ISwspecial2;
> - else if (now->val.str.lenmb == 8
> - && memcmp ("special3", now->val.str.startmb, 8) == 0)
> - class_bit = _ISwspecial3;
> - else
> -#endif
> - {
> - /* OK, it's a new class. */
> - ctype_class_new (ldfile, ctype, now->val.str.startmb);
> + /* OK, it's a new class. */
> + ctype_class_new (ldfile, ctype, now->val.str.startmb);
>
> - class_bit = _ISwbit (ctype->nr_charclass - 1);
> - }
> + class_bit = _ISwbit (ctype->nr_charclass - 1);
> }
> else
> {
> @@ -2874,31 +2826,6 @@ previous definition was here")));
> free (now->val.str.startmb);
> goto read_mapping;
> }
> -#ifdef PREDEFINED_CLASSES
> - if (strcmp (now->val.str.startmb, "special1") == 0)
> - {
> - class_bit = _ISwspecial1;
> - free (now->val.str.startmb);
> - goto read_charclass;
> - }
> - if (strcmp (now->val.str.startmb, "special2") == 0)
> - {
> - class_bit = _ISwspecial2;
> - free (now->val.str.startmb);
> - goto read_charclass;
> - }
> - if (strcmp (now->val.str.startmb, "special3") == 0)
> - {
> - class_bit = _ISwspecial3;
> - free (now->val.str.startmb);
> - goto read_charclass;
> - }
> - if (strcmp (now->val.str.startmb, "tosymmetric") == 0)
> - {
> - mapidx = 2;
> - goto read_mapping;
> - }
> -#endif
> break;
>
> case tok_end:
>
--
Marko Myllynen
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove unused PREDEFINED_CLASSES code
2015-06-03 16:25 ` Marko Myllynen
@ 2015-06-03 17:54 ` Siddhesh Poyarekar
0 siblings, 0 replies; 4+ messages in thread
From: Siddhesh Poyarekar @ 2015-06-03 17:54 UTC (permalink / raw)
To: Marko Myllynen; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 221 bytes --]
On Wed, Jun 03, 2015 at 06:59:16PM +0300, Marko Myllynen wrote:
> Hi,
>
> Ondřej acked this on 2015-05-13, could someone please check it in?
Ondrej, could you please check this in for Marko?
Thanks,
Siddhesh
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-03 17:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 7:50 [PATCH] Remove unused PREDEFINED_CLASSES code Marko Myllynen
2015-05-13 10:12 ` Ondřej Bílka
2015-06-03 16:25 ` Marko Myllynen
2015-06-03 17:54 ` Siddhesh Poyarekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).