From 96f387bbe07d27382ca6fe6086c9bcbae431c2ad Mon Sep 17 00:00:00 2001 From: Arnold Robbins Date: Wed, 9 Nov 2016 16:18:52 +0200 Subject: [PATCH] Whitespace cleanups. --- src/audit_handler.cc | 32 +++++++++++++++++--------------- src/audit_plugin.cc | 6 +++--- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/audit_handler.cc b/src/audit_handler.cc index 5b46100..f3fe426 100644 --- a/src/audit_handler.cc +++ b/src/audit_handler.cc @@ -54,46 +54,48 @@ Audit_handler *Audit_handler::m_audit_handler_list[Audit_handler::MAX_AUDIT_HAND // Yajl alloc funcs based upon thd_alloc static void * yajl_thd_malloc(void *ctx, size_t sz) { - THD *thd = (THD*)ctx; - //we allocate plus sizeof(size_t) and stored the alloced size at the start of the pointer (for support of realloc) - size_t * ptr = (size_t *)thd_alloc(thd, sz + sizeof(size_t)); - if(ptr) + THD *thd = (THD*) ctx; + // we allocate plus sizeof(size_t) and stored the alloced size + // at the start of the pointer (for support of realloc) + size_t *ptr = (size_t *) thd_alloc(thd, sz + sizeof(size_t)); + if (ptr) { *ptr = sz; //set the size at the start of the memory ptr++; } - return ptr; + return ptr; } static void * yajl_thd_realloc(void *ctx, void * previous, - size_t sz) + size_t sz) { - THD *thd = (THD*)ctx; + THD *thd = (THD*)ctx; void *ptr; - if ((ptr= yajl_thd_malloc(thd,sz))) + if ((ptr = yajl_thd_malloc(thd,sz))) { - if(previous) + if (previous) { - //copy only the previous allocated size (which is stored just before the pointer passed in) + // copy only the previous allocated size (which is + // stored just before the pointer passed in) size_t prev_sz = *(((size_t *)previous) - 1); memcpy(ptr,previous, prev_sz); } } - return ptr; + return ptr; } static void yajl_thd_free(void *ctx, void * ptr) { - //do nothing as thd_alloc deosn't require free + //do nothing as thd_alloc deosn't require free return; } static void yajl_set_thd_alloc_funcs(THD * thd, yajl_alloc_funcs * yaf) { yaf->malloc = yajl_thd_malloc; - yaf->free = yajl_thd_free; - yaf->realloc = yajl_thd_realloc; - yaf->ctx = thd; + yaf->free = yajl_thd_free; + yaf->realloc = yajl_thd_realloc; + yaf->ctx = thd; } ////////////////////////////////////////////// diff --git a/src/audit_plugin.cc b/src/audit_plugin.cc index 48ef978..3e675ba 100644 --- a/src/audit_plugin.cc +++ b/src/audit_plugin.cc @@ -441,8 +441,8 @@ static unsigned int trampoline_send_result_to_client_size = 0; static bool audit_open_tables(THD *thd, const DDL_options_st &options, TABLE_LIST **start, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy) { - bool res; - res = trampoline_open_tables (thd, options, start, counter, flags, prelocking_strategy); + bool res; + res = trampoline_open_tables (thd, options, start, counter, flags, prelocking_strategy); #elif MYSQL_VERSION_ID > 50505 static bool audit_open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy) @@ -967,7 +967,7 @@ static bool calc_file_md5(const char *file_name, char *digest_str) { my_MD5Update(&context, file_buff, res); } - } + } while (res > 0); if (res == 0) // reached end of file