diff options
author | Andreas Jaeger <aj@suse.de> | 2012-05-17 11:05:52 +0200 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2012-05-17 11:05:52 +0200 |
commit | e39745ffa030f685fbba13534a3023d52a27ead8 (patch) | |
tree | 4de2877d5a92a8d355546bd701a348327d7bc0c2 /manual/string.texi | |
parent | 48970aba309f08d3c94ddc8796630df87b8e093a (diff) | |
download | glibc-e39745ffa030f685fbba13534a3023d52a27ead8.zip glibc-e39745ffa030f685fbba13534a3023d52a27ead8.tar.gz glibc-e39745ffa030f685fbba13534a3023d52a27ead8.tar.bz2 |
Avoid compiler warnings in qsort/bsearch examples
Diffstat (limited to 'manual/string.texi')
-rw-r--r-- | manual/string.texi | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/manual/string.texi b/manual/string.texi index 5051f54..831873b 100644 --- a/manual/string.texi +++ b/manual/string.texi @@ -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); @} |