mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-23 03:10:05 +00:00
Clean up locale file alignment handling.
This commit is contained in:
parent
f17f137aaf
commit
7602d070dc
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2013-10-07 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* locale/loadlocale.c (_nl_intern_locale_data): Use
|
||||||
|
LOCFILE_ALIGNED_P.
|
||||||
|
* locale/programs/3level.h (CONCAT(add_locale_,TABLE)): Use
|
||||||
|
LOCFILE_ALIGN_UP and LOCFILE_ALIGN.
|
||||||
|
* locale/programs/ld-collate.c (obstack_int32_grow): Assert that
|
||||||
|
obstack data is appropriately aligned.
|
||||||
|
(obstack_int32_grow_fast): Likewise.
|
||||||
|
* locale/programs/ld-ctype.c (ctype_output): Use LOCFILE_ALIGN.
|
||||||
|
* locale/programs/locfile.c (add_locale_uint32): Likewise.
|
||||||
|
(add_locale_uint32_array): Likewise.
|
||||||
|
|
||||||
2013-10-07 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2013-10-07 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
* benchtests/Makefile: Remove ARGLIST and RET variables.
|
* benchtests/Makefile: Remove ARGLIST and RET variables.
|
||||||
|
@ -148,7 +148,7 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
|
|||||||
newdata->values[cnt].string = newdata->filedata + idx;
|
newdata->values[cnt].string = newdata->filedata + idx;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (idx % __alignof__ (u_int32_t) != 0)
|
if (!LOCFILE_ALIGNED_P (idx))
|
||||||
goto puntdata;
|
goto puntdata;
|
||||||
newdata->values[cnt].word =
|
newdata->values[cnt].word =
|
||||||
*((const u_int32_t *) (newdata->filedata + idx));
|
*((const u_int32_t *) (newdata->filedata + idx));
|
||||||
|
@ -270,7 +270,7 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t)
|
|||||||
+ t->level1_size * sizeof (uint32_t)
|
+ t->level1_size * sizeof (uint32_t)
|
||||||
+ (t->level2_size << t->q) * sizeof (uint32_t)
|
+ (t->level2_size << t->q) * sizeof (uint32_t)
|
||||||
+ (t->level3_size << t->p) * sizeof (ELEMENT);
|
+ (t->level3_size << t->p) * sizeof (ELEMENT);
|
||||||
t->result_size = (last_offset + 3) & ~3ul;
|
t->result_size = LOCFILE_ALIGN_UP (last_offset);
|
||||||
|
|
||||||
level2_offset =
|
level2_offset =
|
||||||
5 * sizeof (uint32_t)
|
5 * sizeof (uint32_t)
|
||||||
@ -308,7 +308,7 @@ CONCAT(add_locale_,TABLE) (struct locale_file *file, struct TABLE *t)
|
|||||||
t->level3_size << t->p);
|
t->level3_size << t->p);
|
||||||
else
|
else
|
||||||
abort ();
|
abort ();
|
||||||
align_locale_data (file, 4);
|
align_locale_data (file, LOCFILE_ALIGN);
|
||||||
end_locale_structure (file);
|
end_locale_structure (file);
|
||||||
|
|
||||||
if (t->level1_alloc > 0)
|
if (t->level1_alloc > 0)
|
||||||
|
@ -44,6 +44,7 @@ static inline void
|
|||||||
__attribute ((always_inline))
|
__attribute ((always_inline))
|
||||||
obstack_int32_grow (struct obstack *obstack, int32_t data)
|
obstack_int32_grow (struct obstack *obstack, int32_t data)
|
||||||
{
|
{
|
||||||
|
assert (LOCFILE_ALIGNED_P (obstack_object_size (obstack)));
|
||||||
data = maybe_swap_uint32 (data);
|
data = maybe_swap_uint32 (data);
|
||||||
if (sizeof (int32_t) == sizeof (int))
|
if (sizeof (int32_t) == sizeof (int))
|
||||||
obstack_int_grow (obstack, data);
|
obstack_int_grow (obstack, data);
|
||||||
@ -55,6 +56,7 @@ static inline void
|
|||||||
__attribute ((always_inline))
|
__attribute ((always_inline))
|
||||||
obstack_int32_grow_fast (struct obstack *obstack, int32_t data)
|
obstack_int32_grow_fast (struct obstack *obstack, int32_t data)
|
||||||
{
|
{
|
||||||
|
assert (LOCFILE_ALIGNED_P (obstack_object_size (obstack)));
|
||||||
data = maybe_swap_uint32 (data);
|
data = maybe_swap_uint32 (data);
|
||||||
if (sizeof (int32_t) == sizeof (int))
|
if (sizeof (int32_t) == sizeof (int))
|
||||||
obstack_int_grow_fast (obstack, data);
|
obstack_int_grow_fast (obstack, data);
|
||||||
|
@ -1032,7 +1032,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
|||||||
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
|
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
|
||||||
add_locale_string (&file, ctype->classnames[cnt]);
|
add_locale_string (&file, ctype->classnames[cnt]);
|
||||||
add_locale_char (&file, 0);
|
add_locale_char (&file, 0);
|
||||||
align_locale_data (&file, 4);
|
align_locale_data (&file, LOCFILE_ALIGN);
|
||||||
end_locale_structure (&file);
|
end_locale_structure (&file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1042,7 +1042,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
|||||||
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
|
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
|
||||||
add_locale_string (&file, ctype->mapnames[cnt]);
|
add_locale_string (&file, ctype->mapnames[cnt]);
|
||||||
add_locale_char (&file, 0);
|
add_locale_char (&file, 0);
|
||||||
align_locale_data (&file, 4);
|
align_locale_data (&file, LOCFILE_ALIGN);
|
||||||
end_locale_structure (&file);
|
end_locale_structure (&file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ add_locale_wstring (struct locale_file *file, const uint32_t *string)
|
|||||||
void
|
void
|
||||||
add_locale_uint32 (struct locale_file *file, uint32_t value)
|
add_locale_uint32 (struct locale_file *file, uint32_t value)
|
||||||
{
|
{
|
||||||
align_locale_data (file, sizeof (uint32_t));
|
align_locale_data (file, LOCFILE_ALIGN);
|
||||||
record_offset (file);
|
record_offset (file);
|
||||||
value = maybe_swap_uint32 (value);
|
value = maybe_swap_uint32 (value);
|
||||||
obstack_grow (&file->data, &value, sizeof (value));
|
obstack_grow (&file->data, &value, sizeof (value));
|
||||||
@ -639,7 +639,7 @@ void
|
|||||||
add_locale_uint32_array (struct locale_file *file,
|
add_locale_uint32_array (struct locale_file *file,
|
||||||
const uint32_t *data, size_t n_elems)
|
const uint32_t *data, size_t n_elems)
|
||||||
{
|
{
|
||||||
align_locale_data (file, sizeof (uint32_t));
|
align_locale_data (file, LOCFILE_ALIGN);
|
||||||
record_offset (file);
|
record_offset (file);
|
||||||
obstack_grow (&file->data, data, n_elems * sizeof (uint32_t));
|
obstack_grow (&file->data, data, n_elems * sizeof (uint32_t));
|
||||||
maybe_swap_uint32_obstack (&file->data, n_elems);
|
maybe_swap_uint32_obstack (&file->data, n_elems);
|
||||||
|
Loading…
Reference in New Issue
Block a user