summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-08-08 20:05:40 +0300
committerMonty <monty@mariadb.org>2019-08-08 23:08:23 +0300
commitdbac2039e81f6d371acdacfb65eba10e395bb9a2 (patch)
tree268c85900d5a4bed5f8dd881019ee7e3833b4f98
parent5fa2eb6f3d8210ce73d18e518108f32c29b11d63 (diff)
downloadmariadb-git-dbac2039e81f6d371acdacfb65eba10e395bb9a2.tar.gz
Fixed some errors & warnings found by clang
- pcretest.c could use macro with side effect - maria_chk could access freed memory - Initialized some variables that could be accessed uninitalized - Fixed compiler warning in my_atomic-t.c
-rw-r--r--pcre/pcretest.c3
-rw-r--r--storage/maria/maria_chk.c4
-rw-r--r--storage/mroonga/vendor/groonga/lib/ts.c2
-rw-r--r--storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c2
-rw-r--r--unittest/mysys/my_atomic-t.c4
5 files changed, 9 insertions, 6 deletions
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index a0e65ed9808..dcf1e2c6760 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -2864,7 +2864,8 @@ strncmpic(pcre_uint8 *s, pcre_uint8 *t, int n)
{
while (n--)
{
- int c = tolower(*s++) - tolower(*t++);
+ int c = tolower(*s) - tolower(*t);
+ s++; t++;
if (c) return c;
}
return 0;
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 7cac0a0c718..defbe79e32a 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -974,6 +974,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
int error,lock_type,recreate;
uint warning_printed_by_chk_status;
my_bool rep_quick= MY_TEST(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS));
+ my_bool born_transactional;
MARIA_HA *info;
File datafile;
char llbuff[22],llbuff2[22];
@@ -1416,6 +1417,7 @@ static int maria_chk(HA_CHECK *param, char *filename)
maria_lock_database(info, F_UNLCK);
end2:
+ born_transactional= share->base.born_transactional;
if (maria_close(info))
{
_ma_check_print_error(param, default_close_errmsg, my_errno, filename);
@@ -1431,7 +1433,7 @@ end2:
MYF(MY_REDEL_MAKE_BACKUP) : MYF(0)));
}
if (opt_transaction_logging &&
- share->base.born_transactional && !error &&
+ born_transactional && !error &&
(param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
T_ZEROFILL)))
error= write_log_record(param);
diff --git a/storage/mroonga/vendor/groonga/lib/ts.c b/storage/mroonga/vendor/groonga/lib/ts.c
index 68e363a27d7..909f4864786 100644
--- a/storage/mroonga/vendor/groonga/lib/ts.c
+++ b/storage/mroonga/vendor/groonga/lib/ts.c
@@ -683,7 +683,7 @@ static grn_rc
grn_ts_select_output(grn_ctx *ctx, grn_obj *table, grn_ts_str str,
const grn_ts_record *in, size_t n_in, size_t n_hits)
{
- grn_ts_writer *writer;
+ grn_ts_writer *writer= 0;
grn_rc rc = grn_ts_writer_open(ctx, table, str, &writer);
if (rc != GRN_SUCCESS) {
return rc;
diff --git a/storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c b/storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c
index ddd69714b1e..4ae900034bb 100644
--- a/storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c
+++ b/storage/mroonga/vendor/groonga/lib/ts/ts_expr_node.c
@@ -5173,7 +5173,7 @@ grn_ts_expr_node_deref(grn_ctx *ctx, grn_ts_expr_node **node_ptr)
{
grn_ts_expr_node *node = *node_ptr, **in_ptr = NULL;
while ((node->data_kind & ~GRN_TS_VECTOR_FLAG) == GRN_TS_REF) {
- grn_ts_expr_node *new_node;
+ grn_ts_expr_node *new_node= 0;
grn_rc rc = grn_ts_expr_node_deref_once(ctx, node, &new_node);
if (rc != GRN_SUCCESS) {
if (in_ptr) {
diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c
index 83c46c24d3f..d358b939b4d 100644
--- a/unittest/mysys/my_atomic-t.c
+++ b/unittest/mysys/my_atomic-t.c
@@ -90,10 +90,10 @@ pthread_handler_t test_atomic_cas(void *arg)
y= my_atomic_load32(&bad);
x= (x*m+0x87654321) & INT_MAX32;
do {
- ok= my_atomic_cas32(&bad, &y, (uint32)y+x);
+ ok= my_atomic_cas32((int32*) &bad, &y, y+x);
} while (!ok) ;
do {
- ok= my_atomic_cas32(&bad, &y, y-x);
+ ok= my_atomic_cas32((int32*) &bad, &y, y-x);
} while (!ok) ;
}
return 0;