1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fixed compiler and valgrind warnings

Added missing DBUG_xxx_RETURN statements
Fixed some usage of not initialized variables (as found by valgrind)
Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called.
This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names()
This will allow Tomas to continue with his work to use namelocks to syncronize things.

Note: valgrind still produces a lot of warnings about using not initialized code and shows memory loss errors when running the ndb tests
This commit is contained in:
monty@mysql.com
2006-03-29 14:27:36 +03:00
parent 8cb3cf2382
commit 1994ed49ec
44 changed files with 256 additions and 114 deletions

View File

@@ -176,8 +176,7 @@ err:
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
{
const char *begin, *end = str + str_len;
const char *begin, *end= str + str_len;
DBUG_ENTER("test_if_number");
/*
@@ -186,13 +185,13 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
*/
for (; str != end && my_isspace(system_charset_info, *str); str++) ;
if (str == end)
return 0;
DBUG_RETURN(0);
if (*str == '-')
{
info->negative = 1;
if (++str == end || *str == '0') // converting -0 to a number
return 0; // might lose information
if (++str == end || *str == '0') // converting -0 to a number
DBUG_RETURN(0); // might lose information
}
else
info->negative = 0;
@@ -210,33 +209,33 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
if (info->integers == 1)
return 0; // a single number can't be zerofill
DBUG_RETURN(0); // single number can't be zerofill
info->maybe_zerofill = 1;
return 1; // a zerofill number, or an integer
DBUG_RETURN(1); // a zerofill number, or an integer
}
if (*str == '.' || *str == 'e' || *str == 'E')
{
if (info->zerofill) // can't be zerofill anymore
return 0;
if ((str + 1) == end) // number was something like '123[.eE]'
if (info->zerofill) // can't be zerofill anymore
DBUG_RETURN(0);
if ((str + 1) == end) // number was something like '123[.eE]'
{
char *endpos= (char*) str;
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
return 1;
DBUG_RETURN(1);
}
if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
{
str++;
if (*str != '-' && *str != '+')
return 0;
DBUG_RETURN(0);
for (str++; str != end && my_isdigit(system_charset_info,*str); str++) ;
if (str == end)
{
info->is_float = 1; // we can't use variable decimals here
info->is_float = 1; // we can't use variable decimals here
return 1;
}
return 0;
DBUG_RETURN(0);
}
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
if (str == end) // number was something like '123.000'
@@ -244,17 +243,17 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
char *endpos= (char*) str;
int error;
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
return 1;
DBUG_RETURN(1);
}
for (; str != end && my_isdigit(system_charset_info,*str); str++)
info->decimals++;
if (str == end)
{
info->dval = my_atof(begin);
return 1;
DBUG_RETURN(1);
}
}
return 0;
DBUG_RETURN(0);
}