summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-02-05 01:52:17 +0300
committerunknown <sergefp@mysql.com>2005-02-05 01:52:17 +0300
commit65cd36fc88aae96a3474350205bc22d92f4b34a7 (patch)
treeaad2c1463d49f0a241179d4f7586fcc086b40e45 /sql/sql_string.h
parent74ad9e8f1efde5295b9bf0b4bc4a3331d0faab4f (diff)
parentebda548d0d26f49a05d424f186e0b1d92c90925e (diff)
downloadmariadb-git-65cd36fc88aae96a3474350205bc22d92f4b34a7.tar.gz
Merge mysql.com:/home/psergey/mysql-4.1-bug7816
into mysql.com:/home/psergey/mysql-5.0-bug7716 sql/item_cmpfunc.cc: Auto merged sql/sql_string.h: Auto merged
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index cb9db52c830..a5c7cf77630 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -210,6 +210,11 @@ public:
{
if (&s != this)
{
+ /*
+ It is forbidden to do assignments like
+ some_string = substring_of_that_string
+ */
+ DBUG_ASSERT(!s.uses_buffer_owned_by(this));
free();
Ptr=s.Ptr ; str_length=s.str_length ; Alloced_length=s.Alloced_length;
alloced=0;
@@ -343,4 +348,9 @@ public:
/* Swap two string objects. Efficient way to exchange data without memcpy. */
void swap(String &s);
+
+ inline bool uses_buffer_owned_by(const String *s) const
+ {
+ return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
+ }
};