summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authormonty@mysql.com/narttu.mysql.fi <>2006-12-15 00:51:37 +0200
committermonty@mysql.com/narttu.mysql.fi <>2006-12-15 00:51:37 +0200
commit88dd873de0d5dc6e8f262268f925596a60b58704 (patch)
tree142bd488523fec48817d9fb2194f1a608eec00fc /mysys
parent601e6f4b2a78921304bc1d779991c615ee229f89 (diff)
downloadmariadb-git-88dd873de0d5dc6e8f262268f925596a60b58704.tar.gz
Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions - Added #ifdef around code that is not used - Renamed variables and functions to avoid conflicts - Removed some not used arguments Fixed some class/struct warnings in ndb Added define IS_LONGDATA() to simplify code in libmysql.c I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
Diffstat (limited to 'mysys')
-rw-r--r--mysys/default.c38
-rw-r--r--mysys/mf_iocache2.c26
-rw-r--r--mysys/mf_keycache.c5
-rw-r--r--mysys/my_bitmap.c6
-rw-r--r--mysys/sha1.c12
5 files changed, 44 insertions, 43 deletions
diff --git a/mysys/default.c b/mysys/default.c
index d93f4135e73..33c1a162525 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -42,9 +42,9 @@
#include <winbase.h>
#endif
-const char *defaults_file=0;
-const char *defaults_group_suffix=0;
-char *defaults_extra_file=0;
+const char *my_defaults_file=0;
+const char *my_defaults_group_suffix=0;
+char *my_defaults_extra_file=0;
/* Which directories are searched for options (and in which order) */
@@ -117,7 +117,7 @@ static char *remove_end_comment(char *ptr);
0 ok
1 given cinf_file doesn't exist
- The global variable 'defaults_group_suffix' is updated with value for
+ The global variable 'my_defaults_group_suffix' is updated with value for
--defaults_group_suffix
*/
@@ -133,28 +133,28 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
*args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used,
(char **) &forced_default_file,
(char **) &forced_extra_defaults,
- (char **) &defaults_group_suffix);
+ (char **) &my_defaults_group_suffix);
- if (! defaults_group_suffix)
- defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
+ if (! my_defaults_group_suffix)
+ my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
if (forced_extra_defaults)
- defaults_extra_file= (char *) forced_extra_defaults;
+ my_defaults_extra_file= (char *) forced_extra_defaults;
if (forced_default_file)
- defaults_file= forced_default_file;
+ my_defaults_file= forced_default_file;
/*
We can only handle 'defaults-group-suffix' if we are called from
load_defaults() as otherwise we can't know the type of 'func_ctx'
*/
- if (defaults_group_suffix && func == handle_default_option)
+ if (my_defaults_group_suffix && func == handle_default_option)
{
/* Handle --defaults-group-suffix= */
uint i;
const char **extra_groups;
- const uint instance_len= strlen(defaults_group_suffix);
+ const uint instance_len= strlen(my_defaults_group_suffix);
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
char *ptr;
TYPELIB *group= ctx->group;
@@ -177,7 +177,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
/** Construct new group */
memcpy(ptr, extra_groups[i], len);
- memcpy(ptr+len, defaults_group_suffix, instance_len+1);
+ memcpy(ptr+len, my_defaults_group_suffix, instance_len+1);
}
group->count*= 2;
@@ -211,15 +211,15 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv,
if (search_default_file(func, func_ctx, *dirs, conf_file) < 0)
goto err;
}
- else if (defaults_extra_file)
+ else if (my_defaults_extra_file)
{
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
- defaults_extra_file, 0)) < 0)
+ my_defaults_extra_file, 0)) < 0)
goto err; /* Fatal error */
if (error > 0)
{
fprintf(stderr, "Could not open required defaults file: %s\n",
- defaults_extra_file);
+ my_defaults_extra_file);
goto err;
}
}
@@ -867,8 +867,8 @@ void my_print_default_files(const char *conf_file)
char *end;
if (**dirs)
pos= *dirs;
- else if (defaults_extra_file)
- pos= defaults_extra_file;
+ else if (my_defaults_extra_file)
+ pos= my_defaults_extra_file;
else
continue;
end= convert_dirname(name, pos, NullS);
@@ -894,14 +894,14 @@ void print_defaults(const char *conf_file, const char **groups)
fputs(*groups,stdout);
}
- if (defaults_group_suffix)
+ if (my_defaults_group_suffix)
{
groups= groups_save;
for ( ; *groups ; groups++)
{
fputc(' ',stdout);
fputs(*groups,stdout);
- fputs(defaults_group_suffix,stdout);
+ fputs(my_defaults_group_suffix,stdout);
}
}
puts("\nThe following options may be given as the first argument:\n\
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index f1ea21c2a47..1afa2dd6e10 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -322,10 +322,10 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
if (*fmt == 's') /* String parameter */
{
reg2 char *par = va_arg(args, char *);
- uint length = (uint) strlen(par);
+ uint length2 = (uint) strlen(par);
/* TODO: implement minimum width and precision */
- out_length+=length;
- if (my_b_write(info, par, length))
+ out_length+= length2;
+ if (my_b_write(info, par, length2))
goto err;
}
else if (*fmt == 'b') /* Sized buffer parameter, only precision makes sense */
@@ -338,32 +338,32 @@ uint my_b_vprintf(IO_CACHE *info, const char* fmt, va_list args)
else if (*fmt == 'd' || *fmt == 'u') /* Integer parameter */
{
register int iarg;
- uint length;
+ uint length2;
char buff[17];
iarg = va_arg(args, int);
if (*fmt == 'd')
- length= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
+ length2= (uint) (int10_to_str((long) iarg,buff, -10) - buff);
else
- length= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
- out_length+=length;
- if (my_b_write(info, buff, length))
+ length2= (uint) (int10_to_str((long) (uint) iarg,buff,10)- buff);
+ out_length+= length2;
+ if (my_b_write(info, buff, length2))
goto err;
}
else if ((*fmt == 'l' && fmt[1] == 'd') || fmt[1] == 'u')
/* long parameter */
{
register long iarg;
- uint length;
+ uint length2;
char buff[17];
iarg = va_arg(args, long);
if (*++fmt == 'd')
- length= (uint) (int10_to_str(iarg,buff, -10) - buff);
+ length2= (uint) (int10_to_str(iarg,buff, -10) - buff);
else
- length= (uint) (int10_to_str(iarg,buff,10)- buff);
- out_length+=length;
- if (my_b_write(info, buff, length))
+ length2= (uint) (int10_to_str(iarg,buff,10)- buff);
+ out_length+= length2;
+ if (my_b_write(info, buff, length2))
goto err;
}
else
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index d658e6fe055..bbbda609b21 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -841,9 +841,10 @@ static inline void link_changed(BLOCK_LINK *block, BLOCK_LINK **phead)
*/
static void link_to_file_list(KEY_CACHE *keycache,
- BLOCK_LINK *block, int file, my_bool unlink)
+ BLOCK_LINK *block, int file,
+ my_bool unlink_block)
{
- if (unlink)
+ if (unlink_block)
unlink_changed(block);
link_changed(block, &keycache->file_blocks[FILE_HASH(file)]);
if (block->status & BLOCK_CHANGED)
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index 25ff2651e90..921fc7799a7 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -124,10 +124,10 @@ void bitmap_set_bit(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
{
- uchar *byte= map->bitmap + (bitmap_bit / 8);
+ uchar *value= map->bitmap + (bitmap_bit / 8);
uchar bit= 1 << ((bitmap_bit) & 7);
- uchar res= (*byte) & bit;
- *byte|= bit;
+ uchar res= (*value) & bit;
+ *value|= bit;
return res;
}
diff --git a/mysys/sha1.c b/mysys/sha1.c
index 110d24f8bfc..11c6c14bf8c 100644
--- a/mysys/sha1.c
+++ b/mysys/sha1.c
@@ -245,7 +245,7 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context)
uint32 temp; /* Temporary word value */
uint32 W[80]; /* Word sequence */
uint32 A, B, C, D, E; /* Word buffers */
- int index;
+ int idx;
/*
Initialize the first 16 words in the array W
@@ -253,11 +253,11 @@ static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context)
for (t = 0; t < 16; t++)
{
- index=t*4;
- W[t] = context->Message_Block[index] << 24;
- W[t] |= context->Message_Block[index + 1] << 16;
- W[t] |= context->Message_Block[index + 2] << 8;
- W[t] |= context->Message_Block[index + 3];
+ idx=t*4;
+ W[t] = context->Message_Block[idx] << 24;
+ W[t] |= context->Message_Block[idx + 1] << 16;
+ W[t] |= context->Message_Block[idx + 2] << 8;
+ W[t] |= context->Message_Block[idx + 3];
}