summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2009-12-02 11:00:44 +0100
committerTor Didriksen <tor.didriksen@sun.com>2009-12-02 11:00:44 +0100
commite22de3a3f28416acf35f55c058c17504d2e6f3ab (patch)
tree599c8f0ac49db300bcdf5414b61082689d57d36a /sql/sql_test.cc
parent987e146604d741f13fa03b7cb5e4af1cf3e30324 (diff)
downloadmariadb-git-e22de3a3f28416acf35f55c058c17504d2e6f3ab.tar.gz
Bug #49130 Running mtr tests with valgrind and debug produces lots of warnings
Use safe output formats for strings that are not null terminated. sql/item_func.cc: Use "%*.s" rather than "%s" format. sql/protocol.cc: Use "%*.s" rather than "%s" format. sql/sql_test.cc: Improve output from print_where() - output (nil) predicate if predicate is null - also output pointer value, for tracing of assignment and copying of predicates sql/sql_view.cc: Use "%*.s" rather than "%s" format.
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index d9beb77f546..f95d19f099e 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -55,19 +55,18 @@ static const char *lock_descriptions[] =
void
print_where(COND *cond,const char *info, enum_query_type query_type)
{
+ char buff[256];
+ String str(buff,(uint32) sizeof(buff), system_charset_info);
+ str.length(0);
if (cond)
- {
- char buff[256];
- String str(buff,(uint32) sizeof(buff), system_charset_info);
- str.length(0);
cond->print(&str, query_type);
- str.append('\0');
- DBUG_LOCK_FILE;
- (void) fprintf(DBUG_FILE,"\nWHERE:(%s) ",info);
- (void) fputs(str.ptr(),DBUG_FILE);
- (void) fputc('\n',DBUG_FILE);
- DBUG_UNLOCK_FILE;
- }
+ str.append('\0');
+
+ DBUG_LOCK_FILE;
+ (void) fprintf(DBUG_FILE,"\nWHERE:(%s) %p ", info, cond);
+ (void) fputs(str.ptr(),DBUG_FILE);
+ (void) fputc('\n',DBUG_FILE);
+ DBUG_UNLOCK_FILE;
}
/* This is for debugging purposes */