Format core source code and headers

Formatted core source code and headers with Astyle.
This commit is contained in:
Markus Mäkelä
2017-01-17 13:32:26 +02:00
parent f109144841
commit 0b6b9c3d81
37 changed files with 1757 additions and 1742 deletions

View File

@ -41,7 +41,8 @@ public:
// pointer_type : The type of a pointer to an element, either "uint8_t*" or "const uint8_t*". // pointer_type : The type of a pointer to an element, either "uint8_t*" or "const uint8_t*".
// reference_type: The type of a reference to an element, either "uint8_t&" or "const uint8_t&". // reference_type: The type of a reference to an element, either "uint8_t&" or "const uint8_t&".
template<class buf_type, class pointer_type, class reference_type> template<class buf_type, class pointer_type, class reference_type>
class iterator_base : public std::iterator<std::forward_iterator_tag, // The type of the iterator class iterator_base : public std::iterator <
std::forward_iterator_tag, // The type of the iterator
uint8_t, // The type of the elems uint8_t, // The type of the elems
std::ptrdiff_t, // Difference between two its std::ptrdiff_t, // Difference between two its
pointer_type, // The type of pointer to an elem pointer_type, // The type of pointer to an elem

View File

@ -71,7 +71,8 @@ typedef struct ssl_listener
char *ssl_key; /*< SSL private key */ char *ssl_key; /*< SSL private key */
char *ssl_ca_cert; /*< SSL CA certificate */ char *ssl_ca_cert; /*< SSL CA certificate */
bool ssl_init_done; /*< If SSL has already been initialized for this service */ bool ssl_init_done; /*< If SSL has already been initialized for this service */
struct ssl_listener *next; /*< Next SSL configuration, currently used to store obsolete configurations */ struct ssl_listener
*next; /*< Next SSL configuration, currently used to store obsolete configurations */
} SSL_LISTENER; } SSL_LISTENER;
int ssl_authenticate_client(struct dcb *dcb, bool is_capable); int ssl_authenticate_client(struct dcb *dcb, bool is_capable);

View File

@ -358,7 +358,8 @@ tmp_rsa_callback(SSL *s, int is_export, int keylength)
{ {
RSA *rsa_tmp = NULL; RSA *rsa_tmp = NULL;
switch (keylength) { switch (keylength)
{
case 512: case 512:
if (rsa_512) if (rsa_512)
{ {

View File

@ -59,7 +59,8 @@ static const size_t timestamp_len = (4+1 +2+1 +2+1 +2+1 +2+1 +2+3 +1) * sizeof(
static const char* timestamp_formatstr_hp = "%04d-%02d-%02d %02d:%02d:%02d.%03d "; static const char* timestamp_formatstr_hp = "%04d-%02d-%02d %02d:%02d:%02d.%03d ";
/** One for terminating '\0' */ /** One for terminating '\0' */
static const size_t timestamp_len_hp = (4+1 +2+1 +2+1 +2+1 +2+1 +2+1+3+3 +1) * sizeof(char); static const size_t timestamp_len_hp = (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 3 + 1) * sizeof(
char);
struct skygw_thread_st struct skygw_thread_st
{ {

View File

@ -571,16 +571,20 @@ static uint64_t unpack_bytes(uint8_t *ptr, size_t bytes)
val = (uint64_t)ptr[3] | ((uint64_t)ptr[2] << 8) | ((uint64_t)ptr[1] << 16) | ((uint64_t)ptr[0] << 24); val = (uint64_t)ptr[3] | ((uint64_t)ptr[2] << 8) | ((uint64_t)ptr[1] << 16) | ((uint64_t)ptr[0] << 24);
break; break;
case 5: case 5:
val = (uint64_t)ptr[4] | ((uint64_t)ptr[3] << 8) | ((uint64_t)ptr[2] << 16) | ((uint64_t)ptr[1] << 24) | ((uint64_t)ptr[0] << 32); val = (uint64_t)ptr[4] | ((uint64_t)ptr[3] << 8) | ((uint64_t)ptr[2] << 16) | ((uint64_t)ptr[1] << 24) | ((
uint64_t)ptr[0] << 32);
break; break;
case 6: case 6:
val = (uint64_t)ptr[5] | ((uint64_t)ptr[4] << 8) | ((uint64_t)ptr[3] << 16) | ((uint64_t)ptr[2] << 24) | ((uint64_t)ptr[1] << 32) | ((uint64_t)ptr[0] << 40); val = (uint64_t)ptr[5] | ((uint64_t)ptr[4] << 8) | ((uint64_t)ptr[3] << 16) | ((uint64_t)ptr[2] << 24) | ((
uint64_t)ptr[1] << 32) | ((uint64_t)ptr[0] << 40);
break; break;
case 7: case 7:
val = (uint64_t)ptr[6] | ((uint64_t)ptr[5] << 8) | ((uint64_t)ptr[4] << 16) | ((uint64_t)ptr[3] << 24) | ((uint64_t)ptr[2] << 32) | ((uint64_t)ptr[1] << 40) | ((uint64_t)ptr[0] << 48); val = (uint64_t)ptr[6] | ((uint64_t)ptr[5] << 8) | ((uint64_t)ptr[4] << 16) | ((uint64_t)ptr[3] << 24) | ((
uint64_t)ptr[2] << 32) | ((uint64_t)ptr[1] << 40) | ((uint64_t)ptr[0] << 48);
break; break;
case 8: case 8:
val = (uint64_t)ptr[7] | ((uint64_t)ptr[6] << 8) | ((uint64_t)ptr[5] << 16) | ((uint64_t)ptr[4] << 24) | ((uint64_t)ptr[3] << 32) | ((uint64_t)ptr[2] << 40) | ((uint64_t)ptr[1] << 48) | ((uint64_t)ptr[0] << 56); val = (uint64_t)ptr[7] | ((uint64_t)ptr[6] << 8) | ((uint64_t)ptr[5] << 16) | ((uint64_t)ptr[4] << 24) | ((
uint64_t)ptr[3] << 32) | ((uint64_t)ptr[2] << 40) | ((uint64_t)ptr[1] << 48) | ((uint64_t)ptr[0] << 56);
break; break;
} }

View File

@ -1629,11 +1629,16 @@ dShowEventStats(DCB *pdcb)
int i; int i;
dcb_printf(pdcb, "\nEvent statistics.\n"); dcb_printf(pdcb, "\nEvent statistics.\n");
dcb_printf(pdcb, "Maximum queue time: %3" PRId64 "00ms\n", ts_stats_get(queueStats.maxqtime, TS_STATS_MAX)); dcb_printf(pdcb, "Maximum queue time: %3" PRId64 "00ms\n", ts_stats_get(queueStats.maxqtime,
dcb_printf(pdcb, "Maximum execution time: %3" PRId64 "00ms\n", ts_stats_get(queueStats.maxexectime, TS_STATS_MAX)); TS_STATS_MAX));
dcb_printf(pdcb, "Maximum event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_max, TS_STATS_MAX)); dcb_printf(pdcb, "Maximum execution time: %3" PRId64 "00ms\n", ts_stats_get(queueStats.maxexectime,
dcb_printf(pdcb, "Total event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_length, TS_STATS_SUM)); TS_STATS_MAX));
dcb_printf(pdcb, "Average event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_length, TS_STATS_AVG)); dcb_printf(pdcb, "Maximum event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_max,
TS_STATS_MAX));
dcb_printf(pdcb, "Total event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_length,
TS_STATS_SUM));
dcb_printf(pdcb, "Average event queue length: %3" PRId64 "\n", ts_stats_get(pollStats.evq_length,
TS_STATS_AVG));
dcb_printf(pdcb, "\n"); dcb_printf(pdcb, "\n");
dcb_printf(pdcb, " | Number of events\n"); dcb_printf(pdcb, " | Number of events\n");
dcb_printf(pdcb, "Duration | Queued | Executed\n"); dcb_printf(pdcb, "Duration | Queued | Executed\n");

View File

@ -359,7 +359,8 @@ int test_domain_matching()
const char *ns = "mysqlmon"; const char *ns = "mysqlmon";
const char *id = "test_domain_matching"; const char *id = "test_domain_matching";
modulecmd_arg_type_t args[] = { modulecmd_arg_type_t args[] =
{
{MODULECMD_ARG_MONITOR | MODULECMD_ARG_NAME_MATCHES_DOMAIN, ""} {MODULECMD_ARG_MONITOR | MODULECMD_ARG_NAME_MATCHES_DOMAIN, ""}
}; };

View File

@ -755,7 +755,8 @@ char* replace_literal(char* haystack, const char* needle, const char* replacemen
memcpy(newstr, haystack, match.rm_so + 1); memcpy(newstr, haystack, match.rm_so + 1);
memcpy(newstr + match.rm_so + 1, replacement, rlen); memcpy(newstr + match.rm_so + 1, replacement, rlen);
/** +1 is terminating byte */ /** +1 is terminating byte */
memcpy(newstr + match.rm_so + 1 + rlen, haystack + match.rm_so + 1 + nlen, hlen - (match.rm_so + 1) - nlen + 1); memcpy(newstr + match.rm_so + 1 + rlen, haystack + match.rm_so + 1 + nlen,
hlen - (match.rm_so + 1) - nlen + 1);
regfree(&re); regfree(&re);
free(haystack); free(haystack);