mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-24 06:02:44 +00:00
Simplify conditional guards in error.c
Simplify the guards on MBEDTLS_ERROR_C and MBEDTLS_ERROR_STRERROR_DUMMY. No longer include superfluous headers and definition: platform.h is only needed for MBEDTLS_ERROR_C; time_t is not needed at all. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
3809f5f70a
commit
67aed9ada6
@ -19,20 +19,20 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "mbedtls/error.h"
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C)
|
#if defined(MBEDTLS_ERROR_C)
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#define mbedtls_snprintf snprintf
|
#define mbedtls_snprintf snprintf
|
||||||
#define mbedtls_time_t time_t
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#if defined(MBEDTLS_AES_C)
|
#if defined(MBEDTLS_AES_C)
|
||||||
#include "mbedtls/aes.h"
|
#include "mbedtls/aes.h"
|
||||||
@ -960,8 +960,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
|
|
||||||
#else /* MBEDTLS_ERROR_C */
|
#else /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
||||||
*/
|
*/
|
||||||
@ -973,6 +971,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
|
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_C */
|
#endif /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||||
|
@ -19,20 +19,20 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include "mbedtls/error.h"
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C)
|
#if defined(MBEDTLS_ERROR_C)
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_PLATFORM_C)
|
#if defined(MBEDTLS_PLATFORM_C)
|
||||||
#include "mbedtls/platform.h"
|
#include "mbedtls/platform.h"
|
||||||
#else
|
#else
|
||||||
#define mbedtls_snprintf snprintf
|
#define mbedtls_snprintf snprintf
|
||||||
#define mbedtls_time_t time_t
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_C)
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
HEADER_INCLUDED
|
HEADER_INCLUDED
|
||||||
|
|
||||||
@ -149,8 +149,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
|
|
||||||
#else /* MBEDTLS_ERROR_C */
|
#else /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_ERROR_STRERROR_DUMMY)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
* Provide an non-function in case MBEDTLS_ERROR_C is not defined
|
||||||
*/
|
*/
|
||||||
@ -162,6 +160,6 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */
|
|
||||||
|
|
||||||
#endif /* MBEDTLS_ERROR_C */
|
#endif /* MBEDTLS_ERROR_C */
|
||||||
|
|
||||||
|
#endif /* MBEDTLS_ERROR_C || MBEDTLS_ERROR_STRERROR_DUMMY */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user