From 73c616bdc19412144a4c47b923d95bc8c1540be5 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Wed, 18 Dec 2019 15:07:04 +0000 Subject: [PATCH] Put includes in alphabetical order The library style is to start with the includes corresponding to the current module and then the rest in alphabetical order. Some modules have several header files (eg. ssl_internal.h). The recently added error.h includes did not respect this convention and this commit restores it. In some cases this is not possible just by moving the error.h declarations. This commit fixes the pre-existing order in these instances too. --- library/debug.c | 3 +-- library/net_sockets.c | 3 +-- library/ssl_cli.c | 4 ++-- library/ssl_cookie.c | 2 +- library/ssl_srv.c | 4 ++-- library/ssl_ticket.c | 2 +- library/ssl_tls.c | 4 ++-- library/x509.c | 3 +-- library/x509_create.c | 2 +- library/x509_crl.c | 3 +-- library/x509_crt.c | 3 +-- library/x509_csr.c | 3 +-- library/x509write_crt.c | 7 +++---- library/x509write_csr.c | 5 ++--- 14 files changed, 20 insertions(+), 28 deletions(-) diff --git a/library/debug.c b/library/debug.c index 1f7c2a0903..ae78a697a4 100644 --- a/library/debug.c +++ b/library/debug.c @@ -39,13 +39,12 @@ #endif #include "mbedtls/debug.h" +#include "mbedtls/error.h" #include #include #include -#include "mbedtls/error.h" - #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ !defined(inline) && !defined(__cplusplus) #define inline __inline diff --git a/library/net_sockets.c b/library/net_sockets.c index 1a88c223d4..dbde510db8 100644 --- a/library/net_sockets.c +++ b/library/net_sockets.c @@ -45,11 +45,10 @@ #endif #include "mbedtls/net_sockets.h" +#include "mbedtls/error.h" #include -#include "mbedtls/error.h" - #if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(EFIX64) && \ !defined(EFI32) diff --git a/library/ssl_cli.c b/library/ssl_cli.c index b632998465..1005bd97fa 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -35,10 +35,10 @@ #define mbedtls_free free #endif -#include "mbedtls/error.h" -#include "mbedtls/debug.h" #include "mbedtls/ssl.h" #include "mbedtls/ssl_internal.h" +#include "mbedtls/debug.h" +#include "mbedtls/error.h" #if defined(MBEDTLS_USE_PSA_CRYPTO) #include "mbedtls/psa_util.h" diff --git a/library/ssl_cookie.c b/library/ssl_cookie.c index 1635832668..4bf9058af4 100644 --- a/library/ssl_cookie.c +++ b/library/ssl_cookie.c @@ -38,9 +38,9 @@ #define mbedtls_free free #endif -#include "mbedtls/error.h" #include "mbedtls/ssl_cookie.h" #include "mbedtls/ssl_internal.h" +#include "mbedtls/error.h" #include "mbedtls/platform_util.h" #include diff --git a/library/ssl_srv.c b/library/ssl_srv.c index ec65058bf8..b0b09cd97f 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -35,10 +35,10 @@ #define mbedtls_free free #endif -#include "mbedtls/error.h" -#include "mbedtls/debug.h" #include "mbedtls/ssl.h" #include "mbedtls/ssl_internal.h" +#include "mbedtls/debug.h" +#include "mbedtls/error.h" #include "mbedtls/platform_util.h" #include diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c index a00dd4a28b..8a76b42b6b 100644 --- a/library/ssl_ticket.c +++ b/library/ssl_ticket.c @@ -36,8 +36,8 @@ #endif #include "mbedtls/ssl_ticket.h" -#include "mbedtls/platform_util.h" #include "mbedtls/error.h" +#include "mbedtls/platform_util.h" #include diff --git a/library/ssl_tls.c b/library/ssl_tls.c index d42c2224e0..6cf7781f2a 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -43,10 +43,10 @@ #define mbedtls_free free #endif -#include "mbedtls/error.h" -#include "mbedtls/debug.h" #include "mbedtls/ssl.h" #include "mbedtls/ssl_internal.h" +#include "mbedtls/debug.h" +#include "mbedtls/error.h" #include "mbedtls/platform_util.h" #include "mbedtls/version.h" diff --git a/library/x509.c b/library/x509.c index f0d268ac69..7f8181be27 100644 --- a/library/x509.c +++ b/library/x509.c @@ -35,12 +35,11 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_USE_C) #include "mbedtls/x509.h" #include "mbedtls/asn1.h" +#include "mbedtls/error.h" #include "mbedtls/oid.h" #include diff --git a/library/x509_create.c b/library/x509_create.c index 661d1049d7..7df2f0ed56 100644 --- a/library/x509_create.c +++ b/library/x509_create.c @@ -27,9 +27,9 @@ #if defined(MBEDTLS_X509_CREATE_C) -#include "mbedtls/error.h" #include "mbedtls/x509.h" #include "mbedtls/asn1write.h" +#include "mbedtls/error.h" #include "mbedtls/oid.h" #include diff --git a/library/x509_crl.c b/library/x509_crl.c index 8ff1be85cb..d1176fcef3 100644 --- a/library/x509_crl.c +++ b/library/x509_crl.c @@ -35,11 +35,10 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_CRL_PARSE_C) #include "mbedtls/x509_crl.h" +#include "mbedtls/error.h" #include "mbedtls/oid.h" #include "mbedtls/platform_util.h" diff --git a/library/x509_crt.c b/library/x509_crt.c index 191c8868db..38e69cc550 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -37,11 +37,10 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_CRT_PARSE_C) #include "mbedtls/x509_crt.h" +#include "mbedtls/error.h" #include "mbedtls/oid.h" #include "mbedtls/platform_util.h" diff --git a/library/x509_csr.c b/library/x509_csr.c index d49fa1297a..7e2cfba2ae 100644 --- a/library/x509_csr.c +++ b/library/x509_csr.c @@ -35,11 +35,10 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_CSR_PARSE_C) #include "mbedtls/x509_csr.h" +#include "mbedtls/error.h" #include "mbedtls/oid.h" #include "mbedtls/platform_util.h" diff --git a/library/x509write_crt.c b/library/x509write_crt.c index d844662934..5947e439de 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -31,15 +31,14 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_CRT_WRITE_C) #include "mbedtls/x509_crt.h" -#include "mbedtls/oid.h" #include "mbedtls/asn1write.h" -#include "mbedtls/sha1.h" +#include "mbedtls/error.h" +#include "mbedtls/oid.h" #include "mbedtls/platform_util.h" +#include "mbedtls/sha1.h" #include diff --git a/library/x509write_csr.c b/library/x509write_csr.c index c93e4b44d7..0c3c39672d 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -30,13 +30,12 @@ #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/error.h" - #if defined(MBEDTLS_X509_CSR_WRITE_C) #include "mbedtls/x509_csr.h" -#include "mbedtls/oid.h" #include "mbedtls/asn1write.h" +#include "mbedtls/error.h" +#include "mbedtls/oid.h" #include "mbedtls/platform_util.h" #if defined(MBEDTLS_USE_PSA_CRYPTO)