From f0c53638d79d73a29bbd35b9765667c5c0f4db16 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Thu, 26 Jun 2008 17:10:11 +0200 Subject: [PATCH] Fixes for build errors under Windows and compiler warning under Linux include/m_string.h: new macro like LINT_INIT but for struct. In m_string.h because bzero() becomes available only there storage/maria/ma_check.c: compiler error under Windows (declaration after statements...) storage/maria/ma_key.c: trnman.h is not in include/ but in storage/maria storage/maria/ma_sp_key.c: trnman.h is not in include/ but in storage/maria storage/maria/ma_write.c: avoid compiler warning (org_key.flag may be used uninitialized) --- include/m_string.h | 6 ++++++ storage/maria/ma_check.c | 2 +- storage/maria/ma_key.c | 2 +- storage/maria/ma_sp_key.c | 2 +- storage/maria/ma_write.c | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index 75734d51360..2fadd11af89 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -134,6 +134,12 @@ extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len); #define bzero_if_purify(A,B) #endif /* HAVE_purify */ +#if defined(_lint) || defined(FORCE_INIT_OF_VARS) +#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */ +#else +#define LINT_INIT_STRUCT(var) +#endif + #ifndef bmove512 extern void bmove512(uchar *dst,const uchar *src,size_t len); #endif diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index d91a1522055..8f9a7b5f413 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -4427,8 +4427,8 @@ static int sort_key_read(MARIA_SORT_PARAM *sort_param, uchar *key) int error; MARIA_SORT_INFO *sort_info= sort_param->sort_info; MARIA_HA *info= sort_info->info; - DBUG_ENTER("sort_key_read"); MARIA_KEY int_key; + DBUG_ENTER("sort_key_read"); if ((error=sort_get_next_record(sort_param))) DBUG_RETURN(error); diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c index 9dfc0128b70..1fdb3d15f55 100644 --- a/storage/maria/ma_key.c +++ b/storage/maria/ma_key.c @@ -19,7 +19,7 @@ #include "m_ctype.h" #include "ma_sp_defs.h" #include "ma_blockrec.h" /* For ROW_FLAG_TRANSID */ -#include +#include "trnman.h" #ifdef HAVE_IEEEFP_H #include #endif diff --git a/storage/maria/ma_sp_key.c b/storage/maria/ma_sp_key.c index d9e6b5570f2..22944a5db0a 100644 --- a/storage/maria/ma_sp_key.c +++ b/storage/maria/ma_sp_key.c @@ -15,7 +15,7 @@ #include "maria_def.h" #include "ma_blockrec.h" /* For ROW_FLAG_TRANSID */ -#include +#include "trnman.h" #ifdef HAVE_SPATIAL diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index 06ea4d9c845..223673a4c81 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -396,6 +396,7 @@ static int _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEY *key, MARIA_KEY org_key; DBUG_ENTER("_ma_ck_write_btree_with_log"); + LINT_INIT_STRUCT(org_key); if (share->now_transactional) { /* Save original value as the key may change */