summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-10-16 13:04:42 +0200
committerSergei Golubchik <sergii@pisem.net>2012-10-16 13:04:42 +0200
commitee9afef27141f55165009fdbd58e54942f3a6867 (patch)
treeb5e15e62e10daa40aef3e6d33eeabf9205d1be0f /sql/sql_string.h
parentd9a8799205d160688f81362356dd2323eb8a91ea (diff)
parenta619bfad30c13207fb0453a85af5740846186900 (diff)
downloadmariadb-git-ee9afef27141f55165009fdbd58e54942f3a6867.tar.gz
mysql-5.5.28
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 2f0cd9103dc..8b09d449c2b 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -2,8 +2,8 @@
#define SQL_STRING_INCLUDED
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2011, Monty Program Ab
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
@@ -279,8 +279,11 @@ public:
}
return realloc_with_extra(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 (ALIGN_SIZE(arg_length+1) < Alloced_length)
{
char *new_ptr;
@@ -296,7 +299,7 @@ public:
}
}
}
- bool is_alloced() { return alloced; }
+ bool is_alloced() const { return alloced; }
inline String& operator = (const String &s)
{
if (&s != this)