/* This file is in the public domain. */ #include #include "dequal.h" /* * Strip qualifiers (const, volatile) from a pointer, generic C * version. */ /* * There are at least three ways I know of to do this. Since * qualifiers are defined to not affect storage size and * representation, this is a reasonably portable way, albeit quite * possibly less efficient than one might wish. (If the compiler * recognizes bcopy it can be basically optimized away, though.) I * don't worry too much about efficiency here because this is used * only when we're about to writev(), which carries a _much_ heavier * performance cost (on most machines, the crossing into the kernel * alone swamps this bcopy). * * See dequal.h for more. */ void *dequal(const volatile void *v) { void *rv; bcopy(&v,&rv,sizeof(void *)); return(rv); }