Your message dated Tue, 5 Dec 2017 21:06:46 +0100
with message-id <[email protected]>
and subject line Bug#357051: libc.info s9.4 qsort example is wrong
has caused the Debian Bug report #357051,
regarding glibc-doc: libc.info s9.4 qsort example uses wrong datatypes in 
function declaration
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
357051: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357051
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: glibc-doc
Version: 2.3.2.ds1-22

The example for qsort has, among other things:

     int
     critter_cmp (const struct critter *c1, const struct critter *c2)
     {
       return strcmp (c1->name, c2->name);
     }

     /* ... */

       result = bsearch (&target, muppets, count, sizeof (struct critter),
                         critter_cmp);

     /* ... */

       qsort (muppets, count, sizeof (struct critter), critter_cmp);

This is incorrect.  The comparison function must be declared as

  int critter_cmp (const void *c1, const void *c2)

and should use casts to convert to the proper type.

ttfn/rjk


--- End Message ---
--- Begin Message ---
Version: 2.16-0experimental1

On 2006-03-15 13:31, Richard Kettlewell wrote:
> Package: glibc-doc
> Version: 2.3.2.ds1-22
> 
> The example for qsort has, among other things:
> 
>      int
>      critter_cmp (const struct critter *c1, const struct critter *c2)
>      {
>        return strcmp (c1->name, c2->name);
>      }
> 
>      /* ... */
> 
>        result = bsearch (&target, muppets, count, sizeof (struct critter),
>                          critter_cmp);
> 
>      /* ... */
> 
>        qsort (muppets, count, sizeof (struct critter), critter_cmp);
> 
> This is incorrect.  The comparison function must be declared as
> 
>   int critter_cmp (const void *c1, const void *c2)
> 
> and should use casts to convert to the proper type.

This has been fixed in version 2.16, in upstream commit e39745ffa030.
Closing the bug.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net

--- End Message ---

Reply via email to