On Fri, Dec 05, 2014 at 05:07:04PM +0100, Kurt Roeckx wrote:

> On Fri, Dec 05, 2014 at 10:40:07AM -0500, Daniel Kahn Gillmor wrote:
> > (of course it would probably end up modifying some public
> > interfaces, so it would need to take effect publicly during an API change).
> 
> Adding const to a function shouldn't be a problem for C.  It would
> be for C++.

Actually, it can be a problem with C also.  Replacing "char **" in
a function prototype with "const char **" changes the API.

Postfix has #ifdefs for a previous "constification" effort in OpenSSL:

    SSL_SESSION *tls_session_activate(const char *session_data, int 
session_data_len)
    {
    #if (OPENSSL_VERSION_NUMBER < 0x0090707fL)
    #define BOGUS_CONST
    #else
    #define BOGUS_CONST const
    #endif
        SSL_SESSION *session;
        BOGUS_CONST unsigned char *ptr;

        /*
         * Activate the SSL_SESSION object.
         */
        ptr = (BOGUS_CONST unsigned char *) session_data;
        session = d2i_SSL_SESSION((SSL_SESSION **) 0, &ptr, session_data_len);
        if (!session)
            tls_print_errors();

        return (session);
    }

--
        Viktor.
_______________________________________________
openssl-dev mailing list
[email protected]
https://mta.opensslfoundation.net/mailman/listinfo/openssl-dev

Reply via email to