summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-11-06 11:52:55 +0200
committerunknown <timour@askmonty.org>2012-11-06 11:52:55 +0200
commit7c23d6d0c66cb3b84cb466f956e19bfea0acc342 (patch)
tree551dd23a43a26923a6dd30096a2822a27a90f355 /sql/sql_string.h
parent43293b7a515dbb2cf04907e2d98bcc813279cad8 (diff)
parent813b661d00123e3291530d102e2b94388f42fb0f (diff)
downloadmariadb-git-7c23d6d0c66cb3b84cb466f956e19bfea0acc342.tar.gz
Merge MySQL 5.1.66 -> MariaDB 5.1.65
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 1614157cc64..f20ce2595a0 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates.
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
@@ -230,8 +230,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;
@@ -247,7 +251,7 @@ public:
}
}
}
- bool is_alloced() { return alloced; }
+ bool is_alloced() const { return alloced; }
inline String& operator = (const String &s)
{
if (&s != this)