summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-07-26 15:06:43 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2012-07-26 15:06:43 +0200
commitda4f2a26ca0895b330c706f58383997388eb45aa (patch)
treeb5ed5db7caee8331f7ae6143033dd791377969da /client
parentb82414792b3e2529a7d096dae0da2ea754858fa5 (diff)
parent76386edb83f1146fe3704569d6b4b22241ce5985 (diff)
downloadmariadb-git-da4f2a26ca0895b330c706f58383997388eb45aa.tar.gz
merge 5.1 => 5.5
Diffstat (limited to 'client')
-rw-r--r--client/sql_string.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/client/sql_string.h b/client/sql_string.h
index d087f66f5d0..0b92c370858 100644
--- a/client/sql_string.h
+++ b/client/sql_string.h
@@ -1,7 +1,7 @@
#ifndef CLIENT_SQL_STRING_INCLUDED
#define CLIENT_SQL_STRING_INCLUDED
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -192,8 +192,12 @@ public:
}
bool real_alloc(uint32 arg_length); // Empties old string
bool realloc(uint32 arg_length);
- inline void shrink(uint32 arg_length) // Shrink buffer
+
+ // Shrink the buffer, but only if it is allocated on the heap.
+ inline void shrink(uint32 arg_length)
{
+ if (!is_alloced())
+ return;
if (arg_length < Alloced_length)
{
char *new_ptr;
@@ -209,7 +213,7 @@ public:
}
}
}
- bool is_alloced() { return alloced; }
+ bool is_alloced() const { return alloced; }
inline String& operator = (const String &s)
{
if (&s != this)