mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
2002-08-14 Roland McGrath <roland@redhat.com>
(oldlocrecentcmp): Compare just on file locations used.
This commit is contained in:
parent
ac8f8c53f0
commit
31ff2aa3ea
@ -1,4 +1,4 @@
|
|||||||
2002-08-14 Roland McGrath <roland@frob.com>
|
2002-08-14 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
* locale/locarchive.h (struct locale_category_data): Give this name to
|
* locale/locarchive.h (struct locale_category_data): Give this name to
|
||||||
the type of locale_data_t's elements.
|
the type of locale_data_t's elements.
|
||||||
@ -8,6 +8,7 @@
|
|||||||
hard-coding it to do everything but LC_CTYPE and LC_COLLATE.
|
hard-coding it to do everything but LC_CTYPE and LC_COLLATE.
|
||||||
(show_archive_content): Detect categories inside LC_ALL block
|
(show_archive_content): Detect categories inside LC_ALL block
|
||||||
directly, instead of hard-coding.
|
directly, instead of hard-coding.
|
||||||
|
(oldlocrecentcmp): Compare just on file locations used.
|
||||||
|
|
||||||
2002-08-14 Jakub Jelinek <jakub@redhat.com>
|
2002-08-14 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
@ -168,6 +168,8 @@ create_archive (const char *archivefname, struct locarhandle *ah)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This structure and qsort comparator function are used below to sort an
|
||||||
|
old archive's locrec table in order of data position in the file. */
|
||||||
struct oldlocrecent
|
struct oldlocrecent
|
||||||
{
|
{
|
||||||
unsigned int cnt;
|
unsigned int cnt;
|
||||||
@ -179,31 +181,35 @@ oldlocrecentcmp (const void *a, const void *b)
|
|||||||
{
|
{
|
||||||
struct locrecent *la = ((const struct oldlocrecent *) a)->locrec;
|
struct locrecent *la = ((const struct oldlocrecent *) a)->locrec;
|
||||||
struct locrecent *lb = ((const struct oldlocrecent *) b)->locrec;
|
struct locrecent *lb = ((const struct oldlocrecent *) b)->locrec;
|
||||||
|
uint32_t start_a = -1, end_a = 0;
|
||||||
|
uint32_t start_b = -1, end_b = 0;
|
||||||
|
int cnt;
|
||||||
|
|
||||||
if (la->record[LC_ALL].offset < lb->record[LC_ALL].offset)
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||||
return -1;
|
if (cnt != LC_ALL)
|
||||||
if (la->record[LC_ALL].offset > lb->record[LC_ALL].offset)
|
{
|
||||||
return 1;
|
if (la->record[cnt].offset < start_a)
|
||||||
|
start_a = la->record[cnt].offset;
|
||||||
|
if (la->record[cnt].offset + la->record[cnt].len > end_a)
|
||||||
|
end_a = la->record[cnt].offset + la->record[cnt].len;
|
||||||
|
}
|
||||||
|
assert (start_a != (uint32_t)-1);
|
||||||
|
assert (end_a != 0);
|
||||||
|
|
||||||
if (la->record[LC_CTYPE].offset < lb->record[LC_CTYPE].offset)
|
for (cnt = 0; cnt < __LC_LAST; ++cnt)
|
||||||
return -1;
|
if (cnt != LC_ALL)
|
||||||
if (la->record[LC_CTYPE].offset > lb->record[LC_CTYPE].offset)
|
{
|
||||||
return 1;
|
if (lb->record[cnt].offset < start_b)
|
||||||
|
start_b = lb->record[cnt].offset;
|
||||||
|
if (lb->record[cnt].offset + lb->record[cnt].len > end_b)
|
||||||
|
end_b = lb->record[cnt].offset + lb->record[cnt].len;
|
||||||
|
}
|
||||||
|
assert (start_b != (uint32_t)-1);
|
||||||
|
assert (end_b != 0);
|
||||||
|
|
||||||
if (la->record[LC_COLLATE].offset < lb->record[LC_COLLATE].offset)
|
if (start_a != start_b)
|
||||||
return -1;
|
return (int)start_a - (int)start_b;
|
||||||
if (la->record[LC_COLLATE].offset > lb->record[LC_COLLATE].offset)
|
return (int)end_a - (int)end_b;
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (((const struct oldlocrecent *) a)->cnt
|
|
||||||
< ((const struct oldlocrecent *) b)->cnt)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (((const struct oldlocrecent *) a)->cnt
|
|
||||||
> ((const struct oldlocrecent *) b)->cnt)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -323,10 +329,11 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
|
|||||||
+ head->namehash_offset);
|
+ head->namehash_offset);
|
||||||
oldlocrectab = (struct locrecent *) ((char *) ah->addr
|
oldlocrectab = (struct locrecent *) ((char *) ah->addr
|
||||||
+ head->locrectab_offset);
|
+ head->locrectab_offset);
|
||||||
|
|
||||||
|
/* Sort the old locrec table in order of data position. */
|
||||||
oldlocrecarray = (struct oldlocrecent *)
|
oldlocrecarray = (struct oldlocrecent *)
|
||||||
alloca (head->namehash_size
|
alloca (head->namehash_size
|
||||||
* sizeof (struct oldlocrecent));
|
* sizeof (struct oldlocrecent));
|
||||||
|
|
||||||
for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt)
|
for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt)
|
||||||
if (oldnamehashtab[cnt].locrec_offset != 0)
|
if (oldnamehashtab[cnt].locrec_offset != 0)
|
||||||
{
|
{
|
||||||
@ -335,7 +342,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
|
|||||||
= (struct locrecent *) ((char *) ah->addr
|
= (struct locrecent *) ((char *) ah->addr
|
||||||
+ oldnamehashtab[cnt].locrec_offset);
|
+ oldnamehashtab[cnt].locrec_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort (oldlocrecarray, loccnt, sizeof (struct oldlocrecent),
|
qsort (oldlocrecarray, loccnt, sizeof (struct oldlocrecent),
|
||||||
oldlocrecentcmp);
|
oldlocrecentcmp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user