diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2012-07-26 15:06:43 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2012-07-26 15:06:43 +0200 |
commit | da4f2a26ca0895b330c706f58383997388eb45aa (patch) | |
tree | b5ed5db7caee8331f7ae6143033dd791377969da /client | |
parent | b82414792b3e2529a7d096dae0da2ea754858fa5 (diff) | |
parent | 76386edb83f1146fe3704569d6b4b22241ce5985 (diff) | |
download | mariadb-git-da4f2a26ca0895b330c706f58383997388eb45aa.tar.gz |
merge 5.1 => 5.5
Diffstat (limited to 'client')
-rw-r--r-- | client/sql_string.h | 10 |
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) |