summaryrefslogtreecommitdiff
path: root/client/sql_string.h.dontuse
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-12-16 16:49:19 -0800
committerIgor Babaev <igor@askmonty.org>2012-12-16 16:49:19 -0800
commit7760efad74140680b1eefaf2172b0fa26f7b1146 (patch)
tree57742baa180206a1cd3ea35d38c58108accd22a9 /client/sql_string.h.dontuse
parent40bbf697aad7d923fc1bd995bc5f547e45461cbe (diff)
parentb8b875cb796743240bed71857eae73d37f03c28f (diff)
downloadmariadb-git-7760efad74140680b1eefaf2172b0fa26f7b1146.tar.gz
Merge mariadb-5.5 -> 10.0-base.
Diffstat (limited to 'client/sql_string.h.dontuse')
-rw-r--r--client/sql_string.h.dontuse11
1 files changed, 7 insertions, 4 deletions
diff --git a/client/sql_string.h.dontuse b/client/sql_string.h.dontuse
index fc302110513..67155ebcee7 100644
--- a/client/sql_string.h.dontuse
+++ b/client/sql_string.h.dontuse
@@ -1,8 +1,7 @@
#ifndef SQL_STRING_INCLUDED
#define SQL_STRING_INCLUDED
-/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates
+/* 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
@@ -194,8 +193,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;
@@ -211,7 +214,7 @@ public:
}
}
}
- bool is_alloced() { return alloced; }
+ bool is_alloced() const { return alloced; }
inline String& operator = (const String &s)
{
if (&s != this)