summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-11 15:48:58 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-11 15:58:16 +0300
commit31aef3ae99dff6b7154cf288b3dc508d367f19f8 (patch)
tree023c7584efc6a06809c925593bfe53842df7dc4f /plugin
parent57d1a5fa8ed925b03d28aea3fab82de0823e68a8 (diff)
downloadmariadb-git-31aef3ae99dff6b7154cf288b3dc508d367f19f8.tar.gz
Fix GCC 10.2.0 -Og -Wmaybe-uninitialized
For some reason, GCC emits more -Wmaybe-uninitialized warnings when using the flag -Og than when using -O2. Many of the warnings look genuine.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/server_audit/server_audit.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 8e468cf486d..1061c207a75 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1428,7 +1428,6 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
const char *res_start= result;
const char *res_end= result + result_len - 2;
size_t d_len;
- char b_char;
while (len)
{
@@ -1466,27 +1465,28 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
if (*next_s)
{
- memmove(result + d_len, "*****", 5);
+ const char b_char= *next_s++;
+ memset(result + d_len, '*', 5);
result+= d_len + 5;
- b_char= *(next_s++);
- }
- else
- result+= d_len;
- while (*next_s)
- {
- if (*next_s == b_char)
- {
- ++next_s;
- break;
- }
- if (*next_s == '\\')
+ while (*next_s)
{
- if (next_s[1])
- next_s++;
+ if (*next_s == b_char)
+ {
+ ++next_s;
+ break;
+ }
+ if (*next_s == '\\')
+ {
+ if (next_s[1])
+ next_s++;
+ }
+ next_s++;
}
- next_s++;
}
+ else
+ result+= d_len;
+
len-= (uint)(next_s - str);
str= next_s;
continue;
@@ -1494,19 +1494,23 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
no_password:
if (result >= res_end)
break;
- if ((b_char= escaped_char(*str)))
+ else
{
- if (result+1 >= res_end)
- break;
- *(result++)= '\\';
- *(result++)= b_char;
+ const char b_char= escaped_char(*str);
+ if (b_char)
+ {
+ if (result+1 >= res_end)
+ break;
+ *(result++)= '\\';
+ *(result++)= b_char;
+ }
+ else if (is_space(*str))
+ *(result++)= ' ';
+ else
+ *(result++)= *str;
+ str++;
+ len--;
}
- else if (is_space(*str))
- *(result++)= ' ';
- else
- *(result++)= *str;
- str++;
- len--;
}
*result= 0;
return result - res_start;