Page MenuHome GnuPG

gpgme_data_identify() function prototype not as documented
Open, NormalPublic

Description

Hi,
The manual says that gpgme_data_identify() takes one argument, the gpgme_data_t object, but in practice it actually has a second parameter which is reserved and presumably should be set to zero for now like for other reserved function parameters. This should probably be fixed in the documentation, but I suppose the prototype could be fixed as well.

In the meantime, here's a code snippet I'm using which allows portability to either prototype in an application in standard C11.

#define gpgme_data_identify(X) _Generic(gpgme_data_identify, \
        gpgme_data_type_t (*)(gpgme_data_t): ((gpgme_data_type_t (*)(gpgme_data_t))gpgme_data_identify)(X), \
        gpgme_data_type_t (*)(gpgme_data_t, int): ((gpgme_data_type_t (*)(gpgme_data_t, int))gpgme_data_identify)(X, 0))