diff --git a/query_classifier/query_classifier.cc b/query_classifier/query_classifier.cc index 8a92beba9..9eb33ab82 100644 --- a/query_classifier/query_classifier.cc +++ b/query_classifier/query_classifier.cc @@ -1210,6 +1210,8 @@ bool is_drop_table_query(GWBUF* querybuf) lex->sql_command == SQLCOM_DROP_TABLE); } + + inline void add_str(char** buf, int* buflen, int* bufsize, char* str) { int isize = strlen(str) + 1; @@ -1542,7 +1544,7 @@ static void parsing_info_set_plain_str( * @return string representing the query type value */ char* skygw_get_qtype_str( - skygw_query_type_t qtype) + skygw_query_type_t qtype) { int t1 = (int)qtype; int t2 = 1; @@ -1554,29 +1556,31 @@ char* skygw_get_qtype_str( * t1 is completely cleared. */ while (t1 != 0) - { - if (t1&t2) - { - t = (skygw_query_type_t)t2; + { + if (t1&t2) + { + t = (skygw_query_type_t)t2; - if (qtype_str == NULL) - { - qtype_str = strdup(STRQTYPE(t)); - } - else - { - size_t len = strlen(STRQTYPE(t)); - /** reallocate space for delimiter, new string and termination */ - qtype_str = (char *)realloc(qtype_str, strlen(qtype_str)+1+len+1); - snprintf(qtype_str+strlen(qtype_str), 1+len+1, "|%s", STRQTYPE(t)); - } - /** Remove found value from t1 */ - t1 &= ~t2; - } - t2 <<= 1; + if (qtype_str == NULL) + { + qtype_str = strdup(STRQTYPE(t)); + } + else + { + size_t len = strlen(STRQTYPE(t)); + /** reallocate space for delimiter, new string and termination */ + qtype_str = (char *)realloc(qtype_str, strlen(qtype_str)+1+len+1); + snprintf(qtype_str+strlen(qtype_str), 1+len+1, "|%s", STRQTYPE(t)); + } + /** Remove found value from t1 */ + t1 &= ~t2; } + t2 <<= 1; + } return qtype_str; } + + skygw_query_op_t query_classifier_get_operation(GWBUF* querybuf) { LEX* lex = get_lex(querybuf); diff --git a/server/core/dcb.c b/server/core/dcb.c index 0e9c8b594..896892e5d 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -1222,7 +1222,7 @@ dcb_close(DCB *dcb) * dcb_close may be called for freshly created dcb, in which case * it only needs to be freed. */ - if (dcb->state == DCB_STATE_ALLOC) + if (dcb->state == DCB_STATE_ALLOC) { dcb_set_state(dcb, DCB_STATE_DISCONNECTED, NULL); dcb_final_free(dcb); diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index a14131920..c52802306 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -1118,7 +1118,7 @@ gw_backend_hangup(DCB *dcb) gwbuf_free(errbuf); /** There are no required backends available, close session. */ - if (!succp) + if (!succp) { #if defined(SS_DEBUG) LOGIF(LE, (skygw_log_write_flush( diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 170fbf6b2..663543a7b 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -836,7 +836,7 @@ static void* newSession( free(backend_ref); client_rses = NULL; goto return_rses; - } + } /** * Initialize backend references with BACKEND ptr. * Initialize session command cursors for each backend reference. @@ -2706,7 +2706,7 @@ static void clientReply ( goto lock_failed; } /** There is one pending session command to be executed. */ - if (sescmd_cursor_is_active(scur)) + if (sescmd_cursor_is_active(scur)) { bool succp; @@ -2962,7 +2962,7 @@ static bool select_connect_backend_servers( { succp = false; goto return_succp; - } + } if (router->bitvalue != 0) /*< 'synced' is the only bitvalue in rwsplit */ { @@ -3611,7 +3611,7 @@ static GWBUF* sescmd_cursor_process_replies( bref_clear_state(bref, BREF_WAITING_RESULT); } /** Response is in the buffer and it will be sent to client. */ - else if (replybuf != NULL) + else { /** Mark the rest session commands as replied */ scmd->my_sescmd_is_replied = true; @@ -4544,7 +4544,7 @@ static bool handle_error_new_connection( succp = true; goto return_succp; } - /** + /** * Remove callback because this DCB won't be used * unless it is reconnected later, and then the callback * is set again.