mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
- Fix a few test in TYPVAL<PSZ> that cause Valgrind warnings
modified: storage/connect/value.cpp - Ignore column comment field in TabColumns because its pointer is flagged as invalid by Valgrind (this is a bypass but not a real fix) modified: storage/connect/tabutil.cpp storage/connect/value.cpp
This commit is contained in:
@ -226,8 +226,12 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||||||
crp->Kdata->SetValue((fp->null_ptr != 0) ? 1 : 0, i);
|
crp->Kdata->SetValue((fp->null_ptr != 0) ? 1 : 0, i);
|
||||||
|
|
||||||
crp = crp->Next; // Remark
|
crp = crp->Next; // Remark
|
||||||
fld = fp->comment.str;
|
|
||||||
crp->Kdata->SetValue(fld, fp->comment.length, i);
|
// For Valgrind until bug on comment storage is fixed
|
||||||
|
// if (fp->comment.length > 0 && (fld = fp->comment.str))
|
||||||
|
// crp->Kdata->SetValue(fld, fp->comment.length, i);
|
||||||
|
// else
|
||||||
|
crp->Kdata->Reset(i);
|
||||||
|
|
||||||
crp = crp->Next; // New
|
crp = crp->Next; // New
|
||||||
crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
|
crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
|
||||||
|
@ -871,12 +871,16 @@ TYPVAL<PSZ>::TYPVAL(PSZ s) : VALUE(TYPE_STRING)
|
|||||||
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
|
TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c)
|
||||||
: VALUE(TYPE_STRING)
|
: VALUE(TYPE_STRING)
|
||||||
{
|
{
|
||||||
assert(Type == TYPE_STRING && (g || s));
|
assert(Type == TYPE_STRING);
|
||||||
Len = (g) ? n : strlen(s);
|
Len = (g) ? n : strlen(s);
|
||||||
|
|
||||||
if (g && !s) {
|
if (!s) {
|
||||||
Strp = (char *)PlugSubAlloc(g, NULL, Len + 1);
|
if (g) {
|
||||||
Strp[Len] = '\0';
|
Strp = (char *)PlugSubAlloc(g, NULL, Len + 1);
|
||||||
|
Strp[Len] = '\0';
|
||||||
|
} else
|
||||||
|
assert(false);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
Strp = s;
|
Strp = s;
|
||||||
|
|
||||||
@ -908,15 +912,21 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
|
|||||||
void TYPVAL<PSZ>::SetValue_char(char *p, int n)
|
void TYPVAL<PSZ>::SetValue_char(char *p, int n)
|
||||||
{
|
{
|
||||||
if (p) {
|
if (p) {
|
||||||
n = min(n, Len);
|
if ((n = min(n, Len))) {
|
||||||
strncpy(Strp, p, n);
|
strncpy(Strp, p, n);
|
||||||
|
|
||||||
for (p = Strp + n - 1; (*p == ' ' || *p == '\0') && p >= Strp; p--) ;
|
// for (p = Strp + n - 1; p >= Strp && (*p == ' ' || *p == '\0'); p--) ;
|
||||||
|
for (p = Strp + n - 1; p >= Strp; p--)
|
||||||
|
if (*p && *p != ' ')
|
||||||
|
break;
|
||||||
|
|
||||||
*(++p) = '\0';
|
*(++p) = '\0';
|
||||||
|
|
||||||
if (trace > 1)
|
if (trace > 1)
|
||||||
htrc(" Setting string to: '%s'\n", Strp);
|
htrc(" Setting string to: '%s'\n", Strp);
|
||||||
|
|
||||||
|
} else
|
||||||
|
Reset();
|
||||||
|
|
||||||
Null = false;
|
Null = false;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user