[Openswan dev] [PATCH] fix scandir incompatible pointer type warning

D. Hugh Redelmeier hugh at mimosa.com
Wed Jun 24 02:39:46 EDT 2009


| From: Gilles Espinasse <g.esp at free.fr>
| To: dev at openswan.org
| Subject: [Openswan dev] [PATCH] fix scandir incompatible pointer type warning
| 
| google say cast is the way to go for scandir
| http://gcc.gnu.org/ml/java-patches/2003-q1/msg00113.html

That authority is wrong.

For one thing, void * is a universal pointer to an object type and the
required parameter is a pointer to a function type.  So it is invalid
C.

Furthermore, this technique disguises the typing rather than getting it right.

If you look at the code, there is already a macro to get the type
right: SCANDIR_HAS_CONST

So the correct fix is to make sure that the makefile sets the macro
appropriately.

Perhaps it would work if it were just "wired on".  I don't actually
know if any systems that Opensswan supports actually leave out the
const.

So: I'd revert these changes and get SCANDIR_HAS_CONST right.

Note: I've not tested what I've suggested.


More information about the Dev mailing list