mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-08 23:03:06 -04:00
Merge pull request #7721 from DemiMarie/do-while-2.28
[Backport 2.28] Add a do-while loop around a macro
This commit is contained in:
commit
e0dcd18a23
@ -53,12 +53,16 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#define CHECK(code) if ((ret = (code)) != 0) { return ret; }
|
||||
#define CHECK(code) \
|
||||
do { \
|
||||
if ((ret = (code)) != 0) { \
|
||||
return ret; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define CHECK_RANGE(min, max, val) \
|
||||
do \
|
||||
{ \
|
||||
if ((val) < (min) || (val) > (max)) \
|
||||
{ \
|
||||
do { \
|
||||
if ((val) < (min) || (val) > (max)) { \
|
||||
return ret; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -1945,15 +1945,18 @@ int mbedtls_x509_parse_subject_alt_name(const mbedtls_x509_buf *san_buf,
|
||||
}
|
||||
|
||||
#define PRINT_ITEM(i) \
|
||||
{ \
|
||||
do { \
|
||||
ret = mbedtls_snprintf(p, n, "%s" i, sep); \
|
||||
MBEDTLS_X509_SAFE_SNPRINTF; \
|
||||
sep = ", "; \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define CERT_TYPE(type, name) \
|
||||
if (ns_cert_type & (type)) \
|
||||
PRINT_ITEM(name);
|
||||
do { \
|
||||
if (ns_cert_type & (type)) { \
|
||||
PRINT_ITEM(name); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static int x509_info_cert_type(char **buf, size_t *size,
|
||||
unsigned char ns_cert_type)
|
||||
@ -1979,8 +1982,11 @@ static int x509_info_cert_type(char **buf, size_t *size,
|
||||
}
|
||||
|
||||
#define KEY_USAGE(code, name) \
|
||||
if (key_usage & (code)) \
|
||||
PRINT_ITEM(name);
|
||||
do { \
|
||||
if (key_usage & (code)) { \
|
||||
PRINT_ITEM(name); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static int x509_info_key_usage(char **buf, size_t *size,
|
||||
unsigned int key_usage)
|
||||
|
Loading…
x
Reference in New Issue
Block a user