From 5866b13180519807f875b64b5b69882b8c198c44 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 24 Feb 2000 06:01:05 +0000 Subject: [PATCH] Update. 2000-02-23 Ulrich Drepper * locale/programs/ld-ctype.c (allocate_arrays): Make sure the end of width table is 4-byte aligned. (ctype_output): Write out the entire width array. * sysdeps/unix/sysv/linux/bits/waitflags.h: Add __WALL. --- ChangeLog | 8 +++++++ locale/programs/ld-ctype.c | 37 ++++++++++++++++---------------- sysdeps/unix/sysv/linux/bits/waitflags.h | 3 ++- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5cc5dd2..d8c5821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-02-23 Ulrich Drepper + + * locale/programs/ld-ctype.c (allocate_arrays): Make sure the end + of width table is 4-byte aligned. + (ctype_output): Write out the entire width array. + + * sysdeps/unix/sysv/linux/bits/waitflags.h: Add __WALL. + 2000-02-23 Andreas Jaeger * dlfcn/dlopen.c: Include for NULL. diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 7b2f7c1..dbd030c 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -281,7 +281,6 @@ ctype_startup (struct linereader *lr, struct localedef_t *locale, ctype->class_collection_act = 256; /* Fill character map information. */ - ctype->map_collection_nr = 0; ctype->last_map_idx = MAX_NR_CHARMAP; ctype_map_new (lr, ctype, "toupper", charmap); ctype_map_new (lr, ctype, "tolower", charmap); @@ -910,7 +909,8 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, break; CTYPE_DATA (_NL_CTYPE_WIDTH, - ctype->width, ctype->plane_size * ctype->plane_cnt); + ctype->width, + (ctype->plane_size * ctype->plane_cnt + 3) & ~3ul); CTYPE_DATA (_NL_CTYPE_MB_CUR_MAX, &ctype->mb_cur_max, sizeof (uint32_t)); @@ -1094,9 +1094,7 @@ implementation limit: no more than %d character maps allowed"), ctype->map_collection_max[cnt] = max_chars; ctype->map_collection[cnt] = (uint32_t *) - xmalloc (sizeof (uint32_t) * ctype->map_collection_max[cnt]); - memset (ctype->map_collection[cnt], '\0', - sizeof (uint32_t) * ctype->map_collection_max[cnt]); + xcalloc (sizeof (uint32_t), ctype->map_collection_max[cnt]); ctype->map_collection_act[cnt] = 256; ++ctype->map_collection_nr; @@ -1125,9 +1123,9 @@ find_idx (struct locale_ctype_t *ctype, uint32_t **table, size_t *max, if (ctype->charnames_act == ctype->charnames_max) { ctype->charnames_max *= 2; - ctype->charnames = (unsigned int *) + ctype->charnames = (uint32_t *) xrealloc (ctype->charnames, - sizeof (unsigned int) * ctype->charnames_max); + sizeof (uint32_t) * ctype->charnames_max); } ctype->charnames[ctype->charnames_act++] = idx; } @@ -1146,7 +1144,7 @@ find_idx (struct locale_ctype_t *ctype, uint32_t **table, size_t *max, while (*max <= cnt); *table = - (uint32_t *) xrealloc (*table, *max * sizeof (unsigned long int)); + (uint32_t *) xrealloc (*table, *max * sizeof (uint32_t)); memset (&(*table)[old_max], '\0', (*max - old_max) * sizeof (uint32_t)); } @@ -1197,10 +1195,11 @@ get_character (struct token *now, struct charmap_t *charmap, /* Insert a negative entry. */ static const struct charseq negative = { .ucs4 = ILLEGAL_CHAR_VALUE }; - uint32_t *newp = obstack_alloc (&repertoire->mem_pool, 4); + uint32_t *newp = obstack_alloc (&repertoire->mem_pool, + sizeof (uint32_t)); *newp = now->val.ucs4; - insert_entry (&repertoire->seq_table, newp, 4, + insert_entry (&repertoire->seq_table, newp, sizeof (uint32_t), (void *) &negative); } else @@ -1391,7 +1390,8 @@ to-value of range is smaller than from-value "), { const char *symbol = repertoire_find_symbol (repertoire, last_wch); - uint32_t *newp = obstack_alloc (&repertoire->mem_pool, 4); + uint32_t *newp = obstack_alloc (&repertoire->mem_pool, + sizeof (uint32_t)); *newp = last_wch; if (symbol != NULL) @@ -1404,7 +1404,8 @@ to-value of range is smaller than from-value "), else seq->ucs4 = last_wch; - insert_entry (&repertoire->seq_table, newp, 4, seq); + insert_entry (&repertoire->seq_table, newp, sizeof (uint32_t), + seq); } else /* We have to create a fake entry. */ @@ -1418,7 +1419,7 @@ to-value of range is smaller than from-value "), |= class256_bit; /* And of course we have the UCS4 position. */ - if (class_bit != 0 && class_bit != 0) + if (class_bit != 0) *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max, &ctype->class_collection_act, last_wch) |= class_bit; @@ -1583,7 +1584,7 @@ read_widestring (struct linereader *ldfile, struct token *now, if (now->tok == tok_default_missing) /* The special name "" will denote this case. */ - wstr = (uint32_t *) L""; + wstr = ((uint32_t *) { 0 }); else if (now->tok == tok_bsymbol) { /* Get the value from the repertoire. */ @@ -3233,11 +3234,11 @@ Computing table size for character classes might take a while..."), /* Array for width information. Because the expected width are very small we use only one single byte. This save space and we need not provide the information twice with both endianesses. */ - ctype->width = (unsigned char *) xmalloc (ctype->plane_size - * ctype->plane_cnt); + width_table_size = (ctype->plane_size * ctype->plane_cnt + 3) & ~3ul; + ctype->width = (unsigned char *) xmalloc (width_table_size); + /* Initialize with default width value. */ - memset (ctype->width, charmap->width_default, - ctype->plane_size * ctype->plane_cnt); + memset (ctype->width, charmap->width_default, width_table_size); if (charmap->width_rules != NULL) { size_t cnt; diff --git a/sysdeps/unix/sysv/linux/bits/waitflags.h b/sysdeps/unix/sysv/linux/bits/waitflags.h index e594505..afc8b22 100644 --- a/sysdeps/unix/sysv/linux/bits/waitflags.h +++ b/sysdeps/unix/sysv/linux/bits/waitflags.h @@ -1,5 +1,5 @@ /* Definitions of flag bits for `waitpid' et al. - Copyright (C) 1992, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1992, 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,4 +26,5 @@ #define WNOHANG 1 /* Don't block waiting. */ #define WUNTRACED 2 /* Report status of stopped children. */ +#define __WALL 0x40000000 /* Wait for any child. */ #define __WCLONE 0x80000000 /* Wait for cloned process. */ -- 2.7.4