[PATCH] lib: work around talloc_steal usage from C++ code
Austin Clements
amdragon at MIT.EDU
Thu Apr 12 14:04:14 PDT 2012
Quoth Jani Nikula on Apr 12 at 11:57 pm:
> Implicit typecast from 'void *' to 'T *' is okay in C, but not in
> C++. In talloc_steal, an explicit cast is provided for type safety in
> some GCC versions. Otherwise, a cast is required. Provide a template
> function for this to maintain type safety, and redefine talloc_steal
> to use it.
>
> The template must be outside the extern "C" block (NOTMUCH_BEGIN_DECLS
> and NOTMUCH_END_DECLS), but keep it within the GCC visibility #pragma.
>
> No functional changes, apart from making the library build with
> compilers other than recent GCC.
>
> Signed-off-by: Jani Nikula <jani at nikula.org>
LGTM.
More information about the notmuch
mailing list