bug-gnulib
[Top][All Lists]
Advanced

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

[bug-gnulib] Re: [PATCH]: fix warning in the hash module


From: Yoann Vandoorselaere
Subject: [bug-gnulib] Re: [PATCH]: fix warning in the hash module
Date: Mon, 16 May 2005 15:43:06 +0200

On Mon, 2005-05-16 at 15:20 +0200, Jim Meyering wrote:
> Yoann Vandoorselaere <address@hidden> wrote:
> > This patch fix constness warning in the GnuLib hash module.
> 
> I'm all for avoiding warnings, but not when it detracts from what I
> think of as the correctness of an interface, as it would in this case.
> 
> Those `const void *entry' parameters constitute a promise
> by the hash module that it will not try to write through
> those pointers.  Removing `const' here might make users of
> these functions wonder whether the functions write through
> the void pointers.

Since the interface let the user provide a function for deleting data
(which thus does not use const), you might then as well workaround this
issue using:

union {
        const void *val_ro;
        void *val_rw;
} user_data;

And use the later in order to provide the deletion callback with a not
const pointer.
Proof of concept patch attached.

-- 
Yoann Vandoorselaere | Responsable R&D / CTO | PreludeIDS Technologies
Tel: +33 (0)8 70 70 21 58                  Fax: +33(0)4 78 42 21 58
http://www.prelude-ids.com

Attachment: gnulib-hash.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]