mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
Avoid compiler warnings in qsort/bsearch examples
This commit is contained in:
parent
48970aba30
commit
e39745ffa0
@ -1,3 +1,9 @@
|
||||
2012-05-17 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* manual/examples/search.c (critter_cmp): Change signature to
|
||||
avoid warnings.
|
||||
* manual/string.texi (Collation Functions): Likewise.
|
||||
|
||||
2012-05-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* bits/types.h: Fold copyright years.
|
||||
|
@ -53,8 +53,11 @@ int count = sizeof (muppets) / sizeof (struct critter);
|
||||
/* This is the comparison function used for sorting and searching. */
|
||||
|
||||
int
|
||||
critter_cmp (const struct critter *c1, const struct critter *c2)
|
||||
critter_cmp (const void *v1, const void *v2)
|
||||
{
|
||||
const struct critter *c1 = v1;
|
||||
const struct critter *c2 = v2;
|
||||
|
||||
return strcmp (c1->name, c2->name);
|
||||
}
|
||||
|
||||
|
@ -1370,8 +1370,11 @@ efficiently using @code{strxfrm}.)
|
||||
/* @r{This is the comparison function used with @code{qsort}.} */
|
||||
|
||||
int
|
||||
compare_elements (char **p1, char **p2)
|
||||
compare_elements (const void *v1, const void *v2)
|
||||
@{
|
||||
char * const *p1 = v1;
|
||||
char * const *p1 = v2;
|
||||
|
||||
return strcoll (*p1, *p2);
|
||||
@}
|
||||
|
||||
@ -1462,8 +1465,11 @@ struct sorter @{ char *input; char *transformed; @};
|
||||
@r{to sort an array of @code{struct sorter}.} */
|
||||
|
||||
int
|
||||
compare_elements (struct sorter *p1, struct sorter *p2)
|
||||
compare_elements (const void *v1, const void *v2)
|
||||
@{
|
||||
const struct sorter *p1 = v1;
|
||||
const struct sorter *p2 = v2;
|
||||
|
||||
return strcmp (p1->transformed, p2->transformed);
|
||||
@}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user