summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 79365b7481b..ad32305e9b4 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -95,9 +95,18 @@ public:
Ptr[str_length]=0;
return Ptr;
}
+ inline char *c_ptr_safe()
+ {
+ if (Ptr && str_length < Alloced_length)
+ Ptr[str_length]=0;
+ else
+ (void) realloc(str_length);
+ return Ptr;
+ }
void set(String &str,uint32 offset,uint32 arg_length)
{
+ DBUG_ASSERT(&str != this);
free();
Ptr=(char*) str.ptr()+offset; str_length=arg_length; alloced=0;
if (str.Alloced_length)