diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-08-16 22:22:52 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-09-04 10:32:03 +0200 |
commit | e238d6c51319b6074dfe4a0a605e12ba6bee71f2 (patch) | |
tree | 379b6ca3de8cbfd399f7ba6fc04adf6f8cb4220e /sql/sql_string.h | |
parent | 4569a895f9b978a94c805ee2f2ae66bfb9a2ee70 (diff) | |
download | mariadb-git-e238d6c51319b6074dfe4a0a605e12ba6bee71f2.tar.gz |
String::release and String::reset methods
Rename reassociate to reset and create an inverse method release.
Method names are chosen to match std::unique_ptr methods.
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 46188ce4652..a46374373f5 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -257,9 +257,9 @@ public: bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); } bool set_real(double num,uint decimals, CHARSET_INFO *cs); - /* Move handling of buffer from some other object to String */ - void reassociate(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg, - CHARSET_INFO *cs) + /* Take over handling of buffer from some other object */ + void reset(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg, + CHARSET_INFO *cs) { free(); Ptr= ptr_arg; @@ -269,6 +269,15 @@ public: alloced= ptr_arg != 0; } + /* Forget about the buffer, let some other object handle it */ + char *release() + { + char *old= Ptr; + Ptr=0; str_length= Alloced_length= extra_alloc= 0; + alloced= thread_specific= 0; + return old; + } + /* PMG 2004.11.12 This is a method that works the same as perl's "chop". It simply |