Allow enabling of dummy error_strerror() to support some use-cases

Enable a dummy error function to make use of error_strerror() in
third party libraries easier.

Disable if you run into name conflicts and want to really remove the
error_strerror()
(cherry picked from commit 8fe40dcd7d)

Conflicts:
	ChangeLog
	programs/util/strerror.c
This commit is contained in:
Paul Bakker 2013-03-11 15:50:35 +01:00
parent 66a531b014
commit cb60e7c065
3 changed files with 33 additions and 0 deletions

View file

@ -1,5 +1,9 @@
PolarSSL ChangeLog
= Branch 1.1
Changes
* Allow enabling of dummy error_strerror() to support some use-cases
= Version 1.1.5 released on 2013-01-16
Bugfix
* Fixed MPI assembly for SPARC64 platform

View file

@ -138,6 +138,17 @@
*/
#define POLARSSL_DEBUG_MSG
/**
* \def POLARSSL_ERROR_STRERROR_DUMMY
*
* Enable a dummy error function to make use of error_strerror() in
* third party libraries easier.
*
* Disable if you run into name conflicts and want to really remove the
* error_strerror()
*/
#define POLARSSL_ERROR_STRERROR_DUMMY
/**
* \def POLARSSL_GENPRIME
*

View file

@ -509,4 +509,22 @@ void error_strerror( int ret, char *buf, size_t buflen )
snprintf( buf, buflen, "UNKNOWN ERROR CODE (%04X)", use_ret );
}
#else /* POLARSSL_ERROR_C */
#if defined(POLARSSL_ERROR_STRERROR_DUMMY)
#include <string.h>
/*
* Provide an non-function in case POLARSSL_ERROR_C is not defined
*/
void error_strerror( int ret, char *buf, size_t buflen )
{
((void) ret);
if( buflen > 0 )
buf[0] = '\0';
}
#endif /* POLARSSL_ERROR_STRERROR_DUMMY */
#endif /* POLARSSL_ERROR_C */