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
commit35785ed8b0781e26c9ef949d886acd556a0ec71c (patch)
treeb5ed5db7caee8331f7ae6143033dd791377969da /client
parentfdaafddd808ff51ff38ea8adf9a0abca4d6cfcc6 (diff)
parentd24a78d1ea2b07cd1b3863190b371c7c8ea39a3c (diff)
downloadmariadb-git-35785ed8b0781e26c9ef949d886acd556a0ec71c.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)