This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] Re: PATCH for java.nio FileChannel and MappedByteBuffer
>>>>> "Andreas" == andreas tobler <toa@pop.agri.ch> writes:
Andreas> +// This is for _POSIX_C_SOURCES > 2.
Andreas> +template <typename T_implPtr, typename T_implLen>
Andreas> +static inline int
Andreas> +munmap_adaptor(int (*munmap)(T_implPtr caddr, T_implLen sizet),
Andreas> + void* caddr, size_t sizet)
Andreas> +{
Andreas> + return munmap ((T_implPtr) caddr, (T_implLen) sizet);
Andreas> +}
Andreas> +
Andreas> +// This is for _POSIX_C_SOURCES < 2.
Andreas> +template <typename T_implPtr, typename T_implLen>
Andreas> +static inline int
Andreas> +munmap_adaptor(int (*munmap)(T_implPtr caddr, T_implLen sizet),
Andreas> + caddr_t caddr, size_t sizet)
Andreas> +{
Andreas> + return munmap ((T_implPtr) caddr, (T_implLen) sizet);
Andreas> +}
I think one of these is redundant and couple be eliminated...
Andreas> + munmap_adaptor(munmap, implPtr, implLen);
I think that this will select one of the two templates above for
instantiation, depending on the types of implPtr and implLen, which
are OS-independent. So then the other template function can just be
removed.
Could you remove the unused one? (And likewise for munmap?)
Otherwise this is fine, it can go in with that change.
Tom