Format rest of the sources

This commit is contained in:
Markus Mäkelä
2019-05-09 11:31:40 +03:00
parent fbd61967a7
commit de95fcc9d6
29 changed files with 384 additions and 388 deletions

View File

@ -26,7 +26,9 @@
* @param field_num Field index in the schema
* @return JSON object or NULL if an error occurred
*/
static json_t* read_and_pack_value(MAXAVRO_FILE *file, MAXAVRO_SCHEMA_FIELD *field, enum maxavro_value_type type)
static json_t* read_and_pack_value(MAXAVRO_FILE* file,
MAXAVRO_SCHEMA_FIELD* field,
enum maxavro_value_type type)
{
json_t* value = NULL;
switch (type)
@ -187,7 +189,9 @@ json_t* maxavro_record_read_json(MAXAVRO_FILE* file)
{
for (size_t i = 0; i < file->schema->num_fields; i++)
{
json_t* value = read_and_pack_value(file, &file->schema->fields[i], file->schema->fields[i].type);
json_t* value = read_and_pack_value(file,
&file->schema->fields[i],
file->schema->fields[i].type);
if (value)
{
json_object_set_new(object, file->schema->fields[i].name, value);

View File

@ -58,7 +58,8 @@ public:
{
TimePoint time_point;
int count;
Timestamp(TimePoint p, int c) : time_point(p)
Timestamp(TimePoint p, int c)
: time_point(p)
, count(c)
{
}

View File

@ -38,5 +38,4 @@ std::string to_binary_size(int64_t size);
* @return The result string
*/
std::string string_printf(const char* format, ...) mxb_attribute((format (printf, 1, 2)));
}

View File

@ -117,5 +117,4 @@ inline bool operator!=(const Host& l, const Host& r)
* @return True on success
*/
bool reverse_dns(const std::string& ip, std::string* output);
}

View File

@ -307,7 +307,5 @@ Async get_async(const std::vector<std::string>& urls,
Async get_async(const std::vector<std::string>& urls,
const std::string& user, const std::string& password,
const Config& config = Config());
}
}

View File

@ -70,5 +70,4 @@ public:
private:
T* m_pT;
};
}

View File

@ -55,7 +55,8 @@ namespace
struct TimePointLessEqual
{
TimePoint lhs;
TimePointLessEqual(TimePoint tp) : lhs(tp)
TimePointLessEqual(TimePoint tp)
: lhs(tp)
{
}
bool operator()(const EventCount::Timestamp& rhs) const
@ -134,7 +135,8 @@ namespace
struct MatchEventId
{
std::string event_id;
MatchEventId(const std::string& id) : event_id(id)
MatchEventId(const std::string& id)
: event_id(id)
{
}
bool operator()(const EventCount& stats) const

View File

@ -95,5 +95,4 @@ std::string string_printf(const char* format, ...)
}
return rval;
}
}

View File

@ -271,5 +271,4 @@ bool reverse_dns(const std::string& ip, std::string* output)
}
return success;
}
}

View File

@ -126,8 +126,10 @@ CURL* get_easy_curl(const std::string& url,
if (pCurl)
{
checked_curl_setopt(pCurl, CURLOPT_NOSIGNAL, 1);
checked_curl_setopt(pCurl, CURLOPT_CONNECTTIMEOUT, config.connect_timeout_s);// For connection phase
checked_curl_setopt(pCurl, CURLOPT_TIMEOUT, config.timeout_s); // For data transfer phase
checked_curl_setopt(pCurl, CURLOPT_CONNECTTIMEOUT, config.connect_timeout_s); // For connection
// phase
checked_curl_setopt(pCurl, CURLOPT_TIMEOUT, config.timeout_s); // For data transfer
// phase
checked_curl_setopt(pCurl, CURLOPT_ERRORBUFFER, pErrbuf);
checked_curl_setopt(pCurl, CURLOPT_WRITEFUNCTION, write_callback);
checked_curl_setopt(pCurl, CURLOPT_WRITEDATA, &pRes->body);
@ -440,7 +442,6 @@ private:
int m_still_running;
long m_wait_no_more_than;
};
}
@ -614,7 +615,5 @@ const char* to_string(Async::status_t status)
mxb_assert(!true);
return "Unknown";
}
}
}

View File

@ -97,7 +97,6 @@ int conversation_func(int num_msg,
}
return rval;
}
}
namespace maxbase
@ -171,5 +170,4 @@ PamResult pam_authenticate(const string& user, const string& password, const str
pam_end(pam_handle, pam_status);
return result;
}
}

View File

@ -19,7 +19,6 @@ namespace
{
thread_local char errbuf[512]; // Enough for all errors
}
const char* mxb_strerror(int error)
@ -73,5 +72,4 @@ char* trim(char* str)
{
return ltrim(rtrim(str));
}
}

View File

@ -148,7 +148,6 @@ int test_async_http()
return rv == EXIT_FAILURE ? 1 : 0;
}
}
uint64_t time_since_epoch_ms()

View File

@ -116,7 +116,6 @@ int test_rtrim()
cout << "rtrim()" << endl;
return test(rtrim_testcases, n_rtrim_testcases, mxb::rtrim);
}
}
int main(int argc, char* argv[])

View File

@ -333,5 +333,4 @@ bool QueryResult::ConversionError::error() const
{
return !m_target_type.empty();
}
}

View File

@ -1268,7 +1268,10 @@ public:
if (pSrc->a[i].pSelect)
{
update_field_infos_from_select(aliases, context | QC_FIELD_SUBQUERY, pSrc->a[i].pSelect, pExclude);
update_field_infos_from_select(aliases,
context | QC_FIELD_SUBQUERY,
pSrc->a[i].pSelect,
pExclude);
}
#ifdef QC_COLLECT_NAMES_FROM_USING
@ -1613,13 +1616,15 @@ public:
}
}
void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement */
void mxs_sqlite3BeginTrigger(Parse* pParse, /* The parse context of the CREATE TRIGGER statement
* */
Token* pName1, /* The name of the trigger */
Token* pName2, /* The name of the trigger */
int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
IdList* pColumns, /* column list if this is an UPDATE OF trigger */
SrcList* pTableName, /* The name of the table/view the trigger applies to */
SrcList* pTableName, /* The name of the table/view the trigger applies to
* */
Expr* pWhen, /* WHEN clause */
int isTemp, /* True if the TEMPORARY keyword is present */
int noErr) /* Suppress errors if the trigger already exists */

View File

@ -70,8 +70,7 @@ int test()
string valid_json("SELECT Json_Array(56, 3.1416, 'My name is \"Foo\"', NULL)");
string invalid_json("SELECT Json_Foo(56, 3.1416, 'My name is \"Foo\"', NULL)");
auto encode_version = [](const SERVER::Version& sv) -> uint64_t
{
auto encode_version = [](const SERVER::Version& sv) -> uint64_t {
return sv.major * 10000 + sv.minor * 100 + sv.patch;
};