From eee6b1432794967d4272394dfed1e2b5cca4be39 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 15 Mar 2009 21:33:19 +0000 Subject: [PATCH] [BZ #9759] * dirent/dirent.h: Adjust prototypes of scandir, scandir64, alphasort, alphasort64, versionsort, and versionsort64 to POSIX 2008. * dirent/alphasort.c: Adjust implementation to type change. * dirent/alphasort64.c: Likewise. * dirent/scandir.c: Likewise. * dirent/versionsort.c: Likewise. * dirent/versionsort64.c: Likewise. * sysdeps/wordsize-64/alphasort.c: Add hack to hide alphasort64 declaration. * sysdeps/wordsize-64/versionsort.c: Add hack to hide versionsort64 declaration. --- ChangeLog | 13 ++++++++++ dirent/alphasort.c | 7 +++-- dirent/alphasort64.c | 7 +++-- dirent/dirent.h | 49 +++++++++++++++++++++-------------- dirent/scandir.c | 7 ++--- dirent/versionsort.c | 7 +++-- dirent/versionsort64.c | 7 +++-- localedata/ChangeLog | 3 +++ localedata/locales/iso14651_t1_common | 16 ++++++------ sysdeps/wordsize-64/alphasort.c | 4 +++ sysdeps/wordsize-64/versionsort.c | 4 +++ 11 files changed, 77 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 727b2957f8..2f9f842e3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2009-03-15 Ulrich Drepper + [BZ #9759] + * dirent/dirent.h: Adjust prototypes of scandir, scandir64, alphasort, + alphasort64, versionsort, and versionsort64 to POSIX 2008. + * dirent/alphasort.c: Adjust implementation to type change. + * dirent/alphasort64.c: Likewise. + * dirent/scandir.c: Likewise. + * dirent/versionsort.c: Likewise. + * dirent/versionsort64.c: Likewise. + * sysdeps/wordsize-64/alphasort.c: Add hack to hide alphasort64 + declaration. + * sysdeps/wordsize-64/versionsort.c: Add hack to hide versionsort64 + declaration. + [BZ #9880] * inet/inet6_rth.c (inet6_rth_reverse): Compute number of segments correctly. Set segleft member in output as required. diff --git a/dirent/alphasort.c b/dirent/alphasort.c index b378626f6c..360b17c5a0 100644 --- a/dirent/alphasort.c +++ b/dirent/alphasort.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2009 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 @@ -20,8 +20,7 @@ #include int -alphasort (const void *a, const void *b) +alphasort (const struct dirent **a, const struct dirent **b) { - return strcoll ((*(const struct dirent **) a)->d_name, - (*(const struct dirent **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } diff --git a/dirent/alphasort64.c b/dirent/alphasort64.c index fe84aec2f1..f91cba5088 100644 --- a/dirent/alphasort64.c +++ b/dirent/alphasort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2000, 2009 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 @@ -20,8 +20,7 @@ #include int -alphasort64 (const void *a, const void *b) +alphasort64 (const struct dirent64 **a, const struct dirent64 **b) { - return strcoll ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } diff --git a/dirent/dirent.h b/dirent/dirent.h index cb6d0bc2d5..369ccdc9ee 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -252,7 +252,8 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); extern int scandir (__const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (__const struct dirent *), - int (*__cmp) (__const void *, __const void *)) + int (*__cmp) (__const struct dirent **, + __const struct dirent **)) __nonnull ((1, 2)); # else # ifdef __REDIRECT @@ -260,7 +261,8 @@ extern int __REDIRECT (scandir, (__const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (__const struct dirent *), - int (*__cmp) (__const void *, __const void *)), + int (*__cmp) (__const struct dirent **, + __const struct dirent **)), scandir64) __nonnull ((1, 2)); # else # define scandir scandir64 @@ -273,18 +275,21 @@ extern int __REDIRECT (scandir, extern int scandir64 (__const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (__const struct dirent64 *), - int (*__cmp) (__const void *, __const void *)) + int (*__cmp) (__const struct dirent64 **, + __const struct dirent64 **)) __nonnull ((1, 2)); # endif /* Function to compare two `struct dirent's alphabetically. */ # ifndef __USE_FILE_OFFSET64 -extern int alphasort (__const void *__e1, __const void *__e2) +extern int alphasort (__const struct dirent **__e1, + __const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (alphasort, - (__const void *__e1, __const void *__e2), + (__const struct dirent **__e1, + __const struct dirent **__e2), alphasort64) __attribute_pure__ __nonnull ((1, 2)); # else # define alphasort alphasort64 @@ -292,51 +297,54 @@ extern int __REDIRECT_NTH (alphasort, # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 -extern int alphasort64 (__const void *__e1, __const void *__e2) +extern int alphasort64 (__const struct dirent64 **__e1, + __const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif +#endif /* Use BSD or misc or XPG7. */ -# if defined __USE_BSD || defined __USE_MISC +#if defined __USE_BSD || defined __USE_MISC /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at end of directory; or -1 for errors. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off_t *__restrict __basep) __THROW __nonnull ((2, 4)); -# else -# ifdef __REDIRECT +# else +# ifdef __REDIRECT extern __ssize_t __REDIRECT_NTH (getdirentries, (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep), getdirentries64) __nonnull ((2, 4)); -# else -# define getdirentries getdirentries64 -# endif +# else +# define getdirentries getdirentries64 # endif +# endif -# ifdef __USE_LARGEFILE64 +# ifdef __USE_LARGEFILE64 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) __THROW __nonnull ((2, 4)); -# endif -# endif /* Use BSD or misc. */ -#endif /* Use BSD or misc or XPG7. */ +# endif +#endif /* Use BSD or misc. */ #ifdef __USE_GNU /* Function to compare two `struct dirent's by name & version. */ # ifndef __USE_FILE_OFFSET64 -extern int versionsort (__const void *__e1, __const void *__e2) +extern int versionsort (__const struct dirent **__e1, + __const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (versionsort, - (__const void *__e1, __const void *__e2), + (__const struct dirent **__e1, + __const struct dirent **__e2), versionsort64) __attribute_pure__ __nonnull ((1, 2)); # else @@ -345,7 +353,8 @@ extern int __REDIRECT_NTH (versionsort, # endif # ifdef __USE_LARGEFILE64 -extern int versionsort64 (__const void *__e1, __const void *__e2) +extern int versionsort64 (__const struct dirent64 **__e1, + __const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use GNU. */ diff --git a/dirent/scandir.c b/dirent/scandir.c index 89bd9e94fe..2e03578a3c 100644 --- a/dirent/scandir.c +++ b/dirent/scandir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-1998, 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1992-1998,2000,2002,2003,2009 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 @@ -57,7 +57,7 @@ SCANDIR (dir, namelist, select, cmp) const char *dir; DIRENT_TYPE ***namelist; int (*select) (const DIRENT_TYPE *); - int (*cmp) (const void *, const void *); + int (*cmp) (const DIRENT_TYPE **, const DIRENT_TYPE **); { DIR *dp = __opendir (dir); DIRENT_TYPE **v = NULL; @@ -134,7 +134,8 @@ SCANDIR (dir, namelist, select, cmp) { /* Sort the list if we have a comparison function to sort with. */ if (cmp != NULL) - qsort (v, c.cnt, sizeof (*v), cmp); + qsort (v, c.cnt, sizeof (*v), + (int (*) (const void *, const void *)) cmp); *namelist = v; } diff --git a/dirent/versionsort.c b/dirent/versionsort.c index d986981bce..f7bd717848 100644 --- a/dirent/versionsort.c +++ b/dirent/versionsort.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2009 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 @@ -20,8 +20,7 @@ #include int -versionsort (const void *a, const void *b) +versionsort (const struct dirent **a, const struct dirent **b) { - return __strverscmp ((*(const struct dirent **) a)->d_name, - (*(const struct dirent **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } diff --git a/dirent/versionsort64.c b/dirent/versionsort64.c index e471827023..5b2833111b 100644 --- a/dirent/versionsort64.c +++ b/dirent/versionsort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2000, 2009 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 @@ -20,8 +20,7 @@ #include int -versionsort64 (const void *a, const void *b) +versionsort64 (const struct dirent64 **a, const struct dirent64 **b) { - return __strverscmp ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } diff --git a/localedata/ChangeLog b/localedata/ChangeLog index f8eb4c3db6..17f26f68c1 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,5 +1,8 @@ 2009-03-15 Ulrich Drepper + [BZ #9844] + * locales/iso14651_t1_common: Move U0138 entry. + [BZ #9833] * locales/ko_KR: Fix noexpr. Add nostr. diff --git a/localedata/locales/iso14651_t1_common b/localedata/locales/iso14651_t1_common index 1c9963aaf6..6bdc795f4a 100644 --- a/localedata/locales/iso14651_t1_common +++ b/localedata/locales/iso14651_t1_common @@ -917,7 +917,7 @@ collating-symbol # mlvw- denotes Malayalam vowel # ml-visarga - dentos Malayalam Visarga # consonant + virama is considered half of consonant or consonant without vowel part -# so it consonant + virama should be considered as cluster and should be +# so it consonant + virama should be considered as cluster and should be # sorted before the consonant. All consonants are considered to have an implicit a vowel # part associated with it. collating-element from "" @@ -2362,7 +2362,6 @@ endif ;;;IGNORE # 337 ḳ ;;;IGNORE # 338 ḵ ;;;IGNORE # 339 ƙ - ;;;IGNORE # 340 ;;;IGNORE # 341 l ;;;IGNORE # 342 ;;;IGNORE # 343 @@ -2436,6 +2435,7 @@ endif

;;;IGNORE # 411

;;;IGNORE # 412 ;;;IGNORE # 413 q + ;;;IGNORE # 340 ;;;IGNORE # 414 r ;;;IGNORE # 415 ;;;IGNORE # 416 @@ -4309,7 +4309,7 @@ order_start ;forward;forward;forward;forward,position "";;;IGNORE "";;;IGNORE "";;;IGNORE # ണ്‍ = ണ + ് + zwj - "";;;IGNORE # ണ = ണ + ് + അ + "";;;IGNORE # ണ = ണ + ് + അ "";;;IGNORE "";;;IGNORE "";;;IGNORE @@ -4329,14 +4329,14 @@ order_start ;forward;forward;forward;forward,position "";;;IGNORE "";;;IGNORE "";;;IGNORE # ം = മ + ് - "";"";;IGNORE # ം = മ + ് - "";;;IGNORE # മ = മ + ് + അ + "";"";;IGNORE # ം = മ + ് + "";;;IGNORE # മ = മ + ് + അ "";;;IGNORE "";;;IGNORE "";;;IGNORE # ര = ര + ് + zwj - "";;;IGNORE # ര = ര + ് + അ + "";;;IGNORE # ര = ര + ് + അ ;;;IGNORE # ല്‍ = ല + ് + zwj - "";;;IGNORE # ല = ല + ് + അ + "";;;IGNORE # ല = ല + ് + അ "";;;IGNORE "";;;IGNORE "";;;IGNORE @@ -4348,7 +4348,7 @@ order_start ;forward;forward;forward;forward,position "";;;IGNORE "";;;IGNORE "";;;IGNORE # ള്‍ = ള + ് + zwj - "";;;IGNORE # ള = ള + ് + അ + "";;;IGNORE # ള = ള + ് + അ "";;;IGNORE "";;;IGNORE "";;;IGNORE diff --git a/sysdeps/wordsize-64/alphasort.c b/sysdeps/wordsize-64/alphasort.c index 5096166625..edc410129d 100644 --- a/sysdeps/wordsize-64/alphasort.c +++ b/sysdeps/wordsize-64/alphasort.c @@ -1,3 +1,7 @@ +#define alphasort64 rename_alphasort64 + #include "../../dirent/alphasort.c" +#undef alphasort64 + weak_alias (alphasort, alphasort64) diff --git a/sysdeps/wordsize-64/versionsort.c b/sysdeps/wordsize-64/versionsort.c index 90365a4b25..bb25550d3d 100644 --- a/sysdeps/wordsize-64/versionsort.c +++ b/sysdeps/wordsize-64/versionsort.c @@ -1,3 +1,7 @@ +#define versionsort64 rename_versionsort64 + #include "../../dirent/versionsort.c" +#undef versionsort64 + weak_alias (versionsort, versionsort64) -- 2.11.4.GIT