[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#357051: marked as done (glibc-doc: libc.info s9.4 qsort example uses wrong datatypes in function declaration)



Your message dated Tue, 5 Dec 2017 21:06:46 +0100
with message-id <[🔎] 20171205200646.GA16806@aurel32.net>
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 owner@bugs.debian.org
immediately.)


-- 
357051: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357051
Debian Bug Tracking System
Contact owner@bugs.debian.org 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
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: